Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

flag to optionally consider overrides for gather-and-list as well #15

Merged
merged 1 commit into from
Jan 21, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions src/depot/outdated.clj
Original file line number Diff line number Diff line change
Expand Up @@ -92,16 +92,19 @@
[lib coord data]
(-current-latest-map lib coord data))

(defn gather-outdated [consider-types aliases]
(defn gather-outdated [consider-types aliases include-overrides]
(let [deps-map (-> (reader/clojure-env)
(:config-files)
(reader/read-deps))
args-map (deps/combine-aliases deps-map aliases)
overrides (:override-deps args-map)
all-deps (merge (:deps deps-map) (:extra-deps args-map))]
all-deps (merge (:deps deps-map) (:extra-deps args-map)
(when include-overrides overrides))]
(->> (for [[lib coord] all-deps
:let [outdated (current-latest-map lib
(get overrides lib coord)
(if include-overrides
coord
(get overrides lib coord))
{:consider-types consider-types
:deps-map deps-map})]]
(when outdated
Expand Down
5 changes: 3 additions & 2 deletions src/depot/outdated/main.clj
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,12 @@
:default-desc "release"
:parse-fn comma-str->keywords-set
:validate [#(set/subset? % depot/version-types) (str "Must be subset of " depot/version-types)]]
["-o" "--overrides" "Consider overrides for updates instead of pinning to them."]
["-u" "--update" "Update deps.edn, or filenames given as additional command line arguments."]
["-h" "--help"]])

(defn -main [& args]
(let [{{:keys [aliases consider-types help update]} :options
(let [{{:keys [aliases consider-types overrides help update]} :options
files :arguments
summary :summary} (cli/parse-opts args cli-options)]
(cond
Expand All @@ -44,7 +45,7 @@
(depot.outdated.update/update-deps-edn! "deps.edn" consider-types))

:else
(let [outdated (depot/gather-outdated consider-types aliases)]
(let [outdated (depot/gather-outdated consider-types aliases overrides)]
(if (empty? outdated)
(println "All up to date!")
(do (pprint/print-table ["Dependency" "Current" "Latest"] outdated)
Expand Down