Skip to content

Commit

Permalink
0.0.20 - implement no argument behavior of update command
Browse files Browse the repository at this point in the history
  • Loading branch information
somecho committed Jul 2, 2023
1 parent d496831 commit 10da7cc
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 3 deletions.
2 changes: 1 addition & 1 deletion build.clj
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
[deps-deploy.deps-deploy :as dd]))

(def lib 'org.clojars.some/depo)
(def version "0.0.19")
(def version "0.0.20")
(def jar-file (format "target/%s-%s.jar" (name lib) version))
(def class-dir "target/classes")
(def url "https://github.com/somecho/depo")
Expand Down
8 changes: 6 additions & 2 deletions src/depo/core.clj
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,16 @@
(defn update-cmd [{:keys [_arguments file]}]
(let [args _arguments
config-path (if file file (rw/get-config))]
(println args)))
(if (empty? args)
(do (mapv #(rw/update-dependency config-path %)
(rw/get-all-dependency-names config-path))
(println "Done!"))
(mapv #(rw/update-dependency config-path %) args))))

(def CONFIGURATION
{:command "depo"
:description "Manage dependencies for Clojure projects easily"
:version "0.0.19"
:version "0.0.20"
:opts [{:as "path to configuration file"
:default nil
:option "file"
Expand Down
24 changes: 24 additions & 0 deletions src/depo/readwrite.clj
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,30 @@
:wrap-coll? nil}})
(as-> new-conf (spit config-path new-conf)))))

(defmulti get-all-dependency-names
"Returns all the dependencies from the config"
(fn [config-path] config-path))

(defmethod get-all-dependency-names :default
[config-path]
(let [zloc (z/of-string (slurp config-path))]
(-> zloc
(z/get :deps)
(z/string)
(read-string)
(keys)
(as-> keys (map str keys)))))

(defmethod get-all-dependency-names "project.clj"
[config-path]
(let [zloc (z/of-string (slurp config-path))]
(-> zloc
(z/find-value z/next :dependencies)
(z/next)
(z/string)
(read-string)
(as-> dep-vec (map #(str (first %)) dep-vec)))))

(defmulti update-dependency
"Updates a dependency in a Clojure project"
(fn [config-path dependency] config-path))
Expand Down

0 comments on commit 10da7cc

Please sign in to comment.