v0.3.1
This commit is contained in:
parent
02cecb259d
commit
6a7baf2a90
3 changed files with 18 additions and 13 deletions
|
|
@ -1 +1 @@
|
|||
0.3.1-SNAPSHOT
|
||||
0.3.1
|
||||
|
|
@ -111,7 +111,7 @@ or: bb [classpath opts] subcommand [subcommand opts] [cmdline args]
|
|||
|
||||
Classpath:
|
||||
|
||||
-cp, --classpath Classpath to use.
|
||||
-cp, --classpath Classpath to use. Overrides bb.edn classpath.
|
||||
|
||||
Evaluation:
|
||||
|
||||
|
|
@ -562,8 +562,16 @@ When no eval opts or subcommand is provided, the implicit subcommand is repl.")
|
|||
uberscript-sources (atom ())
|
||||
classpath (or classpath
|
||||
(System/getenv "BABASHKA_CLASSPATH"))
|
||||
_ (when classpath
|
||||
(cp/add-classpath classpath))
|
||||
_ (if classpath
|
||||
(cp/add-classpath classpath)
|
||||
;; when classpath isn't set, we calculate it from bb.edn, if present
|
||||
(let [bb-edn-file (or (System/getenv "BABASHKA_EDN")
|
||||
"bb.edn")]
|
||||
(when (fs/exists? bb-edn-file)
|
||||
(let [edn (edn/read-string (slurp bb-edn-file))]
|
||||
(vreset! bb-edn edn)))
|
||||
;; we mutate the atom from tests as well, so despite the above it can contain a bb.edn
|
||||
(when-let [bb-edn @bb-edn] (deps/add-deps bb-edn))))
|
||||
abs-path (when file
|
||||
(let [abs-path (.getAbsolutePath (io/file file))]
|
||||
(vars/bindRoot sci/file abs-path)
|
||||
|
|
@ -715,13 +723,6 @@ When no eval opts or subcommand is provided, the implicit subcommand is repl.")
|
|||
exit-code))))
|
||||
|
||||
(defn main [& args]
|
||||
(let [bb-edn-file (or (System/getenv "BABASHKA_EDN")
|
||||
"bb.edn")]
|
||||
(when (fs/exists? bb-edn-file)
|
||||
(let [edn (edn/read-string (slurp bb-edn-file))]
|
||||
(vreset! bb-edn edn)))
|
||||
;; we mutate the atom from tests as well, so despite the above it can contain a bb.edn
|
||||
(when-let [bb-edn @bb-edn] (deps/add-deps bb-edn)))
|
||||
(let [opts (parse-opts args)]
|
||||
(exec opts)))
|
||||
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
[babashka.test-utils :as test-utils]
|
||||
[clojure.edn :as edn]
|
||||
[clojure.string :as str]
|
||||
[clojure.test :as test :refer [deftest is]]))
|
||||
[clojure.test :as test :refer [deftest is testing]]))
|
||||
|
||||
(defn bb [& args]
|
||||
(edn/read-string
|
||||
|
|
@ -35,7 +35,11 @@
|
|||
(deftest deps-test
|
||||
(with-config '{:deps {medley/medley {:mvn/version "1.3.0"}}}
|
||||
(is (= '{1 {:id 1}, 2 {:id 2}}
|
||||
(bb "-e" "(require 'medley.core)" "-e" "(medley.core/index-by :id [{:id 1} {:id 2}])")))))
|
||||
(bb "-e" "(require 'medley.core)" "-e" "(medley.core/index-by :id [{:id 1} {:id 2}])"))))
|
||||
(testing "--classpath option overrides bb.edn"
|
||||
(with-config '{:deps {medley/medley {:mvn/version "1.3.0"}}}
|
||||
(is (= "src"
|
||||
(bb "-cp" "src" "-e" "(babashka.classpath/get-classpath)"))))))
|
||||
|
||||
;; TODO:
|
||||
;; Do we want to support the same parsing as the clj CLI?
|
||||
|
|
|
|||
Loading…
Reference in a new issue