lib/Module/Provision/Base.pm

filter: Statementstmt 45.7% 92 / 201 Branchbran 1.6% 1 / 62 Conditioncond 0.0% 0 / 28 MC/DCmcdc 0.0% 0 / 16 Subroutinesub 41.5% 22 / 53 Podpod 100% 3 / 3 totaltotal 32.5% 118 / 363 CC 45 SCAR 27.5
CC
45
Cov
32%
_build_appbase
56.0
_build_appldir
42.0
_build_vcs
42.0
CRAP 15.6
« lib/Module/Provision/TraitFor/UpdatingContent.pm ↑ Summary blib/lib/auto/share/dist/Module-Provision/boilerplate.pm »
1 package Module::Provision::Base;
2  
3 1 ▶use namespace::autoclean;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 1 ▶use Class::Usul::Constants qw( EXCEPTION_CLASS NUL SPC TRUE );
Subroutine BEGIN: called CC=1 SCAR=0.0
6 1 ▶use Class::Usul::Functions qw( app_prefix class2appdir classdir
Subroutine BEGIN: called CC=1 SCAR=0.0
7 1 distname first_char io is_arrayref throw );
8 1 ▶use Class::Usul::Time qw( time2str );
Subroutine BEGIN: called CC=1 SCAR=0.0
9 1 ▶use CPAN::Meta;
Subroutine BEGIN: called CC=1 SCAR=0.0
10 1 ▶use English qw( -no_match_vars );
Subroutine BEGIN: called CC=1 SCAR=0.0
11 1 ▶use File::DataClass::Types qw( ArrayRef Directory HashRef NonEmptySimpleStr
Subroutine BEGIN: called CC=1 SCAR=0.0
12 Object OctalNum Path PositiveInt
13 1 SimpleStr Undef );
14 1 ▶use Module::Metadata;
Subroutine BEGIN: called CC=1 SCAR=0.0
15 1 ▶use Perl::Version;
Subroutine BEGIN: called CC=1 SCAR=0.0
16 1 ▶use Try::Tiny;
Subroutine BEGIN: called CC=1 SCAR=0.0
17 1 ▶use Type::Utils qw( enum );
Subroutine BEGIN: called CC=1 SCAR=0.0
18 1 ▶use Unexpected::Functions qw( Unspecified );
Subroutine BEGIN: called CC=1 SCAR=0.0
19 1 ▶use Moo;
Subroutine BEGIN: called CC=1 SCAR=0.0
20 1 ▶use Class::Usul::Options;
Subroutine BEGIN: called CC=1 SCAR=0.0
21  
22 1 extends q(Class::Usul::Programs);
23  
24 1 my %BUILDERS = ( 'DZ' => 'dist.ini', 'MB' => 'Build.PL', );
25 1 my $BUILDER = enum 'Builder' => [ qw( DZ MB ) ];
26 1 my $VCS = enum 'VCS' => [ qw( git none svn ) ];
27  
28 # Override defaults in base class
29 1 ▶has '+config_class' => default => sub { 'Module::Provision::Config' };
Subroutine __ANON__: called CC=1 SCAR=0.0
30  
31 # Object attributes (public)
32 # Visible to the command line
33 option 'base' => is => 'lazy', isa => Path, format => 's',
34 documentation => 'Directory containing new projects',
35 0 ▶ builder => sub { $_[ 0 ]->config->base }, coerce => TRUE;
Subroutine __ANON__: not called CC=1 SCAR=1.2
36  
37 1 option 'branch' => is => 'lazy', isa => SimpleStr, format => 's',
38 documentation => 'The name of the initial branch to create', short => 'b';
39  
40 1 option 'builder' => is => 'lazy', isa => $BUILDER, format => 's',
41 documentation => 'Which build system to use: DZ or MB';
42  
43 option 'license' => is => 'ro', isa => NonEmptySimpleStr, format => 's',
44 documentation => 'License used for the project',
45 1 ▶ builder => sub { $_[ 0 ]->config->license };
Subroutine __ANON__: called CC=1 SCAR=0.0
46  
47 1 option 'perms' => is => 'ro', isa => OctalNum, format => 'i',
48 documentation => 'Default permission for file / directory creation',
49 default => '640', coerce => TRUE;
50  
51 option 'plugins' => is => 'ro', isa => ArrayRef[NonEmptySimpleStr],
52 documentation => 'Name of optional plugins to load, comma separated list',
53 1 ▶ builder => sub { [] }, format => 's', short => 'M',
Subroutine _build_plugins: called CC=1 SCAR=0.0
54 1 ▶ coerce => sub { (is_arrayref $_[ 0 ])
Subroutine __ANON__: called CC=2 SCAR=7.6
Branch: 1 branch
BranchTrueFalseTotal
&is_arrayref($_[0]) ? : 1 0 1
55 1 ? $_[ 0 ] : [ split m{ , }mx, $_[ 0 ] ] };
56  
57 1 option 'project' => is => 'lazy', isa => NonEmptySimpleStr, format => 's',
58 documentation => 'Package name of the new projects main module';
59  
60 option 'repository' => is => 'ro', isa => NonEmptySimpleStr, format => 's',
61 documentation => 'Directory containing the SVN repository',
62 1 ▶ builder => sub { $_[ 0 ]->config->repository };
Subroutine _build_repository: called CC=1 SCAR=0.0
63  
64 1 option 'vcs' => is => 'lazy', isa => $VCS, format => 's',
65 documentation => 'Which VCS to use: git, none, or svn';
66  
67 # Ingnored by the command line
68 1 has 'appbase' => is => 'lazy', isa => Path, coerce => TRUE;
69  
70 1 has 'appldir' => is => 'lazy', isa => Path, coerce => TRUE;
71  
72 has 'branch_file' => is => 'lazy', isa => Path, coerce => TRUE,
73 0 ▶ builder => sub { [ $_[ 0 ]->appbase, '.branch' ] };
Subroutine __ANON__: not called CC=1 SCAR=1.2
74  
75 has 'binsdir' => is => 'lazy', isa => Path, coerce => TRUE,
76 0 ▶ builder => sub { [ $_[ 0 ]->appldir, 'bin' ] };
Subroutine __ANON__: not called CC=1 SCAR=1.2
77  
78 1 has 'default_branch' => is => 'lazy', isa => SimpleStr;
79  
80 has 'dist_module' => is => 'lazy', isa => Path, coerce => TRUE,
81 0 ▶ builder => sub { [ $_[ 0 ]->homedir.'.pm' ] };
Subroutine __ANON__: not called CC=1 SCAR=1.2
82  
83 1 has 'dist_version' => is => 'lazy', isa => Object, clearer => TRUE;
84  
85 has 'distname' => is => 'lazy', isa => NonEmptySimpleStr,
86 0 ▶ builder => sub { distname $_[ 0 ]->project };
Subroutine _build_distname: not called CC=1 SCAR=1.2
87  
88 1 has 'exec_perms' => is => 'lazy', isa => PositiveInt;
89  
90 1 has 'homedir' => is => 'lazy', isa => Path, coerce => TRUE;
91  
92 has 'incdir' => is => 'lazy', isa => Path, coerce => TRUE,
93 0 ▶ builder => sub { [ $_[ 0 ]->appldir, 'inc' ] };
Subroutine _build_incdir: not called CC=1 SCAR=1.2
94  
95 has 'initial_wd' => is => 'ro', isa => Directory,
96 1 ▶ builder => sub { io()->cwd };
Subroutine _build_initial_wd: called CC=1 SCAR=0.0
97  
98 has 'libdir' => is => 'lazy', isa => Path, coerce => TRUE,
99 0 ▶ builder => sub { [ $_[ 0 ]->appldir, 'lib' ] };
Subroutine __ANON__: not called CC=1 SCAR=1.2
100  
101 1 has 'license_keys' => is => 'lazy', isa => HashRef;
102  
103 1 has 'manifest_paths' => is => 'lazy', isa => ArrayRef, init_arg => undef;
104  
105 1 has 'module_abstract' => is => 'lazy', isa => NonEmptySimpleStr;
106  
107 0 ▶has 'module_metadata' => is => 'lazy', isa => Object | Undef, builder => sub {
Subroutine __ANON__: not called CC=1 SCAR=6.9
108 0 Module::Metadata->new_from_file
109 ( $_[ 0 ]->dist_module->abs2rel( $_[ 0 ]->appldir ), collect_pod => 1 ) },
110 1 clearer => TRUE;
111  
112 1 has 'project_file' => is => 'lazy', isa => NonEmptySimpleStr;
113  
114 1 has 'stash' => is => 'lazy', isa => HashRef;
115  
116 has 'testdir' => is => 'lazy', isa => Path, coerce => TRUE,
117 0 ▶ builder => sub { [ $_[ 0 ]->appldir, 't' ] };
Subroutine _build_testdir: not called CC=1 SCAR=1.2
118  
119 # Private functions
120 0 ▶my $_builders = sub {
Subroutine __ANON__: not called CC=1 SCAR=6.9
121 0 return (sort keys %BUILDERS);
122 1 };
123  
124 0 ▶my $_get_module_from = sub { # Return main module name from project file
Subroutine __ANON__: not called CC=2 SCAR=17.9
125 return
126 0 (map { s{ [-] }{::}gmx; $_ }
127 0 ▶ map { m{ \A [q\'\"] }mx ? eval $_ : $_ }
Branch: 1 branch
BranchTrueFalseTotal
/ \A [q\'\"] /mx ? : 0 0 0
128 0 map { m{ \A \s* (?:module_name|module|name)
129 \s+ [=]?[>]? \s* ([^,;]+) [,;]? }imx }
130 0 grep { m{ \A \s* (module|name) }imx }
131 split m{ [\n] }mx, $_[ 0 ])[ 0 ];
132 1 };
133  
134 0 ▶my $_parse_manifest_line = sub { # Robbed from ExtUtils::Manifest
Subroutine __ANON__: not called CC=2 SCAR=17.9
135 0 my $line = shift; my ($file, $comment);
136  
137 # May contain spaces if enclosed in '' (in which case, \\ and \' are escapes)
138 0 ▶ if (($file, $comment) = $line =~ m{ \A \' (\\[\\\']|.+)+ \' \s* (.*) }mx) {
Branch: 1 branch
BranchTrueFalseTotal
if (() = $line =~ / \A \' (\\[\\\']|.+)+ \' \s* (.*) /mx) { } 0 0 0
139 0 $file =~ s{ \\ ([\\\']) }{$1}gmx;
140 }
141 else {
142 0 ($file, $comment) = $line =~ m{ \A (\S+) \s* (.*) }mx;
143 }
144  
145 0 return [ $file, $comment ];
146 1 };
147  
148 0 ▶my $_get_project_file = sub {
Subroutine __ANON__: not called CC=5 SCAR=34.0
149 0 my $dir = shift; my $prev;
150  
151 0 ▶ while (not $prev or $prev ne $dir) { # Search for dist.ini first
Branch: 1 branch
BranchTrueFalseTotal
if (not $prev or $prev ne $dir) 0 0 0
Condition0%0/3
not $prev or $prev ne $dir
l!l&&r!l&&!r
000
MC/DC0%0/2
not $prev or $prev ne $dir
not $prev $prev ne $dir
Truth table0%0/3
not(A) or B
A= not $prevB= $prev ne $dir
ABresult
1X1
011
000
152 0 for my $file (map { $dir->catfile( $BUILDERS{ $_ } ) } $_builders->()) {
153 0 ▶ $file->exists and return $file
Branch: 1 branch
BranchTrueFalseTotal
$file->exists and return $file 0 0 0
154 }
155  
156 0 $prev = $dir; $dir = $dir->parent;
157 }
158  
159 0 return;
160 1 };
161  
162 # Construction
163 1 ▶sub BUILD {
Subroutine BUILD: called CC=3 SCAR=18.8
Pod documented
164 1 my $self = shift;
165  
166 1 for my $plugin (@{ $self->plugins }) {
167 0 ▶ if (first_char $plugin eq '+') { $plugin = substr $plugin, 1 }
Branch: 1 branch
BranchTrueFalseTotal
if (&first_char($plugin) eq '+') { } 0 0 0
168 0 else { $plugin = "Module::Provision::TraitFor::${plugin}" }
169  
170 0 ▶ try { Role::Tiny->apply_roles_to_object( $self, $plugin ) }
Subroutine __ANON__: not called CC=1 SCAR=6.9
171 0 ▶ catch {
Subroutine __ANON__: not called CC=2 SCAR=17.9
172 0 ▶ $_ =~ m{ \ACan\'t \s+ locate }mx
Branch: 1 branch
BranchTrueFalseTotal
$_ =~ / \ACan\'t \s+ locate /mx and &throw("Package [_1] not found in \@INC", [$plugin]) 0 0 0
173 and throw 'Package [_1] not found in @INC', [ $plugin ];
174 0 throw $_;
175 0 };
176 }
177  
178 1 return;
179 }
180  
181 0 ▶sub _build_appbase { # Base + distname
Subroutine _build_appbase: not called CC=7 SCAR=40.3
182 0 my $self = shift;
183 0 my $base = $self->base->absolute( $self->initial_wd );
184 0 my $appbase = $base->catdir( $self->distname );
185  
186 0 ▶ $appbase->exists and return $appbase;
Branch: 1 branch
BranchTrueFalseTotal
$appbase->exists and return $appbase 0 0 0
187  
188 # This is so you can rename the dist directory
189 0 my $file = $_get_project_file->( $self->initial_wd );
190 0 ▶ my $grand_parent = $file && $file->parent && $file->parent->parent;
Condition0%0/6
$file && $file->parent && $file->parent->parent
!ll&&!rl&&r
000
$file and $file->parent
!ll&&!rl&&r
000
MC/DC0%0/3
$file && $file->parent && $file->parent->parent
$file $file->parent $file->parent->parent
Truth table0%0/4
A and B && C
A= $fileB= $file->parentC= $file->parent->parent
ABCresult
0XX0
10X0
1100
1111
191  
192 0 ▶ $grand_parent and $grand_parent !~ m{ \.build \z }mx
Branch: 1 branch
BranchTrueFalseTotal
$grand_parent and not $grand_parent =~ / \.build \z /mx and $grand_parent->exists and return $grand_parent 0 0 0
Condition0%0/6
$grand_parent and not $grand_parent =~ / \.build \z /mx and $grand_parent->exists
!ll&&!rl&&r
000
$grand_parent and not $grand_parent =~ / \.build \z /mx
!ll&&!rl&&r
000
MC/DC0%0/3
$grand_parent and not $grand_parent =~ / \.build \z /mx and $grand_parent->exists
$grand_parent not $grand_parent =~ / \.build \z /mx $grand_parent->exists
Truth table0%0/4
A and not(B) and C
A= $grand_parentB= not $grand_parent =~ / \.build \z /mxC= $grand_parent->exists
ABCresult
0XX0
10X0
1100
1111
193 and $grand_parent->exists and return $grand_parent;
194  
195 0 return $appbase;
196 }
197  
198 0 ▶sub _build_appldir {
Subroutine _build_appldir: not called CC=6 SCAR=37.4
199 0 my $self = shift; my $appbase = $self->appbase; my $branch = $self->branch;
200  
201 0 my $home = $self->config->my_home; my $vcs = $self->vcs;
202  
203 0 (my $rel_appbase = $appbase) =~ s{ \Q$home\E [\\/] }{}mx;
204  
205 0 ▶ $self->debug and $self->info
Branch: 1 branch
BranchTrueFalseTotal
$self->debug and $self->info("Appbase: $rel_appbase, Branch: $branch, VCS: $vcs") 0 0 0
206 ( "Appbase: ${rel_appbase}, Branch: ${branch}, VCS: ${vcs}" );
207  
208 0 ▶ return $vcs eq 'none' ? $appbase
Branch: 4 branches
BranchTrueFalseTotal
$vcs eq 'none' ? : 0 0 0
$appbase->catdir('.git')->exists ? : 0 0 0
$appbase->catdir('.svn')->exists ? : 0 0 0
$appbase->catdir($branch)->exists ? : 0 0 0
209 : $appbase->catdir( '.git' )->exists ? $appbase
210 : $appbase->catdir( '.svn' )->exists ? $appbase
211 : $appbase->catdir( $branch )->exists ? $appbase->catdir( $branch )
212 : undef;
213 }
214  
215 0 ▶sub _build_branch {
Subroutine _build_branch: not called CC=3 SCAR=24.8
216 0 ▶ my $self = shift; my $branch = $ENV{BRANCH}; $branch and return $branch;
Branch: 1 branch
BranchTrueFalseTotal
$branch and return $branch 0 0 0
217  
218 0 ▶ $self->branch_file->exists and return $self->branch_file->chomp->getline;
Branch: 1 branch
BranchTrueFalseTotal
$self->branch_file->exists and return $self->branch_file->chomp->getline 0 0 0
219  
220 0 return $self->default_branch;
221 }
222  
223 0 ▶sub _build_builder {
Subroutine _build_builder: not called CC=3 SCAR=24.8
224 0 my $self = shift; my $appldir = $self->appldir;
225  
226 0 for (map { [ $appldir->catfile( $BUILDERS{ $_ } ), $_ ] } $_builders->()) {
227 0 ▶ $_->[ 0 ]->exists and return $_->[ 1 ];
Branch: 1 branch
BranchTrueFalseTotal
$_->[0]->exists and return $_->[1] 0 0 0
228 }
229  
230 0 return;
231 }
232  
233 0 ▶sub _build_default_branch {
Subroutine _build_default_branch: not called CC=2 SCAR=17.9
234 0 ▶ return $_[ 0 ]->config->default_branches->{ $_[ 0 ]->vcs } // NUL;
Condition0%0/2
$_[0]->config->default_branches->{$_[0]->vcs} // ""
l!l
00
MC/DC0%0/1
$_[0]->config->default_branches->{$_[0]->vcs} // ""
$_[0]->config->default_branches->{$_[0]->vcs}
Truth table0%0/2
A
A= $_[0]->config->default_branches->{$_[0]->vcs}
Aresult
11
00
235 }
236  
237 0 ▶sub _build_dist_version {
Subroutine _build_dist_version: not called CC=2 SCAR=17.9
238 0 my $self = shift; my $meta = $self->module_metadata;
239  
240 0 ▶ return Perl::Version->new( $meta ? $meta->version : '0.1.1' );
Branch: 1 branch
BranchTrueFalseTotal
$meta ? : 0 0 0
241 }
242  
243 1 ▶sub _build_exec_perms {
Subroutine _build_exec_perms: called CC=1 SCAR=0.0
244 1 return (($_[ 0 ]->perms & oct '0444') >> 2) | $_[ 0 ]->perms;
245 }
246  
247 0 ▶sub _build_homedir {
Subroutine _build_homedir: not called CC=1 SCAR=6.9
248 0 return [ $_[ 0 ]->libdir, classdir $_[ 0 ]->project ];
249 }
250  
251 0 ▶sub _build_license_keys {
Subroutine _build_license_keys: not called CC=1 SCAR=6.9
252 return {
253 perl => 'Perl_5',
254 perl_5 => 'Perl_5',
255 0 apache => [ map { "Apache_$_" } qw( 1_1 2_0 ) ],
256 artistic => 'Artistic_1_0',
257 artistic_2 => 'Artistic_2_0',
258 0 lgpl => [ map { "LGPL_$_" } qw( 2_1 3_0 ) ],
259 bsd => 'BSD',
260 0 gpl => [ map { "GPL_$_" } qw( 1 2 3 ) ],
261 mit => 'MIT',
262 0 mozilla => [ map { "Mozilla_$_" } qw( 1_0 1_1 ) ], };
263 }
264  
265 0 ▶sub _build_manifest_paths {
Subroutine _build_manifest_paths: not called CC=1 SCAR=6.9
266 0 my $self = shift;
267  
268 0 return [ grep { $_->exists }
269 0 map { io( $_parse_manifest_line->( $_ )->[ 0 ] ) }
270 0 grep { not m{ \A \s* [\#] }mx }
271 $self->appldir->catfile( 'MANIFEST' )->chomp->getlines ];
272 }
273  
274 0 ▶sub _build_module_abstract {
Subroutine _build_module_abstract: not called CC=4 SCAR=30.0
275 0 my $self = shift; my $meta = $self->module_metadata; my $abstract = NUL;
276  
277 0 ▶ $meta and ($abstract = $meta->pod( 'Name' ) // NUL)
Branch: 1 branch
BranchTrueFalseTotal
$meta and ($abstract = $meta->pod("Name") // "") =~ s/ \A [^\-]+ \s* [\-] \s* //mx 0 0 0
Condition0%0/2
$meta->pod("Name") // ""
l!l
00
MC/DC0%0/1
$meta->pod("Name") // ""
$meta->pod("Name")
Truth table0%0/2
A
A= $meta->pod("Name")
Aresult
11
00
278 0 =~ s{ \A [^\-]+ \s* [\-] \s* }{}mx; chomp $abstract;
279  
280 0 ▶ return $self->loc( $abstract || $self->config->module_abstract );
Condition0%0/3
$abstract || $self->config->module_abstract
l!l&&r!l&&!r
000
MC/DC0%0/2
$abstract || $self->config->module_abstract
$abstract $self->config->module_abstract
Truth table0%0/3
A || B
A= $abstractB= $self->config->module_abstract
ABresult
1X1
011
000
281 }
282  
283 0 ▶sub _build_project {
Subroutine _build_project: not called CC=3 SCAR=24.8
284 0 my $self = shift;
285 0 ▶ my $file = $_get_project_file->( $self->initial_wd )
Branch: 1 branch
BranchTrueFalseTotal
my $file = &$_get_project_file($self->initial_wd) or &throw("Path [_1] contains no project file", [$self->initial_wd]) 0 0 0
286 or throw 'Path [_1] contains no project file', [ $self->initial_wd ];
287 0 ▶ my $module = $_get_module_from->( $file->all )
Branch: 1 branch
BranchTrueFalseTotal
my $module = &$_get_module_from($file->all) or &throw("File [_1] contains no module name", [$file]) 0 0 0
288 or throw 'File [_1] contains no module name', [ $file ];
289  
290 0 return $module;
291 }
292  
293 0 ▶sub _build_project_file {
Subroutine _build_project_file: not called CC=1 SCAR=6.9
294 0 return $BUILDERS{ $_[ 0 ]->builder };
295 }
296  
297 0 ▶sub _build_stash {
Subroutine _build_stash: not called CC=3 SCAR=24.8
298 0 my $self = shift; my $config = $self->config; my $author = $config->author;
299  
300 0 my $project = $self->project; my $perl_ver = $self->config->min_perl_ver;
301  
302 0 ▶ my $perl_code = $self->method eq 'dist' ? "use ${perl_ver};" : NUL;
Branch: 1 branch
BranchTrueFalseTotal
$self->method eq 'dist' ? : 0 0 0
303  
304 return { abstract => $self->module_abstract,
305 appdir => class2appdir $self->distname,
306 author => $author,
307 author_email => $config->author_email,
308 author_id => $config->author_id,
309 author_ID => uc $config->author_id,
310 copyright => $ENV{ORGANIZATION} || $author,
311 copyright_year => time2str( '%Y' ),
312 creation_date => time2str,
313 dist_module => $self->dist_module->abs2rel( $self->appldir ),
314 dist_version => NUL.$self->dist_version,
315 distname => $self->distname,
316 first_name => lc ((split SPC, $author)[ 0 ]),
317 home_page => $config->home_page,
318 initial_wd => NUL.$self->initial_wd,
319 last_name => lc ((split SPC, $author)[ -1 ]),
320 lc_distname => lc $self->distname,
321 license => $self->license,
322 0 ▶ license_class => $self->license_keys->{ $self->license },
Condition0%0/3
$ENV{'ORGANIZATION'} || $author
l!l&&r!l&&!r
000
MC/DC0%0/2
$ENV{'ORGANIZATION'} || $author
$ENV{'ORGANIZATION'} $author
Truth table0%0/3
A || B
A= $ENV{'ORGANIZATION'}B= $author
ABresult
1X1
011
000
323 module => $project,
324 perl => $perl_ver,
325 prefix => (split m{ :: }mx, lc $project)[ -1 ],
326 project => $project,
327 pub_repo_prefix => $config->pub_repo_prefix,
328 use_perl => $perl_code,
329 version => $self->VERSION, };
330 }
331  
332 0 ▶sub _build_vcs {
Subroutine _build_vcs: not called CC=6 SCAR=37.4
333 0 my $self = shift; my $appbase = $self->appbase;
334  
335 0 ▶ return $appbase->catdir( '.git' )->exists ? 'git'
Branch: 5 branches
BranchTrueFalseTotal
$appbase->catdir('.git')->exists ? : 0 0 0
$appbase->catdir('master', '.git')->exists ? : 0 0 0
$appbase->catdir('.svn')->exists ? : 0 0 0
$appbase->catdir('trunk', '.svn')->exists ? : 0 0 0
$appbase->catdir($self->repository)->exists ? : 0 0 0
336 : $appbase->catdir( 'master', '.git' )->exists ? 'git'
337 : $appbase->catdir( '.svn' )->exists ? 'svn'
338 : $appbase->catdir( 'trunk', '.svn' )->exists ? 'svn'
339 : $appbase->catdir( $self->repository )->exists ? 'svn'
340 : 'none';
341 }
342  
343 # Public methods
344 0 ▶sub chdir {
Subroutine chdir: not called CC=3 SCAR=24.8
Pod documented
345 0 my ($self, $dir) = @_;
346  
347 0 ▶ $dir or throw Unspecified, [ 'directory' ];
Branch: 1 branch
BranchTrueFalseTotal
$dir or &throw(Unspecified(), ["directory"]) 0 0 0
348 0 ▶ chdir $dir or throw 'Directory [_1] cannot chdir: [_2]', [ $dir, $OS_ERROR ];
Branch: 1 branch
BranchTrueFalseTotal
CORE::chdir $dir or &throw("Directory [_1] cannot chdir: [_2]", [$dir, $Module::Provision::Base::OS_ERROR]) 0 0 0
349 0 return $dir;
350 }
351  
352 0 ▶sub load_meta {
Subroutine load_meta: not called CC=4 SCAR=30.0
Pod documented
353 0 my ($self, $dir) = @_;
354  
355 0 ▶ not $dir and $self->builder eq 'DZ'
Branch: 1 branch
BranchTrueFalseTotal
not $dir and $self->builder eq "DZ" and $dir = &io($self->distname . '-' . $self->dist_version) 0 0 0
Condition0%0/3
not $dir and $self->builder eq "DZ"
!ll&&!rl&&r
000
MC/DC0%0/2
not $dir and $self->builder eq "DZ"
not $dir $self->builder eq "DZ"
Truth table0%0/3
not(A) and B
A= not $dirB= $self->builder eq "DZ"
ABresult
0X0
100
111
356 and $dir = io $self->distname.'-'.$self->dist_version;
357  
358 0 ▶ my $path = $dir ? $dir->catfile( 'META.json' ) : 'META.json';
Branch: 1 branch
BranchTrueFalseTotal
$dir ? : 0 0 0
359  
360 0 return CPAN::Meta->load_file( "${path}" );
361 }
362  
363 1 1;
364  
365 __END__
« lib/Module/Provision/TraitFor/UpdatingContent.pm ↑ Summary blib/lib/auto/share/dist/Module-Provision/boilerplate.pm »