forked from cask/cask
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcask-bootstrap.el
68 lines (52 loc) · 2.32 KB
/
cask-bootstrap.el
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
;;; cask-bootstrap.el --- Cask: Bootstrap internal dependencies -*- lexical-binding: t; -*-
;; Copyright (C) 2012, 2013 Johan Andersson
;; Author: Johan Andersson <[email protected]>
;; Maintainer: Johan Andersson <[email protected]>
;; URL: http://github.com/cask/cask
;; This file is NOT part of GNU Emacs.
;; This program is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.
;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;; You should have received a copy of the GNU General Public License
;; along with this program. If not, see <http://www.gnu.org/licenses/>.
;;; Commentary:
;; Bootstrap Cask's internal dependencies.
;;; Code:
(eval-when-compile
(defvar cask-directory))
(defconst cask-bootstrap-dir
(expand-file-name
(locate-user-emacs-file (format ".cask/%s/bootstrap" emacs-version)))
"Path to Cask bootstrap directory.")
(defconst cask-bootstrap-packages
'(s dash f commander git epl shut-up cl-lib package-build)
"List of bootstrap packages required by this file.")
(unless (require 'package nil :noerror)
(require 'package (expand-file-name "package-legacy" cask-directory)))
(let ((orig-load-path load-path))
(unwind-protect
(let (package-archives
package-alist
package-archive-contents
(package-user-dir cask-bootstrap-dir))
(package-initialize)
(condition-case nil
(mapc 'require cask-bootstrap-packages)
(error
(add-to-list 'package-archives (cons "gnu" "http://elpa.gnu.org/packages/"))
(add-to-list 'package-archives (cons "melpa" "http://melpa.org/packages/"))
(package-refresh-contents)
(mapc
(lambda (package)
(unless (package-installed-p package)
(package-install package)))
cask-bootstrap-packages)
(mapc 'require cask-bootstrap-packages))))
(setq load-path orig-load-path)))
(provide 'cask-bootstrap)
;;; cask-bootstrap.el ends here