Skip to content

Commit

Permalink
Merge pull request #14 from flyboarder/master
Browse files Browse the repository at this point in the history
prep release
  • Loading branch information
Matthew Ratzke authored and Matthew Ratzke committed Dec 18, 2015
2 parents f1f2858 + e21679c commit 97a702a
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 20 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,5 @@ pom.xml.asc
.lein-plugins/
.lein-failures
.nrepl-port

.nrepl-history
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

[](dependency)
```clojure
[degree9/boot-semver "0.7.0"] ;; latest release
[degree9/boot-semver "1.0.0"] ;; latest release
```
[](/dependency)

Expand Down
14 changes: 9 additions & 5 deletions build.boot
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
(set-env!
:dependencies '[[org.clojure/clojure "1.7.0"]
[boot/core "2.4.2"]
[adzerk/bootlaces "0.1.13"]
[hoplon/boot-hoplon "0.1.10"]
:dependencies '[[org.clojure/clojure "1.7.0"]
[boot/core "2.5.1"]
[adzerk/bootlaces "0.1.13"]
[hoplon/boot-hoplon "0.1.10"]
[clojurewerkz/propertied "1.2.0"]
[grimradical/clj-semver "0.3.0"]]
[grimradical/clj-semver "0.3.0"]
[clj-time "0.11.0"]]
:resource-paths #{"src"})

(require
Expand All @@ -22,6 +23,9 @@
[]
(comp
(watch)
(version :no-update true
:minor 'inc
:pre-release 'snapshot)
(build-jar)))

(deftask deploy
Expand Down
40 changes: 28 additions & 12 deletions src/boot_semver/core.clj
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,28 @@
[adzerk.bootlaces :as bootlaces]
[clojure.java.io :as io]
[clj-semver.core :as ver]
[clojurewerkz.propertied.properties :as prop]))
[clojurewerkz.propertied.properties :as prop]
[clj-time.core :as timec]
[clj-time.coerce :as timeco]
[clj-time.format :as timef]))

(def semver-file "./version.properties")

(defn alpha [x] "alpha")

(defn beta [x] "beta")

(defn snapshot [x] "SNAPSHOT")

(def semver-file "./version.properties")
;;TODO add pre-release inc/dec functions

(defn semver-date [x] (timef/unparse (timef/formatter "yyyyMMdd") (timec/now)))

(defn semver-time [x] (timef/unparse (timef/formatter "hhmmss") (timec/now)))

(defn semver-date-time [x & [delim]] (clojure.string/join [(semver-date) (or delim "-") (semver-time)]))

(defn semver-date-dot-time [x] (semver-date-time x "."))

(defn- update-version [vermap upmap]
(merge-with (fn [uv vv] ((resolve uv) vv)) upmap vermap))
Expand All @@ -36,22 +49,25 @@
minor (into ["." minor])
patch (into ["." patch])
pre-release (into ["-" pre-release])
build (into ["-" build]))))
build (into ["+" build]))))

(boot/deftask version
"Semantic Versioning for your project."
[x major MAJ sym "Symbol of fn to apply to Major version."
y minor MIN sym "Symbol of fn to apply to Minor version."
z patch PAT sym "Symbol of fn to apply to Patch version."
r pre-release PRE sym "Symbol of fn to apply to Pre-Release version."
b build BLD sym "Symbol of fn to apply to Build version."]
[x major MAJ sym "Symbol of fn to apply to Major version."
y minor MIN sym "Symbol of fn to apply to Minor version."
z patch PAT sym "Symbol of fn to apply to Patch version."
r pre-release PRE sym "Symbol of fn to apply to Pre-Release version."
b build BLD sym "Symbol of fn to apply to Build version."
n no-update bool "Prevents writing to version.properties file."]
(let [curver (get-version semver-file)
cursemver (ver/version curver)
version (to-mavver (update-version (ver/version curver) *opts*))]
(boot/task-options! task/pom #(assoc-in % [:version] version)
task/push #(assoc-in % [:ensure-version] version))
(boot/with-pre-wrap [fs]
(util/info (clojure.string/join ["Current Project Version...: " curver "\n"]))
(when (not= curver version)
(let [] (util/info (clojure.string/join ["Updating Project Version...: " curver "->" version "\n"]))
(set-version! semver-file version)))
(util/info (clojure.string/join ["Version in version.properties ...: " curver "\n"]))
(util/info (clojure.string/join ["Current Build Version ...: " version "\n"]))
(when (and (nil? (:no-update *opts*)) (not= curver version))
(util/info (clojure.string/join ["Updating Project Version...: " curver "->" version "\n"]))
(set-version! semver-file version))
fs)))
4 changes: 2 additions & 2 deletions version.properties
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
#Fri Dec 11 17:26:56 MST 2015
VERSION=0.7.0
#Fri Dec 18 00:39:23 MST 2015
VERSION=1.0.0

0 comments on commit 97a702a

Please sign in to comment.