From 4ffe274e71043bf869390a649c0ad530044133a7 Mon Sep 17 00:00:00 2001 From: Michiel Borkent Date: Mon, 20 Jan 2020 22:09:37 +0100 Subject: [PATCH] [#7] fix differences with -Sdescribe --- deps.clj | 25 +++++++++++++++---------- src/borkdude/deps.clj | 25 +++++++++++++++---------- 2 files changed, 30 insertions(+), 20 deletions(-) diff --git a/deps.clj b/deps.clj index f5ff015..4cba486 100755 --- a/deps.clj +++ b/deps.clj @@ -135,7 +135,8 @@ For more info, see: (defn describe [lines] (let [[first-line & lines] lines] (print "{") (describe-line first-line) - (doseq [line lines] + (doseq [line lines + :when line] (print "\n ") (describe-line line)) (println "}"))) @@ -305,7 +306,7 @@ function Get-StringHash($str) { (when-not (.exists config-dir) (.mkdirs config-dir))) (let [config-deps-edn (io/file config-dir "deps.edn")] - (when (and (not (.exists config-deps-edn)) install-dir) + (when (and install-dir (not (.exists config-deps-edn))) (io/copy (io/file install-dir "example-deps.edn") config-deps-edn))) ;; Determine user cache directory @@ -321,10 +322,14 @@ function Get-StringHash($str) { config-project deps-edn config-paths (if (:repro args) - [(.getPath (io/file install-dir "deps.edn")) deps-edn] - [(.getPath (io/file install-dir "deps.edn")) - (.getPath (io/file config-dir "deps.edn")) - deps-edn]) + (if install-dir [(.getPath (io/file install-dir "deps.edn")) deps-edn] + []) + (if install-dir + [(.getPath (io/file install-dir "deps.edn")) + (.getPath (io/file config-dir "deps.edn")) + deps-edn] + [(.getPath (io/file config-dir "deps.edn")) + deps-edn])) ;; Determine whether to use user or project cache cache-dir (if (.exists (io/file "deps.edn")) @@ -352,7 +357,7 @@ function Get-StringHash($str) { _ (when (:verbose args) (println "deps.clj version =" deps-clj-version) (println "version =" version) - (println "install_dir =" install-dir) + (when install-dir (println "install_dir =" install-dir)) (println "config_dir =" config-dir) (println "config_paths =" (str/join " " config-paths)) (println "cache_dir =" cache-dir) @@ -422,10 +427,10 @@ function Get-StringHash($str) { [:config-files (filterv #(.exists (io/file %)) config-paths)] [:config-user config-user] [:config-project config-project] - [:install-dir install-dir] + (when install-dir [:install-dir install-dir]) [:cache-dir cache-dir] - [:force (str (:force args))] - [:repro (str (:repro args))] + [:force (boolean (:force args))] + [:repro (boolean (:repro args))] [:resolve-aliases (str (:resolve-aliases args))] [:classpath-aliases (str (:claspath-aliases args))] [:jvm-aliases (str (:jvm-aliases args))] diff --git a/src/borkdude/deps.clj b/src/borkdude/deps.clj index cf51a80..54497aa 100755 --- a/src/borkdude/deps.clj +++ b/src/borkdude/deps.clj @@ -135,7 +135,8 @@ For more info, see: (defn describe [lines] (let [[first-line & lines] lines] (print "{") (describe-line first-line) - (doseq [line lines] + (doseq [line lines + :when line] (print "\n ") (describe-line line)) (println "}"))) @@ -305,7 +306,7 @@ function Get-StringHash($str) { (when-not (.exists config-dir) (.mkdirs config-dir))) (let [config-deps-edn (io/file config-dir "deps.edn")] - (when (and (not (.exists config-deps-edn)) install-dir) + (when (and install-dir (not (.exists config-deps-edn))) (io/copy (io/file install-dir "example-deps.edn") config-deps-edn))) ;; Determine user cache directory @@ -321,10 +322,14 @@ function Get-StringHash($str) { config-project deps-edn config-paths (if (:repro args) - [(.getPath (io/file install-dir "deps.edn")) deps-edn] - [(.getPath (io/file install-dir "deps.edn")) - (.getPath (io/file config-dir "deps.edn")) - deps-edn]) + (if install-dir [(.getPath (io/file install-dir "deps.edn")) deps-edn] + []) + (if install-dir + [(.getPath (io/file install-dir "deps.edn")) + (.getPath (io/file config-dir "deps.edn")) + deps-edn] + [(.getPath (io/file config-dir "deps.edn")) + deps-edn])) ;; Determine whether to use user or project cache cache-dir (if (.exists (io/file "deps.edn")) @@ -352,7 +357,7 @@ function Get-StringHash($str) { _ (when (:verbose args) (println "deps.clj version =" deps-clj-version) (println "version =" version) - (println "install_dir =" install-dir) + (when install-dir (println "install_dir =" install-dir)) (println "config_dir =" config-dir) (println "config_paths =" (str/join " " config-paths)) (println "cache_dir =" cache-dir) @@ -422,10 +427,10 @@ function Get-StringHash($str) { [:config-files (filterv #(.exists (io/file %)) config-paths)] [:config-user config-user] [:config-project config-project] - [:install-dir install-dir] + (when install-dir [:install-dir install-dir]) [:cache-dir cache-dir] - [:force (str (:force args))] - [:repro (str (:repro args))] + [:force (boolean (:force args))] + [:repro (boolean (:repro args))] [:resolve-aliases (str (:resolve-aliases args))] [:classpath-aliases (str (:claspath-aliases args))] [:jvm-aliases (str (:jvm-aliases args))]