std.lib.version

+lookup+

+order+

+pattern+

+qualifiers+

clojure-version

added in 3.0

(clojure-version)

returns the current clojure version (clojure-version) => (contains {:major anything, :minor anything, :incremental anything :qualifier anything})

equal?

added in 3.0

(equal? a b)

compares if two versions are the same

(equal? “1.2-final” “1.2”) => true

init

macro

added in 3.0

(init constraints & statements)

only attempts to load the files when the minimum versions have been met

(version/init [:java :newer {:major 1 :minor 8} :clojure :newer {:major 1 :minor 6}] (:import java.time.Instant))

java-version

added in 3.0

(java-version)

returns the current java version (java-version) => (contains {:major anything, :minor anything, :incremental anything :qualifier anything})

newer?

added in 3.0

(newer? a b)

returns true if the the first argument is newer than the second

(newer? “1.2” “1.0”) => true

(newer? “1.2.2” “1.0.4”) => true

not-equal?

added in 3.0

(not-equal? a b)

returns true if first argument is not older than the second

(not-equal? “3.0” “3.0”) => false

not-newer?

added in 3.0

(not-newer? a b)

returns true if first argument is not older than the second

(not-newer? “3.0” “3.0”) => true

not-older?

added in 3.0

(not-older? a b)

returns true if first argument is not older than the second

(not-older? “3.0” “3.0”) => true

older?

added in 3.0

(older? a b)

returns true if first argument is older than the second

(older? “1.0-alpha” “1.0-beta”) => true

(older? “1.0-rc1” “1.0”) => true

order

parse

added in 3.0

(parse s)

parses a version input (parse “1.0.0-final”) => {:major 1, :minor 0, :incremental 0, :qualifier 6, :release “final”, :build ""}

(parse “1.0.0-alpha+build.123”) => {:major 1, :minor 0, :incremental 0, :qualifier 0, :release “alpha”, :build “build.123”}

parse-number

added in 3.0

(parse-number s)

parse a number from string input

(parse-number “1”) => 1

parse-qualifier

added in 3.0

(parse-qualifier release build)

parses a qualifier from string input

(parse-qualifier "" "") => 6

(parse-qualifier “alpha” "") => 0

run

macro

added in 3.0

(run constraints & body)

only runs the following code is the minimum versions have been met

(version/run [:java :newer {:major 1 :minor 8} :clojure :newer {:major 1 :minor 6}] (eval ’(Instant/ofEpochMilli 0)))

satisfied

added in 3.0

(satisfied [type compare constraint :as entry])(satisfied [type compare constraint] current)

checks to see if the current version satisfies the given constraints (satisfied :java :newer {:major 1 :minor 7} {:major 1 :minor 8}) => true

(satisfied :java :older {:major 1 :minor 7} {:major 1 :minor 7}) => false

(satisfied :java :not-newer {:major 30 :minor 0}) => true

system-version

added in 3.0

(system-version tag)

alternate way of getting clojure and java version (system-version :clojure) => (clojure-version)

(system-version :java) => (java-version)

version

added in 3.0

(version x)

like parse but also accepts maps

(version “1.0-RC5”) => {:major 1, :minor 0, :incremental nil, :qualifier 3, :release “rc5”, :build ""}