blib/lib/Dist/Zilla/Plugin/Run/Clean.pm

filter: Statementstmt 100% 39 / 39 Branchbran 50.0% 1 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 8 / 8 Podpod 0.0% 0 / 1 totaltotal 96.0% 48 / 50 CC 4 SCAR 5.5
CC
4
Cov
98%
clean
3.0
__ANON__
2.0
BEGIN
1.0
CRAP 1.7
« blib/lib/Dist/Zilla/Plugin/Run/Role/Runner.pm ↑ Summary blib/lib/Dist/Zilla/Plugin/Run/AfterMint.pm »
1 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
2 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 package Dist::Zilla::Plugin::Run::Clean;
4 # ABSTRACT: execute a command of the distribution on 'dzil clean'
5 # vim: set ts=8 sts=2 sw=2 tw=115 et :
6  
7 1 our $VERSION = '0.050';
8  
9 1 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
10 1 with
11 'Dist::Zilla::Role::Plugin',
12 'Dist::Zilla::Plugin::Run::Role::Runner';
13  
14 1 ▶use Moose::Util ();
Subroutine BEGIN: called CC=1 SCAR=0.0
15 1 ▶use namespace::autoclean;
Subroutine BEGIN: called CC=1 SCAR=0.0
16  
17 {
18 1 ▶ use Dist::Zilla::Dist::Builder;
Subroutine BEGIN: called CC=1 SCAR=0.0
19 1 my $meta = Moose::Util::find_meta('Dist::Zilla::Dist::Builder');
20 1 $meta->make_mutable;
21 Moose::Util::add_method_modifier($meta, 'after',
22 [
23 2 ▶ clean => sub {
Subroutine __ANON__: called CC=2 SCAR=6.9
24 2 my ($zilla, $dry_run) = @_;
25 2 foreach my $plugin (grep $_->isa(__PACKAGE__), @{ $zilla->plugins })
26 {
27 # Dist::Zilla really ought to have a -CleanerProvider hook...
28 2 $plugin->clean($dry_run);
29 }
30 },
31 1 ],
32 );
33 1 $meta->make_immutable;
34 }
35  
36 sub clean
37 2 ▶{
Subroutine clean: called CC=3 SCAR=11.0
Pod undocumented
38 2 my ($self, $dry_run) = @_;
39  
40 # may need some subrefs for positional parameters?
41 2 my $params = {};
42  
43 2 foreach my $run_cmd (@{$self->run}) {
44 2 $self->_run_cmd($run_cmd, $params, $dry_run);
45 }
46  
47 2 ▶ if (my @code = @{ $self->eval }) {
Branch: 1 branch
BranchTrueFalseTotal
if (my(@code) = @{$self->eval;}) 2 0 2
48 2 my $code = join "\n", @code;
49 2 $self->_eval_cmd($code, $params, $dry_run);
50 }
51 }
52  
53 1 __PACKAGE__->meta->make_immutable;
54  
55 __END__
« blib/lib/Dist/Zilla/Plugin/Run/Role/Runner.pm ↑ Summary blib/lib/Dist/Zilla/Plugin/Run/AfterMint.pm »