Alien-Build-Git
view release on metacpan or search on metacpan
lib/Alien/Build/Plugin/Fetch/Git.pm view on Meta::CPAN
if($^O eq 'MSWin32')
{
$tmp->host('');
}
else
{
$tmp->host('localhost');
}
if($url =~ s/#(.*)$//)
{
$tmp->fragment($1);
}
$tmp->path($url);
$url = $tmp;
}
my $exe = Alien::git->exe;
if(defined $url->fragment)
{
local $CWD = tempdir( CLEANUP => 1 );
my($tag) = $url->fragment;
$url->fragment(undef);
if(can_branch_clone())
{
$build->system('%{git}', 'clone', '--depth' => 1, '--branch', "$tag", "$url");
}
else
{
$build->system('%{git}', 'clone', "$url");
}
die "command failed" if $?;
my($dir) = path(".")->absolute->children;
lib/Alien/Build/Plugin/Fetch/Git.pm view on Meta::CPAN
grep { defined $_ }
map { m{refs/tags/(.*)$} ? $1 : undef }
split /\n\r?/, $output;
return {
type => 'list',
list => [
map {
my $tag = $_;
my $url = $url->clone;
$url->fragment($tag);
my %h = (
filename => $tag,
url => "$url",
);
\%h;
} @tags
],
protocol => $url->scheme,
};
}
lib/Alien/Build/Plugin/Fetch/Git.pm view on Meta::CPAN
=head1 SYNOPSIS
use alienfile;
meta->prop->{start_url} = 'git://example.git/foo.git#v0.01';
plugin 'Fetch::Git';
=head1 DESCRIPTION
This plugin provides a fetch capability for C<git> in L<Alien::Build>.
You can specify a tag or branch with the fragment part of the URL.
Most of the time you won't be using this plugin directly, but will
instead be using L<Alien::git> or L<Alien::Build::Plugin::Download::Git>.
=head1 SEE ALSO
=over 4
=item L<Alien::Build>
=item L<Alien::Build::Git>
t/alien_build_plugin_fetch_git.t view on Meta::CPAN
hash {
field type => 'list';
field list => array {
item hash {
field filename => '0.01';
field url => url {
url_component scheme => 'file';
url_component host => 'localhost' if $^O ne 'MSWin32';
url_component host => '' if $^O eq 'MSWin32';
url_component path => $example1;
url_component fragment => '0.01';
};
};
item hash {
field filename => '0.02';
field url => url {
url_component scheme => 'file';
url_component host => 'localhost' if $^O ne 'MSWin32';
url_component host => '' if $^O eq 'MSWin32';
url_component path => $example1;
url_component fragment => '0.02';
};
};
item hash {
field filename => '0.03';
field url => url {
url_component scheme => 'file';
url_component host => 'localhost' if $^O ne 'MSWin32';
url_component host => '' if $^O eq 'MSWin32';
url_component path => $example1;
url_component fragment => '0.03';
};
};
end;
};
field protocol => 'file';
end;
},
) || do {
require Data::Dumper;
diag Data::Dumper::Dumper($ret);
( run in 1.403 second using v1.01-cache-2.11-cpan-b16cb0d3907 )