1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
|
package Devscripts::Uscan::Templates::Github;
use strict;
sub transform {
my $watchSource = shift;
delete $watchSource->{template};
my $owner = delete $watchSource->{owner};
my $project = delete $watchSource->{project};
die 'Missing owner' unless $owner;
die 'Missing project' unless $project;
$watchSource->{source}
||= "https://api.github.com/repos/$owner/$project/git/matching-refs/"
. ($watchSource->{releaseonly} ? 'release/' : 'tags/');
$watchSource->{matchingpattern}
||= 'https://api.github.com/repos/[^/]+/[^/]+/git/refs/tags/(?:[^/]+\-)?'
. $watchSource->{versiontype}
. '(?:(?=")|$)';
$watchSource->{downloadurlmangle}
||= 's%(api.github.com/repos/[^/]+/[^/]+)/git/refs/%$1/tarball/refs/%g';
$watchSource->{filenamemangle} ||= (
$watchSource->{component}
? 's%.*/(?:[^/]+\-)?@ANY_VERSION@%@PACKAGE@-@COMPONENT@-$1.tar.gz%'
: 's%.*/(?:[^/]+\-)?@ANY_VERSION@%@PACKAGE@-$1.tar.gz%'
);
$watchSource->{searchmode} ||= 'plain';
$watchSource->{pgpmode} ||= 'none';
return $watchSource;
}
1;
|