Liking cljdoc? Tell your friends :D

boot.util


*colorize?*clj

Atom containing the value that determines whether ANSI colors escape codes will be printed with boot output.

Atom containing the value that determines whether ANSI colors escape codes
will be printed with boot output.
sourceraw docstring

*sh-dir*clj

The directory to use as CWD for shell commands.

The directory to use as CWD for shell commands.
sourceraw docstring

*verbosity*clj

Atom containing the verbosity level, 1 is lowest, 3 highest. Level 2 corresponds to the -v boot option, level 3 to -vv, etc.

Levels:

  1. Print INFO level messages or higher, colorize and prune stack traces for maximum readability.
  2. Print DEBUG level messages or higher, don't colorize stack traces and prune some trace elements for improved readablility.
  3. Print DEBUG level messages or higher, don't colorize stack traces and include full traces with no pruning.
Atom containing the verbosity level, 1 is lowest, 3 highest. Level 2
corresponds to the -v boot option, level 3 to -vv, etc.

Levels:

  1.  Print INFO level messages or higher, colorize and prune stack traces
      for maximum readability.
  2.  Print DEBUG level messages or higher, don't colorize stack traces and
      prune some trace elements for improved readablility.
  3.  Print DEBUG level messages or higher, don't colorize stack traces and
      include full traces with no pruning.
sourceraw docstring

*watchers?*clj

Atom containing the value that determines whether inotify watches are registered

Atom containing the value that determines whether inotify watches are registered
sourceraw docstring

auto-flushclj

(auto-flush writer)

Returns a PrintWriter suitable for binding to out or err. This writer will call .flush() on every write, ensuring that all output is flushed before boot exits, even if output was written from a background thread.

Returns a PrintWriter suitable for binding to *out* or *err*. This writer
will call .flush() on every write, ensuring that all output is flushed before
boot exits, even if output was written from a background thread.
sourceraw docstring

bind-symsclj

(bind-syms form)

Returns the names bound in the given destructuring form.

Returns the names bound in the given destructuring form.
sourceraw docstring

colorize?-system-defaultclj

(colorize?-system-default)

Return whether we should colorize output on this system. The default console on Windows does not interprete ANSI escape codes, so colorized output is disabled on Windows by default, but enabled by default on other platforms. The default can be overriden by setting the environment variable or configuration option BOOT_COLOR to either '1' or 'yes' or 'true' to enable it; any other value disables colorization.

Return whether we should colorize output on this system. The default
console on Windows does not interprete ANSI escape codes, so colorized
output is disabled on Windows by default, but enabled by default
on other platforms. The default can be overriden by setting the
environment variable or configuration option BOOT_COLOR to
either '1' or 'yes' or 'true' to enable it; any other value disables
colorization.
sourceraw docstring

dbugclj

(dbug & more)

Print DEBUG level message. Arguments of the form fmt & args suitable for passing to clojure.core/format.

Note that boot.util/verbosity in a pod needs to be altered AFTER pod creation or log level won't be affected.

Print DEBUG level message. Arguments of the form fmt & args suitable for
passing to clojure.core/format.

Note that boot.util/*verbosity* in a pod needs to be altered AFTER pod
creation or log level won't be affected.
sourceraw docstring

dbug*clj/smacro

(dbug* fmt & args)

Macro version of boot.util/dbug, arguments are only evaluated when the message will be printed (i.e., verbosity level >= 2).

Macro version of boot.util/dbug, arguments are only evaluated when the
message will be printed (i.e., verbosity level >= 2).
sourceraw docstring

dep-as-mapclj

(dep-as-map [project & terms])

Returns the given dependency vector as a map with :project and :version keys plus any modifiers (eg. :scope, :exclusions, etc). If the version is not specified, nil will be used.

Returns the given dependency vector as a map with :project and :version
keys plus any modifiers (eg. :scope, :exclusions, etc).  If the version
is not specified, nil will be used.
sourceraw docstring

do-while-letclj/smacro

(do-while-let [binding test] & body)

Like while-let, except that the body is executed at least once.

Like while-let, except that the body is executed at least once.
sourceraw docstring

doshclj

(dosh & args)

Evaluates args as a shell command, blocking on completion and throwing an exception on non-zero exit status. Output from the shell is streamed to stdout and stderr as it is produced.

Evaluates args as a shell command, blocking on completion and throwing an
exception on non-zero exit status. Output from the shell is streamed to
stdout and stderr as it is produced.
sourceraw docstring

dosh-timedclj

(dosh-timed timeout-ms & args)

Evaluates args as a shell command, blocking on completion up to timeout-ms and throwing an exception on non-zero exit status. Output from the shell is streamed to stdout and stderr as it is produced.

Evaluates args as a shell command, blocking on completion up to `timeout-ms`
and throwing an exception on non-zero exit status. Output from the shell is
streamed to stdout and stderr as it is produced.
sourceraw docstring

dotoseqclj/smacro

(dotoseq obj seq-exprs & body)

A cross between doto and doseq. For example:

(-> (System/-err) (dotoseq [i (range 0 100)] (.printf "i = %d\n" i)) (.checkError))

A cross between doto and doseq. For example:

(-> (System/-err)
    (dotoseq [i (range 0 100)]
      (.printf "i = %d\n" i))
    (.checkError))
sourceraw docstring

exit-errorclj/smacro

(exit-error & body)

Binds out to err, evaluates the body, and exits with non-zero status.

Notes:

  • This is the preferred method for returning an exit code != 0, this method returns 1.
  • This macro does not call System.exit(), because this instance of boot may be nested in another boot instance. Instead a special method on boot.App is called which handles the exit behavior (calling shutdown hooks etc.).
Binds *out* to *err*, evaluates the body, and exits with non-zero status.

Notes:
* This is the preferred method for returning an exit code != 0, this
method returns 1.
* This macro does not call System.exit(), because this instance of boot
may be nested in another boot instance. Instead a special method on boot.App
is called which handles the exit behavior (calling shutdown hooks etc.).
sourceraw docstring

exit-okclj/smacro

(exit-ok & body)

Evaluates the body, and exits with non-zero status.

Notes:

  • Boot's main explicitly wraps user tasks in exit-ok so that in general it is not necessary to call it for exiting with 0.
  • This macro does not call System.exit(), because this instance of boot may be nested in another boot instance. Instead a special method on boot.App is called which handles the exit behavior (calling shutdown hooks etc.).
Evaluates the body, and exits with non-zero status.

Notes:
* Boot's main explicitly wraps user tasks in exit-ok so that in general
it is not necessary to call it for exiting with 0.
* This macro does not call System.exit(), because this instance of boot
may be nested in another boot instance. Instead a special method on boot.App
is called which handles the exit behavior (calling shutdown hooks etc.).
sourceraw docstring

extends-protocolclj/smacro

(extends-protocol protocol & specs)

Like extend-protocol but allows specifying multiple classes for each of the implementations:

(extends-protocol IFoo
  clojure.lang.MapEntry         ; <-- this is the difference, multiple
  clojure.lang.PersistentVector ; <-- classes per implementation
  (-foo [x] (into [] (map bar x))))
Like extend-protocol but allows specifying multiple classes for each of the
implementations:

    (extends-protocol IFoo
      clojure.lang.MapEntry         ; <-- this is the difference, multiple
      clojure.lang.PersistentVector ; <-- classes per implementation
      (-foo [x] (into [] (map bar x))))
sourceraw docstring

extract-idsclj

(extract-ids sym)

Extracts the group-id and artifact-id from sym, using the convention that non-namespaced symbols have group-id the same as artifact-id.

Extracts the group-id and artifact-id from sym, using the convention that
non-namespaced symbols have group-id the same as artifact-id.
sourceraw docstring

failclj

(fail & more)

Print ERROR level message. Arguments of the form fmt & args suitable for passing to clojure.core/format.

Note that boot.util/verbosity in a pod needs to be altered AFTER pod creation or log level won't be affected.

Print ERROR level message. Arguments of the form fmt & args suitable for
passing to clojure.core/format.

Note that boot.util/*verbosity* in a pod needs to be altered AFTER pod
creation or log level won't be affected.
sourceraw docstring

fail*clj/smacro

(fail* fmt & args)

Macro version of boot.util/fail, arguments are only evaluated when the message will be printed (i.e., verbosity level >= 1).

Macro version of boot.util/fail, arguments are only evaluated when
the message will be printed (i.e., verbosity level >= 1).
sourceraw docstring

guardclj/smacro

(guard expr & [default])

Evaluates expr within a try/catch and returns default (or nil if default is not given) if an exception is thrown, otherwise returns the result.

Evaluates expr within a try/catch and returns default (or nil if default is
not given) if an exception is thrown, otherwise returns the result.
sourceraw docstring

index-ofclj

(index-of v val)

Find the index of val in the sequential collection v, or nil if not found.

Find the index of val in the sequential collection v, or nil if not found.
sourceraw docstring

infoclj

(info & more)

Print INFO level message. Arguments of the form fmt & args suitable for passing to clojure.core/format.

Note that boot.util/verbosity in a pod needs to be altered AFTER pod creation or log level won't be affected.

Print INFO level message. Arguments of the form fmt & args suitable for
passing to clojure.core/format.

Note that boot.util/*verbosity* in a pod needs to be altered AFTER pod
creation or log level won't be affected.
sourceraw docstring

info*clj/smacro

(info* fmt & args)

Macro version of boot.util/info, arguments are only evaluated when the message will be printed (i.e., verbosity level >= 1).

Macro version of boot.util/info, arguments are only evaluated when
the message will be printed (i.e., verbosity level >= 1).
sourceraw docstring

jarnameclj

(jarname project version)

Generates a friendly name for the jar file associated with the given project symbol and version.

Generates a friendly name for the jar file associated with the given project
symbol and version.
sourceraw docstring

let-assert-keysclj/smacro

(let-assert-keys binding & body)

Let expression that throws an exception when any of the expected bindings is missing.

Let expression that throws an exception when any of the expected bindings
is missing.
sourceraw docstring

map-as-depclj

(map-as-dep {:keys [project version] :as dep-map})

Returns the given dependency vector with :project and :version put at indexes 0 and 1 respectively (if the values are not nil) and modifiers (e.g. :scope, :exclusions, etc.) and their values afterwards.

Returns the given dependency vector with :project and :version put at
indexes 0 and 1 respectively (if the values are not nil) and modifiers
(e.g. :scope, :exclusions, etc.) and their values afterwards.
sourceraw docstring

path->nsclj

(path->ns path)

Returns the namespace symbol corresponding to the source file path.

Returns the namespace symbol corresponding to the source file path.
sourceraw docstring

pp*clj

(pp* expr)

Pretty-print expr using the code dispatch.

Pretty-print expr using the code dispatch.
sourceraw docstring

pp-strclj

(pp-str expr)

Pretty-print expr to a string using the code dispatch.

Pretty-print expr to a string using the code dispatch.
sourceraw docstring

print**clj/smacro

(print** verbosity color fmt args)

Macro version of boot.util/print* but arguments are only evaluated when the message will be printed.

Macro version of boot.util/print* but arguments are only evaluated
when the message will be printed.
sourceraw docstring

(print-ex ex)

Print exception to err as appropriate for the current verbosity level.

If ex-data contains truthy :boot.util/omit-stacktrace? value, only exception message is shown.

Print exception to *err* as appropriate for the current *verbosity* level.

If ex-data contains truthy :boot.util/omit-stacktrace? value, only exception
message is shown.
sourceraw docstring

(print-tree tree & [prefixes node-fn])

Pretty prints tree, with the optional prefixes prepended to each line. The output is similar to the tree(1) unix program.

A tree consists of a graph of nodes of the format [<name> <nodes>], where <name> is a string and <nodes> is a set of nodes (the children of this node).

Example:

(util/print-tree [["foo" #{["bar" #{["baz"]}]}]] ["--" "XX"])

prints:

--XX└── foo
--XX    └── bar
--XX        └── baz

You can also pass a function to generate the prefix instead of a collection of prefixes that will be passed the node. Passing a function to generate the string representation of the node itself is also an option.

Pretty prints tree, with the optional prefixes prepended to each line. The
output is similar to the tree(1) unix program.

A tree consists of a graph of nodes of the format [<name> <nodes>], where
<name> is a string and <nodes> is a set of nodes (the children of this node).

Example:

    (util/print-tree [["foo" #{["bar" #{["baz"]}]}]] ["--" "XX"])

prints:

    --XX└── foo
    --XX    └── bar
    --XX        └── baz

You can also pass a function to generate the prefix instead of a
collection of prefixes that will be passed the node. Passing a
function to generate the string representation of the node itself is
also an option.
sourceraw docstring

read-string-allclj

(read-string-all s)

Reads all forms from the string s, by wrapping in parens before reading.

Reads all forms from the string s, by wrapping in parens before reading.
sourceraw docstring

shclj

(sh & args)

Evaluate args as a shell command, asynchronously, and return a thunk which may be called to block on the exit status. Output from the shell is streamed to stdout and stderr as it is produced.

Evaluate args as a shell command, asynchronously, and return a thunk which
may be called to block on the exit status. Output from the shell is streamed
to stdout and stderr as it is produced.
sourceraw docstring

traceclj

(trace & more)

Print TRACE level message. Arguments of the form fmt & args suitable for passing to clojure.core/format.

Note that boot.util/verbosity in a pod needs to be altered AFTER pod creation or log level won't be affected.

Print TRACE level message. Arguments of the form fmt & args suitable for
passing to clojure.core/format.

Note that boot.util/*verbosity* in a pod needs to be altered AFTER pod
creation or log level won't be affected.
sourceraw docstring

trace*clj/smacro

(trace* fmt & args)

Tracing macro, arguments are only evaluated when the message will be printed (i.e., verbosity level >= 3).

Tracing macro, arguments are only evaluated when the message will be
printed (i.e., verbosity level >= 3).
sourceraw docstring

warnclj

(warn & more)

Print WARNING level message. Arguments of the form fmt & args suitable for passing to clojure.core/format.

Note that boot.util/verbosity in a pod needs to be altered AFTER pod creation or log level won't be affected.

Print WARNING level message. Arguments of the form fmt & args suitable for
passing to clojure.core/format.

Note that boot.util/*verbosity* in a pod needs to be altered AFTER pod
creation or log level won't be affected.
sourceraw docstring

warn*clj/smacro

(warn* fmt & args)

Macro version of boot.util/warn, arguments are only evaluated when the message will be printed (i.e., verbosity level >= 1).

Macro version of boot.util/warn, arguments are only evaluated when
the message will be printed (i.e., verbosity level >= 1).
sourceraw docstring

warn-deprecatedclj

(warn-deprecated & args)

Print WARNING level message. Arguments of the form fmt & args suitable for passing to clojure.core/format. Respects the BOOT_WARN_DEPRECATED environment variable, which if set to no suppresses these messages.

Note that boot.util/verbosity in a pod needs to be altered AFTER pod creation or log level won't be affected.

Print WARNING level message. Arguments of the form fmt & args suitable for
passing to clojure.core/format. Respects the BOOT_WARN_DEPRECATED environment
variable, which if set to no suppresses these messages.

Note that boot.util/*verbosity* in a pod needs to be altered AFTER pod
creation or log level won't be affected.
sourceraw docstring

watchers?-system-defaultclj

(watchers?-system-default)

Return whether we should register file watches on this system. Constrained environments like clould build containers limit the number of inotify handles, and watchers are only necessary for interactive dev, not one-shot jobs. environment variable or configuration option BOOT_WATCHERS_DISABLE to either '1' or 'yes' or 'true' to disable inotify; any other value keeps normal behavior.

Return whether we should register file watches on this
system. Constrained environments like clould build containers limit
the number of inotify handles, and watchers are only necessary for
interactive dev, not one-shot jobs.  environment variable or
configuration option BOOT_WATCHERS_DISABLE to either '1' or 'yes' or
'true' to disable inotify; any other value keeps normal behavior.
sourceraw docstring

while-letclj/smacro

(while-let [binding test] & body)

Repeatedly executes body while test expression is true. Test expression is bound to binding.

Repeatedly executes body while test expression is true. Test expression is
bound to binding.
sourceraw docstring

with-err-strclj/smacro

(with-err-str & body)

Evaluates exprs in a context in which err is bound to a fresh StringWriter. Returns the string created by any nested printing calls.

Evaluates exprs in a context in which *err* is bound to a fresh StringWriter.
Returns the string created by any nested printing calls.

[1]: http://stackoverflow.com/questions/17314128/get-stacktrace-as-string
sourceraw docstring

with-letclj/smacro

(with-let [binding resource] & body)

Binds resource to binding and evaluates body. Then, returns resource. It's a cross between doto and with-open.

Binds resource to binding and evaluates body. Then, returns resource. It's
a cross between doto and with-open.
sourceraw docstring

with-resolveclj/smacro

(with-resolve bindings & body)

Given a set of binding pairs bindings, resolves the righthand sides requiring namespaces as necessary, binds them, and evaluates the body.

Given a set of binding pairs bindings, resolves the righthand sides requiring
namespaces as necessary, binds them, and evaluates the body.
sourceraw docstring

with-rethrowclj/smacro

(with-rethrow expr message)

Evaluates expr. If an exception is thrown it is wrapped in an exception with the given message and the original exception as the cause, and the wrapped exception is rethrown.

Evaluates expr. If an exception is thrown it is wrapped in an exception with
the given message and the original exception as the cause, and the wrapped
exception is rethrown.
sourceraw docstring

with-semaphoreclj/smacro

(with-semaphore sem & body)

Acquires a permit from the Semaphore sem, blocking if necessary, and then evaluates the body expressions, returning the result. In all cases the permit will be released before returning.

Acquires a permit from the Semaphore sem, blocking if necessary, and then
evaluates the body expressions, returning the result. In all cases the permit
will be released before returning.
sourceraw docstring

with-semaphore-noblockclj/smacro

(with-semaphore-noblock sem & body)

Attempts to acquire a permit from the Semaphore sem. If successful the body expressions are evaluated and the result returned. In all cases the permit will be released before returning.

Attempts to acquire a permit from the Semaphore sem. If successful the body
expressions are evaluated and the result returned. In all cases the permit
will be released before returning.
sourceraw docstring

without-exitingclj/smacro

(without-exiting & body)

Evaluates body in a context where System/exit doesn't work. Returns result of evaluating body, or nil if code in body attempted to exit.

Evaluates body in a context where System/exit doesn't work. Returns result
of evaluating body, or nil if code in body attempted to exit.
sourceraw docstring

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close