logo
Free, unlimited AI code reviews that run on commit
git-lrc git-lrc GitHub Install Now We'd appreciate a star git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt

App::DocKnot::Spin::Versions - Parse package release information for spin

Author

       Russ Allbery <rra@cpan.org>

Class Methods

       new(PATH)
           Create a new App::DocKnot::Spin::Versions object for the .versions file specified by PATH.

Description

       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.

Instance Methods

       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.

Name

       App::DocKnot::Spin::Versions - Parse package release information for spin

Requirements

       Perl 5.24 or later and the Path::Tiny module, available from CPAN.

See Also

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/>.

perl v5.38.2                                       2024-07-14                  App::DocKnot::Spin::Versions(3pm)

Synopsis

           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');

See Also