App::DocKnot::Spin::Versions - Parse package release information for spin
use App::DocKnot::Spin::Versions;
my $versions = App::DocKnot::Spin::Versions('/path/to/.versions');
my $version = $versions->version('some-package');
my $release_date = $versions->release_date('some-package');
my $timestamp = $versions->latest_release('some/file/index.th');
Perl 5.24 or later and the Path::Tiny module, available from CPAN.
App::DocKnot::Spin supports a database of release information for packages that
may be referenced in the generated web site. This is stored as the file named
.versions at the top of the source tree. This module parses that file
and provides an API to the information it contains.
The file should consist of lines (except for continuation lines, see below) in
the form:
<package> <version> <date> <time> <files>
starting in the first column. Each field is separated by one or more spaces
except the last, <files>, which is all remaining space-separated words
of the line. Blank lines and lines starting with "#" in the first
column are ignored.
The fields are:
- <package>
- The name of a package.
- <version>
- The version number of the latest release of that
package.
- <date>
- The date of the latest release of that package in
YYYY-MM-DD format in the local time zone.
- <time>
- The time of the latest release of that package in HH:MM:SS
format in the local time zone.
- <files>
- Any number of thread input files affected by this release,
separated by spaces. The file names should be relative to the top of the
source tree for the web site.
The <files> field can be continued on the following line by starting the
line with whitespace. Each whitespace-separated word in a continuation line is
taken as an additional affected file for the previous line.
This information is used for the "\version" and "\release"
thread commands and to force regeneration of files affected by a release with
a timestamp newer than the timestamp of the corresponding output file.
- new(PATH)
- Create a new App::DocKnot::Spin::Versions object for the
.versions file specified by PATH.
- latest_release(PATH)
- Return the timestamp (in seconds since epoch) for the
latest release affecting PATH, or 0 if no releases affect that file.
- release_date(PACKAGE)
- Return the release date of the latest release of PACKAGE
(in UTC), or "undef" if there is no release information for
PACKAGE.
- update_version(PACKAGE, VERSION, TIMESTAMP)
- Given a new VERSION and TIMESTAMP (in seconds since epoch)
for a release of PACKAGE, update the release information in the
.versions file for that package accordingly. If the
.versions file is at the root of a Git repository, this change will
be staged with "git add".
- version(PACKAGE)
- Return the version of the latest release of PACKAGE, or
"undef" if there is no release information for PACKAGE.
Russ Allbery <
[email protected]>
Copyright 2004, 2021-2022 Russ Allbery <
[email protected]>
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
sell copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO
EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES
OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
docknot(1), App::DocKnot::Spin
This module is part of the App-DocKnot distribution. The current version of
DocKnot is available from CPAN, or directly from its web site at
<
https://www.eyrie.org/~eagle/software/docknot/>.