Liking cljdoc? Tell your friends :D

tservice-core.plugins.util

Common utility functions useful throughout the codebase.

Common utility functions useful throughout the codebase.
raw docstring

call-command!clj

(call-command! cmd)
(call-command! cmd env)
(call-command! cmd workdir env)
(call-command! cmd parameters-coll workdir env)

chain-fn-collclj

(chain-fn-coll fn-coll pred)

Run the set of functions sequentially, exit the run when pred is false and return the existing result.

Run the set of functions sequentially, exit the run 
when pred is false and return the existing result.
raw docstring

datetimeclj

(datetime)

format-colorclj

(format-color color x)
(format-color color format-string & args)

Like format, but colorizes the output. color should be a symbol or keyword like green, red, yellow, blue, cyan, magenta, etc. See the entire list of avaliable colors here.

(format-color :red "Fatal error: %s" error-message)
Like `format`, but colorizes the output. `color` should be a symbol or keyword like `green`, `red`, `yellow`, `blue`,
`cyan`, `magenta`, etc. See the entire list of avaliable
colors [here](https://github.com/ibdknox/colorize/blob/master/src/colorize/core.clj).

    (format-color :red "Fatal error: %s" error-message)
raw docstring

get-path-variableclj

(get-path-variable)

hashmap->parametersclj

(hashmap->parameters coll)

{ '-d' 'true' '-o' 'output' } -> '-d true -o output'

{ '-d' 'true' '-o' 'output' } -> '-d true -o output'
raw docstring

make-plugin-subpathclj

(make-plugin-subpath plugin-dir dir-name plugin-name)

Return a new directory based on plugin-name and custom subdir.

Return a new directory based on plugin-name and custom subdir.
raw docstring

nowclj

(now)
(now offset)

Get the current local datetime.

Get the current local datetime.
raw docstring

one-or-manyclj

(one-or-many arg)

Wraps a single element in a sequence; returns sequences as-is. In lots of situations we'd like to accept either a single value or a collection of values as an argument to a function, and then loop over them; rather than repeat logic to check whether something is a collection and wrap if not everywhere, this utility function is provided for your convenience. (u/one-or-many 1) ; -> [1] (u/one-or-many [1 2]) ; -> [1 2]

Wraps a single element in a sequence; returns sequences as-is. In lots of situations we'd like to accept either a
single value or a collection of values as an argument to a function, and then loop over them; rather than repeat
logic to check whether something is a collection and wrap if not everywhere, this utility function is provided for
your convenience.
  (u/one-or-many 1)     ; -> [1]
  (u/one-or-many [1 2]) ; -> [1 2]
raw docstring

prog1cljmacro

(prog1 first-form & body)

Execute first-form, then any other expressions in body, presumably for side-effects; return the result of first-form. (def numbers (atom [])) (defn find-or-add [n] (or (first-index-satisfying (partial = n) @numbers) (prog1 (count @numbers) (swap! numbers conj n)))) (find-or-add 100) -> 0 (find-or-add 200) -> 1 (find-or-add 100) -> 0 The result of first-form is bound to the anaphor <>, which is convenient for logging: (prog1 (some-expression) (println "RESULTS:" <>)) prog1 is an anaphoric version of the traditional macro of the same name in Emacs Lisp and Common Lisp. Style note: Prefer doto when appropriate, e.g. when dealing with Java objects.

Execute `first-form`, then any other expressions in `body`, presumably for side-effects; return the result of
`first-form`.
 (def numbers (atom []))
 (defn find-or-add [n]
   (or (first-index-satisfying (partial = n) @numbers)
       (prog1 (count @numbers)
         (swap! numbers conj n))))
 (find-or-add 100) -> 0
 (find-or-add 200) -> 1
 (find-or-add 100) -> 0
The result of `first-form` is bound to the anaphor `<>`, which is convenient for logging:
  (prog1 (some-expression)
    (println "RESULTS:" <>))
`prog1` is an anaphoric version of the traditional macro of the same name in
[Emacs Lisp](http://www.gnu.org/software/emacs/manual/html_node/elisp/Sequencing.html#index-prog1)
and [Common Lisp](http://www.lispworks.com/documentation/HyperSpec/Body/m_prog1c.htm#prog1).
Style note: Prefer `doto` when appropriate, e.g. when dealing with Java objects.
raw docstring

render-templateclj

(render-template template env-context)

TODO: Schema for rendering environment.

Arguments: env-context: {:ENV_DEST_DIR " " :ENV_NAME "pgi" :CLONE_ENV_BIN ""}

TODO: Schema for rendering environment.

Arguments:
  env-context: {:ENV_DEST_DIR " "
                :ENV_NAME "pgi"
                :CLONE_ENV_BIN ""}
raw docstring

time->intclj

(time->int datetime)

uuidclj

(uuid)

These UUID's will be guaranteed to be unique and thread-safe regardless of clock precision or degree of concurrency.

These UUID's will be guaranteed to be unique and thread-safe regardless of clock precision or degree of concurrency.
raw docstring

varargscljmacro

(varargs klass)
(varargs klass xs)

Make a properly-tagged Java interop varargs argument. This is basically the same as into-array but properly tags the result. (u/varargs String) (u/varargs String ["A" "B"])

Make a properly-tagged Java interop varargs argument. This is basically the same as `into-array` but properly tags
the result.
  (u/varargs String)
  (u/varargs String ["A" "B"])
raw docstring

with-sh-envcljmacro

(with-sh-env dir env & forms)

Sets the directory for use with sh, see sh for details.

Sets the directory for use with sh, see sh for details.
raw docstring

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

× close