Skip to content
This repository has been archived by the owner on Jun 12, 2024. It is now read-only.

Commit

Permalink
refactor deps option
Browse files Browse the repository at this point in the history
  • Loading branch information
minhtuannguyen committed Jun 29, 2016
1 parent 273e69f commit f5eb0b0
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 18 deletions.
8 changes: 4 additions & 4 deletions project.clj
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@
[com.github.jnr/jnr-posix "3.0.29"]
[digest "1.4.4"]
[ancient-clj "0.3.14"]
[org.clojure/tools.cli "0.3.5"]
[com.fasterxml.jackson.core/jackson-core "2.2.3"]
[com.fasterxml.jackson.core/jackson-databind "2.2.3"]]
[org.clojure/tools.cli "0.3.5"]]

:profiles {:uberjar {:aot :all}
:test {:resource-paths ["test-resources"]}
:test {:resource-paths ["test-resources"]
:dependencies [[com.fasterxml.jackson.core/jackson-core "2.2.3"]
[com.fasterxml.jackson.core/jackson-databind "2.2.3"]]}
:dev {:dependencies [[pjstadig/humane-test-output "0.8.0"]]
:plugins [[lein-cljfmt "0.5.3"]
[lein-cloverage "1.0.6"]]}})
32 changes: 18 additions & 14 deletions src/leiningen/leinsync/deps.clj
Original file line number Diff line number Diff line change
Expand Up @@ -30,26 +30,30 @@
{}
deps))

(defn has-newer-version? [m last-version]
(-> m
(vals)
(conj last-version)
(distinct)
(count)
(> 1)))

(defn mark-for-possible-update [get-version]
(fn [[k v]]
(let [last-version (get-version k)
deps-info {:name k :last-version last-version}]
(if (has-newer-version? v last-version)
(merge deps-info (zipmap (keys v) (map #(str "==> " %) (vals v))))
(merge deps-info v)))))

(defn pretty-print-structure [enrich-version deps]
(->> deps
(seq)
(map (fn [[k v]]
(let [last-version (enrich-version k)
has-newer-version? (-> v
(vals)
(conj last-version)
(distinct)
(count)
(> 1))]
(if has-newer-version?
(merge {:name k :last-version last-version}
(zipmap (keys v)
(map #(str "==> " %) (vals v))))
(merge {:name k :last-version last-version} v)))))))
(map (mark-for-possible-update enrich-version))))

(defn log-resouces-table [m]
(m/info "\n* List of dependencies")
(m/info " - ==> version : means that the dependency on this project is out-of-date")
(m/info " ==> version : means that the dependency on this project is out-of-date")
(pp/print-compact-table m)
(m/info "\n"))

Expand Down

0 comments on commit f5eb0b0

Please sign in to comment.