title | layout | permalink |
---|---|---|
API |
default |
api.html |
Cask has an extensive API, which is briefly described in this document. For full documentation of each function, read the function doc-string.
As you will see, almost every API function takes a bundle
as first
argument. A bundle is an object that describes the current Cask
project. You should not modify this object directly, but use the API
functions to do so.
To create a bundle
object, use either cask-setup
or
cask-initialize
, which are described below.
- cask-setup
(project-path)
- cask-initialize
(&optional project-path)
- cask-update
(bundle)
- cask-outdated
(bundle)
- cask-install
(bundle)
- cask-caskify
(bundle &optional dev-mode)
- cask-package-name
(bundle)
- cask-package-version
(bundle)
- cask-package-description
(bundle)
- cask-version
()
- cask-load-path
(bundle)
- cask-exec-path
(bundle)
- cask-elpa-path
(bundle)
- cask-runtime-dependencies
(bundle &optional deep)
- cask-development-dependencies
(bundle &optional deep)
- cask-dependencies
(bundle &optional deep)
- cask-installed-dependencies
(bundle &optional deep)
- cask-has-dependency
(bundle name)
- cask-find-dependency
(bundle name)
- cask-define-package-string
(bundle)
- cask-define-package-file
(bundle)
- cask-dependency-path
(bundle name)
- cask-path
(bundle)
- cask-file
(bundle)
- cask-files
(bundle)
- cask-add-dependency
(bundle name &rest args)
- cask-add-source
(bundle name-or-alias &optional url)
- cask-remove-source
(bundle name)
- cask-build
(bundle)
- cask-clean-elc
(bundle)
- cask-links
(bundle)
- cask-link
(bundle name source)
- cask-link-delete
(bundle name)
- cask-linked-p
(bundle name)
- cask-package
(bundle &optional target-dir)
Create a bundle
object for project-path
. Use this function for
packages and cask-initialize
for your local Emacs configuration.
{% highlight cl %} (let ((bundle (cask-setup "/path/to/project"))) ;; ... ) {% endhighlight %}
Like cask-setup
, but also initializes all dependencies. Use this
function for your local Emacs configuration and cask-setup
for
packages.
{% highlight cl %} (let ((bundle (cask-initialize "/path/to/project"))) ;; ... ) {% endhighlight %}
Update dependencies and return list of updated dependencies.
{% highlight cl %} (let ((updated (cask-update bundle))) ;; ... ) {% endhighlight %}
Return a list of all outdated dependencies.
{% highlight cl %} (let ((outdated (cask-outdated bundle))) ;; ... ) {% endhighlight %}
Install dependencies.
{% highlight cl %} (cask-install bundle) {% endhighlight %}
Create Cask
-file.
{% highlight cl %} (cask-caskify bundle) ;; For Emacs configuration (cask-caskify bundle 'dev-mode) ;; For packages {% endhighlight %}
Return package name.
{% highlight cl %} (cask-package-name bundle) ;; => 'foo {% endhighlight %}
Return package version.
{% highlight cl %} (cask-package-version bundle) ;; => "0.1.2" {% endhighlight %}
Return package description.
{% highlight cl %} (cask-package-description bundle) ;; => "Description for Foo package" {% endhighlight %}
Return Cask's version.
{% highlight cl %} (cask-version) {% endhighlight %}
Return load-path
including dependencies.
{% highlight cl %} (cask-load-path bundle) ;; => '("/path/to/.cask/24.3.1/elpa/foo-1.2.3" ...) {% endhighlight %}
Return exec-path
including dependencies.
{% highlight cl %} (cask-exec-path bundle) ;; => '("/path/to/.cask/24.3.1/elpa/foo-1.2.3/bin" ...) {% endhighlight %}
Return path to elpa directory.
{% highlight cl %} (cask-elpa-path bundle) ;; => "/path/to/.cask/24.3.1/elpa" {% endhighlight %}
Return list of runtime dependencies.
{% highlight cl %} (cask-runtime-dependencies bundle) (cask-runtime-dependencies bundle 'deep) {% endhighlight %}
Return list of development dependencies.
{% highlight cl %} (cask-development-dependencies bundle) (cask-development-dependencies bundle 'deep) {% endhighlight %}
Return list of runtime and development dependencies.
{% highlight cl %} (cask-dependencies bundle) (cask-dependencies bundle 'deep) {% endhighlight %}
Return list of installed dependencies.
{% highlight cl %} (cask-installed-dependencies bundle) (cask-installed-dependencies bundle 'deep) {% endhighlight %}
Return true if project has dependency with name
.
{% highlight cl %} (cask-has-dependency bundle 'foo) {% endhighlight %}
Return dependency with name
.
{% highlight cl %} (cask-find-dependency bundle 'foo) {% endhighlight %}
Return define-package
string used for -pkg.el
files.
{% highlight cl %} (cask-define-package-string bundle) ;; => "(define-package ...)" {% endhighlight %}
Return path to -pkg.el
file.
{% highlight cl %} (cask-define-package-file bundle) ;; => "/path/to/project-pkg.el" {% endhighlight %}
Return path to dependency with name
.
{% highlight cl %} (cask-dependency-path bundle 'foo) ;; => "/path/to/.cask/24.3.1/elpa/foo-1.3.3" {% endhighlight %}
Return path to project root.
{% highlight cl %} (cask-path bundle) ;; => "/path/to" {% endhighlight %}
Return path to project Cask
-file.
{% highlight cl %} (cask-file bundle) ;; => "/path/to/Cask" {% endhighlight %}
Return list of project files.
{% highlight cl %} (cask-files bundle) ;; => '("foo.el" "foo-core.el" ...) {% endhighlight %}
Add dependency with name
.
Last argument args
, can be:
- A string specifying minimum version.
- A plist specifying VCS fetcher options.
:ref
- Fetcher ref to checkout.:branch
- Fetcher branch to checkout.:files
- Only include files matching this pattern.
{% highlight cl %} (cask-add-dependency bundle 'foo) (cask-add-dependency bundle 'foo "1.2.3") (cask-add-dependency bundle 'foo :git "https://foo.git" :ref "ij7ads0" :files '("*.el" (:exclude ".git"))) (cask-add-dependency bundle 'foo :git "https://foo.git" :branch "experimental") {% endhighlight %}
Add ELPA source.
{% highlight cl %} (cask-add-dependency bundle "name" "http://path.to.elpa/packages/") (cask-add-dependency bundle 'alias) {% endhighlight %}
Remove ELPA source.
{% highlight cl %} (cask-remove-dependency bundle "name") {% endhighlight %}
Byte compile project files.
{% highlight cl %} (cask-build bundle) {% endhighlight %}
Remove byte compiled files.
{% highlight cl %} (cask-clean-elc bundle) {% endhighlight %}
Return list of links.
{% highlight cl %} (cask-links bundle) ;; => '((foo "/path/to/too") (bar "/path/to/bar")) {% endhighlight %}
Create link with name
to source
path.
{% highlight cl %} (cask-link bundle 'foo "/path/to/foo") {% endhighlight %}
Delete link with name
.
{% highlight cl %} (cask-delete-link bundle 'foo) {% endhighlight %}
Return true if link with name
exist, false otherwise.
{% highlight cl %} (cask-linked-p bundle 'foo) {% endhighlight %}
Create an ELPA package of this project. Put package in directory
called dist
or target-dir
if specified.
{% highlight cl %} (cask-package bundle) (cask-package bundle "/path/to/dist") {% endhighlight %}