tools-convenience.api
Convenience fns for tools.build scripts.
clojure
(clojure & args)
Execute clojure reproducibly (-Srepro) with the given args (strings).
clojure-capture-exceptions
(clojure-capture-exceptions & args)
Execute clojure reproducibly (-Srepro) with the given args (strings), capturing stderr only (as a result map as per clojure.tools.build.api/process), and not throwing exceptions on sub-process failure (caller must check :exit status code in result).
clojure-discard-exceptions
(clojure-discard-exceptions & args)
Execute clojure reproducibly (-Srepro) with the given args (strings), discarding any exception thrown by the sub-process (an exception will still thrown in this process if the exit status <> 0, however).
clojure-silent
(clojure-silent & args)
Execute clojure reproducibly (-Srepro) with the given args (strings), capturing and returning stdout and stderr (as a result map as per clojure.tools.build.api/process).
ensure-command
(ensure-command command-name)
Ensures that the given command is available (note: POSIX only). Returns true if it exists, throws an exception otherwise.
Notes:
* This fn is memoized, so calling it repeatedly with the same command-name will not hurt performance.
exec
(exec command-line)
(exec command-line opts)
Executes the given command line, expressed as either a string or a sequential (vector or list), optionally with other clojure.tools.build.api/process options as a second argument.
Throws an ExceptionInfo on non-zero status code, containing the entire execution result (from clojure.tools.build.api/process) in the info map.
Throws if the command doesn't exist.
git
(git & args)
Execute git with the given args (which can be strings or keywords), capturing and returning the output (stdout only).
git-current-branch
(git-current-branch)
git-current-commit
(git-current-commit)
The sha of the current commit.
git-exact-tag
(git-exact-tag)
(git-exact-tag sha)
Returns the exact tag for the given sha (or current commit sha if not provided), or nil if there is no tag for that sha.
git-nearest-tag
(git-nearest-tag)
The nearest tag to the current commit.
git-remote
(git-remote)
The URL of the origin server (if any). Note: includes the .git extension.
git-tag-commit
(git-tag-commit tag)
Returns the commit sha for the given tag, or nil if the tag doesn't exist.
git-tag-or-hash
(git-tag-or-hash)
Returns the tag for the current revision, or if there isn't one, the hash of the current revision.
process
multimethod
(process command-line)
(process command-line opts)
Executes the given command line, expressed as either a string or a sequential (vector or list), optionally with other clojure.tools.build.api/process options as a second argument.
Caller must check :exit status code of the result to determine whether the sub-process succeeded or not.
Throws if the command doesn't exist.