Skip to content

Commit

Permalink
code: ns
Browse files Browse the repository at this point in the history
  • Loading branch information
jcs090218 committed Mar 28, 2022
1 parent 94a5a37 commit 2c85287
Show file tree
Hide file tree
Showing 13 changed files with 71 additions and 57 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ Check [Keep a Changelog](http://keepachangelog.com/) for recommendations on how
* Fix line endings on Windows system (b7b25da75f794e1bd1c1f6b74a9d4cd6a83e3435)
* Fix option that accept arguments (979d87ef6953f0f4a9403db4bb244c87987ea478)
* Add verbosity level and timestamps (9de0bb4155911c5399d9d2ddb0cbff9dfc25f88f)
* Add new command `eask concat` ()

## 0.2.x
> Released Mar 26, 2022
Expand Down
25 changes: 18 additions & 7 deletions lisp/_prepare.el
Original file line number Diff line number Diff line change
Expand Up @@ -99,14 +99,16 @@
(defun eask-debug-p () (eask--flag "--debug")) ; --debug

;;; String (with arguments)
(defun eask-proxy () (eask--flag-value "--proxy"))
(defun eask-http-proxy () (eask--flag-value "--http-proxy"))
(defun eask-https-proxy () (eask--flag-value "--https-proxy"))
(defun eask-no-proxy () (eask--flag-value "--no-proxy"))
(defun eask-proxy () (eask--flag-value "--proxy")) ; --proxy
(defun eask-http-proxy () (eask--flag-value "--http-proxy")) ; --http-proxy
(defun eask-https-proxy () (eask--flag-value "--https-proxy")) ; --https-proxy
(defun eask-no-proxy () (eask--flag-value "--no-proxy")) ; --no-proxy
(defun eask-destination () (eask--flag-value "--dest")) ; --dest, --destintation
(defalias 'eask-dest #'eask-destination)

;;; Number (with arguments)
(defun eask-depth () (eask--str2num (eask--flag-value "--depth"))) ; --depth is enabled
(defun eask-verbose () (eask--str2num (eask--flag-value "--verbose")))
(defun eask-depth () (eask--str2num (eask--flag-value "--depth"))) ; --depth
(defun eask-verbose () (eask--str2num (eask--flag-value "--verbose"))) ; -v, --verbose

(defun eask--handle-global-options ()
"Handle global options."
Expand Down Expand Up @@ -181,7 +183,8 @@ other scripts internally. See function `eask-call'.")
(defconst eask--option-args
(eask--form-options
'("--proxy" "--http-proxy" "--https-proxy" "--no-proxy"
"--verbose" "--silent"))
"--verbose" "--silent"
"--dest"))
"List of arguments (number/string) type options.")

(defconst eask--command-list
Expand Down Expand Up @@ -474,4 +477,12 @@ Standard is, 0 (error), 1 (warning), 2 (info), 3 (log), 4 or above (debug)."
"Return t if single file package."
(not (eask-package-multi-p)))

;;
;;; User customization

(defcustom eask-dist-path "dist"
"Name of default target directory for building packages."
:type 'string
:group 'eask)

;;; _prepare.el ends here
46 changes: 46 additions & 0 deletions lisp/concat.el
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
;;; concat.el --- Byte compile all Emacs Lisp files in the package -*- lexical-binding: t; -*-

;;; Commentary:
;;
;; Byte compile all Emacs Lisp files in the package
;;
;; $ eask concat [names..]
;;
;;
;; Initialization options:
;;
;; [names..] specify files to concatenate
;;
;; Action options:
;;
;; [destintation] optional output destintation
;;

;;; Code:

(load-file (expand-file-name
"_prepare.el"
(file-name-directory (nth 1 (member "-scriptload" command-line-args)))))

(eask-start
(let* ((name (eask-guess-package-name))
(files (or (eask-args) (eask-package-el-files)))
(eask-dist-path (or (eask-dest) eask-dist-path))
(eask-dist-path (expand-file-name eask-dist-path))
(target-file (concat name ".built.el"))
(target-filename (expand-file-name target-file eask-dist-path)))
(eask-debug "Destination path in %s" eask-dist-path)
(ignore-errors (make-directory eask-dist-path t))

(eask-info "Prepare to concatenate files %s..." target-filename)
(write-region "" nil target-filename)

(eask-with-verbosity 'log
(with-temp-buffer
(dolist (filename files)
(message "Visit file %s... append!" filename)
(insert-file-contents filename))
(eask-info "Done. (Wrote file in %s)" target-filename)
(write-region (buffer-string) nil target-filename)))))

;;; concat.el ends here
5 changes: 0 additions & 5 deletions lisp/exec-path.el
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,6 @@
;;
;; $ eask path
;;
;;
;; Effective flags:
;;
;; [-g, --global]
;;

;;; Code:

Expand Down
4 changes: 0 additions & 4 deletions lisp/install.el
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,6 @@
;; package from current directory by calling function
;; `package-install-file'
;;
;; Effective flags:
;;
;; [-g, --global] [--development, --dev]
;;

;;; Code:

Expand Down
4 changes: 0 additions & 4 deletions lisp/list-all.el
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,6 @@
;;
;; [--depth] dependency level to print
;;
;; Effective flags:
;;
;; [-g, --global]
;;

;;; Code:

Expand Down
4 changes: 0 additions & 4 deletions lisp/list.el
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,6 @@
;;
;; [--depth] dependency level to print
;;
;; Effective flags:
;;
;; [-g, --global]
;;

;;; Code:

Expand Down
5 changes: 0 additions & 5 deletions lisp/load-path.el
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,6 @@
;;
;; $ eask load-path
;;
;;
;; Effective flag:
;;
;; [-g, --global]
;;

;;; Code:

Expand Down
5 changes: 0 additions & 5 deletions lisp/load.el
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,6 @@
;;
;; $ eask load
;;
;;
;; Effective flag:
;;
;; [-g, --global]
;;

;;; Code:

Expand Down
5 changes: 0 additions & 5 deletions lisp/outdated.el
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,6 @@
;;
;; $ eask outdated
;;
;;
;; Effective flag:
;;
;; [-g, --global]
;;

;;; Code:

Expand Down
16 changes: 6 additions & 10 deletions lisp/package.el
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@
;;
;; Build a package artefact, and put it into the given destination
;;
;; $ eask package [dest]
;; $ eask package [destintation]
;;
;;
;; Positional options:
;;
;; [dest] destination path/folder
;; [destintation] destination path/folder
;;

;;; Code:
Expand All @@ -18,11 +18,6 @@
"_prepare.el"
(file-name-directory (nth 1 (member "-scriptload" command-line-args)))))

(defcustom eask-dist-path "dist"
"Name of default target directory for building packages."
:type 'string
:group 'eask)

(defun eask-package-dir-recipe ()
"Form a directory recipe."
(eask-load "./extern/package-recipe")
Expand All @@ -39,7 +34,7 @@

(defun eask--packaged-file (ext)
"Find a possible packaged file."
(let* ((dist (expand-file-name eask-dist-path))
(let* ((dist eask-dist-path)
(file (expand-file-name (concat (eask-packaged-name) "." ext) dist)))
(and (file-exists-p file) file)))

Expand All @@ -49,8 +44,9 @@

(eask-start
(let ((eask-dist-path (or (eask-argv 0) eask-dist-path))
(eask-dist-path (expand-file-name eask-dist-path))
(packaged))
(ignore-errors (make-directory (expand-file-name eask-dist-path) t))
(ignore-errors (make-directory eask-dist-path t))

(eask-pkg-init)
(eask-package-install 'package-build)
Expand All @@ -59,7 +55,7 @@
(let* ((version (eask-package-get :version))
(rcp (eask-package-dir-recipe))
(package-build-working-dir default-directory)
(package-build-archive-dir (expand-file-name eask-dist-path)))
(package-build-archive-dir eask-dist-path))
(package-build--package rcp version))

(setq packaged (eask-packaged-file))
Expand Down
4 changes: 0 additions & 4 deletions lisp/uninstall.el
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,6 @@
;;
;; <name> name of the package to uninstall
;;
;; Effective flag:
;;
;; [-g, --global], [-f, --force]
;;

;;; Code:

Expand Down
4 changes: 0 additions & 4 deletions lisp/upgrade.el
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,6 @@
;;
;; [names..] package to upgrade; else we upgrade all packages
;;
;; Effective flag:
;;
;; [-g, --global], [-f, --force]
;;

;;; Code:

Expand Down

0 comments on commit 2c85287

Please sign in to comment.