Liking cljdoc? Tell your friends :D

orzo.core


*now-provider*clj

(*now-provider*)
source

appendclj

(append version value)

Appends the value to the version in the pipe.

Appends the value to the version in the pipe.
sourceraw docstring

bump-semverclj

(bump-semver version indicator)

Bumps the specific indicator of an incoming semver. Options for indicator are :major, :minor, and :patch.

Bumps do ripple through lower order indicators (i.e. 0.1.5 with a :minor bump would lead to 0.2.0)

Bumps the specific indicator of an incoming semver. Options for
indicator are `:major`, `:minor`, and `:patch`.

Bumps do ripple through lower order indicators (i.e. `0.1.5` with a
`:minor` bump would lead to `0.2.0`)
sourceraw docstring

calverclj

(calver)
(calver current-or-format)
(calver current format)

Returns a calver (https://calver.org) based on LocalDate and following the format specified in format below:

  • YYYY - Full year - 2006, 2016, 2106
  • YY - Short year - 6, 16, 106
  • 0Y - Zero-padded year - 06, 16, 106
  • MM - Short month - 1, 2 ... 11, 12
  • 0M - Zero-padded month - 01, 02 ... 11, 12
  • WW - Short week (since start of year) - 1, 2, 33, 52
  • 0W - Zero-padded week - 01, 02, 33, 52
  • DD - Short day - 1, 2 ... 30, 31
  • 0D - Zero-padded day - 01, 02 ... 30, 31
  • CC - Cumulative counter - counter is a special case. See below.

Uses the ISO-8601 definition, where a week starts on Monday and the first week of the year has a minimum of 4 days.

The default format string is YY.MM.DD.

Calling this function without args uses the now LocalDate and the default format above.

Calling this function with one arg will trigger a check whether the arg is a format string (and then uses it as such) or whether the arg is a current calver fed to this calver calculation (see below the special counter case.)

Lastly, the two-arg signature takes the current calver followed by the format string.

The CC marker on the format is a special case. A common pattern when using calver is to bump a counter when the other temporal fields match. The idea is that if you use YY.MM.CC and have a calver 23.2.5 it means it was the 6th (0-based) version on month 2, year 2023. Calling calver with a CC marker in the format and a current version with a compatible counter will take care of this case.

Returns a calver (https://calver.org) based on `LocalDate` and
following the format specified in `format` below:

- YYYY - Full year - 2006, 2016, 2106
- YY - Short year - 6, 16, 106
- 0Y - Zero-padded year - 06, 16, 106
- MM - Short month - 1, 2 ... 11, 12
- 0M - Zero-padded month - 01, 02 ... 11, 12
- WW - Short week (since start of year) - 1, 2, 33, 52
- 0W - Zero-padded week - 01, 02, 33, 52
- DD - Short day - 1, 2 ... 30, 31
- 0D - Zero-padded day - 01, 02 ... 30, 31
- CC - Cumulative counter - counter is a special case. See below.

Uses the ISO-8601 definition, where a week starts on Monday and the
first week of the year has a minimum of 4 days.

The default format string is `YY.MM.DD`.

Calling this function without args uses the now LocalDate and the
default format above.

Calling this function with one arg will trigger a check whether the
arg is a format string (and then uses it as such) or whether the arg is
a current calver fed to this calver calculation (see below the special
counter case.)

Lastly, the two-arg signature takes the current calver followed by the
format string.

The `CC` marker on the format is a special case. A common pattern when
using calver is to bump a counter when the other temporal fields match.
The idea is that if you use `YY.MM.CC` and have a calver `23.2.5` it
means it was the 6th (0-based) version on month 2, year 2023. Calling
`calver` with a `CC` marker in the format and a current version with a
compatible counter will take care of this case.
sourceraw docstring

envclj

(env var-name)

Returns the value of the environment variable.

Returns the value of the environment variable.
sourceraw docstring

extract-base-semverclj

(extract-base-semver version)

Parses the incoming version as a pure semver (just a simple string of <major>.<minor>.<patch>).

Parses the incoming version as a pure semver (just a simple string
of `<major>.<minor>.<patch>`).
sourceraw docstring

instantclj

(instant)

Returns a timestamp as a string.

Returns a timestamp as a string.
sourceraw docstring

overwrite-fileclj

(overwrite-file version path regex-or-builder)
(overwrite-file version path regex-or-builder treat-fn)

Utilized in cases where there are files that need to be changed with the new version (i.e. README.md, package.json, etc).

The key parameters are the file path and the regex to be used to find the placement of the version (the implementation uses clojure.string/replace).

A common regex for a traditional semver-like version would look like #"\d+.\d+.\d+". In some cases, you might need to include other markers such as double quotes around the version (with a regex like #""\d+.\d+.\d+"" for instance.)

For more complex scenarios, you can provide a builder function to the regex argument. It is called with the version and expects a regex in return.

The last optional parameter is a function that is called with the intended version and is expected to return the string to be inserted in the match. This tackles the cases where more characters are needed in the match (for instance, the surrounding double quotes described above.)

Utilized in cases where there are files that need to be changed with
the new version (i.e. README.md, package.json, etc).

The key parameters are the file path and the regex to be used to
find the placement of the version (the implementation uses
clojure.string/replace).

A common regex for a traditional semver-like version would look like
`#"\d+.\d+.\d+"`. In some cases, you might need to include other
markers such as double quotes around the version (with a regex like
`#""\d+.\d+.\d+""` for instance.)

For more complex scenarios, you can provide a builder function to
the regex argument. It is called with the version and expects a
regex in return.

The last optional parameter is a function that is called with the
intended version and is expected to return the string to be inserted
in the match. This tackles the cases where more characters are
needed in the match (for instance, the surrounding double quotes
described above.)
sourceraw docstring

prependclj

(prepend version value)

Prepends the value to the version in the pipe.

Prepends the value to the version in the pipe.
sourceraw docstring

read-fileclj

(read-file path)
(read-file path regex)

Reads a version (or any other information) from a file. If a path is provided, the first line of the file should contain the information you are want to read.

If a path and a regex is provided, the whole file is read and the first group match of the regex is returned. If no match is found, an exception is thrown.

Reads a version (or any other information) from a file. If a path is
provided, the first line of the file should contain the information
you are want to read.

If a path and a regex is provided, the whole file is read and the
first group match of the regex is returned. If no match is found, an
exception is thrown.
sourceraw docstring

save-fileclj

(save-file version path)
(save-file version path template-path)
(save-file version path template-path var-name)

Saves the incoming version from the pipeline to the file specified by the path.

A template file can be specified as the third parameter. In such case, the string ${VERSION} will be replaced with the incoming version.

It is also possible to specify a placeholder name in case your template has a different format (i.e. you could specify "SEMVER" to have all the ${SEMVER} replaced.

Saves the incoming version from the pipeline to the file specified by
the path.

A template file can be specified as the third parameter. In such
case, the string `${VERSION}` will be replaced with the incoming
version.

It is also possible to specify a placeholder name in case your
template has a different format (i.e. you could specify "SEMVER"
to have all the `${SEMVER}` replaced.
sourceraw docstring

set-semverclj

(set-semver version {:keys [major minor patch ripple?] :as opts})

Allows direct manipulation of an incoming semver version.

The second parameter is a map with the keys:

  • major: major number to set the semver
  • minor: minor number to set the semver
  • patch: patch number to set the semver
  • ripple?: (default false) if true, then any change on higher order indicator ripple through the lower order ones (i.e. change a major up would set minor and patch to 0 each)

If a certain key is not passed, then that indicator is untouched.

If the incoming version is not parsed as a semver, extract-base-semver will be called on it.

Allows direct manipulation of an incoming semver version.

The second parameter is a map with the keys:

* `major`: major number to set the semver
* `minor`: minor number to set the semver
* `patch`: patch number to set the semver
* `ripple?`: (default false) if true, then any change on higher order
indicator ripple through the lower order ones (i.e. change a `major`
up would set `minor` and `patch` to `0` each)

If a certain key is not passed, then that indicator is untouched.

If the incoming version is not parsed as a semver,
`extract-base-semver` will be called on it.
sourceraw docstring

stageclj

(stage version)

Stages the incoming version so that it can be used later.

Stages the incoming version so that it can be used later.
sourceraw docstring

unstageclj

(unstage)

Unstages a version that had been previously stage by the stage function.

Unstages a version that had been previously stage by the `stage` function.
sourceraw docstring

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

× close