lib/Dist/Zilla/App/Command/configure_CSJEWELL.pm

filter: Statementstmt 46.5% 20 / 43 Branchbran 0.0% 0 / 8 Conditioncond 0.0% 0 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 54.5% 6 / 11 Podpod 100% 3 / 3 totaltotal 41.4% 29 / 70 CC 6 SCAR 16.1
CC
6
Cov
37%
execute
12.0
validate_args
6.0
__ANON__
6.0
CRAP 5.0
« lib/Dist/Zilla/MintingProfile/CSJEWELL.pm ↑ Summary lib/Dist/Zilla/PluginBundle/CSJEWELL.pm »
1 package Dist::Zilla::App::Command::configure_CSJEWELL;
2  
3 1 ▶use 5.008003;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 1 ▶use Dist::Zilla::App -command;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 1 ▶use autodie;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 1 ▶use File::Spec;
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 1 our $VERSION = '0.900';
11 1 $VERSION =~ s/_//sm;
12  
13 0 ▶sub abstract { ## no critic(ProhibitAmbiguousNames)
Subroutine abstract: not called CC=1 SCAR=6.9
Pod documented
14 0 return q{configure the 'CSJEWELL' minting profile.};
15 }
16  
17 0 ▶sub validate_args {
Subroutine validate_args: not called CC=2 SCAR=17.9
Pod documented
18 0 my ( $self, undef, $args ) = @_;
19  
20 0 ▶ if ( 0 != @{$args} ) {
Branch: 1 branch
BranchTrueFalseTotal
if (0 != @{$args;}) 0 0 0
21 0 $self->usage_error('Too many arguments');
22 }
23  
24 0 return;
25 }
26  
27 0 ▶sub execute {
Subroutine execute: not called CC=3 SCAR=24.8
Pod documented
28 0 my ( $self, undef, undef ) = @_;
29  
30 0 my $chrome = $self->app()->chrome();
31  
32 ## no critic(ProtectPrivateSubs)
33 0 my $config_root = Dist::Zilla::Util->_global_config_root();
34  
35 0 ▶ if ( not -d $config_root
Branch: 1 branch
BranchTrueFalseTotal
unless (-d $config_root and -f "File::Spec"->catfile($config_root, "config.ini")) 0 0 0
Condition0%0/3
-d $config_root and -f "File::Spec"->catfile($config_root, "config.ini")
!ll&&!rl&&r
000
MC/DC0%0/2
-d $config_root and -f "File::Spec"->catfile($config_root, "config.ini")
-d $config_root -f "File::Spec"->catfile($config_root, "config.ini")
Truth table0%0/3
A and B
A= -d $config_rootB= -f "File::Spec"->catfile($config_root, "config.ini")
ABresult
0X0
100
111
36 or not -f File::Spec->catfile( $config_root, 'config.ini' ) )
37 {
38 0 $chrome->logger()->log_fatal( [
39 'A per-user configuration file does not exist in %s',
40 "$config_root",
41 ] );
42  
43 0 return;
44 }
45  
46 my $homepage = $chrome->prompt_str(
47 'Where is your homepage?',
48 0 ▶ { check => sub { defined $_[0] and $_[0] =~ /\S/ms },
Subroutine __ANON__: not called CC=2 SCAR=17.9
Branch: 1 branch
BranchTrueFalseTotal
defined $_[0] and $_[0] =~ /\S/ms 0 0 0
49 0 default => 'http://search.cpan.org/~username/',
50 },
51 );
52  
53 my $repo = $chrome->prompt_str(
54 'Where are your repositories?',
55 0 ▶ { check => sub { defined $_[0] and $_[0] =~ /\S/ms },
Subroutine __ANON__: not called CC=2 SCAR=17.9
Branch: 1 branch
BranchTrueFalseTotal
defined $_[0] and $_[0] =~ /\S/ms 0 0 0
56 0 default => 'http://bitbucket.org/username/',
57 },
58 );
59  
60 0 open my $fh, '>>', $config_root->file('config.ini');
61  
62 0 $fh->print("\n[%DefaultURLs]\n");
63 0 $fh->print("homepage = $homepage\n");
64 0 $fh->print("repository_location = $repo\n\n");
65  
66 0 close $fh;
67  
68 0 $self->log('Added to config.ini file.');
69  
70 0 return;
71 } ## end sub execute
72  
73 1 1;
74  
75 __END__
« lib/Dist/Zilla/MintingProfile/CSJEWELL.pm ↑ Summary lib/Dist/Zilla/PluginBundle/CSJEWELL.pm »