Liking cljdoc? Tell your friends :D

pallet.script

Base infrastructure for script generation, and operating system abstraction.

defscript defines an abstract script function, that can be implemented for different operating system (and version) targets.

implement is used to add an implementation to a function defined with defscript.

Dispatch of defscript is based on an implementation's specialisers vector. All elements of the specialisers vector must match *script-context*. The specialisers vector may contain keywords that match if the are in *script-context*, sets of keywords that match if any of the set values are in *script-context*, or functions that will be passed *script-context* as an argument and should return a truth value indicating whether a match occured.

Mutiple implementations may match the *script-context* vector, and the best fit is determined by the highest number of matching specialiser functions, with ties decided by the earliest defined implementation.

Base infrastructure for script generation, and operating system abstraction.

`defscript` defines an abstract script function, that can be implemented
for different operating system (and version) targets.

`implement` is used to add an implementation to a function defined with
`defscript`.

Dispatch of `defscript` is based on an implementation's specialisers vector.
All elements of the specialisers vector must match `*script-context*`.  The
specialisers vector may contain keywords that match if the are in
`*script-context*`, sets of keywords that match if any of the set values are
in `*script-context*`, or functions that will be passed `*script-context*` as
an argument and should return a truth value indicating whether a match
occured.

Mutiple implementations may match the `*script-context*` vector, and the
best fit is determined by the highest number of matching specialiser
functions, with ties decided by the earliest defined implementation.
raw docstring

*script-context*clj

Determine the target to generate script for. defscript implementations are dispatched on this. The value should be a vector, containing os-family values (e.g. :ubuntu), os-family and os-version values (e.g. :centos-5.3), or other keywords.

Determine the target to generate script for.
`defscript` implementations are dispatched on this.  The value should
be a vector, containing os-family values (e.g. `:ubuntu`), os-family and
os-version values (e.g. `:centos-5.3`), or other keywords.
sourceraw docstring

defimplclj/smacro

(defimpl script specialisers [& args] & body)

Define a script function implementation for the given specialisers.

specialisers should be the :default keyword, or a vector. The specialisers vector may contain keywords, a set of keywords that provide an inclusive or match, or functions that return a truth value indication whether the implementation is a match for the script template passed as the function's first argument.

body is wrapped in an implicit script form.

(pallet.script/defscript ls [& args])
(defimpl ls :default [& args] (ls ~@args))
(defimpl ls [:windows] [& args] (dir ~@args))
Define a script function implementation for the given `specialisers`.

`specialisers` should be the :default keyword, or a vector.  The
`specialisers` vector may contain keywords, a set of keywords that provide an
inclusive `or` match, or functions that return a truth value indication
whether the implementation is a match for the script template passed as the
function's first argument.

`body` is wrapped in an implicit `script` form.

    (pallet.script/defscript ls [& args])
    (defimpl ls :default [& args] (ls ~@args))
    (defimpl ls [:windows] [& args] (dir ~@args))
sourceraw docstring

defscriptclj/smacro

(defscript fn-name & args)

Define a top level var with an abstract script function, that can be implemented differently for different operating systems. Calls to functions defined by defscript are dispatched based on the *script-context* vector.

Define a top level var with an abstract script function, that can be
implemented differently for different operating systems.  Calls to functions
defined by `defscript` are dispatched based on the `*script-context*`
vector.
sourceraw docstring

dispatchclj

(dispatch script args)
(dispatch script args file line)

Invoke script with the given args. The implementations of script is found based on the current *script-context* value. If no matching implementation is found, then a :no-script-implementation condition is raised.

Invoke `script` with the given `args`.  The implementations of `script` is
found based on the current `*script-context*` value.  If no matching
implementation is found, then a :no-script-implementation condition
is raised.
sourceraw docstring

implementclj

(implement script specialisers f)

Add an implementation of script for the given specialisers. The default implementation can be set by passing :default as the specialisers argument. specialisers should be the :default keyword, or a vector. The specialisers vector may contain keywords, a set of keywords that provide an inclusive or match, or functions that return a truth value indication whether the implementation is a match for the *script-context* passed as the function's first argument.

Add an implementation of script for the given specialisers.
The default implementation can be set by passing :default as the
`specialisers` argument. `specialisers` should be the :default keyword, or a
vector.  The `specialisers` vector may contain keywords, a set of keywords
that provide an inclusive `or` match, or functions that return a truth value
indication whether the implementation is a match for the `*script-context*`
passed as the function's first argument.
sourceraw docstring

script-fnclj/smacro

(script-fn [& args])
(script-fn fn-name [& args])

Define an abstract script function, that can be implemented differently for different operating systems. Calls to functions defined by script-fn are dispatched based on the *script-context* vector.

Define an abstract script function, that can be implemented differently for
different operating systems. Calls to functions defined by `script-fn` are
dispatched based on the `*script-context*` vector.
sourceraw docstring

script-fn*clj

(script-fn* fn-name args)

Define an abstract script function, that can be implemented differently for different operating systems. Calls to functions defined by script-fn* are dispatched based on the *script-context* vector.

Define an abstract script function, that can be implemented differently for
different operating systems. Calls to functions defined by `script-fn*` are
dispatched based on the `*script-context*` vector.
sourceraw docstring

with-script-contextclj/smacro

(with-script-context template & body)

Specify the target for script generation. template should be a vector of os-family, os-family and os-version, or other keywords.

Specify the target for script generation. `template` should be a vector of
os-family, os-family and os-version, or other keywords.
sourceraw docstring

with-templateclj/smacrodeprecated

(with-template template & body)

Specify the target for script generation. template should be a vector of os-family, os-family and os-version, or other keywords. DEPRECATED - see with-script-context

Specify the target for script generation. `template` should be a vector of
os-family, os-family and os-version, or other keywords.
DEPRECATED - see `with-script-context`
sourceraw docstring

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

× close