44 [clojure.java.io :as jio]
55 [clojure.string :as str]
66 [clojure.test :refer :all ]
7+ [clojure.tools.deps.extensions.git :as git]
78 [clojure.tools.tools.api :as api])
89 (:import
910 [java.io File]
7980 (finally
8081 (System/setProperty " user.home" old-home#)))))
8182
83+ (println " !! env paths" (System/getenv " CLJ_CONFIG" ) (System/getenv " XDG_CONFIG_HOME" ))
84+
85+ ; ; when new tool has both git and maven versions, prefer git and install
86+ (deftest install-latest-new-mixed
87+ (let-tools-dir [tools " test-data/empty" ]
88+ (api/install-latest {:lib 'com.github.seancorfield/clj-new
89+ :as 'clj-new})
90+ (let [new-edn (edn/read-string (slurp (jio/file tools " clj-new.edn" )))]
91+ (clojure.pprint/pprint new-edn)
92+ ; ; has a :git/tag
93+ (is (= 'com.github.seancorfield/clj-new (-> new-edn :lib )))
94+ (is (= " https://github.com/seancorfield/clj-new.git" (-> new-edn :lib git/auto-git-url)))
95+ (is (-> new-edn :coord :git/tag ))
96+ (is (-> new-edn :coord :git/sha )))))
97+
8298; ; when out of date tool has both git and maven versions, only consider updates
8399; ; to version with the same coordinate type. here, git is installed
84- (deftest install-latest-mixed
100+ (deftest install-latest-existing-tool- mixed
85101 (let-tools-dir [tools " test-data/tools1" ]
86102 (let [old-edn (edn/read-string (slurp (jio/file tools " clj-new.edn" )))
87103 old-tag (-> old-edn :coord :git/tag )]
88104 (api/install-latest {:tool " clj-new" })
89105 (let [new-edn (edn/read-string (slurp (jio/file tools " clj-new.edn" )))
90106 new-tag (-> new-edn :coord :git/tag )]
91107 (is new-tag) ; ; has a :git/tag
92- (is (not= old-tag new-tag)))))) ; ; ... that has been updated
108+ (is (not= old-tag new-tag)))))) ; ; ... that has been updated
0 commit comments