Skip to content

Commit

Permalink
Fix #22 in 0.4.6 by adding Leiningen release stub
Browse files Browse the repository at this point in the history
  • Loading branch information
seancorfield committed Jul 29, 2016
1 parent d43853d commit 0ec21bb
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 1 deletion.
2 changes: 1 addition & 1 deletion build.boot
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
(set-env! :resource-paths #{"src"})

(def version "0.4.5")
(def version "0.4.6")

(task-options!
pom {:project 'seancorfield/boot-new
Expand Down
30 changes: 30 additions & 0 deletions src/leiningen/release.clj
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
(ns leiningen.release
"Adapted from Leiningen's code by stripping things down to
just one method to support one particular template (play-clj)
that uses lein-droid, which expects parse-semantic-version
to be available here."
(:require [boot.util :as util]))

(defn string->semantic-version
"Create map representing the given version string. Returns nil if the
string does not follow guidelines setforth by Semantic Versioning 2.0.0,
http://semver.org/"
[version-string]
;; <MajorVersion>.<MinorVersion>.<PatchVersion>[-<Qualifier>][-SNAPSHOT]
(if-let [[_ major minor patch qualifier snapshot]
(re-matches
#"(\d+)\.(\d+)\.(\d+)(?:-(?!SNAPSHOT)([^\-]+))?(?:-(SNAPSHOT))?"
version-string)]
(->> [major minor patch]
(map #(Integer/parseInt %))
(zipmap [:major :minor :patch])
(merge {:qualifier qualifier
:snapshot snapshot}))))

(defn parse-semantic-version
"Create map representing the given version string. Aborts with exit code 1
if the string does not follow guidelines setforth by Semantic Versioning 2.0.0,
http://semver.org/"
[version-string]
(or (string->semantic-version version-string)
(util/exit-error (println "Unrecognized version string:" version-string))))

0 comments on commit 0ec21bb

Please sign in to comment.