Table of contents
June 8, 2023 ยท View on GitHub
borkdude.deps- Port of https://github.com/clojure/brew-install/blob/1.11.1/src/main/resources/clojure/install/clojure in Clojure.*aux-process-fn*- Invokesjavawith arguments to calculate classpath, etc.*clojure-process-fn*- Invokesjavawith arguments toclojure.mainto start Clojure.*clojure-tools-download-fn*- Can be dynamically rebound to customise the download of the Clojure tools.*dir*- Directory in which deps.clj should be executed.*exit-fn*- Function that is called on exit with:exitcode and:message, an exceptional message when exit is non-zero.*getenv-fn*- Get ENV'ironment variable, typically used for gettingCLJ_CONFIG, etc.-main- Seehelp-text.clojure-tools-download-direct!- Downloads from:urlto:destfile returning true on success.clojure-tools-download-java!- Downloads:urlzip file to:destby invokingjavawith:proxyoptions on a.javaprogram file, and returns true on success.clojure-tools-install!- Installs clojure tools archive by downloading it in:out-dir, if not already there, and extracting in-place.deps-clj-version- The current version of deps.clj.get-basis-file- Returns path to basis file.get-cache-dir- Returns cache dir (.cpcache) from either local dir, ifdeps-ednexists, or the user cache dir.get-checksum- Returns checksum based on cli-opts (as returned byparse-cli-opts) and config-paths (as returned byget-config-paths).get-config-dir- Retrieves configuration directory.get-config-paths- Returns vec of configuration paths, i.e.get-help- Returns help text as string.get-install-dir- Retrieves the install directory where tools jar is located (after download).get-local-deps-edn- Returns the path of thedeps.ednfile (as string) in the current directory or as set by-Sdeps-file.get-proxy-info- Returns a map with proxy information parsed from env vars.parse-cli-opts- Parses the command line options.print-help- Print help text.proxy-jvm-opts- Returns a vector containing the JVM system property arguments to be passed to a new process to set its proxy system properties.set-proxy-system-props!- Sets the proxy system properties in the current JVM.
borkdude.deps
Port of https://github.com/clojure/brew-install/blob/1.11.1/src/main/resources/clojure/install/clojure in Clojure
*aux-process-fn*
(*aux-process-fn* {:keys [cmd out]})
Invokes java with arguments to calculate classpath, etc. May be
replaced by rebinding this dynamic var.
Called with a map of:
:cmd: a vector of strings:out: if set to:string,:outkey in result must contains stdout
Returns a map of:
:exit, the exit code of the process:out, the string of stdout, if the input:outwas set to:string
*clojure-process-fn*
(*clojure-process-fn* {:keys [cmd]})
Invokes java with arguments to clojure.main to start Clojure. May
be replaced by rebinding this dynamic var.
Called with a map of:
:cmd: a vector of strings
Must return a map of :exit, the exit code of the process.
*clojure-tools-download-fn*
Can be dynamically rebound to customise the download of the Clojure tools. Should be bound to a function accepting a map with:
:url: The URL to download, as a string:dest: The path to the file to download it to, as a string:proxy-opts: a map as returned byget-proxy-info:clj-jvm-opts: a vector of JVM opts (as passed on the command line).
Should return true if the download was successful, or false if not.
*dir*
Directory in which deps.clj should be executed.
*exit-fn*
(*exit-fn* {:keys [exit message]})
Function that is called on exit with :exit code and :message, an exceptional message when exit is non-zero
*getenv-fn*
(*getenv-fn* env)
Get ENV'ironment variable, typically used for getting CLJ_CONFIG, etc.
-main
(-main & command-line-args)
See help-text.
In addition
-
the values of the
CLJ_JVM_OPTSandJAVA_OPTIONSenvironment variables are passed to the java subprocess as command line options when downloading dependencies and running any other commands respectively. -
if the clojure tools jar cannot be located and the clojure tools archive is not found, an attempt is made to download the archive from the official site and extract its contents locally. The archive is downloaded from this process directly, unless the
CLJ_JVM_OPTSenv variable is set and a succesful attempt is made to download the archive by invoking a java subprocess passing the env variable value as command line options.
clojure-tools-download-direct!
(clojure-tools-download-direct! {:keys [url dest]})
Downloads from :url to :dest file returning true on success.
clojure-tools-download-java!
(clojure-tools-download-java! {:keys [url dest proxy-opts clj-jvm-opts]})
Downloads :url zip file to :dest by invoking java with
:proxy options on a .java program file, and returns true on
success. Requires Java 11+ (JEP 330).
clojure-tools-install!
(clojure-tools-install! {:keys [out-dir debug proxy-opts clj-jvm-opts]})
Installs clojure tools archive by downloading it in :out-dir, if not already there,
and extracting in-place.
If *clojure-tools-download-fn* is set, it will be called for
download the tools archive. This function should return a truthy
value to indicate a successful download.
The download is attempted directly from this process, unless
:clj-jvm-opts is set, in which case a java subprocess
is created to download the archive passing in its value as command
line options.
It calls *exit-fn* if it cannot download the archive, with
instructions how to manually download it.
deps-clj-version
The current version of deps.clj
get-basis-file
(get-basis-file {:keys [cache-dir checksum]})
Returns path to basis file. Required options:
-
cache-diras returned byget-cache-dir
-
checksumas returned byget-check-sum
get-cache-dir
(get-cache-dir {:keys [deps-edn config-dir]})
Returns cache dir (.cpcache) from either local dir, if deps-edn
exists, or the user cache dir.
get-checksum
(get-checksum {:keys [cli-opts config-paths]})
Returns checksum based on cli-opts (as returned by parse-cli-opts)
and config-paths (as returned by get-config-paths)
get-config-dir
(get-config-dir)
Retrieves configuration directory.
First tries CLJ_CONFIG env var, then $XDG_CONFIG_HOME/clojure, then ~/.clojure.
get-config-paths
(get-config-paths {:keys [cli-opts deps-edn config-dir install-dir]})
Returns vec of configuration paths, i.e. deps.edn from:
:install-diras obtained thrhoughget-install-dir:config-diras obtained throughget-config-dir:deps-ednas obtained throughget-local-deps-edn
get-help
(get-help)
Returns help text as string.
get-install-dir
(get-install-dir)
Retrieves the install directory where tools jar is located (after download).
Defaults to ~/.deps.clj/
get-local-deps-edn
(get-local-deps-edn {:keys [cli-opts]})
Returns the path of the deps.edn file (as string) in the current directory or as set by -Sdeps-file.
Required options:
:cli-opts: command line options as parsed byparse-opts
get-proxy-info
(get-proxy-info)
Returns a map with proxy information parsed from env vars. The map will contain :http-proxy and :https-proxy entries if the relevant env vars are set and parsed correctly. The value for each is a map with :host and :port entries.
parse-cli-opts
(parse-cli-opts args)
Parses the command line options.
print-help
(print-help)
Print help text
proxy-jvm-opts
(proxy-jvm-opts {:keys [http-proxy https-proxy]})
Returns a vector containing the JVM system property arguments to be passed to a new process
to set its proxy system properties.
proxy-info parameter is as returned from get-proxy-info.
set-proxy-system-props!
(set-proxy-system-props! {:keys [http-proxy https-proxy]})
Sets the proxy system properties in the current JVM.
proxy-info parameter is as returned from get-proxy-info.