Skip to content

Commit

Permalink
split concerns
Browse files Browse the repository at this point in the history
  • Loading branch information
mpenet committed Jul 18, 2024
1 parent 6654ef4 commit ad652b7
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 12 deletions.
11 changes: 10 additions & 1 deletion src/exoscale/tools/project/api/git.clj
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
(ns exoscale.tools.project.api.git
(:require [clojure.string :as str]
(:require [clojure.java.io :as io]
[clojure.string :as str]
[clojure.tools.build.api :as b]
[clojure.tools.deps.alpha.util.dir :as td]
[exoscale.tools.project.api.version :as v]
[exoscale.tools.project.io :as pio]))
Expand Down Expand Up @@ -31,3 +33,10 @@
:fatal? false})
:out
str/trim-newline))

(defn git-count-revs
[{:as _opts :exoscale.project/keys [version-template-file]
:or {version-template-file "VERSION_TEMPLATE"}}]
(str/replace (slurp (td/canonicalize (io/file version-template-file)))
"GENERATED_VERSION"
(b/git-count-revs nil)))
17 changes: 6 additions & 11 deletions src/exoscale/tools/project/api/version.clj
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
(ns exoscale.tools.project.api.version
(:require [clojure.java.io :as io]
[clojure.string :as str]
[clojure.tools.build.api :as b]
[clojure.tools.deps.alpha.util.dir :as td]
[exoscale.deps-version :as version]))
[exoscale.deps-version :as version]
[exoscale.tools.project.api.git :as git]))

(defn get-version
[{:as _opts :exoscale.project/keys [version-file version]}]
Expand All @@ -26,13 +25,9 @@
:key version-key
:suffix version-suffix}))

(defn git-count-revs-version
(defn git-count-revs
"Updates VERSION file with clojure core libs like version scheme"
[{:as _opts
:exoscale.project/keys [version-file version-template-file]
:or {version-file "VERSION"
version-template-file "VERSION_TEMPLATE"}}]
[{:as opts :exoscale.project/keys [version-file]
:or {version-file "VERSION"}}]
(spit (td/canonicalize (io/file version-file))
(str/replace (slurp (td/canonicalize (io/file version-template-file)))
"GENERATED_VERSION"
(b/git-count-revs nil))))
(git/git-count-revs opts)))

0 comments on commit ad652b7

Please sign in to comment.