Skip to content

Commit

Permalink
Merge pull request #6 from somecho/dev
Browse files Browse the repository at this point in the history
rewrite dependency management operations
  • Loading branch information
somecho committed Jul 3, 2023
2 parents f55f949 + c899a6e commit 29747bc
Show file tree
Hide file tree
Showing 22 changed files with 1,291 additions and 280 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ on:
- main
push:
paths: ['src/**']
branches:
- master
workflow_dispatch:

jobs:
Expand Down
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.21")
(def version "0.1.23")
(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
7 changes: 4 additions & 3 deletions generate.clj
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
(def INPUT-FOLDER "test/resources/input/")
(def SNAPSHOTS-FOLDER "test/resources/snapshots/")
(def FILES ["project.clj" "deps.edn" "bb.edn" "shadow-cljs.edn"])
(def TARGETS ["update-all"])
(def TARGETS ["add-reagent-1.2.0" "add-multiple"])

(defn setup-directories []
(mapv #(io/make-parents (str SNAPSHOTS-FOLDER % "/FILE")) TARGETS))
Expand All @@ -23,6 +23,7 @@
(println "Setting up snapshot directories")
(setup-directories)
(println "Creating snapshots")
(println "Update-all snapshots")
(mapv #(create-snapshot % "update-all" "update") FILES)
(println "add-reagent-1.2.0 snapshots")
(mapv #(create-snapshot % "add-reagent-1.2.0" "add" "reagent@1.2.0") FILES)
(mapv #(create-snapshot % "add-multiple" "add" "reagent@1.2.0" "org.clojure/java.jdbc@0.7.12") FILES)
(println "All snapshots have been created"))
18 changes: 13 additions & 5 deletions src/depo/core.clj
Original file line number Diff line number Diff line change
Expand Up @@ -7,31 +7,39 @@
(let [args _arguments
config-path (if file file (rw/get-config))]
(if-not (empty? args)
(do (mapv #(rw/write-dependency config-path %) args)
(do (mapv #(rw/apply-operation {:config-path config-path
:id %
:operation :add}) args)
(println "Done!"))
(println (e/err :no-args)))))

(defn remove-cmd [{:keys [_arguments file]}]
(let [args _arguments
config-path (if file file (rw/get-config))]
(if-not (empty? args)
(do (mapv #(rw/remove-dependency config-path %) args)
(do (mapv #(rw/apply-operation {:config-path config-path
:id %
:operation :remove}) args)
(println "Done!"))
(println (e/err :no-args)))))

(defn update-cmd [{:keys [_arguments file]}]
(let [args _arguments
config-path (if file file (rw/get-config))]
(if (empty? args)
(do (mapv #(rw/update-dependency config-path %)
(do (mapv #(rw/apply-operation {:config-path config-path
:id %
:operation :update})
(rw/get-all-dependency-names config-path))
(println "Done!"))
(mapv #(rw/update-dependency config-path %) args))))
(mapv #(rw/apply-operation {:config-path config-path
:id %
:operation :update}) args))))

(def CONFIGURATION
{:command "depo"
:description "Manage dependencies for Clojure projects easily"
:version "0.0.21"
:version "0.1.23"
:opts [{:as "path to configuration file"
:default nil
:option "file"
Expand Down
Loading

0 comments on commit 29747bc

Please sign in to comment.