Alien-Build-Plugin-Download-GitLab
view release on metacpan or search on metacpan
lib/Alien/Build/Plugin/Download/GitLab.pm view on Meta::CPAN
package Alien::Build::Plugin::Download::GitLab;
use strict;
use warnings;
use 5.008004;
use Carp qw( croak );
use URI;
use JSON::PP qw( decode_json );
use URI::Escape qw( uri_escape );
use Alien::Build::Plugin;
use File::Basename qw( basename );
use Path::Tiny qw( path );
# ABSTRACT: Alien::Build plugin to download from GitLab
our $VERSION = '0.01'; # VERSION
has gitlab_host => 'https://gitlab.com';
has gitlab_user => undef;
lib/Alien/Build/Plugin/Download/GitLab.pm view on Meta::CPAN
{
my($self, $meta) = @_;
croak("No gitlab_user provided") unless defined $self->gitlab_user;
croak("No gitlab_project provided") unless defined $self->gitlab_project;
croak("Don't set set a start_url with the Download::GitLab plugin") if defined $meta->prop->{start_url};
$meta->add_requires('configure' => 'Alien::Build::Plugin::Download::GitLab' => 0 );
my $url = URI->new($self->gitlab_host);
$url->path("/api/v4/projects/@{[ uri_escape(join '/', $self->gitlab_user, $self->gitlab_project) ]}/releases");
$meta->prop->{start_url} ||= "$url";
$meta->apply_plugin('Download');
$meta->apply_plugin('Extract', format => $self->format );
# we assume that GitLab returns the releases in reverse
# chronological order.
$meta->register_hook(
prefer => sub {
my($build, $res) = @_;
( run in 0.341 second using v1.01-cache-2.11-cpan-c21f80fb71c )