A library for defining environments by setting ^:dynamic identities using file defined envs. There are a few ways to use this:
First, via the with-env
macro, like so:
(with-env (do-something))
Second, by loading an env to apply globally:
(do
(load-env! env)
(do-something))
The former is useful for narrow scopes, the latter to ensure that all threads use the same bindings until changed.
A library for defining environments by setting ^:dynamic identities using file defined envs. There are a few ways to use this: First, via the `with-env` macro, like so: (with-env (do-something)) Second, by loading an env to apply globally: (do (load-env! env) (do-something)) The former is useful for narrow scopes, the latter to ensure that all threads use the same bindings until changed.
(backup-vars vars)
Implementation detail.
Backs up multiple vars current values, returns a map of var=>value.
Implementation detail. Backs up multiple vars current values, returns a map of var=>value.
(bindings-map env)
Converts the env file format into a map that can be passed to with-bindings. Throws an Exception if there is an invalid config.
Converts the env file format into a map that can be passed to with-bindings. Throws an Exception if there is an invalid config.
(invalid-override-exception var)
(invalid-override-exception ns name)
Implementation detail.
Creates an IllegalArgumentException with details of the bad override
Implementation detail. Creates an IllegalArgumentException with details of the bad override
(load! src)
Attempts to load a config. src
can be anything slurp
can handle, such as
a string representing a file or resource path, a java.net URI/URL, or
java.io.File.
Loads env
, backing up any vars to be rebound and then binding vars globally
to their new values.
Returns a delay that, when forced, restores all vars to their original values.
Attempts to load a config. `src` can be anything `slurp` can handle, such as a string representing a file or resource path, a java.net URI/URL, or java.io.File. Loads `env`, backing up any vars to be rebound and then binding vars globally to their new values. Returns a delay that, when forced, restores all vars to their original values.
Implementation detail. Holds the env bindings as a map of
namespace qualified vars to values. This tracks the calls to
set-var!
which can be useful to inspect what has been
modified.
Implementation detail. Holds the env bindings as a map of namespace qualified vars to values. This tracks the calls to `set-var!` which can be useful to inspect what has been modified.
(resolve-bindings {:keys [ns bindings]})
Resolves the fully-qualified bindings. Transforms this:
{:ns some.namespace
:bindings {:some-var 1
:a-value :foo}}
Into a with-bindings
compatible bindings map, like so:
{#'some.namespace/some-var 1
#'some.namespace/a-value :foo}
Resolves the fully-qualified bindings. Transforms this: {:ns some.namespace :bindings {:some-var 1 :a-value :foo}} Into a `with-bindings` compatible bindings map, like so: {#'some.namespace/some-var 1 #'some.namespace/a-value :foo}
(set-var! [var value])
(set-var! var value)
Implementation detail.
Sets a single dynamic var to the specified value, regardless of its present value.
Note: this implementation could result in inconsistencies if it is called concurrently to modify the same var.
Implementation detail. Sets a single dynamic var to the specified value, regardless of its present value. Note: this implementation could result in inconsistencies if it is called concurrently to modify the same var.
(set-vars! var-map)
Implementation detail.
Sets multiple dynamic vars specified in the input map. The input map must be a map of var => value.
Implementation detail. Sets multiple dynamic vars specified in the input map. The input map must be a map of var => value.
(to-string-keys map)
Exaclty as named. This is a hack to fix Var printing in clojure.pprint until CLJ-1565 is resolved.
Exaclty as named. This is a hack to fix Var printing in clojure.pprint until [CLJ-1565](http://dev.clojure.org/jira/browse/CLJ-1565) is resolved.
(validate env)
Returns true if the specified env is valid, otherwise a list of errors
Returns true if the specified env is valid, otherwise a list of errors
(with-env env & body)
Evaluates body with env bindings.
Evaluates body with env bindings.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close