Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

output interesting cpanm flags (closes #495) #496

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 26 additions & 2 deletions lib/App/cpanminus/script.pm
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ sub new {
uninstall_shadows => ($] < 5.012),
skip_installed => 1,
skip_satisfied => 0,
skip_report => 0,
auto_cleanup => 7, # days
pod2man => 1,
installed_dists => 0,
Expand Down Expand Up @@ -176,6 +177,7 @@ sub parse_options {
'installdeps' => \$self->{installdeps},
'skip-installed!' => \$self->{skip_installed},
'skip-satisfied!' => \$self->{skip_satisfied},
'skip-report!' => \$self->{skip_report},
'reinstall' => sub { $self->{skip_installed} = 0 },
'interactive!' => \$self->{interactive},
'i|install' => sub { $self->{cmd} = 'install' },
Expand Down Expand Up @@ -378,7 +380,16 @@ sub setup_home {
{ open my $out, ">$self->{log}" or die "$self->{log}: $!" }

$self->chat("cpanm (App::cpanminus) $VERSION on perl $] built for $Config{archname}\n" .
"Work directory is $self->{base}\n");
"Work directory is $self->{base}\n" .
"Running with: " . join(' ',
grep { exists $self->{$_} && $self->{$_} }
qw(force notest test_only sudo verbose quiet self_contained
exclude_vendor prompt dev reinstall pure_perl
with_develop skip_installed skip_satisfied verify
interactive installdeps
)
) . "\n"
);
}

sub fetch_meta_sco {
Expand Down Expand Up @@ -1152,7 +1163,20 @@ sub test {

$cmd = $self->append_args($cmd, 'test') if $depth == 0;

return 1 if $self->run_timeout($cmd, $self->{test_timeout});
my $r = $self->run_timeout($cmd, $self->{test_timeout});

if ( !$self->{skip_report}
and !$self->{verbose} # verbose logging is not supported yet on cpanm
and eval 'use App::cpanminus::reporter 0.10; 1'
) {
# we don't want cpanm to die if reporting fails
eval {
my $reporter = App::cpanminus::reporter->new( cpanm => $self, only => $distname );
$reporter->run();
};
}
return 1 if $r;

if ($self->{force}) {
$self->diag_fail("Testing $distname failed but installing it anyway.");
return 1;
Expand Down
6 changes: 6 additions & 0 deletions script/cpanm.PL
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,12 @@ Note that if you specify this option with a module or distribution
that has dependencies, these dependencies will be installed if you
don't currently have them.

=item --skip-report

If L<App::cpanminus::reporter> is found in the system, cpanm will
automatically send test reports to CPAN Testers unless you set this
option.

=item -S, --sudo

Switch to the root user with C<sudo> when installing modules. Use this
Expand Down