App-Prove-Dist
view release on metacpan or search on metacpan
lib/App/Prove/Dist.pm view on Meta::CPAN
$perls->[$i] = $perl;
}
return @$perls;
}
sub setup {
my ($self) = @_;
my $args = $self->_args;
if (my $count = @$args) {
if ($count == 1) {
$self->_src($args->[0]);
}
else {
$self->usage();
exit 1;
}
}
my $src = $self->_src;
chdir $self->_src or die "Can't chdir to $src";
if (-e 'dist.ini') {
die "Distzilla not yet supported";
}
if (not -e "Makefile.PL") {
die "'$src' does not have a 'Makefile.PL";
}
$self->_dist_type('eumm');
if (-e 'Makefile') {
$self->run_cli_cmd("make purge");
}
$self->run_cli_cmd("perl Makefile.PL");
$self->run_cli_cmd("make manifest");
$self->run_cli_cmd("make dist");
my ($dist) = glob("*.tar.gz");
die "'make dist' seems to have failed"
unless $dist;
$self->run_cli_cmd("tar xzf $dist");
$dist =~ s/\.tar\.gz$// or die;
$self->_dist_dir($dist);
$self->_meta(YAML::XS::LoadFile("$dist/META.yml"));
}
sub cleanup {
my ($self) = @_;
$self->run_cli_cmd("make purge");
}
sub run_cli_cmd {
my ($self, $command) = @_;
print "-> $command\n" if $self->debug;
my $rc;
my $out = Capture::Tiny::capture_merged {
$rc = system($command);
};
die "FAIL '$command':\n$out\n" unless $rc == 0;
return $out;
}
# Hack to suppress extra options I don't care about.
around usage=>sub{$a=$_[1]->{usage}{options};@$a=grep{$_->{name}ne'help'}@$a;$_[0]->($_[1])};
sub validate_args {
my ($self, $opts, $args) = @_;
$self->_opts($opts);
$self->_args($args);
}
1;
=head1 SYNOPSIS
prove-dist # make dist; unzip dist;
# test against core-only + custom-locallib
prove-dist test --perl=5.14.1 # use a specific perl
prove-dist test --perl=5.10.1 --perl=5.12.0 --perl=5.14.2
prove-dist list # list your defined dependencies
prove-dist scan # scan for your required dependencies
prove-dist make --perl=... # make a custom locallib for your dist
# and your perl. prove-dist will look
# for this lib when you test your dist
prove-dist wipe --perl=... # delete the custom locallib
prove-dist perls # list perls to test against
=head1 STATUS
THIS IS A ROUGH DRAFT AND PROOF OF CONCEPT RELEASE! DON'T USE IT YET!
Currently:
* Only likes Unix
* Only likes perlbrew
* Many hardcoded assumptions
* Scan not implemented
* Not fully configurable
* Will probably push your grandmother down the stairs
Suggestions and patches welcome!
=head1 DESCRIPTION
When releasing a Perl module distribution, it is good to test it on a clean
perl installation and on muliple versions of installed perl. Many modules have
dependency modules, so a truly clean Perl won't work. You can use locallib to
work around that. You'll need to set up a locallib for each version of perl,
for each module you release.
App::Prove::Dist does all this for you:
cd your-dist-dir
prove-dist perls # Get a list of perls to use
prove-dist make --perl=5.14.2 # Create a custom locallib for a perl
prove-dist perls # List now shows locallib
prove-dist test --perl=5.14.2 # Prove against clean perl + new locallib
C<prove-dist> will use C<lib-core-only> and your custom locallib to prove your
C<t/> tests, so you can be more certain it will pass cpantesters.
( run in 2.883 seconds using v1.01-cache-2.11-cpan-140bd7fdf52 )