resource-types/text

Methods

(inner) getVersion(resource, cb)

Get version value from the text resource, using the first match of the regex.
Source:
Parameters:
Name Type Description
resource Object resource configuration
Name Type Description
path String path to the text file
params.regex String regular expression which matches the version value
cb function standard cb(err, result) callback, result is the version value

(inner) isReadyForRelease(resource, cb)

Check that the text resource is ready for release, i.e. the regex is valid and it matches a non-empty version value.
Source:
Parameters:
Name Type Description
resource Object resource configuration
Name Type Description
path String path to the text file
params.regex String regular expression which matches the version value
cb function standard cb(err, result) callback, result is true when the resource is ready for release, an error is passed when the regex is not configured, is invalid, or doesn't match a non-empty version

(inner) setVersion(version, resource, opts, cb)

Set version value in the text resource, replacing all matches of the regex.
Source:
Parameters:
Name Type Description
version String version value to set
resource Object resource configuration
Name Type Description
path String path to the text file
params.regex String regular expression which matches the version value
opts Object optional settings
Name Type Attributes Description
dryRun Boolean <optional>
when true, text file won't be modified
cb function standard cb(err, result) callback