Add babashka.classpath/classpath (#669)
This commit is contained in:
parent
9a80a47cfa
commit
b269b37ecf
2 changed files with 12 additions and 2 deletions
|
|
@ -365,6 +365,8 @@ If neither -e, -f, or --socket-repl are specified, then the first argument that
|
||||||
:cp new-cp})))
|
:cp new-cp})))
|
||||||
nil)
|
nil)
|
||||||
|
|
||||||
|
(defn classpath []
|
||||||
|
(:cp @cp-state))
|
||||||
|
|
||||||
;;(def ^:private server-ns-obj (sci/create-ns 'clojure.core.server nil))
|
;;(def ^:private server-ns-obj (sci/create-ns 'clojure.core.server nil))
|
||||||
|
|
||||||
|
|
@ -395,7 +397,8 @@ If neither -e, -f, or --socket-repl are specified, then the first argument that
|
||||||
(let [opts (apply hash-map opts)]
|
(let [opts (apply hash-map opts)]
|
||||||
(repl/start-repl! @common/ctx opts)))}
|
(repl/start-repl! @common/ctx opts)))}
|
||||||
'clojure.test t/clojure-test-namespace
|
'clojure.test t/clojure-test-namespace
|
||||||
'babashka.classpath {'add-classpath add-classpath*}
|
'babashka.classpath {'add-classpath add-classpath*
|
||||||
|
'classpath classpath}
|
||||||
'clojure.pprint pprint-namespace
|
'clojure.pprint pprint-namespace
|
||||||
'babashka.curl curl-namespace
|
'babashka.curl curl-namespace
|
||||||
'babashka.pods pods/pods-namespace
|
'babashka.pods pods/pods-namespace
|
||||||
|
|
@ -674,4 +677,3 @@ If neither -e, -f, or --socket-repl are specified, then the first argument that
|
||||||
;;;; Scratch
|
;;;; Scratch
|
||||||
|
|
||||||
(comment)
|
(comment)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,14 @@
|
||||||
(tu/bb nil
|
(tu/bb nil
|
||||||
"(require '[foo :as f])"))))
|
"(require '[foo :as f])"))))
|
||||||
|
|
||||||
|
(deftest babashka-classpath-test
|
||||||
|
(is (= "test-resources"
|
||||||
|
(bb nil "--classpath" "test-resources"
|
||||||
|
"(require '[babashka.classpath :as cp]) (cp/classpath)")))
|
||||||
|
(is (= "test-resources:foobar"
|
||||||
|
(bb nil "--classpath" "test-resources"
|
||||||
|
"(require '[babashka.classpath :as cp]) (cp/add-classpath \"foobar\") (cp/classpath)"))))
|
||||||
|
|
||||||
(deftest classpath-env-test
|
(deftest classpath-env-test
|
||||||
;; for this test you have to set `BABASHKA_CLASSPATH` to test-resources/babashka/src_for_classpath_test/env
|
;; for this test you have to set `BABASHKA_CLASSPATH` to test-resources/babashka/src_for_classpath_test/env
|
||||||
;; and `BABASHKA_PRELOADS` to "(require '[env-ns])"
|
;; and `BABASHKA_PRELOADS` to "(require '[env-ns])"
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue