Dist/Zilla/PluginBundle/Author/ETHER.pm

filter: Statementstmt 98.6% 215 / 218 Branchbran 70.4% 86 / 122 Conditioncond 67.4% 85 / 126 MC/DCmcdc 39.1% 27 / 69 Subroutinesub 96.5% 56 / 58 Podpod 0.0% 0 / 3 totaltotal 78.6% 469 / 596 CC 108 SCAR 39.0
CC
108
Cov
83%
configure
128.9
pause_cfg_dir
20.0
__ANON__
12.0
CRAP 49.5
↑ Summary Pod/Weaver/PluginBundle/Author/ETHER.pm »
1 22 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
2 22 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 package Dist::Zilla::PluginBundle::Author::ETHER; # git description: v0.173-3-g78e71a7
4 # vim: set ts=8 sts=2 sw=2 tw=100 et :
5 # ABSTRACT: A plugin bundle for distributions built by ETHER
6 # KEYWORDS: author bundle distribution tool
7  
8 22 our $VERSION = '0.174';
9  
10 22 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
11 22 with
12 'Dist::Zilla::Role::PluginBundle::Easy',
13 'Dist::Zilla::Role::PluginBundle::PluginRemover' => { -version => '0.103' },
14 'Dist::Zilla::Role::PluginBundle::Config::Slicer';
15  
16 22 ▶use if "$]" >= 5.022, experimental => 're_strict';
Subroutine BEGIN: called CC=1 SCAR=0.0
17 22 ▶no if "$]" >= 5.031009, feature => 'indirect';
Subroutine BEGIN: called CC=1 SCAR=0.0
18 22 ▶no if "$]" >= 5.033001, feature => 'multidimensional';
Subroutine BEGIN: called CC=1 SCAR=0.0
19 22 ▶no if "$]" >= 5.033006, feature => 'bareword_filehandles';
Subroutine BEGIN: called CC=1 SCAR=0.0
20 22 ▶no if "$]" >= 5.041009, feature => 'smartmatch';
Subroutine BEGIN: called CC=1 SCAR=0.0
21 22 ▶no feature 'switch';
Subroutine BEGIN: called CC=1 SCAR=0.0
22 22 ▶use Dist::Zilla::Util;
Subroutine BEGIN: called CC=1 SCAR=0.0
23 22 ▶use Moose::Util::TypeConstraints qw(enum subtype where class_type);
Subroutine BEGIN: called CC=1 SCAR=0.0
24 22 ▶use List::Util 1.45 qw(first any uniq none);
Subroutine BEGIN: called CC=1 SCAR=0.0
25 22 ▶use Module::Runtime qw(require_module use_module);
Subroutine BEGIN: called CC=1 SCAR=0.0
26 22 ▶use Devel::CheckBin 'can_run';
Subroutine BEGIN: called CC=1 SCAR=0.0
27 22 ▶use Path::Tiny;
Subroutine BEGIN: called CC=1 SCAR=0.0
28 22 ▶use CPAN::Meta 2.150006; # for x_* preservation
Subroutine BEGIN: called CC=1 SCAR=0.0
29 22 ▶use CPAN::Meta::Requirements;
Subroutine BEGIN: called CC=1 SCAR=0.0
30 22 ▶use Term::ANSIColor 'colored';
Subroutine BEGIN: called CC=1 SCAR=0.0
31 0 ▶eval { +require Win32::Console::ANSI } if $^O eq 'MSWin32';
Branch: 1 branch
BranchTrueFalseTotal
if $^O eq "MSWin32" 0 22 22
32 22 ▶use Config;
Subroutine BEGIN: called CC=1 SCAR=0.0
33 22 ▶use Try::Tiny;
Subroutine BEGIN: called CC=1 SCAR=0.0
34 22 ▶use URI::Escape 'uri_escape';
Subroutine BEGIN: called CC=1 SCAR=0.0
35 22 ▶use namespace::autoclean;
Subroutine BEGIN: called CC=1 SCAR=0.0
36  
37 44 ▶sub mvp_multivalue_args { qw(installer copy_file_from_release) }
Subroutine mvp_multivalue_args: called CC=1 SCAR=0.0
38  
39 # Note: no support yet for depending on a specific version of the plugin --
40 # but [PromptIfStale] generally makes that unnecessary
41 has installer => (
42 isa => 'ArrayRef[Str]',
43 init_arg => undef,
44 lazy => 1,
45 44 ▶ default => sub {
Subroutine __ANON__: called CC=2 SCAR=6.9
46 44 my $self = shift;
47  
48 return [ 'ModuleBuildTiny' ]
49 44 ▶ if not exists $self->payload->{installer};
Branch: 1 branch
BranchTrueFalseTotal
unless exists $self->payload->{"installer"} 10 34 44
50  
51 # remove 'none' from installer list
52 34 return [ grep $_ ne 'none', @{ $self->payload->{installer} } ];
53 },
54 22 traits => ['Array'],
55 handles => { installer => 'elements' },
56 );
57  
58 has server => (
59 is => 'ro', isa => enum([qw(github gitmo p5sagit catagits none)]),
60 init_arg => undef,
61 lazy => 1,
62 44 ▶ default => sub { $_[0]->payload->{server} // 'github' },
Subroutine __ANON__: called CC=2 SCAR=6.9
Condition100%2/2
$_[0]->payload->{"server"} // "github"
l!l
2420
MC/DC100%1/1
$_[0]->payload->{"server"} // "github"
$_[0]->payload->{"server"}
Truth table100%2/2
A
A= $_[0]->payload->{"server"}
Aresult
11
00
63 22 );
64  
65 has bugtracker => (
66 is => 'ro', isa => enum([qw(rt github)]),
67 init_arg => undef,
68 lazy => 1,
69 44 ▶ default => sub {
Subroutine __ANON__: called CC=4 SCAR=13.9
70 44 ▶ my $bugtracker = $_[0]->payload->{bugtracker} // 'rt';
Condition100%2/2
$_[0]->payload->{"bugtracker"} // "rt"
l!l
440
MC/DC100%1/1
$_[0]->payload->{"bugtracker"} // "rt"
$_[0]->payload->{"bugtracker"}
Truth table100%2/2
A
A= $_[0]->payload->{"bugtracker"}
Aresult
11
00
71 44 ▶ die 'bugtracker cannot be github unless server = github'
Branch: 1 branch
BranchTrueFalseTotal
if $bugtracker eq "github" and $_[0]->server ne "github" 3 41 44
Condition100%3/3
$bugtracker eq "github" and $_[0]->server ne "github"
!ll&&!rl&&r
4013
MC/DC100%2/2
$bugtracker eq "github" and $_[0]->server ne "github"
$bugtracker eq "github" $_[0]->server ne "github"
Truth table100%3/3
A and B
A= $bugtracker eq "github"B= $_[0]->server ne "github"
ABresult
0X0
100
111
72 if $bugtracker eq 'github' and $_[0]->server ne 'github';
73 41 $bugtracker;
74 },
75 22 );
76  
77 has surgical_podweaver => (
78 is => 'ro', isa => 'Bool',
79 init_arg => undef,
80 lazy => 1,
81 44 ▶ default => sub { $_[0]->payload->{surgical_podweaver} // 0 },
Subroutine __ANON__: called CC=2 SCAR=7.6
Condition50%1/2
$_[0]->payload->{"surgical_podweaver"} // 0
l!l
044
MC/DC0%0/1
$_[0]->payload->{"surgical_podweaver"} // 0
$_[0]->payload->{"surgical_podweaver"}
Truth table50%1/2
A
A= $_[0]->payload->{"surgical_podweaver"}
Aresult
11
00
82 22 );
83  
84 has airplane => (
85 is => 'ro', isa => 'Bool',
86 init_arg => undef,
87 lazy => 1,
88 44 ▶ default => sub { $ENV{DZIL_AIRPLANE} || $_[0]->payload->{airplane} // 0 },
Subroutine __ANON__: called CC=3 SCAR=11.1
Condition80%4/5
($ENV{"DZIL_AIRPLANE"} || $_[0]->payload->{"airplane"}) // 0
l!l
341
$ENV{"DZIL_AIRPLANE"} or $_[0]->payload->{"airplane"}
l!l&&r!l&&!r
0341
MC/DC50%1/2
($ENV{"DZIL_AIRPLANE"} || $_[0]->payload->{"airplane"}) // 0
$ENV{"DZIL_AIRPLANE"} $_[0]->payload->{"airplane"}
Truth table66%2/3
A or B
A= $ENV{"DZIL_AIRPLANE"}B= $_[0]->payload->{"airplane"}
ABresult
1X1
011
000
89 22 );
90  
91 has copy_file_from_release => (
92 isa => 'ArrayRef[Str]',
93 init_arg => undef,
94 lazy => 1,
95 41 ▶ default => sub { $_[0]->payload->{copy_file_from_release} // [] },
Subroutine __ANON__: called CC=2 SCAR=6.9
Condition100%2/2
$_[0]->payload->{"copy_file_from_release"} // []
l!l
140
MC/DC100%1/1
$_[0]->payload->{"copy_file_from_release"} // []
$_[0]->payload->{"copy_file_from_release"}
Truth table100%2/2
A
A= $_[0]->payload->{"copy_file_from_release"}
Aresult
11
00
96 22 traits => ['Array'],
97 handles => { copy_files_from_release => 'elements' },
98 );
99  
100 82 ▶around copy_files_from_release => sub {
Subroutine __ANON__: called CC=2 SCAR=6.9
101 82 my $orig = shift; my $self = shift;
102 82 ▶ sort(uniq($self->$orig(@_),
Branch: 1 branch
BranchTrueFalseTotal
$self->cpanfile ? : 2 80 82
103 qw(LICENCE LICENSE CONTRIBUTING ppport.h INSTALL),
104 $self->cpanfile ? 'cpanfile' : (),
105 ));
106 22 };
107  
108 41 ▶sub commit_files_after_release {
Subroutine commit_files_after_release: called CC=1 SCAR=0.0
Pod undocumented
109 41 grep -e, sort(uniq('README.md', 'README.pod', 'Changes', shift->copy_files_from_release));
110 }
111  
112 has changes_version_columns => (
113 41 ▶ is => 'ro', isa => subtype('Int', where { $_ > 0 && $_ < 20 }),
Subroutine __ANON__: called CC=2 SCAR=7.6
Branch: 1 branch
BranchTrueFalseTotal
$_ > 0 and $_ < 20 41 0 41
114 init_arg => undef,
115 lazy => 1,
116 41 ▶ default => sub { $_[0]->payload->{changes_version_columns} // 10 },
Subroutine __ANON__: called CC=2 SCAR=7.6
Condition50%1/2
$_[0]->payload->{"changes_version_columns"} // 10
l!l
041
MC/DC0%0/1
$_[0]->payload->{"changes_version_columns"} // 10
$_[0]->payload->{"changes_version_columns"}
Truth table50%1/2
A
A= $_[0]->payload->{"changes_version_columns"}
Aresult
11
00
117 22 );
118  
119 has licence => (
120 is => 'ro', isa => 'Str',
121 init_arg => undef,
122 lazy => 1,
123 44 ▶ default => sub {
Subroutine __ANON__: called CC=4 SCAR=13.9
124 44 my $self = shift;
125 44 my $authority = $self->authority;
126 $self->payload->{licence}
127 // $self->payload->{license}
128 # licenSe is US-only; known non-American authors will be treated appropriately.
129 72 ▶ // ((any { $authority eq "cpan:$_" }
Subroutine __ANON__: called CC=1 SCAR=0.0
130 44 ▶ qw(ETHER ABERGMAN AVAR BINGOS BOBTFISH CHANSEN CHOLET DOHERTY FLORA GAAS GETTY GSAR ILMARI JAWNSY JQUELIN LBROCARD LEONT LLAP MANWAR MSTROUT NEILB NUFFIN OALDERS PERIGRIN PHAYLON RELEQUEST SALVA))
Branch: 1 branch
BranchTrueFalseTotal
&any(sub { $authority eq "cpan:$_"; } , 'ETHER', 'ABERGMAN', 'AVAR', 'BINGOS', 'BOBTFISH', 'CHANSEN', 'CHOLET', 'DOHERTY', 'FLORA', 'GAAS', 'GETTY', 'GSAR', 'ILMARI', 'JAWNSY', 'JQUELIN', 'LBROCARD', 'LEONT', 'LLAP', 'MANWAR', 'MSTROUT', 'NEILB', 'NUFFIN', 'OALDERS', 'PERIGRIN', 'PHAYLON', 'RELEQUEST', 'SALVA') ? : 41 1 42
Condition80%4/5
($self->payload->{"licence"} // $self->payload->{"license"}) // (&any(sub { $authority eq "cpan:$_"; } , "ETHER", "ABERGMAN", "AVAR", "BINGOS", "BOBTFISH", "CHANSEN", "CHOLET", "DOHERTY", "FLORA", "GAAS", "GETTY", "GSAR", "ILMARI", "JAWNSY", "JQUELIN", "LBROCARD", "LEONT", "LLAP", "MANWAR", "MSTROUT", "NEILB", "NUFFIN", "OALDERS", "PERIGRIN", "PHAYLON", "RELEQUEST", "SALVA") ? "LICENCE" : "LICENSE")
l!l
242
$self->payload->{"licence"} // $self->payload->{"license"}
l!l&&r!l&&!r
2042
MC/DC50%1/2
($self->payload->{"licence"} // $self->payload->{"license"}) // (&any(sub { $authority eq "cpan:$_"; } , "ETHER", "ABERGMAN", "AVAR", "BINGOS", "BOBTFISH", "CHANSEN", "CHOLET", "DOHERTY", "FLORA", "GAAS", "GETTY", "GSAR", "ILMARI", "JAWNSY", "JQUELIN", "LBROCARD", "LEONT", "LLAP", "MANWAR", "MSTROUT", "NEILB", "NUFFIN", "OALDERS", "PERIGRIN", "PHAYLON", "RELEQUEST", "SALVA") ? "LICENCE" : "LICENSE")
$self->payload->{"licence"} $self->payload->{"license"}
Truth table66%2/3
A // B
A= $self->payload->{"licence"}B= $self->payload->{"license"}
ABresult
1X1
011
000
131 ? 'LICENCE' : 'LICENSE');
132 },
133 22 );
134  
135 has authority => (
136 is => 'ro', isa => 'Str',
137 init_arg => undef,
138 lazy => 1,
139 44 ▶ default => sub {
Subroutine __ANON__: called CC=3 SCAR=11.1
140 44 my $self = shift;
141  
142 # we could warn about this, but then we'd have to change configs (and bump prereqs) for an awful lot of
143 # distributions.
144 return $self->payload->{'Authority.authority'}
145 44 ▶ if exists $self->payload->{'Authority.authority'};
Branch: 1 branch
BranchTrueFalseTotal
if exists $self->payload->{"Authority.authority"} 0 44 44
146  
147 44 ▶ $self->payload->{authority} // 'cpan:ETHER';
Condition100%2/2
$self->payload->{"authority"} // "cpan:ETHER"
l!l
341
MC/DC100%1/1
$self->payload->{"authority"} // "cpan:ETHER"
$self->payload->{"authority"}
Truth table100%2/2
A
A= $self->payload->{"authority"}
Aresult
11
00
148 },
149 22 );
150  
151 has fake_release => (
152 is => 'ro', isa => 'Bool',
153 init_arg => undef,
154 lazy => 1,
155 41 ▶ default => sub { $ENV{FAKE_RELEASE} || $_[0]->payload->{fake_release} // 0 },
Subroutine __ANON__: called CC=3 SCAR=11.1
Condition80%4/5
($ENV{"FAKE_RELEASE"} || $_[0]->payload->{"fake_release"}) // 0
l!l
338
$ENV{"FAKE_RELEASE"} or $_[0]->payload->{"fake_release"}
l!l&&r!l&&!r
3038
MC/DC50%1/2
($ENV{"FAKE_RELEASE"} || $_[0]->payload->{"fake_release"}) // 0
$ENV{"FAKE_RELEASE"} $_[0]->payload->{"fake_release"}
Truth table66%2/3
A or B
A= $ENV{"FAKE_RELEASE"}B= $_[0]->payload->{"fake_release"}
ABresult
1X1
011
000
156 22 );
157  
158 has plugin_prereq_phase => (
159 is => 'ro',
160 isa => 'Str',
161 lazy => 1,
162 41 ▶ default => sub { $_[0]->payload->{plugin_prereq_phase} // 'x_Dist_Zilla' },
Subroutine __ANON__: called CC=2 SCAR=6.9
Condition100%2/2
$_[0]->payload->{"plugin_prereq_phase"} // "x_Dist_Zilla"
l!l
140
MC/DC100%1/1
$_[0]->payload->{"plugin_prereq_phase"} // "x_Dist_Zilla"
$_[0]->payload->{"plugin_prereq_phase"}
Truth table100%2/2
A
A= $_[0]->payload->{"plugin_prereq_phase"}
Aresult
11
00
163 22 );
164  
165 has plugin_prereq_relationship => (
166 is => 'ro',
167 isa => 'Str',
168 lazy => 1,
169 41 ▶ default => sub { $_[0]->payload->{plugin_prereq_relationship} // 'requires' },
Subroutine __ANON__: called CC=2 SCAR=6.9
Condition100%2/2
$_[0]->payload->{"plugin_prereq_relationship"} // "requires"
l!l
140
MC/DC100%1/1
$_[0]->payload->{"plugin_prereq_relationship"} // "requires"
$_[0]->payload->{"plugin_prereq_relationship"}
Truth table100%2/2
A
A= $_[0]->payload->{"plugin_prereq_relationship"}
Aresult
11
00
170 22 );
171  
172 has cpanfile => (
173 is => 'ro', isa => 'Bool',
174 init_arg => undef,
175 lazy => 1,
176 44 ▶ default => sub { $_[0]->payload->{cpanfile} // 0 },
Subroutine __ANON__: called CC=2 SCAR=6.9
Condition100%2/2
$_[0]->payload->{"cpanfile"} // 0
l!l
143
MC/DC100%1/1
$_[0]->payload->{"cpanfile"} // 0
$_[0]->payload->{"cpanfile"}
Truth table100%2/2
A
A= $_[0]->payload->{"cpanfile"}
Aresult
11
00
177 22 );
178  
179 sub pause_cfg_file () { '.pause' }
180 0 ▶sub pause_cfg_dir () { $^O eq 'MSWin32' && "$]" < 5.016 ? $ENV{HOME} || $ENV{USERPROFILE} : (<~>)[0] }
Subroutine pause_cfg_dir: not called CC=4 SCAR=30.0
Pod undocumented
Branch: 1 branch
BranchTrueFalseTotal
$^O eq 'MSWin32' && "$]" < 5.016 ? : 0 0 0
Condition0%0/6
$^O eq "MSWin32" and "$]" < "5.016"
!ll&&!rl&&r
000
$ENV{"HOME"} or $ENV{"USERPROFILE"}
l!l&&r!l&&!r
000
MC/DC0%0/2
$^O eq "MSWin32" and "$]" < "5.016"
$^O eq "MSWin32" "$]" < "5.016"
MC/DC0%0/2
$ENV{"HOME"} or $ENV{"USERPROFILE"}
$ENV{"HOME"} $ENV{"USERPROFILE"}
Truth table0%0/3
A and B
A= $^O eq "MSWin32"B= "$]" < "5.016"
ABresult
0X0
100
111
Truth table0%0/3
A or B
A= $ENV{"HOME"}B= $ENV{"USERPROFILE"}
ABresult
1X1
011
000
181  
182 22 my $_pause_config;
183 sub _pause_config {
184 return $_pause_config if $_pause_config;
185  
186 # stolen shamelessly from Dist::Zilla::Plugin::UploadToCPAN
187 my $self = shift;
188 require CPAN::Uploader;
189 my $file = $self->pause_cfg_file;
190 $file = File::Spec->catfile($self->pause_cfg_dir, $file)
191 unless File::Spec->file_name_is_absolute($file);
192 return {} unless -e $file && -r _;
193 my $cfg = try {
194 CPAN::Uploader->read_config_file($file)
195 } catch {
196 warn "[\@Author::ETHER] Couldn't load credentials from '$file': $_";
197 {};
198 };
199 return $cfg;
200 }
201  
202 41 ▶sub _pause_download_url {
Subroutine _pause_download_url: called CC=3 SCAR=11.6
203 41 my $self = shift;
204 41 my ($username, $password) = @{$self->_pause_config}{qw(user password)};
205 41 ▶ return if not $username or not $password;
Branch: 1 branch
BranchTrueFalseTotal
unless $username and $password 0 41 41
Condition33%1/3
$username and $password
!ll&&!rl&&r
0041
MC/DC0%0/2
$username and $password
$username $password
Truth table33%1/3
A and B
A= $usernameB= $password
ABresult
0X0
100
111
206 41 $password = uri_escape($password) =~ s/%/%%/gr;
207 41 'https://'.$username.':'.$password.'@pause.perl.org/pub/PAUSE/authors/id/'.substr($username, 0, 1).'/'.substr($username,0,2).'/'.$username.'/%a';
208 }
209  
210 # configs are applied when plugins match ->isa($key) or ->does($key)
211 22 my %extra_args = (
212 'Dist::Zilla::Plugin::MakeMaker' => { 'eumm_version' => '0' },
213 'Dist::Zilla::Plugin::MakeMaker::Awesome' => { 'eumm_version' => '0' },
214 'Dist::Zilla::Plugin::ModuleBuildTiny' => { ':version' => '0.012', version_method => 'conservative', static => 'auto' },
215 'Dist::Zilla::Plugin::MakeMaker::Fallback' => { ':version' => '0.029' },
216 # default_jobs is no-op until Dist::Zilla 5.014
217 'Dist::Zilla::Role::TestRunner' => { default_jobs => 9 },
218 'Dist::Zilla::Plugin::ModuleBuild' => { mb_version => '0.28' },
219 'Dist::Zilla::Plugin::ModuleBuildTiny::Fallback' => { ':version' => '0.018', version_method => 'conservative', static => 'auto' },
220 );
221  
222 # plugins that use the network when they run
223 5 ▶sub _network_plugins {
Subroutine _network_plugins: called CC=1 SCAR=0.0
224 5 qw(
225 PromptIfStale
226 Test::Pod::LinkCheck
227 Test::Pod::No404s
228 Git::Remote::Check
229 CheckPrereqsIndexed
230 CheckIssues
231 UploadToCPAN
232 Git::Push
233 );
234 }
235  
236 has _has_bash => (
237 is => 'ro',
238 isa => 'Bool',
239 lazy => 1,
240 41 ▶ default => sub { !!can_run('bash') },
Subroutine __ANON__: called CC=1 SCAR=0.0
241 22 );
242  
243 # note this is applied to the plugin list in Dist::Zilla::Role::PluginBundle::PluginRemover,
244 # but we also need to use it here to be sure we are not adding configs that are only needed
245 # by plugins that will be subsequently removed.
246 has _removed_plugins => (
247 isa => 'HashRef[Str]',
248 init_arg => undef,
249 lazy => 1,
250 41 ▶ default => sub {
Subroutine __ANON__: called CC=2 SCAR=7.0
251 41 my $self = shift;
252 41 ▶ my $remove = $self->payload->{ $self->plugin_remover_attribute } // [];
Condition50%1/2
$self->payload->{$self->plugin_remover_attribute} // []
l!l
410
MC/DC0%0/1
$self->payload->{$self->plugin_remover_attribute} // []
$self->payload->{$self->plugin_remover_attribute}
Truth table50%1/2
A
A= $self->payload->{$self->plugin_remover_attribute}
Aresult
11
00
253 41 my %removed; @removed{@$remove} = (!!1) x @$remove;
254 41 \%removed;
255 },
256 22 traits => ['Hash'],
257 handles => { _plugin_removed => 'exists', _removed_plugins => 'keys' },
258 );
259  
260 # this attribute and its supporting code is a candidate to be extracted out into its own role,
261 # for re-use in other bundles
262 has _plugin_requirements => (
263 isa => class_type('CPAN::Meta::Requirements'),
264 lazy => 1,
265 41 ▶ default => sub { CPAN::Meta::Requirements->new },
Subroutine __ANON__: called CC=1 SCAR=0.0
266 22 handles => {
267 _add_minimum_plugin_requirement => 'add_minimum',
268 _plugin_requirements_as_string_hash => 'as_string_hash',
269 },
270 );
271  
272 # files that might be in the repository that should never be gathered
273 22 my @never_gather = grep -e, qw(
274 Makefile.PL ppport.h README.md README.pod META.json
275 cpanfile TODO CONTRIBUTING LICENCE LICENSE INSTALL
276 inc/ExtUtils/MakeMaker/Dist/Zilla/Develop.pm
277 );
278  
279 44 ▶sub BUILD {
Subroutine BUILD: called CC=2 SCAR=6.9
Pod undocumented
280 44 my $self = shift;
281  
282 44 ▶ if ($self->airplane) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->airplane) 3 41 44
283 3 warn '[@Author::ETHER] ' . colored('building in airplane mode - plugins requiring the network are skipped, and releases are not permitted', 'yellow') . "\n";
284  
285 # doing this before running configure means we can be sure we update the removal list before
286 # our _removed_plugins attribute is built.
287 3 push @{ $self->payload->{ $self->plugin_remover_attribute } }, $self->_network_plugins;
288 }
289 }
290  
291 44 ▶sub configure {
Subroutine configure: called CC=60 SCAR=48.6
292 44 my $self = shift;
293  
294 warn '[DZ] Building with ', blessed($self), ' ', $VERSION, "...\n"
295 44 ▶ if not $INC{'Test/More.pm'};
Branch: 1 branch
BranchTrueFalseTotal
unless $INC{"Test/More.pm"} 0 44 44
296  
297 warn '[@Author::ETHER] no "bash" executable found; skipping Run::AfterBuild command to update .ackrc', "\n"
298 44 ▶ if not $INC{'Test/More.pm'} and not $self->_has_bash;
Branch: 1 branch
BranchTrueFalseTotal
unless $INC{"Test/More.pm"} or $self->_has_bash 0 44 44
Condition33%1/3
$INC{"Test/More.pm"} or $self->_has_bash
l!l&&r!l&&!r
4400
MC/DC0%0/2
$INC{"Test/More.pm"} or $self->_has_bash
$INC{"Test/More.pm"} $self->_has_bash
Truth table33%1/3
A or B
A= $INC{"Test/More.pm"}B= $self->_has_bash
ABresult
1X1
011
000
299  
300 # NOTE! since the working directory has not changed to $zilla->root yet
301 # (and in future versions of Dist::Zilla, it may never change...)
302 # if running this code via a different mechanism than dzil <command>, file
303 # operations may be looking at the wrong directory! Take this into
304 # consideration when running tests!
305  
306 44 ▶ my $has_xs = glob('*.xs') ? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
glob('*.xs') ? : 0 44 44
307 44 ▶ warn '[@Author::ETHER] XS-based distribution detected.', "\n" if $has_xs;
Branch: 1 branch
BranchTrueFalseTotal
if $has_xs 0 44 44
308 44 ▶ die '[@Author::ETHER] no Makefile.PL found in the repository root: this is not very nice for contributors!', "\n"
Branch: 1 branch
BranchTrueFalseTotal
if $has_xs and not -e "Makefile.PL" 0 44 44
Condition33%1/3
$has_xs and not -e "Makefile.PL"
!ll&&!rl&&r
4400
MC/DC0%0/2
$has_xs and not -e "Makefile.PL"
$has_xs not -e "Makefile.PL"
Truth table33%1/3
A and not(B)
A= $has_xsB= not -e "Makefile.PL"
ABresult
0X0
100
111
309 if $has_xs and not -e 'Makefile.PL';
310  
311 # check for a bin/ that should probably be renamed to script/
312 warn '[@Author::ETHER] ', colored('bin/ detected - should this be moved to script/, so its contents can be installed into $PATH?', 'bright_red'), "\n"
313 0 ▶ if -d 'bin' and any { $_ eq 'ModuleBuildTiny' } $self->installer;
Subroutine __ANON__: not called CC=1 SCAR=1.7
Branch: 1 branch
BranchTrueFalseTotal
if -d "bin" and &any(sub { $_ eq "ModuleBuildTiny"; } , $self->installer) 0 44 44
Condition33%1/3
-d "bin" and &any(sub { $_ eq "ModuleBuildTiny"; } , $self->installer)
!ll&&!rl&&r
4400
MC/DC0%0/2
-d "bin" and &any(sub { $_ eq "ModuleBuildTiny"; } , $self->installer)
-d "bin" &any(sub { $_ eq "ModuleBuildTiny"; } , $self->installer)
Truth table33%1/3
A and B
A= -d "bin"B= &any(sub { $_ eq "ModuleBuildTiny"; } , $self->installer)
ABresult
0X0
100
111
314  
315 warn '[@Author::ETHER] ', colored('You are using [ModuleBuild] as an installer, WTF?!', 'bright_red'), "\n"
316 43 ▶ if any { $_->isa('Dist::Zilla::Plugin::ModuleBuild') }
Subroutine __ANON__: called CC=1 SCAR=0.0
317 44 ▶ map Dist::Zilla::Util->expand_config_package_name($_), $self->installer;
Branch: 1 branch
BranchTrueFalseTotal
if &any(sub { $_->isa("Dist::Zilla::Plugin::ModuleBuild"); } , map("Dist::Zilla::Util"->expand_config_package_name($_), $self->installer)) 0 44 44
318  
319 # this is better than injecting a perl prereq for 5.008, to allow MBT to
320 # become more 5.006-compatible in the future without forcing the distribution to be re-released.
321 die 'Module::Build::Tiny should not be used in distributions that are targeting perl 5.006!'
322 43 ▶ if any { /ModuleBuildTiny/ } $self->installer
Subroutine __ANON__: called CC=1 SCAR=0.0
323 and (not exists $self->payload->{'Test::MinimumVersion.max_target_perl'}
324 44 ▶ or $self->payload->{'Test::MinimumVersion.max_target_perl'} < '5.008');
Branch: 1 branch
BranchTrueFalseTotal
if &any(sub { /ModuleBuildTiny/; } , $self->installer) and !exists $self->payload->{"Test::MinimumVersion.max_target_perl"} || $self->payload->{"Test::MinimumVersion.max_target_perl"} < "5.008" 0 44 44
Condition50%3/6
&any(sub { /ModuleBuildTiny/; } , $self->installer) and !exists $self->payload->{"Test::MinimumVersion.max_target_perl"} || $self->payload->{"Test::MinimumVersion.max_target_perl"} < "5.008"
!ll&&!rl&&r
32120
not exists $self->payload->{"Test::MinimumVersion.max_target_perl"} or $self->payload->{"Test::MinimumVersion.max_target_perl"} < "5.008"
l!l&&r!l&&!r
0012
MC/DC0%0/3
&any(sub { /ModuleBuildTiny/; } , $self->installer) and !exists $self->payload->{"Test::MinimumVersion.max_target_perl"} || $self->payload->{"Test::MinimumVersion.max_target_perl"} < "5.008"
&any(sub { /ModuleBuildTiny/; } , $self->installer) not exists $self->payload->{"Test::MinimumVersion.max_target_perl"} $self->payload->{"Test::MinimumVersion.max_target_perl"} < "5.008"
Truth table50%2/4
A and not(B) or C
A= &any(sub { /ModuleBuildTiny/; } , $self->installer)B= not exists $self->payload->{"Test::MinimumVersion.max_target_perl"}C= $self->payload->{"Test::MinimumVersion.max_target_perl"} < "5.008"
ABCresult
0XX0
1000
11X1
1011
325  
326 44 ▶ warn '[@Author::ETHER] ', colored('.git is missing and META.json is present -- this looks like a CPAN download rather than a git repository. You should probably run '
Branch: 2 branches
BranchTrueFalseTotal
if not -d ".git" and -f "META.json" and not $self->_plugin_removed("Git::GatherDir") 0 44 44
-f 'Build.PL' ? : 0 0 0
Condition33%2/6
not -d ".git" and -f "META.json" and not $self->_plugin_removed("Git::GatherDir")
!ll&&!rl&&r
4400
not -d ".git" and -f "META.json"
!ll&&!rl&&r
0440
MC/DC0%0/3
not -d ".git" and -f "META.json" and not $self->_plugin_removed("Git::GatherDir")
not -d ".git" -f "META.json" not $self->_plugin_removed("Git::GatherDir")
Truth table25%1/4
not(A) and B and not(C)
A= not -d ".git"B= -f "META.json"C= not $self->_plugin_removed("Git::GatherDir")
ABCresult
0XX0
10X0
1100
1111
327 . (-f 'Build.PL' ? 'perl Build.PL; ./Build' : 'perl Makefile.PL; make') . ' instead of using dzil commands!', 'yellow'), "\n"
328 if not -d '.git' and -f 'META.json' and not $self->_plugin_removed('Git::GatherDir');
329  
330 # only set x_static_install using auto mode for my own distributions
331 # (for all other distributions, set explicitly to on or off)
332 # Note that this is just the default; if a dist.ini changed these values, ConfigSlicer will apply it later
333 44 ▶ my $static_install_mode = $self->payload->{'StaticInstall.mode'} // 'auto';
Condition100%2/2
$self->payload->{"StaticInstall.mode"} // "auto"
l!l
341
MC/DC100%1/1
$self->payload->{"StaticInstall.mode"} // "auto"
$self->payload->{"StaticInstall.mode"}
Truth table100%2/2
A
A= $self->payload->{"StaticInstall.mode"}
Aresult
11
00
334 44 ▶ my $static_install_dry_run = ($static_install_mode eq 'auto'
Branch: 1 branch
BranchTrueFalseTotal
$static_install_mode eq 'auto' && $self->authority ne 'cpan:ETHER' ? : 2 42 44
Condition100%3/3
$static_install_mode eq "auto" and $self->authority ne "cpan:ETHER"
!ll&&!rl&&r
3392
MC/DC100%2/2
$static_install_mode eq "auto" and $self->authority ne "cpan:ETHER"
$static_install_mode eq "auto" $self->authority ne "cpan:ETHER"
Truth table100%3/3
A and B
A= $static_install_mode eq "auto"B= $self->authority ne "cpan:ETHER"
ABresult
0X0
100
111
335 and $self->authority ne 'cpan:ETHER') ? 1 : 0;
336  
337 44 ▶ warn '[@Author::ETHER] ', colored('server = ' . $self->server
Branch: 1 branch
BranchTrueFalseTotal
if $self->server ne "github" and $self->server ne "none" 6 38 44
Condition100%3/3
$self->server ne "github" and $self->server ne "none"
!ll&&!rl&&r
22166
MC/DC100%2/2
$self->server ne "github" and $self->server ne "none"
$self->server ne "github" $self->server ne "none"
Truth table100%3/3
A and B
A= $self->server ne "github"B= $self->server ne "none"
ABresult
0X0
100
111
338 . ': recommend instead using server = github and GithubMeta.remote = '
339 . $self->server . ' with a read-only mirror', 'yellow'), "\n"
340 if $self->server ne 'github' and $self->server ne 'none';
341  
342 44 ▶ warn '[@Author::ETHER] ', colored('defunct .travis.yml file detected in repository', 'yellow'), "\n"
Branch: 1 branch
BranchTrueFalseTotal
if -f ".travis.yml" 0 44 44
343 if -f '.travis.yml';
344  
345 # method modifier will also apply default configs, compile plugin prereqs
346 $self->add_plugins(
347 # adding this first indicates the start of the bundle in x_Dist_Zilla metadata
348 [ 'Prereqs' => 'pluginbundle version' => {
349 '-phase' => 'develop', '-relationship' => 'recommends',
350 $self->meta->name => $self->VERSION,
351 } ],
352  
353 # VersionProvider
354 # see [@Git::VersionManager]
355  
356 # Before Build
357 # [ 'EnsurePrereqsInstalled' ], # FIXME: use options to make this less annoying!
358 [ 'PromptIfStale' => 'stale modules, build' => { phase => 'build', module => [ $self->meta->name ] } ],
359  
360 # ExecFiles
361 44 ▶ (-d ($self->payload->{'ExecDir.dir'} // 'script') || any { /^ExecDir\./ } keys %{ $self->payload })
Subroutine __ANON__: called CC=1 SCAR=0.1
Branch: 18 branches
BranchTrueFalseTotal
@never_gather ? : 44 0 44
$self->cpanfile ? : 1 43 44
$ENV{'CONTINUOUS_INTEGRATION'} ? : 0 44 44
&any(sub { $_ ne 'MakeMaker'; } , $self->installer) ? : 13 31 44
$self->surgical_podweaver ? : 0 44 44
$self->surgical_podweaver ? : 0 44 44
-f 'weaver.ini' ? : 1 43 44
$self->server eq 'github' ? : 22 22 44
$self->bugtracker eq 'github' ? : 1 21 22
$self->bugtracker eq 'rt' ? : 40 1 41
$self->server eq 'gitmo' ? : 1 40 41
$self->server eq 'p5sagit' ? : 1 39 40
$self->server eq 'catagits' ? : 1 38 39
$Dist::Zilla::PluginBundle::Author::ETHER::Config{'default_inc_excludes_dot'} ? : 41 0 41
$self->surgical_podweaver ? : 0 41 41
$self->_has_bash ? : 41 0 41
$self->airplane ? : 3 38 41
$self->fake_release ? : 3 38 41
362 ? [ 'ExecDir' => { dir => 'script' } ] : (),
363  
364 # Finders
365 [ 'FileFinder::ByName' => Examples => { dir => 'examples' } ],
366  
367 # Gather Files
368 [ 'Git::GatherDir' => { ':version' => '2.016', @never_gather ? ( exclude_filename => \@never_gather) : () } ],
369  
370 qw(MetaYAML MetaJSON Readme Manifest),
371  
372 $self->cpanfile ? [ 'CPANFile' ] : (),
373  
374 [ 'License' => { ':version' => '5.038', filename => $self->licence } ],
375 [ 'GenerateFile::FromShareDir' => 'generate CONTRIBUTING' => { -dist => 'Dist-Zilla-PluginBundle-Author-ETHER', -filename => 'CONTRIBUTING', has_xs => $has_xs } ],
376 [ 'InstallGuide' => { ':version' => '1.200005' } ],
377  
378 [ 'Test::Compile' => { ':version' => '2.039', bail_out_on_fail => 1, xt_mode => 1,
379 script_finder => [qw(:PerlExecFiles @Author::ETHER/Examples)] } ],
380 [ 'Test::NoTabs' => { ':version' => '0.08', finder => [qw(:InstallModules :ExecFiles @Author::ETHER/Examples :TestFiles :ExtraTestFiles)] } ],
381 [ 'Test::EOL' => { ':version' => '0.17', finder => [qw(:InstallModules :ExecFiles @Author::ETHER/Examples :TestFiles :ExtraTestFiles)] } ],
382 'MetaTests',
383 [ 'Test::CPAN::Changes' => { ':version' => '0.012' } ],
384 'Test::ChangesHasContent',
385 [ 'Test::MinimumVersion' => { ':version' => '2.000010', max_target_perl => '5.006' } ],
386 [ 'PodSyntaxTests' => { ':version' => '5.040' } ],
387 'Test::Pod::Coverage::TrustMe',
388 [ 'Test::PodSpelling' => { ':version' => '2.006003', stopwords => ['irc'], directories => [qw(examples lib script t xt)] } ],
389 #[Test::Pod::LinkCheck] many outstanding bugs
390 ($ENV{CONTINUOUS_INTEGRATION} ? () : [ 'Test::Pod::No404s' => { ':version' => '1.003' } ] ),
391 [ 'Test::Kwalitee' => { ':version' => '2.10', filename => 'xt/author/kwalitee.t' } ],
392 [ 'MojibakeTests' => { ':version' => '0.8' } ],
393 [ 'Test::ReportPrereqs' => { ':version' => '0.022', verify_prereqs => 1,
394 43 ▶ version_extractor => ( ( any { $_ ne 'MakeMaker' } $self->installer ) ? 'Module::Metadata' : 'ExtUtils::MakeMaker' ),
Subroutine __ANON__: called CC=1 SCAR=0.0
395 include => [ sort qw(autodie Encode File::Temp JSON::PP Module::Runtime Sub::Name YAML::XS YAML::PP) ] } ],
396 [ 'Test::Portability' => { ':version' => '2.000007' } ],
397 [ 'Test::CleanNamespaces' => { ':version' => '0.006' } ],
398  
399  
400 # Munge Files
401 [ 'Git::Describe' => { ':version' => '0.004', on_package_line => 1 } ],
402 [
403 ($self->surgical_podweaver ? 'SurgicalPodWeaver' : 'PodWeaver') => {
404 $self->surgical_podweaver ? () : ( ':version' => '4.008' ),
405 -f 'weaver.ini' ? () : ( config_plugin => '@Author::ETHER' ),
406 replacer => 'replace_with_comment',
407 post_code_replacer => 'replace_with_nothing',
408 }
409 ],
410  
411 # Metadata
412 $self->server eq 'github' ? [ 'GithubMeta' => {
413 ':version' => '0.54',
414 homepage => 0,
415 issues => ($self->bugtracker eq 'github' ? 1 : 0),
416 } ] : (),
417 [ 'AutoMetaResources' => {
418 $self->bugtracker eq 'rt' ? ( 'bugtracker.rt' => 1 ) : (),
419 $self->server eq 'gitmo' ? ( 'repository.gitmo' => 1 )
420 : $self->server eq 'p5sagit' ? ( 'repository.p5sagit' => 1 )
421 : $self->server eq 'catagits' ? ( 'repository.catagits' => 1 )
422 : ()
423 } ],
424 [ 'Authority' => { ':version' => '1.009', authority => $self->authority, do_munging => 0 } ],
425 [ 'MetaNoIndex' => { directory => [ qw(t xt), grep -d, qw(inc local perl5 fatlib eg examples share corpus demo ) ] } ],
426 [ 'MetaProvides::Package' => { ':version' => '1.15000002', finder => ':InstallModules', meta_noindex => 1, inherit_version => 0, inherit_missing => 0 } ],
427 'MetaConfig',
428 [ 'Keywords' => { ':version' => '0.004' } ],
429 ($Config{default_inc_excludes_dot} ? [ 'UseUnsafeInc' => { dot_in_INC => 0 } ] : ()),
430 # [Git::Contributors]
431 # [StaticInstall]
432  
433 # Register Prereqs
434 # (MakeMaker or other installer)
435 [ 'AutoPrereqs' => { ':version' => '5.038' } ],
436 [ 'Prereqs::AuthorDeps' => { ':version' => '0.006', phase => $self->plugin_prereq_phase, relation => $self->plugin_prereq_relationship } ],
437 [ 'MinimumPerl' => { ':version' => '1.006', configure_finder => ':NoFiles' } ],
438 ($self->surgical_podweaver ? [ 'Prereqs' => pod_weaving => {
439 '-phase' => $self->plugin_prereq_phase,
440 '-relationship' => $self->plugin_prereq_relationship,
441 'Dist::Zilla::Plugin::SurgicalPodWeaver' => 0
442 } ] : ()),
443  
444 # Install Tool (some are also Test Runners)
445 $self->installer, # options are set lower down, via %extra_args
446  
447 # we prefer this to run after other Register Prereqs plugins
448 [ 'Git::Contributors' => { ':version' => '0.029', order_by => 'commits' } ],
449  
450 # must appear after installers; also note that MBT::*'s static tweak is consequently adjusted, later
451 [ 'StaticInstall' => { ':version' => '0.005', mode => $static_install_mode, dry_run => $static_install_dry_run } ],
452  
453 # Test Runners (load after installers to avoid a rebuild)
454 [ 'RunExtraTests' => { ':version' => '0.024' } ],
455  
456 # After Build
457 'CheckSelfDependency',
458  
459 ( $self->_has_bash ?
460 [ 'Run::AfterBuild' => '.ackrc' => { ':version' => '0.038', quiet => 1, run => q{bash -c "test -e .ackrc && grep -q -- '--ignore-dir=.latest' .ackrc || echo '--ignore-dir=.latest' >> .ackrc; if [[ `dirname '%d'` != .build ]]; then test -e .ackrc && grep -q -- '--ignore-dir=%d' .ackrc || echo '--ignore-dir=%d' >> .ackrc; fi"} } ]
461 : ()),
462 [ 'Run::AfterBuild' => '.latest' => { ':version' => '0.041', quiet => 1, fatal_errors => 0, eval => q!if ('%d' =~ /^%n-[.[:xdigit:]]+$/) { unlink '.latest'; symlink '%d', '.latest'; }! } ],
463  
464  
465 # Before Release
466 [ 'CheckStrictVersion' => { decimal_only => 1 } ],
467 'CheckMetaResources',
468 'EnsureLatestPerl',
469 [ 'PromptIfStale' => 'stale modules, release' => { phase => 'release', check_all_plugins => 1, check_all_prereqs => 1 } ],
470  
471 # if in airplane mode, allow our uncommitted dist.ini edit which sets 'airplane = 1'
472 [ 'Git::Check' => 'initial check' => { allow_dirty => [ $self->airplane ? 'dist.ini' : '' ] } ],
473  
474 'Git::CheckFor::MergeConflicts',
475 [ 'Git::CheckFor::CorrectBranch' => { ':version' => '0.004', release_branch => 'master' } ],
476 [ 'Git::Remote::Check' => { branch => 'master', remote_branch => 'master' } ],
477 [ 'CheckPrereqsIndexed' => { ':version' => '0.019' } ],
478 'TestRelease',
479 [ 'Git::Check' => 'after tests' => { allow_dirty => [''] } ],
480 'CheckIssues',
481 # (ConfirmRelease)
482  
483 # Releaser
484 $self->fake_release
485 44 ▶ ? do { warn '[@Author::ETHER] ', colored('FAKE_RELEASE set - not uploading to CPAN', 'yellow'), "\n"; 'FakeRelease' }
Branch: 4 branches
BranchTrueFalseTotal
-d ($self->payload->{'ExecDir.dir'} // 'script') || &any(sub { /^ExecDir\./; } , keys %{$self->payload;}) ? : 0 44 44
$self->licence eq 'LICENSE' && -e 'LICENCE' ? : 0 41 41
$self->licence eq 'LICENCE' && -e 'LICENSE' ? : 0 41 41
-e 'README.md' ? : 0 41 41
Condition54%6/11
-d ($self->payload->{"ExecDir.dir"} // "script") or &any(sub { /^ExecDir\./; } , keys %{$self->payload;})
l!l&&r!l&&!r
0044
$self->payload->{"ExecDir.dir"} // "script"
l!l
044
$self->licence eq "LICENSE" and -e "LICENCE"
!ll&&!rl&&r
3920
$self->licence eq "LICENCE" and -e "LICENSE"
!ll&&!rl&&r
2390
MC/DC0%0/2
-d ($self->payload->{"ExecDir.dir"} // "script") or &any(sub { /^ExecDir\./; } , keys %{$self->payload;})
$self->payload->{"ExecDir.dir"} &any(sub { /^ExecDir\./; } , keys %{$self->payload;})
MC/DC0%0/2
$self->licence eq "LICENSE" and -e "LICENCE"
$self->licence eq "LICENSE" -e "LICENCE"
MC/DC0%0/2
$self->licence eq "LICENCE" and -e "LICENSE"
$self->licence eq "LICENCE" -e "LICENSE"
Truth table33%1/3
A or B
A= $self->payload->{"ExecDir.dir"}B= &any(sub { /^ExecDir\./; } , keys %{$self->payload;})
ABresult
1X1
011
000
Truth table66%2/3
A and B
A= $self->licence eq "LICENSE"B= -e "LICENCE"
ABresult
0X0
100
111
Truth table66%2/3
A and B
A= $self->licence eq "LICENCE"B= -e "LICENSE"
ABresult
0X0
100
111
486 : 'UploadToCPAN',
487  
488 # After Release
489 ( $self->licence eq 'LICENSE' && -e 'LICENCE' ?
490 [ 'Run::AfterRelease' => 'remove old LICENCE' => { ':version' => '0.038', quiet => 1, eval => q!unlink 'LICENCE'! } ]
491 : ()),
492 ( $self->licence eq 'LICENCE' && -e 'LICENSE' ?
493 [ 'Run::AfterRelease' => 'remove old LICENSE' => { ':version' => '0.038', quiet => 1, eval => q!unlink 'LICENSE'! } ]
494 : ()),
495 ( -e 'README.md' ?
496 [ 'Run::AfterRelease' => 'remove old READMEs' => { ':version' => '0.038', quiet => 1, eval => q!unlink 'README.md'! } ]
497 : ()),
498  
499 [ 'CopyFilesFromRelease' => 'copy generated files' => { filename => [ $self->copy_files_from_release ] } ],
500 [ 'ReadmeAnyFromPod' => { ':version' => '0.142180', type => 'pod', location => 'root', phase => 'release' } ],
501 );
502  
503 # plugins to do with calculating, munging, incrementing versions
504 41 $self->add_bundle('@Git::VersionManager' => {
505 # Take care! runtime-requires prereqs needs to be updated in dist.ini when this is changed.
506 ':version' => '0.007',
507  
508 'RewriteVersion::Transitional.:version' => 0.006,
509 'RewriteVersion::Transitional.global' => 1,
510 'RewriteVersion::Transitional.fallback_version_provider' => 'Git::NextVersion',
511 'RewriteVersion::Transitional.version_regexp' => '^v([\d._]+)(-TRIAL)?$',
512  
513 # for first Git::Commit
514 commit_files_after_release => [ $self->commit_files_after_release ],
515 # because of [Git::Check], only files copied from the release would be added -- there is nothing else
516 # hanging around in the current directory
517 'release snapshot.add_files_in' => ['.'],
518 'release snapshot.commit_msg' => '%N-%v%t%n%n%c',
519  
520 'Git::Tag.tag_message' => "v%v%t%n%n%c",
521  
522 # if the caller set bump_only_matching_versions, then this global setting falls on the floor automatically
523 # because the bundle uses the non-Transitional plugin in that case.
524 'BumpVersionAfterRelease::Transitional.global' => 1,
525 'BumpVersionAfterRelease::Transitional.finder' => [ ':InstallModules' ], # removed :ExecFiles
526  
527 'NextRelease.:version' => '5.033',
528 'NextRelease.time_zone' => 'UTC',
529 'NextRelease.format' => '%-' . ($self->changes_version_columns - 2) . 'v %{yyyy-MM-dd HH:mm:ss\'Z\'}d%{ (TRIAL RELEASE)}T',
530  
531 # 0.003 and earlier uses develop-suggests unconditionally, so we need not specify a minimum version
532 # for the default case here.
533 plugin_prereq_phase => $self->plugin_prereq_phase,
534 plugin_prereq_relationship => $self->plugin_prereq_relationship,
535 });
536  
537 41 ▶ $self->add_plugins(
Branch: 1 branch
BranchTrueFalseTotal
$self->server eq 'github' ? : 22 19 41
538 'Git::Push',
539 $self->server eq 'github' ? [ 'GitHub::Update' => { ':version' => '0.40', metacpan => 1 } ] : (),
540 );
541  
542 # install with an author-specific URL from PAUSE, so cpanm-reporter knows where to submit the report
543 # hopefully the file is available at this location soonish after release!
544 41 my $pause_download_url = $self->_pause_download_url;;
545 41 ▶ $self->add_plugins(
Branch: 1 branch
BranchTrueFalseTotal
if $pause_download_url 41 0 41
546 [ 'Run::AfterRelease' => 'install release' => {
547 ':version' => '0.031', fatal_errors => 0, run => 'cpanm '.$pause_download_url } ],
548 ) if $pause_download_url;
549  
550 # halt release after pre-release checks, but before ConfirmRelease
551 41 ▶ $self->add_plugins('BlockRelease') if $self->airplane;
Branch: 1 branch
BranchTrueFalseTotal
if $self->airplane 3 38 41
552  
553 41 $self->add_plugins(
554 [ 'Run::AfterRelease' => 'release complete' => { ':version' => '0.038', quiet => 1, eval => [ qq{print "release complete!\\xa"} ] } ],
555 # listed late, to allow all other plugins which do BeforeRelease checks to run first.
556 'ConfirmRelease',
557 );
558  
559 # if ModuleBuildTiny(::*) is being used, disable its static option if
560 # [StaticInstall] is being run with mode=off or dry_run=1
561 41 ▶ if (($static_install_mode eq 'off' or $static_install_dry_run)
Branch: 1 branch
BranchTrueFalseTotal
if ($static_install_mode eq "off" || $static_install_dry_run and &any(sub { /^ModuleBuildTiny/; } , $self->installer)) 2 39 41
Condition100%6/6
$static_install_mode eq "off" || $static_install_dry_run and &any(sub { /^ModuleBuildTiny/; } , $self->installer)
!ll&&!rl&&r
3722
$static_install_mode eq "off" or $static_install_dry_run
l!l&&r!l&&!r
2237
MC/DC33%1/3
$static_install_mode eq "off" || $static_install_dry_run and &any(sub { /^ModuleBuildTiny/; } , $self->installer)
$static_install_mode eq "off" $static_install_dry_run &any(sub { /^ModuleBuildTiny/; } , $self->installer)
Truth table60%3/5
A or B and C
A= $static_install_mode eq "off"B= $static_install_dry_runC= &any(sub { /^ModuleBuildTiny/; } , $self->installer)
ABCresult
00X0
1X00
0100
1X11
0111
562 4 ▶ and any { /^ModuleBuildTiny/ } $self->installer) {
Subroutine __ANON__: called CC=1 SCAR=0.0
563 2 my $mbt = Dist::Zilla::Util->expand_config_package_name('ModuleBuildTiny');
564 2 ▶ my $mbt_spec = first { $_->[1] =~ /^$mbt/ } @{ $self->plugins };
Subroutine __ANON__: called CC=1 SCAR=0.0
565  
566 2 $mbt_spec->[-1]{static} = 'no';
567 }
568  
569 # add used plugins to desired prereq section
570 $self->add_plugins(
571 [ 'Prereqs' => 'prereqs for @Author::ETHER' => {
572 '-phase' => $self->plugin_prereq_phase,
573 '-relationship' => $self->plugin_prereq_relationship,
574 41 ▶ %{ $self->_plugin_requirements_as_string_hash } } ]
Branch: 1 branch
BranchTrueFalseTotal
if $self->plugin_prereq_phase and $self->plugin_prereq_relationship 40 1 41
Condition66%2/3
$self->plugin_prereq_phase and $self->plugin_prereq_relationship
!ll&&!rl&&r
1040
MC/DC50%1/2
$self->plugin_prereq_phase and $self->plugin_prereq_relationship
$self->plugin_prereq_phase $self->plugin_prereq_relationship
Truth table66%2/3
A and B
A= $self->plugin_prereq_phaseB= $self->plugin_prereq_relationship
ABresult
0X0
100
111
575 ) if $self->plugin_prereq_phase and $self->plugin_prereq_relationship;
576  
577 # listed last, to be sure we run at the very end of each phase
578 $self->add_plugins(
579 [ 'VerifyPhases' => 'PHASE VERIFICATION' => { ':version' => '0.015' } ]
580 41 ▶ ) if ($ENV{USER} // '') eq 'ether';
Branch: 1 branch
BranchTrueFalseTotal
if ($ENV{"USER"} // "") eq "ether" 0 41 41
Condition50%1/2
$ENV{"USER"} // ""
l!l
410
MC/DC0%0/1
$ENV{"USER"} // ""
$ENV{"USER"}
Truth table50%1/2
A
A= $ENV{"USER"}
Aresult
11
00
581 }
582  
583 # determine plugin prereqs, and apply default configs (respecting superclasses, roles)
584 207 ▶around add_plugins => sub {
Subroutine __ANON__: called CC=12 SCAR=24.9
585 207 my ($orig, $self, @plugins) = @_;
586  
587 @plugins = grep {
588 207 my $plugin = $_;
589 2752 my $plugin_package = Dist::Zilla::Util->expand_config_package_name($plugin->[0]);
590 32624 ▶ none {
Subroutine __ANON__: called CC=4 SCAR=13.9
591 32624 ▶ $plugin_package eq Dist::Zilla::Util->expand_config_package_name($_) # match by package name
Branch: 1 branch
BranchTrueFalseTotal
$plugin_package eq "Dist::Zilla::Util"->expand_config_package_name($_) or $plugin->[1] and not ref $plugin->[1] and $plugin->[1] eq $_ 448 32176 32624
Condition100%9/9
$plugin_package eq 'Dist::Zilla::Util'->expand_config_package_name($_) || $plugin->[1] && !ref($plugin->[1]) && $plugin->[1] eq $_
l!l&&r!l&&!r
448132175
$plugin->[1] and not ref $plugin->[1] and $plugin->[1] eq $_
!ll&&!rl&&r
2643657391
$plugin->[1] and not ref $plugin->[1]
!ll&&!rl&&r
8920175165740
MC/DC100%4/4
$plugin_package eq 'Dist::Zilla::Util'->expand_config_package_name($_) || $plugin->[1] && !ref($plugin->[1]) && $plugin->[1] eq $_
$plugin_package eq 'Dist::Zilla::Util'->expand_config_package_name($_) $plugin->[1] not ref $plugin->[1] $plugin->[1] eq $_
Truth table100%5/5
A || B and not(C) and D
A= $plugin_package eq 'Dist::Zilla::Util'->expand_config_package_name($_)B= $plugin->[1]C= not ref $plugin->[1]D= $plugin->[1] eq $_
ABCDresult
1XXX1
01111
00XX0
010X0
01100
592 or ($plugin->[1] and not ref $plugin->[1] and $plugin->[1] eq $_) # match by moniker
593 2752 ▶ } $self->_removed_plugins
Branch: 1 branch
BranchTrueFalseTotal
ref $_ ? : 2012 740 2752
594 } map +(ref $_ ? $_ : [ $_ ]), @plugins;
595  
596 207 foreach my $plugin_spec (@plugins) {
597 # these should never be added as plugin prereqs
598 2303 ▶ next if $plugin_spec->[0] eq 'BlockRelease' # temporary use during development
Branch: 1 branch
BranchTrueFalseTotal
if $plugin_spec->[0] eq "BlockRelease" or $plugin_spec->[0] eq "VerifyPhases" 3 2300 2303
Condition66%2/3
$plugin_spec->[0] eq "BlockRelease" or $plugin_spec->[0] eq "VerifyPhases"
l!l&&r!l&&!r
302300
MC/DC50%1/2
$plugin_spec->[0] eq "BlockRelease" or $plugin_spec->[0] eq "VerifyPhases"
$plugin_spec->[0] eq "BlockRelease" $plugin_spec->[0] eq "VerifyPhases"
Truth table66%2/3
A or B
A= $plugin_spec->[0] eq "BlockRelease"B= $plugin_spec->[0] eq "VerifyPhases"
ABresult
1X1
011
000
599 or $plugin_spec->[0] eq 'VerifyPhases'; # only used by ether, not others
600  
601 2300 my $plugin = Dist::Zilla::Util->expand_config_package_name($plugin_spec->[0]);
602 2300 require_module($plugin);
603  
604 2300 ▶ push @$plugin_spec, {} if not ref $plugin_spec->[-1];
Branch: 1 branch
BranchTrueFalseTotal
unless ref $plugin_spec->[-1] 656 1644 2300
605 2300 my $payload = $plugin_spec->[-1];
606  
607 2300 ▶ foreach my $module (grep +($plugin->isa($_) or $plugin->does($_)), keys %extra_args) {
Condition100%3/3
$plugin->isa($_) || $plugin->does($_)
l!l&&r!l&&!r
408015980
MC/DC100%2/2
$plugin->isa($_) || $plugin->does($_)
$plugin->isa($_) $plugin->does($_)
Truth table100%3/3
A || B
A= $plugin->isa($_)B= $plugin->does($_)
ABresult
1X1
011
000
608 120 my %configs = %{ $extra_args{$module} }; # copy, not reference!
609  
610 # don't keep :version unless it matches the package exactly, but still respect the prereq
611 $self->_add_minimum_plugin_requirement($module => delete $configs{':version'})
612 120 ▶ if exists $configs{':version'} and $module ne $plugin;
Branch: 1 branch
BranchTrueFalseTotal
if exists $configs{":version"} and $module ne $plugin 0 120 120
Condition66%2/3
exists $configs{":version"} and $module ne $plugin
!ll&&!rl&&r
108120
MC/DC0%0/2
exists $configs{":version"} and $module ne $plugin
exists $configs{":version"} $module ne $plugin
Truth table66%2/3
A and B
A= exists $configs{":version"}B= $module ne $plugin
ABresult
0X0
100
111
613  
614 # we don't need to worry about overwriting the payload with defaults, as
615 # ConfigSlicer will copy them back over later on.
616 120 @{$payload}{keys %configs} = values %configs;
617 }
618  
619 # record prereq (and version) for later possible injection
620 # (Note: this depends on $CWD being equal to $zilla->root)
621 $self->_add_minimum_plugin_requirement($plugin => $payload->{':version'} // 0)
622 2300 ▶ if not -f do { (my $filename = $plugin) =~ s{::}{/}g; $filename .= '.pm' };
Branch: 1 branch
BranchTrueFalseTotal
unless -f do { (my $filename = $plugin) =~ s[::][/]g; $filename .= '.pm' } 2299 1 2300
Condition100%2/2
$payload->{":version"} // 0
l!l
12801019
MC/DC100%1/1
$payload->{":version"} // 0
$payload->{":version"}
Truth table100%2/2
A
A= $payload->{":version"}
Aresult
11
00
623 }
624  
625 207 return $self->$orig(@plugins);
626 22 };
627  
628 42 ▶around add_bundle => sub {
Subroutine __ANON__: called CC=6 SCAR=19.1
629 42 my ($orig, $self, $bundle, $payload) = @_;
630  
631 42 ▶ return if $self->_plugin_removed($bundle);
Branch: 1 branch
BranchTrueFalseTotal
if $self->_plugin_removed($bundle) 0 42 42
632  
633 42 my $package = Dist::Zilla::Util->expand_config_package_name($bundle);
634 &use_module(
635 $package,
636 42 ▶ $payload && $payload->{':version'} ? $payload->{':version'} : (),
Branch: 1 branch
BranchTrueFalseTotal
$payload && $payload->{':version'} ? : 42 0 42
Condition33%1/3
$payload and $payload->{":version"}
!ll&&!rl&&r
0042
MC/DC0%0/2
$payload and $payload->{":version"}
$payload $payload->{":version"}
Truth table33%1/3
A and B
A= $payloadB= $payload->{":version"}
ABresult
0X0
100
111
637 );
638  
639 # default configs can be passed in directly - no need to consult %extra_args
640  
641 # record plugin prereq of bundle only, not its components (it should do that itself)
642 42 ▶ $self->_add_minimum_plugin_requirement($package => $payload->{':version'} // 0);
Condition50%1/2
$payload->{":version"} // 0
l!l
420
MC/DC0%0/1
$payload->{":version"} // 0
$payload->{":version"}
Truth table50%1/2
A
A= $payload->{":version"}
Aresult
11
00
643  
644 # allow config slices to propagate down from the user
645 $payload = {
646 %$payload, # caller bundle's default settings for this bundle, passed to this sub
647 # custom configs from the user, which may override defaults
648 42 (map +($_ => $self->payload->{$_}), grep /^(.+?)\.(.+?)/, keys %{ $self->payload }),
649 };
650  
651 # allow the user to say -remove = <plugin added in subbundle>, but also do not override
652 # any removals that were passed into this sub directly.
653 42 push @{$payload->{-remove}}, @{ $self->payload->{ $self->plugin_remover_attribute } }
654 42 ▶ if $self->payload->{ $self->plugin_remover_attribute };
Branch: 1 branch
BranchTrueFalseTotal
if $self->payload->{$self->plugin_remover_attribute} 42 0 42
655  
656 42 return $self->$orig($bundle, $payload);
657 22 };
658  
659 # patch around broken Dist::Zilla 6.034+
660 # known affected modules:
661 # Dist::Zilla::App::Command::stale
662 # Dist::Zilla::Plugin::EnsurePrereqsInstalled
663 # Dist::Zilla::Plugin::Prereqs::AuthorDeps
664 # Dist::Zilla::Plugin::PromptIfStale
665 22 +require Dist::Zilla::Util::AuthorDeps;
666 *Dist::Zilla::Util::AuthorDeps::extract_author_deps = \&Dist::Zilla::Util::AuthorDeps::_extract_author_deps
667 22 ▶ if eval { Dist::Zilla::Util::AuthorDeps->VERSION(6.034); 1 }
Branch: 1 branch
BranchTrueFalseTotal
if eval { do { "Dist::Zilla::Util::AuthorDeps"->VERSION("6.034"); 1 } } and not "Dist::Zilla::Util::AuthorDeps"->can("extract_author_deps") 0 22 22
Condition33%1/3
eval { do { "Dist::Zilla::Util::AuthorDeps"->VERSION("6.034"); 1 } } and not "Dist::Zilla::Util::AuthorDeps"->can("extract_author_deps")
!ll&&!rl&&r
0220
MC/DC0%0/2
eval { do { "Dist::Zilla::Util::AuthorDeps"->VERSION("6.034"); 1 } } and not "Dist::Zilla::Util::AuthorDeps"->can("extract_author_deps")
eval { do { "Dist::Zilla::Util::AuthorDeps"->VERSION("6.034"); 1 } } not "Dist::Zilla::Util::AuthorDeps"->can("extract_author_deps")
Truth table33%1/3
A and not(B)
A= eval { do { "Dist::Zilla::Util::AuthorDeps"->VERSION("6.034"); 1 } }B= not "Dist::Zilla::Util::AuthorDeps"->can("extract_author_deps")
ABresult
0X0
100
111
668 and not Dist::Zilla::Util::AuthorDeps->can('extract_author_deps');
669  
670 22 __PACKAGE__->meta->make_immutable;
671  
672 __END__
↑ Summary Pod/Weaver/PluginBundle/Author/ETHER.pm »