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

rewrite dependency management operations #6

Merged
merged 5 commits into from
Jul 3, 2023
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
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