Alien-Build-Git
view release on metacpan or search on metacpan
This module is documentation only for how to use git as a download
source from alienfile + Alien::Build. Depending on the project source
that you are using and the way your alienfile is structured, you will
want to use one of three modules that come with the distribution
Alien-Build-Git. See the synopsis above and the modules in the SEE ALSO
section below. To decide which you need.
Also please carefully consider NOT using one of these modules. If you
can, using http or ftp to download your target project will probably
require fewer and less error-prone dependencies.
SEE ALSO
Alien::git
Alien::Build::Plugin::Download::Git
Alien::Build::Plugin::Fetch::Git
AUTHOR
lib/Alien/Build/Git.pm view on Meta::CPAN
This module is documentation only for how to use C<git> as a download source
from L<alienfile> + L<Alien::Build>. Depending on the project source that you
are using and the way your L<alienfile> is structured, you will want to use
one of three modules that come with the distribution C<Alien-Build-Git>.
See the synopsis above and the modules in the SEE ALSO section below. To decide
which you need.
Also please carefully consider NOT using one of these modules. If you can,
using http or ftp to download your target project will probably require fewer
and less error-prone dependencies.
=head1 SEE ALSO
=over 4
=item L<Alien::git>
=item L<Alien::Build::Plugin::Download::Git>
=item L<Alien::Build::Plugin::Fetch::Git>
lib/Alien/Build/Plugin/Fetch/Git.pm view on Meta::CPAN
return {
type => 'file',
filename => $dir->basename,
path => $dir->stringify,
protocol => $url->scheme,
};
}
else
{
$build->log("fetching tags from $url");
my($output, $error) = capture_merged {
$build->system('%{git}', 'ls-remote', '--tags', "$url");
$?;
};
if($error)
{
print $output;
die "command failed";
}
my @tags = sort
grep { defined $_ }
map { m{refs/tags/(.*)$} ? $1 : undef }
split /\n\r?/, $output;
done_testing;
sub require_ok ($)
{
# special case of when I really do want require_ok.
# I just want a test that checks that the modules
# will compile okay. I won't be trying to use them.
my($mod) = @_;
my $ctx = context();
eval qq{ require $mod };
my $error = $@;
my $ok = !$error;
$ctx->ok($ok, "require $mod");
$ctx->diag("error: $error") if $error ne '';
$ctx->release;
}
t/alien_build_plugin_download_git.t view on Meta::CPAN
$build->load_requires('share');
my $example1 = example1();
note "example1 = $example1";
$build->meta_prop->{start_url} = "$example1";
subtest 'latest' => sub {
my $error;
my $ret;
my $out;
note $out = scalar capture_merged {
$ret = eval {
$build->download;
};
$error = $@;
};
is $error, '';
diag $out if $error;
note $out = scalar capture_merged {
$ret = eval {
$build->extract;
};
$error = $@;
};
is $error, '';
diag $out if $error;
my $dir = $ret;
ok -d $dir;
is( path($dir)->child('content.txt')->slurp, "This is version 0.03\n");
};
done_testing
t/alien_build_plugin_fetch_git.t view on Meta::CPAN
};
$build->load_requires('share');
my $example1 = example1();
note "example1 = $example1";
subtest 'fetch with tag' => sub {
my $ret;
my $error;
my $out;
note $out = capture_merged {
$ret = eval { $build->fetch("$example1#0.02") };
$error = $@;
};
is $error, '';
diag $out if $error;
is(
$ret,
hash {
field filename => 'example1';
field path => match(qr/example1/);
field type => 'file';
field protocol => 'file';
end;
},
t/alien_build_plugin_fetch_git.t view on Meta::CPAN
is(
path($ret->{path})->child('content.txt')->slurp,
"This is version 0.02\n",
);
};
subtest 'fetch without tag' => sub {
my $ret;
my $error;
my $out;
note $out = capture_merged {
$ret = eval { $build->fetch("$example1") };
$error = $@;
};
is $error, '';
diag $out if $error;
is(
$ret,
hash {
field type => 'list';
field list => array {
item hash {
field filename => '0.01';
field url => url {
url_component scheme => 'file';
t/alien_git.t view on Meta::CPAN
use alienfile;
probe sub { 'share' };
share {
requires 'Alien::git';
download [ [ '%{git}', 'clone', '$example1' ] ];
};
};
my $error;
note scalar capture_merged {
eval {
$build->load_requires($build->install_type);
$build->download;
};
$error = $@;
};
is $error, '', 'do not throw error';
is(
path($build->install_prop->{download})->child('content.txt')->slurp,
"This is version 0.03\n",
);
done_testing
( run in 0.303 second using v1.01-cache-2.11-cpan-65fba6d93b7 )