« blib/lib/Dist/Zilla/Plugin/Author/Plicease/Tests.pm
↑ Summary
blib/lib/Dist/Zilla/Plugin/Author/Plicease/Upload.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 | 1 | ▶ | use Dist::Zilla::PluginBundle::Author::Plicease; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 4 | 1 | ▶ | use Config::INI::Reader; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 5 | 1 | ▶ | use Path::Tiny qw( path ); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 6 | 1 | ▶ | use File::Temp qw( tempdir ); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||
| 8 | 1 | ▶ | BEGIN { @INC = map { ref($_) ? $_ : path($_)->absolute->stringify } @INC } | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=2 SCAR=7.2
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||
| 10 | 1 | my $nl = 0; | |||||||||||||||||||||||||||
| 11 | 1 | my $in_config; | |||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||
| 13 | 1 | ▶ | if($ARGV[0] eq '--default') | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 14 | { | ||||||||||||||||||||||||||||
| 15 | 0 | $in_config = {}; | |||||||||||||||||||||||||||
| 16 | 0 | warn "using default"; | |||||||||||||||||||||||||||
| 17 | 0 | chdir(tempdir( CLEANUP => 1)); | |||||||||||||||||||||||||||
| 18 | 0 | mkdir 'My-Dist'; | |||||||||||||||||||||||||||
| 19 | 0 | chdir 'My-Dist'; | |||||||||||||||||||||||||||
| 20 | } | ||||||||||||||||||||||||||||
| 21 | else | ||||||||||||||||||||||||||||
| 22 | { | ||||||||||||||||||||||||||||
| 23 | 1 | ▶ | die "run from the directory with the dist.ini file" unless -r 'dist.ini'; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 24 | 1 | $in_config = Config::INI::Reader->read_file('dist.ini')->{'@Author::Plicease'}; | |||||||||||||||||||||||||||
| 25 | } | ||||||||||||||||||||||||||||
| 26 | |||||||||||||||||||||||||||||
| 27 | 1 | ▶ | die "unable to find [\@Author::Plicease] in your dist.ini" unless defined $in_config; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 28 | |||||||||||||||||||||||||||||
| 29 | 1 | my $bundle = Bundle->new; | |||||||||||||||||||||||||||
| 30 | |||||||||||||||||||||||||||||
| 31 | 1 | Dist::Zilla::PluginBundle::Author::Plicease::configure($bundle); | |||||||||||||||||||||||||||
| 32 | |||||||||||||||||||||||||||||
| 33 | 1 | chdir(Path::Tiny->rootdir); | |||||||||||||||||||||||||||
| 34 | |||||||||||||||||||||||||||||
| 35 | package | ||||||||||||||||||||||||||||
| 36 | Bundle; | ||||||||||||||||||||||||||||
| 37 | |||||||||||||||||||||||||||||
| 38 | 1 | ▶ | sub new { bless {} } | ||||||||||||||||||||||||||
|
Subroutine
new: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 39 | 41 | ▶ | sub payload { $in_config } | ||||||||||||||||||||||||||
|
Subroutine
payload: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 40 | 23 | ▶ | sub _my_add_plugin { shift->add_plugins(@_) } | ||||||||||||||||||||||||||
|
Subroutine
_my_add_plugin: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 41 | |||||||||||||||||||||||||||||
| 42 | sub add_plugins | ||||||||||||||||||||||||||||
| 43 | 23 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
add_plugins: called CC=12 SCAR=24.9
| |||||||||||||||||||||||||||||
| 44 | 23 | shift; # self | |||||||||||||||||||||||||||
| 45 | 23 | ▶ | foreach my $item (map { ref $_ ? [@$_] : [$_] } @_) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 46 | { | ||||||||||||||||||||||||||||
| 47 | 31 | ▶ | if(ref($item) eq 'ARRAY') | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 48 | { | ||||||||||||||||||||||||||||
| 49 | 31 | ▶ | my %config = ref $item->[-1] eq 'HASH' ? %{ pop @$item } : (); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 50 | 31 | my($moniker, $name) = @$item; | |||||||||||||||||||||||||||
| 51 | |||||||||||||||||||||||||||||
| 52 | 31 | ▶ | print "\n" if $nl && %config; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$nl and %config
MC/DC100%2/2
$nl and %config
$nl
%config
Truth table100%3/3
A and B
A= $nlB= %config
| |||||||||||||||||||||||||||||
| 53 | 31 | ▶ | if(defined $name) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 54 | { | ||||||||||||||||||||||||||||
| 55 | 1 | print "[$moniker / $name]\n"; | |||||||||||||||||||||||||||
| 56 | } | ||||||||||||||||||||||||||||
| 57 | else | ||||||||||||||||||||||||||||
| 58 | { | ||||||||||||||||||||||||||||
| 59 | 30 | print "[$moniker]\n"; | |||||||||||||||||||||||||||
| 60 | } | ||||||||||||||||||||||||||||
| 61 | |||||||||||||||||||||||||||||
| 62 | 31 | foreach my $k (sort keys %config) | |||||||||||||||||||||||||||
| 63 | { | ||||||||||||||||||||||||||||
| 64 | 23 | my $v = $config{$k}; | |||||||||||||||||||||||||||
| 65 | 23 | ▶ | $v = [ $v ] unless ref $v; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 66 | 23 | print "$k = $_\n" for @$v; | |||||||||||||||||||||||||||
| 67 | } | ||||||||||||||||||||||||||||
| 68 | |||||||||||||||||||||||||||||
| 69 | 31 | ▶ | if(%config) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 70 | { | ||||||||||||||||||||||||||||
| 71 | 10 | print "\n"; | |||||||||||||||||||||||||||
| 72 | 10 | $nl = 0; | |||||||||||||||||||||||||||
| 73 | } | ||||||||||||||||||||||||||||
| 74 | else | ||||||||||||||||||||||||||||
| 75 | { | ||||||||||||||||||||||||||||
| 76 | 21 | $nl = 1; | |||||||||||||||||||||||||||
| 77 | } | ||||||||||||||||||||||||||||
| 78 | |||||||||||||||||||||||||||||
| 79 | } | ||||||||||||||||||||||||||||
| 80 | else | ||||||||||||||||||||||||||||
| 81 | { | ||||||||||||||||||||||||||||
| 82 | 0 | die "do not know how to handle " . ref $item; | |||||||||||||||||||||||||||
| 83 | } | ||||||||||||||||||||||||||||
| 84 | } | ||||||||||||||||||||||||||||
| 85 | } | ||||||||||||||||||||||||||||
| 86 | |||||||||||||||||||||||||||||