diff --git a/CHANGELOG.md b/CHANGELOG.md index 5543093e..19674d92 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/lisp/_prepare.el b/lisp/_prepare.el index 4a9d2752..76bbfb49 100644 --- a/lisp/_prepare.el +++ b/lisp/_prepare.el @@ -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." @@ -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 @@ -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 diff --git a/lisp/concat.el b/lisp/concat.el new file mode 100644 index 00000000..1e61a1aa --- /dev/null +++ b/lisp/concat.el @@ -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 diff --git a/lisp/exec-path.el b/lisp/exec-path.el index e88ba797..13932f6d 100644 --- a/lisp/exec-path.el +++ b/lisp/exec-path.el @@ -6,11 +6,6 @@ ;; ;; $ eask path ;; -;; -;; Effective flags: -;; -;; [-g, --global] -;; ;;; Code: diff --git a/lisp/install.el b/lisp/install.el index 80a9aa37..6e55c070 100644 --- a/lisp/install.el +++ b/lisp/install.el @@ -13,10 +13,6 @@ ;; package from current directory by calling function ;; `package-install-file' ;; -;; Effective flags: -;; -;; [-g, --global] [--development, --dev] -;; ;;; Code: diff --git a/lisp/list-all.el b/lisp/list-all.el index b31b9865..82063b46 100644 --- a/lisp/list-all.el +++ b/lisp/list-all.el @@ -11,10 +11,6 @@ ;; ;; [--depth] dependency level to print ;; -;; Effective flags: -;; -;; [-g, --global] -;; ;;; Code: diff --git a/lisp/list.el b/lisp/list.el index 2353af27..6f03db3c 100644 --- a/lisp/list.el +++ b/lisp/list.el @@ -11,10 +11,6 @@ ;; ;; [--depth] dependency level to print ;; -;; Effective flags: -;; -;; [-g, --global] -;; ;;; Code: diff --git a/lisp/load-path.el b/lisp/load-path.el index b6948c66..f07fc437 100644 --- a/lisp/load-path.el +++ b/lisp/load-path.el @@ -6,11 +6,6 @@ ;; ;; $ eask load-path ;; -;; -;; Effective flag: -;; -;; [-g, --global] -;; ;;; Code: diff --git a/lisp/load.el b/lisp/load.el index 4e8fe60b..efb6d5e2 100644 --- a/lisp/load.el +++ b/lisp/load.el @@ -6,11 +6,6 @@ ;; ;; $ eask load ;; -;; -;; Effective flag: -;; -;; [-g, --global] -;; ;;; Code: diff --git a/lisp/outdated.el b/lisp/outdated.el index 3da395ff..c9c6f2c7 100644 --- a/lisp/outdated.el +++ b/lisp/outdated.el @@ -6,11 +6,6 @@ ;; ;; $ eask outdated ;; -;; -;; Effective flag: -;; -;; [-g, --global] -;; ;;; Code: diff --git a/lisp/package.el b/lisp/package.el index 88305ab1..25af86ae 100644 --- a/lisp/package.el +++ b/lisp/package.el @@ -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: @@ -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") @@ -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))) @@ -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) @@ -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)) diff --git a/lisp/uninstall.el b/lisp/uninstall.el index df5bcf5c..07011876 100644 --- a/lisp/uninstall.el +++ b/lisp/uninstall.el @@ -11,10 +11,6 @@ ;; ;; name of the package to uninstall ;; -;; Effective flag: -;; -;; [-g, --global], [-f, --force] -;; ;;; Code: diff --git a/lisp/upgrade.el b/lisp/upgrade.el index d69456d2..8d543d72 100644 --- a/lisp/upgrade.el +++ b/lisp/upgrade.el @@ -11,10 +11,6 @@ ;; ;; [names..] package to upgrade; else we upgrade all packages ;; -;; Effective flag: -;; -;; [-g, --global], [-f, --force] -;; ;;; Code: