Liking cljdoc? Tell your friends :D

boot.core

The Boot core namespace, containing most of Boot's public API.

Settings (read-only)

*app-version* *boot-opts* *boot-script* *boot-version* *warnings* bootignore last-file-change new-build-at

Configuration Helpers

configure-repositories! load-data-readers!

Boot Environment

get-checkouts get-env get-sys-env merge-env! post-env! pre-env! set-env! set-sys-env!

Define Tasks

cleanup deftask reset-build! reset-fileset with-pass-thru with-post-wrap with-pre-wrap

Manipulate Task Options

disable-task! replace-task! task-options!

REPL Integration

boot launch-nrepl rebuild!

Create Temp Directories

cache-dir! tmp-dir!

TmpFile API

tmp-dir tmp-file tmp-path tmp-time

Query Fileset For TmpFiles

input-files output-files tmp-get user-files

Filter Sequences Of TmpFiles

by-ext by-meta by-name by-path by-re file-filter not-by-ext not-by-meta not-by-name not-by-path not-by-re

Other Fileset Queries

fileset-namespaces input-dirs input-fileset ls output-dirs output-fileset user-dirs

Manipulate Fileset

add-asset add-cached-asset add-cached-resource add-cached-source add-meta add-resource add-source commit! cp mv mv-asset mv-resource mv-source new-fileset rm

Fileset Diffs

fileset-added fileset-changed fileset-diff fileset-removed

Misc. Helpers

empty-dir! git-files gpg-decrypt json-generate json-parse patch! sync! template touch watch-dirs yaml-generate yaml-parse

Deprecated / Internal

fileset-reduce init! temp-dir! tmpdir tmpfile tmpget tmppath tmptime


*app-version*

The running version of boot app.

*boot-opts*

Command line options for boot itself.

*boot-script*

The script's name (when run as script).

*boot-version*

The running version of boot core.

*warnings*

Count of warnings during build.

add-asset

(add-asset fileset dir & {:keys [mergers include exclude], :as opts})
Add the contents of the java.io.File dir to the fileset's assets.

  Option :include and :exclude, a #{} of regex expressions, control
  which paths are added; a path is only added if it matches an :include
  regex and does not match any :exclude regexes.

  If the operation produces duplicate entries, they will be merged using
  the rules specified by the :mergers option. A merge rule is a
  [regex fn] pair, where fn takes three parameters:

  - an InputStream for the previous entry,
  - an InputStream of the new entry,
  - and an OutputStream that will replace the entry.

  You will typically use default mergers as in:

    [[ #"data_readers.clj$"    into-merger       ]
     [ #"META-INF/services/.*" concat-merger     ]
     [ #".*"                   first-wins-merger ]]

  The merge rule regular expressions are tested in order, and the fn
  from the first match is applied.

add-cached-asset

(add-cached-asset fileset cache-key cache-fn & {:keys [mergers include exclude], :as opts})
FIXME: document

add-cached-resource

(add-cached-resource fileset cache-key cache-fn & {:keys [mergers include exclude], :as opts})
FIXME: document

add-cached-source

(add-cached-source fileset cache-key cache-fn & {:keys [mergers include exclude], :as opts})
FIXME: document

add-meta

(add-meta fileset meta-map)
Adds metadata about the files in the filesystem to their corresponding
TmpFile objects in the fileset. The meta-map is expected to be a map with
string paths as keys and maps of metadata as values. These metadata maps
will be merged into the TmpFile objects associated with the paths.

add-resource

(add-resource fileset dir & {:keys [mergers include exclude], :as opts})
Add the contents of the java.io.File dir to the fileset's resources.

  Option :include and :exclude, a #{} of regex expressions, control
  which paths are added; a path is only added if it matches an :include
  regex and does not match any :exclude regexes.

  If the operation produces duplicate entries, they will be merged using
  the rules specified by the :mergers option. A merge rule is a
  [regex fn] pair, where fn takes three parameters:

  - an InputStream for the previous entry,
  - an InputStream of the new entry,
  - and an OutputStream that will replace the entry.

  You will typically use default mergers as in:

    [[ #"data_readers.clj$"    into-merger       ]
     [ #"META-INF/services/.*" concat-merger     ]
     [ #".*"                   first-wins-merger ]]

  The merge rule regular expressions are tested in order, and the fn
  from the first match is applied.

add-source

(add-source fileset dir & {:keys [mergers include exclude], :as opts})
Add the contents of the java.io.File dir to the fileset's sources.

  Option :include and :exclude, a #{} of regex expressions, control
  which paths are added; a path is only added if it matches an :include
  regex and does not match any :exclude regexes.

  If the operation produces duplicate entries, they will be merged using
  the rules specified by the :mergers option. A merge rule is a
  [regex fn] pair, where fn takes three parameters:

  - an InputStream for the previous entry,
  - an InputStream of the new entry,
  - and an OutputStream that will replace the entry.

  You will typically use default mergers as in:

    [[ #"data_readers.clj$"    into-merger       ]
     [ #"META-INF/services/.*" concat-merger     ]
     [ #".*"                   first-wins-merger ]]

  The merge rule regular expressions are tested in order, and the fn
  from the first match is applied.

boot

(boot & argv)
The REPL equivalent to the command line 'boot'. If all arguments are
strings then they are treated as if they were given on the command line.
Otherwise they are assumed to evaluate to task middleware.

bootignore

Set of regexes source file paths must not match.

by-ext

(by-ext exts files & [negate?])
This function takes two arguments: `exts` and `files`, where `exts` is a seq
of file extension strings like `[".clj" ".cljs"]` and `files` is a seq of
file objects. Returns a seq of the files in `files` which have file extensions
listed in `exts`.

by-meta

(by-meta preds files & [negate?])
This function takes two arguments: `preds` and `files`, where `preds` is a
seq of predicates to be applied to the file metadata and `files` is a seq of
file objects obtained from the fileset with the help of `boot.core/ls` or any
other way. Returns a seq of files in `files` which match all of the
predicates in `preds`. `negate?` inverts the result.

This function will not unwrap the `File` objects from `TmpFiles`.

by-name

(by-name names files & [negate?])
This function takes two arguments: `names` and `files`, where `names` is
a seq of file name strings like `["foo.clj" "bar.xml"]` and `files` is
a seq of file objects. Returns a seq of the files in `files` which have file
names listed in `names`.

by-path

(by-path paths files & [negate?])
This function takes two arguments: `paths` and `files`, where `path` is
a seq of path strings like `["a/b/c/foo.clj" "bar.xml"]` and `files` is
a seq of file objects. Returns a seq of the files in `files` which have file
paths listed in `paths`.

by-re

(by-re res files & [negate?])
This function takes two arguments: `res` and `files`, where `res` is a seq
of regex patterns like `[#"clj$" #"cljs$"]` and `files` is a seq of
file objects. Returns a seq of the files in `files` whose paths match one of
the regex patterns in `res`.

cache-dir!

(cache-dir! key & {:keys [global]})
Returns a directory which is managed by boot but whose contents will not be
deleted after the build is complete. The :global option specifies that the
directory is shared by all projects. The default behavior returns different
directories for the same key when run in different projects.

cleanup

(cleanup & body)
Evaluate body after tasks have been run. This macro is meant to be called
from inside a task definition, and is provided as a means to shutdown or
clean up persistent resources created by the task (eg. threads, files, etc.)

commit!

(commit! fileset)
Make the underlying temp directories correspond to the immutable fileset
tree structure.

configure-repositories!

(configure-repositories!) (configure-repositories! f)
Get or set the repository configuration callback function. The function
will be applied to all repositories added to the boot env, it should return
the repository map with any additional configuration (like credentials, for
example).

cp

(cp fileset src-file dest-tmpfile)
Given a fileset and a dest-tmpfile from that fileset, overwrites the dest
tmpfile with the contents of the java.io.File src-file.

deftask

(deftask sym & forms)
Define a boot task.

disable-task!

(disable-task! & tasks)
Disables the given tasks by replacing them with the identity task.

  Example:

      (disable-task! repl jar)

empty-dir!

(empty-dir! & dirs)
For each directory in dirs, recursively deletes all files and subdirectories.
The directories in dirs themselves are not deleted.

file-filter

(file-filter mkpred)
A file filtering function factory. FIXME: more documenting here.

fileset-added

(fileset-added before after & props)
Returns a new fileset containing only files that were added.

fileset-changed

(fileset-changed before after & props)
Returns a new fileset containing only files that were changed.

fileset-diff

(fileset-diff before after & props)
Returns a new fileset containing files that were added or modified. Removed
files are not considered. The optional props arguments can be any of :time,
:hash, or both, specifying whether to consider changes to last modified time
or content md5 hash of the files (the default is both).

fileset-namespaces

(fileset-namespaces fileset)
Returns a set of symbols: the namespaces defined in this fileset.

fileset-reduce

(fileset-reduce fileset get-files & reducers)
Given a fileset, a function get-files that selects files from the fileset,
and a number of reducing functions, composes the reductions. The result of
the previous reduction and the result of get-files applied to it are passed
through to the next reducing function.

fileset-removed

(fileset-removed before after & props)
Returns a new fileset containing only files that were removed.

get-checkouts

(get-checkouts)
FIXME

get-env

(get-env & [k not-found])
Returns the value associated with the key `k` in the boot environment, or
`not-found` if the environment doesn't contain key `k` and `not-found` was
given. Calling this function with no arguments returns the environment map.

get-sys-env

(get-sys-env) (get-sys-env k) (get-sys-env k not-found)
Returns the value associated with the system property k, the environment
variable k, or not-found if neither of those are set. If not-found is the
keyword :required, an exception will be thrown when there is no value for
either the system property or environment variable k.

git-files

(git-files & {:keys [untracked]})
Returns a list of files roughly equivalent to what you'd get with the git
command line `git ls-files`. The :untracked option includes untracked files.

gpg-decrypt

(gpg-decrypt path-or-file & {:keys [as]})
Uses gpg(1) to decrypt a file and returns its contents as a string. The
:as :edn option can be passed to read the contents as an EDN form.

init!

(init!)
Initialize the boot environment. This is normally run once by boot at
startup. There should be no need to call this function directly.

input-dirs

(input-dirs fileset)
Get a list of directories containing files with input roles.

input-files

(input-files fileset)
Get a set of TmpFile objects corresponding to files with input role.

input-fileset

(input-fileset fileset)
FIXME: document

json-generate

(json-generate x & [opt-map])
Same as cheshire.core/generate-string.

json-parse

(json-parse x & [key-fn])
Same as cheshire.core/parse-string.

last-file-change

Last source file watcher update time.

launch-nrepl

(launch-nrepl & {:keys [pod], :as opts})
Launches an nREPL server in a pod. See the repl task for options.

load-data-readers!

(load-data-readers!)
Refresh *data-readers* with readers from newly acquired dependencies.

ls

(ls fileset)
Get a set of TmpFile objects for all files in the fileset.

merge-env!

(merge-env! & kvs)
Merges the new values into the current values for the given keys in the env
map. Uses a merging strategy that is appropriate for the given key (eg. uses
clojure.core/into for keys whose values are collections and simply replaces
Keys whose values aren't collections).

mv

(mv fileset from-path to-path)
Given a fileset and two paths in the fileset, from-path and to-path, moves
the tmpfile at from-path to to-path, returning a new fileset.

mv-asset

(mv-asset fileset tmpfiles)
FIXME: document

mv-resource

(mv-resource fileset tmpfiles)
FIXME: document

mv-source

(mv-source fileset tmpfiles)
FIXME: document

new-build-at

Latest build occured at time.

new-fileset

FIXME: document this

not-by-ext

(not-by-ext exts files)
This function is the same as `by-ext` but negated.

not-by-meta

(not-by-meta preds files)
Negated version of `by-meta`.

  This function will not unwrap the `File` objects from `TmpFiles`.

not-by-name

(not-by-name names files)
This function is the same as `by-name` but negated.

not-by-path

(not-by-path paths files)
This function is the same as `by-path` but negated.

not-by-re

(not-by-re res files)
This function is the same as `by-re` but negated.

output-dirs

(output-dirs fileset)
FIXME: document this

output-files

(output-files fileset)
Get a set of TmpFile objects corresponding to files with output role.

output-fileset

(output-fileset fileset)
FIXME: document

patch!

(patch! dest srcs & {:keys [ignore state link]})
Given prev-state

post-env!

Event handler called when the env atom is modified. This handler is for
performing side-effects associated with maintaining the application state in
the env atom. For example, when `:src-paths` is modified the handler adds
the new directories to the classpath.

pre-env!

This multimethod is used to modify how new values are merged into the boot
atom when `set-env!` is called. This function's result will become the new
value associated with the given `key` in the env atom.

rebuild!

(rebuild!)
Manually trigger build watch.

replace-task!

(replace-task! & replacements)
Given a number of binding form and function pairs, this macro alters the
root bindings of task vars, replacing their values with the given functions.

Example:

(replace-task!
  [r repl] (fn [& xs] (apply r :port 12345 xs))
  [j jar]  (fn [& xs] (apply j :manifest {"howdy" "world"} xs)))

reset-build!

(reset-build!)
Resets mutable build state to default values. This includes such things as
warning counters etc., state that is relevant to a single build cycle. This
function should be called before each build iteration.

reset-fileset

(reset-fileset & [fileset])
Updates the user directories in the fileset with the latest project files,
returning a new immutable fileset. When called with no args returns a new
fileset containing only the latest project files.

rm

(rm fileset files)
Removes files from the fileset tree, returning a new fileset object. This
does not affect the underlying filesystem in any way.

set-env!

(set-env! & kvs)
Update the boot environment atom `this` with the given key-value pairs given
in `kvs`. See also `post-env!` and `pre-env!`. The values in the env map must
be both printable by the Clojure printer and readable by its reader. If the
value for a key is a function, that function will be applied to the current
value of that key and the result will become the new value (similar to how
clojure.core/update-in works.

set-sys-env!

(set-sys-env! & kvs)
For each key value pair in kvs the system property corresponding to the key
is set. Keys and values must be strings, but the value can be nil or false
to remove the system property.

sync!

(sync! dest & srcs)
Given a dest directory and one or more srcs directories, overlays srcs on
dest, removing files in dest that are not in srcs. Uses file modification
timestamps to decide which version of files to emit to dest. Uses hardlinks
instead of copying file contents. File modification times are preserved.

task-options!

(task-options! & task-option-pairs)
Given a number of task/map-of-curried-arguments pairs, replaces the root
bindings of the tasks with their curried values. For example:

    (task-options!
      repl {:port     12345}
      jar  {:manifest {:howdy "world"}})

You can update options, too, by providing a function instead of an option
map. This function will be passed the current option map and its result will
be used as the new one. For example:

    (task-options!
      repl #(update-in % [:port] (fnil inc 1234))
      jar  #(assoc-in % [:manifest "ILike"] "Turtles"))

temp-dir!

(temp-dir! & args__584__auto__)
#'boot.core/temp-dir! was deprecated, please use #'boot.core/tmp-dir! instead

template

(template form)
The syntax-quote (aka quasiquote) reader macro as a normal macro. Provides
the unquote ~ and unquote-splicing ~@ metacharacters for templating forms
without performing symbol resolution.

tmp-dir

(tmp-dir tmpfile)
Returns the temporary directory containing the tmpfile.

tmp-dir!

(tmp-dir!)
Creates a boot-managed temporary directory, returning a java.io.File.

tmp-file

(tmp-file tmpfile)
Returns the java.io.File object for the tmpfile.

tmp-get

(tmp-get fileset path & [not-found])
Given a fileset and a path, returns the associated TmpFile record. If the
not-found argument is specified and the TmpFile is not in the fileset then
not-found is returned, otherwise nil.

tmp-path

(tmp-path tmpfile)
Returns the tmpfile's path relative to the fileset root.

tmp-time

(tmp-time tmpfile)
Returns the last modified timestamp for the tmpfile.

tmpdir

(tmpdir & args__584__auto__)
#'boot.core/tmpdir was deprecated, please use #'boot.core/tmp-dir instead

tmpfile

(tmpfile & args__584__auto__)
#'boot.core/tmpfile was deprecated, please use #'boot.core/tmp-file instead

tmpget

(tmpget & args__584__auto__)
#'boot.core/tmpget was deprecated, please use #'boot.core/tmp-get instead

tmppath

(tmppath & args__584__auto__)
#'boot.core/tmppath was deprecated, please use #'boot.core/tmp-path instead

tmptime

(tmptime & args__584__auto__)
#'boot.core/tmptime was deprecated, please use #'boot.core/tmp-time instead

touch

(touch f)
Same as the Unix touch(1) program.

user-dirs

(user-dirs fileset)
Get a list of directories containing files that originated in the project's
source, resource, or asset paths.

user-files

(user-files fileset)
Get a set of TmpFile objects corresponding to files that originated in
the project's source, resource, or asset paths.

watch-dirs

(watch-dirs callback dirs & {:keys [debounce]})
Watches dirs for changes and calls callback with set of changed files
when file(s) in these directories are modified. Returns a thunk which
will stop the watcher.

The watcher uses the somewhat quirky native filesystem event APIs. A
debounce option is provided (in ms, default 10) which can be used to
tune the watcher sensitivity.

with-pass-thru

(with-pass-thru bind & body)
Given a binding and body expressions, constructs a task handler. The body
expressions are evaluated for side effects with the current fileset bound
to binding. The current fileset is then passed to the next handler and the
result is then returned up the handler stack.

with-post-wrap

(with-post-wrap bind & body)
Given a binding and body expressions, constructs a task handler. The next
handler is called with the current fileset, and the result is bound to
binding. The body expressions are then evaluated for side effects and the
bound fileset is returned up the handler stack. Roughly equivalent to:

    (fn [next-handler]
      (fn [fileset]
        (let [binding (next-handler fileset)]
          (do ... ...)
          binding)))

where ... are the given body expressions.

with-pre-wrap

(with-pre-wrap bind & body)
Given a binding and body expressions, constructs a task handler. The body
expressions are evaluated with the current fileset bound to binding, and the
result is passed to the next handler in the pipeline. The fileset obtained
from the next handler is then returned up the handler stack. The body must
evaluate to a fileset object. Roughly equivalent to:

    (fn [next-handler]
      (fn [binding]
        (next-handler (do ... ...))))

where ... are the given body expressions.

yaml-generate

(yaml-generate x)
Same as clj-yaml.core/generate-string.

yaml-parse

(yaml-parse x)
Same as clj-yaml.core/parse-string.

Can you improve this documentation?Edit on GitHub

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

× close