NAME
Pandoc::Release - get pandoc releases from GitHub
SYNOPSIS
From command line:
# print latest release name
perl -MPandoc::Release -E 'say latest->{name}'
# download latest release unless already in ~/.pandoc/bin
perl -MPandoc::Release -E 'latest->download'
In Perl code:
use Pandoc::Release;
my $release = get('2.1.3'); # get a specific release
my $latest = latest; # get a latest release
# get multiple releases
my @releases = list( since => '2.0', verbose => 1 );
foreach my $release (@releases) {
# print version number
say $release->{tag_name};
# download Debian package and executable
$release->download( dir => './deb', bin => './bin' );
}
# download executable and use as temporary Pandoc object:
my $pandoc = get('2.1.3)->download( bin => './bin' );
DESCRIPTION
This utility module fetches information about pandoc releases via GitHub API. It requires at least Perl 5.14 or HTTP::Tiny and JSON::PP installed.
FUNCTIONS
All functions are exported by default.
get( $version [, verbose => 0|1 ] )
Get a specific release by its version or die if the given version does not exist. Returns data as returned by GitHub releases API: https://developer.github.com/v3/repos/releases/#get-a-release-by-tag-name.
list( ... )
Get a list of all pandoc releases, optionally since some version or within a version range such as !=1.16, <=1.17 or ==2.1.2. See "Version Ranges" in CPAN::Meta::Spec for possible values. Option verbose will print URLs before each request. Option limit limits the maximum number of releases to be returned.
latest( ... )
Get the latest release, optionally since some version or within a version range. Equivalent to method list with option limit => 1.
METHODS
download( [ dir => $dir ] [ arch => $arch ] [ bin => $bin ] [ verbose => 0|1] )
Download the Debian release file for some architecture (e.g. amd64) to directory dir, unless already there. By default architecture is determined via calling dpkg and download directory is a newly created temporary directory. Pandoc executables is then extracted to directory bin named by pandoc version number (e.g. pandoc-2.1.2). The default bin directory is ~/.pandoc/bin on Unix (see Pandoc function pandoc_data_dir):
$release->download( bin => pandoc_data_dir('bin') );
$release->download; # equivalent
Extraction of executables can be disabled by setting bin to a false value. Returns a Pandoc instance if bin is not false or Pandoc::Version otherwise.