Skip to content
Open
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 README.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,8 @@ becomes this:

Assuming that there is a git tag `v1.0.1` on the commit `HEAD~~`, and that the SHA of `HEAD` is uniquely identified by `abcd`. This behavior is automatically enabled whenever lein-v finds the project version to be the keyword `:lein-v`.

Note that the project version can be set to either the keyword `:lein-v` or the string `":lein-v"` (the Cursive IDE, in particular, gets confused by the keyword version).

## Dependencies

In case you're using a monorepository, you could also use lein-v to determine the current version of dependencies.
Expand Down
2 changes: 1 addition & 1 deletion src/lein_v/plugin.clj
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
(deploy-when-anchored))

(defn- select-versioner [version]
(if (= :lein-v version)
(if (#{:lein-v ":lein-v"} version)
version-from-scm
(do (when (and (string? version) (or (empty? version) (re-find #"lein" version)))
(leiningen.core.main/warn "WARNING: lein-v is not managing this project's version. Set version in project.clj to :lein-v to trigger automatic lein-v management"))
Expand Down
11 changes: 11 additions & 0 deletions test/integration/lein_v/plugin.clj
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,17 @@
=> (contains {:version "0.0.0"
:manifest (contains {"Implementation-Version" "0.0.0"})}))

(fact "String version of :lein-v works correctly"
(against-background (before :facts (do (init!))))
(middleware {:version ":lein-v" :v {:from-scm 'leiningen.v.maven/from-scm}})
=> (contains {:version "0.0.0"
:manifest (contains {"Implementation-Version" "0.0.0"})}))

(fact "Non :lein-v version number is ignored"
(against-background (before :facts (do (init!))))
(middleware {:version "1.2.3" :v {:from-scm 'leiningen.v.maven/from-scm}})
=> (contains {:version "1.2.3"}))

(fact "Baseless commit returns default + commit metadata"
(against-background (before :facts (do (init!) (commit!))))
(middleware $mproject)
Expand Down