NAME
Pandoc::Release - get pandoc releases from GitHub
SYNOPSIS
use Pandoc::Release;
# get a specific release
my $release = Pandoc::Release->get('2.1.3');
# get multiple releases
my @releases = Pandoc::Release->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 = Pandoc::Release->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.
METHODS
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( [ since => $version ] [ range => $range ] [ verbose => 0|1 ] )
Get a list of all pandoc releases at GitHub, optionally since some version and 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.
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. Optionally extract pandoc executables to directory bin
, each named by pandoc version number (e.g. pandoc-2.1.2
).
You can download pandoc executables into subdirectory bin
of Pandoc user data directory and add this directory to your $PATH
:
$release->download( bin => $ENV{HOME}.'/.pandoc/bin' )
Returns a Pandoc instance if bin
is given or Pandoc::Version otherwise.