Documentation moved! The Cask documentation moved to http://cask.readthedocs.org. This documentation is kept for historical purposes and not updated anymore. Please consult the current documentation.

API


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.

Documentation and Examples

cask-setup (project-path)

Create a bundle object for project-path. Use this function for packages and cask-initialize for your local Emacs configuration.

(let ((bundle (cask-setup "/path/to/project")))
  ;; ...
  )

cask-initialize (&optional project-path)

Like cask-setup, but also initializes all dependencies. Use this function for your local Emacs configuration and cask-setup for packages.

(let ((bundle (cask-initialize "/path/to/project")))
  ;; ...
  )

cask-update (bundle)

Update dependencies and return list of updated dependencies.

(let ((updated (cask-update bundle)))
  ;; ...
  )

cask-outdated (bundle)

Return a list of all outdated dependencies.

(let ((outdated (cask-outdated bundle)))
  ;; ...
  )

cask-install (bundle)

Install dependencies.

(cask-install bundle)

cask-caskify (bundle &optional dev-mode)

Create Cask-file.

(cask-caskify bundle)           ;; For Emacs configuration
(cask-caskify bundle 'dev-mode) ;; For packages

cask-package-name (bundle)

Return package name.

(cask-package-name bundle) ;; => 'foo

cask-package-version (bundle)

Return package version.

(cask-package-version bundle) ;; => "0.1.2"

cask-package-description (bundle)

Return package description.

(cask-package-description bundle) ;; => "Description for Foo package"

cask-version ()

Return Cask's version.

(cask-version)

cask-load-path (bundle)

Return load-path including dependencies.

(cask-load-path bundle) ;; => '("/path/to/.cask/24.3.1/elpa/foo-1.2.3" ...)

cask-exec-path (bundle)

Return exec-path including dependencies.

(cask-exec-path bundle) ;; => '("/path/to/.cask/24.3.1/elpa/foo-1.2.3/bin" ...)

cask-elpa-path (bundle)

Return path to elpa directory.

(cask-elpa-path bundle) ;; => "/path/to/.cask/24.3.1/elpa"

cask-runtime-dependencies (bundle &optional deep)

Return list of runtime dependencies.

(cask-runtime-dependencies bundle)
(cask-runtime-dependencies bundle 'deep)

cask-development-dependencies (bundle &optional deep)

Return list of development dependencies.

(cask-development-dependencies bundle)
(cask-development-dependencies bundle 'deep)

cask-dependencies (bundle &optional deep)

Return list of runtime and development dependencies.

(cask-dependencies bundle)
(cask-dependencies bundle 'deep)

cask-installed-dependencies (bundle &optional deep)

Return list of installed dependencies.

(cask-installed-dependencies bundle)
(cask-installed-dependencies bundle 'deep)

cask-has-dependency (bundle name)

Return true if project has dependency with name.

(cask-has-dependency bundle 'foo)

cask-find-dependency (bundle name)

Return dependency with name.

(cask-find-dependency bundle 'foo)

cask-define-package-string (bundle)

Return define-package string used for -pkg.el files.

(cask-define-package-string bundle) ;; => "(define-package ...)"

cask-define-package-file (bundle)

Return path to -pkg.el file.

(cask-define-package-file bundle) ;; => "/path/to/project-pkg.el"

cask-dependency-path (bundle name)

Return path to dependency with name.

(cask-dependency-path bundle 'foo) ;; => "/path/to/.cask/24.3.1/elpa/foo-1.3.3"

cask-path (bundle)

Return path to project root.

(cask-path bundle) ;; => "/path/to"

cask-file (bundle)

Return path to project Cask-file.

(cask-file bundle) ;; => "/path/to/Cask"

cask-files (bundle)

Return list of project files.

(cask-files bundle) ;; => '("foo.el" "foo-core.el" ...)

cask-add-dependency (bundle name &rest args)

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.
(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")

cask-add-source (bundle name-or-alias &optional url)

Add ELPA source.

(cask-add-dependency bundle "name" "http://path.to.elpa/packages/")
(cask-add-dependency bundle 'alias)

cask-remove-source (bundle name)

Remove ELPA source.

(cask-remove-dependency bundle "name")

cask-build (bundle)

Byte compile project files.

(cask-build bundle)

cask-clean-elc (bundle)

Remove byte compiled files.

(cask-clean-elc bundle)

cask-links (bundle)

Return list of links.

(cask-links bundle) ;; => '((foo "/path/to/too") (bar "/path/to/bar"))

cask-link (bundle name source)

Create link with name to source path.

(cask-link bundle 'foo "/path/to/foo")

cask-link-delete (bundle name)

Delete link with name.

(cask-delete-link bundle 'foo)

cask-linked-p (bundle name)

Return true if link with name exist, false otherwise.

(cask-linked-p bundle 'foo)

cask-package (bundle &optional target-dir)

Create an ELPA package of this project. Put package in directory called dist or target-dir if specified.

(cask-package bundle)
(cask-package bundle "/path/to/dist")