From 211757d5a428abda21acb39e1159e3c41484ec7e Mon Sep 17 00:00:00 2001 From: Wes Morgan Date: Tue, 5 Apr 2022 03:04:38 -0600 Subject: [PATCH] Add prepare subcommand (#1229) * Add prepare subcommand Downloads deps & pods, caches pod metadata, and then exits * Add prepare subcommand to CHANGELOG Co-authored-by: Michiel Borkent --- CHANGELOG.md | 4 +++- src/babashka/main.clj | 11 +++++++++-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6fe55d00..f41af96c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,8 +5,10 @@ For a list of breaking changes, check [here](#breaking-changes). A preview of the next release can be installed from [babashka-dev-builds](https://github.com/babashka/babashka-dev-builds). -## 0.8.1 (TBD) +======= +## Unreleased +- Add `prepare` subcommand to download deps & pods and cache pod metadata - [#1041](https://github.com/babashka/babashka/issues/1041): Improve error message when regex literal in EDN config ## 0.8.0 (2022-04-04) diff --git a/src/babashka/main.clj b/src/babashka/main.clj index 268985a0..55958dee 100644 --- a/src/babashka/main.clj +++ b/src/babashka/main.clj @@ -115,7 +115,8 @@ "socket-repl" "nrepl-server" "describe" - "print-deps") true + "print-deps" + "prepare") true false)) (defn print-error [& msgs] @@ -175,6 +176,7 @@ Packaging: uberscript [eval-opt] Collect all required namespaces from the classpath into a single file. Accepts additional eval opts, like `-m`. uberjar [eval-opt] Similar to uberscript but creates jar file. + prepare Download deps & pods defined in bb.edn and cache their metadata. Only an optimization, this will happen on demand when needed. In- and output flags (only to be used with -e one-liners): @@ -621,6 +623,10 @@ Use bb run --help to show this help output. :command-line-args (next options)) ("--print-deps") (parse-print-deps-opts opts-map (next options)) + ("--prepare") + (let [options (next options)] + (recur (next options) + (assoc opts-map :prepare true))) ;; fallback (if (and opts-map (some opts-map [:file :jar :socket-repl :expressions :main :run])) @@ -715,7 +721,7 @@ Use bb run --help to show this help output. :main :uberscript :describe? :jar :uberjar :clojure :doc :run :list-tasks - :print-deps]} + :print-deps :prepare]} cli-opts _ (when debug (vreset! common/debug true)) _ (do ;; set properties @@ -883,6 +889,7 @@ Use bb run --help to show this help output. uberjar [nil 0] list-tasks [(tasks/list-tasks sci-ctx) 0] print-deps [(print-deps/print-deps (:print-deps-format cli-opts)) 0] + prepare [nil 0] uberscript [nil (do (uberscript/uberscript {:ctx sci-ctx :expressions expressions})