164

GitHub - cask/cask: Project management tool for Emacs

 6 years ago
source link: https://github.com/cask/cask
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

Cask can be likened to venv or maven for Emacs Lisp development, although, as with all things emacs, is decidedly less sophisticated (but no less arcane).

Cask simplifies sandboxing that more expert elisp developers accomplish directly with emacs’s built-in -Q, --batch, and --eval switches. Within the sandbox, Cask provisions dependencies via a user-defined “Cask” file analogous to requirements-dev.txt or pom.xml.

Installation

git clone https://github.com/cask/cask
cd cask
make install

Not-so-quick start

With just this baseline “Cask” file, you can run most of the commands described in http://cask.readthedocs.io.

(source gnu)
(source melpa)

(package-file "your-main-file.el")

Typical Makefile Usage

Egregious boilerplate follows:

export EMACS ?= $(shell which emacs)
CASK_DIR := $(shell cask package-directory)

$(CASK_DIR): Cask
	cask install
	@touch $(CASK_DIR)

.PHONY: cask
cask: $(CASK_DIR)

.PHONY: compile
compile: cask
	! (cask eval "(let ((byte-compile-error-on-warn t)) \
	                 (cask-cli/build))" 2>&1 \
	   | egrep -a "(Warning|Error):") ; \
	  (ret=$$? ; cask clean-elc && exit $$ret)

.PHONY: test
test: compile
	cask exec ert-runner help

Typical CI Usage

Cask, in conjunction with setup-emacs, is commonly used in Github Actions. Egregious boilerplate follows:

jobs:
  test:
    runs-on: ubuntu-latest
    strategy:
      matrix:
        emacs-version:
          - 26.3
          - 27.2
    steps:
      - uses: actions/checkout@v2
      - uses: purcell/setup-emacs@master
        with:
          version: ${{ matrix.emacs-version }}
      - uses: actions/cache@v2
        id: cache-cask-packages
        with:
          path: .cask
          key: cache-cask-packages-000
      - uses: actions/cache@v2
        id: cache-cask-executable
        with:
          path: ~/.cask
          key: cache-cask-executable-000
      - uses: conao3/setup-cask@master
        if: steps.cache-cask-executable.outputs.cache-hit != 'true'
        with:
          version: snapshot
      - run: echo "$HOME/.cask/bin" >> $GITHUB_PATH

Frequently Asked Questions

Why is everything you say inconsistent with cask.readthedocs.io?I would disregard nearly everything at cask.readthedocs.io, especially the Quickstart page. In particular, I would not require cask in your dot.emacs since cask is now largely a command-line tool independent of whatever you do within emacs. If you are calling cask-initialize in your dot.emacs or harken back to the bygone era of pallet, I’m afraid you’re on your own. Why must I replicate dependencies in the Cask file?You mustn’t, but probably more than half of Cask deployments in the wild needlessly do. cask list automatically shows your package’s dependencies if you specify them pro forma in a Package-Requires header. The oft-confused development stanza is analogous to requirements-dev.txt. Only packages required by your testing apparatus, e.g., ert-runner, should be added there. Doesn’t Cask make things more complicated?Yes, because it forces you to test your package under multiple versions of emacs. Most packages don’t do any testing at all, which is why emacs has lost credibility with the computing public. Is Cask a vassal of MELPA?Yes, Cask’s early development history is intertwined with that of MELPA’s package-build. Cask employs that module for all packaging tasks including dependency provisioning.


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK