« lib/Module/Provision/TraitFor/CPANDistributions.pm
↑ Summary
lib/Module/Provision/TraitFor/VCS.pm »
| 1 | package Module::Provision::TraitFor::CreatingDistributions; | ||||||||||||||||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||||||||||||||||
| 3 | 1 | ▶ | use namespace::autoclean; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||||||||||||||||
| 5 | 1 | ▶ | use Class::Usul::Constants qw( FAILED FALSE OK SPC TRUE ); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 6 | 1 | ▶ | use Class::Usul::Functions qw( emit emit_to io trim ); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 7 | 1 | ▶ | use Class::Usul::Types qw( ArrayRef NonEmptySimpleStr ); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 8 | 1 | ▶ | use English qw( -no_match_vars ); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 9 | 1 | ▶ | use IO::Handle; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 10 | 1 | ▶ | use Moo::Role; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 11 | 1 | ▶ | use Class::Usul::Options; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||||||||||||||||
| 13 | 1 | requires qw( appbase appldir branch builder chdir config exec_perms | |||||||||||||||||||||||||||||||||||||||||
| 14 | homedir incdir method output next_argv project_file | ||||||||||||||||||||||||||||||||||||||||||
| 15 | quiet render_templates run_cmd stash testdir vcs ); | ||||||||||||||||||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||||||||||||||||
| 17 | # Object attributes (public) | ||||||||||||||||||||||||||||||||||||||||||
| 18 | option 'editor' => is => 'lazy', isa => NonEmptySimpleStr, | ||||||||||||||||||||||||||||||||||||||||||
| 19 | documentation => 'Which text editor to use', | ||||||||||||||||||||||||||||||||||||||||||
| 20 | 0 | ▶ | default => sub { $_[ 0 ]->config->editor }, format => 's'; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=1.2
| |||||||||||||||||||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||||||||||||||||
| 22 | # Private functions | ||||||||||||||||||||||||||||||||||||||||||
| 23 | 0 | ▶ | my $_set_env_false = sub { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||
| 24 | 0 | $ENV{ $_ } = FALSE for (@_); return; | |||||||||||||||||||||||||||||||||||||||||
| 25 | 1 | }; | |||||||||||||||||||||||||||||||||||||||||
| 26 | |||||||||||||||||||||||||||||||||||||||||||
| 27 | 0 | ▶ | my $_set_env_true = sub { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||
| 28 | 0 | $ENV{ $_ } = TRUE for (@_); return; | |||||||||||||||||||||||||||||||||||||||||
| 29 | 1 | }; | |||||||||||||||||||||||||||||||||||||||||
| 30 | |||||||||||||||||||||||||||||||||||||||||||
| 31 | # Private methods | ||||||||||||||||||||||||||||||||||||||||||
| 32 | 0 | ▶ | my $_create_mask = sub { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 33 | 0 | return oct '0777' ^ $_[ 0 ]->exec_perms; | |||||||||||||||||||||||||||||||||||||||||
| 34 | 1 | }; | |||||||||||||||||||||||||||||||||||||||||
| 35 | |||||||||||||||||||||||||||||||||||||||||||
| 36 | 0 | ▶ | my $_get_cover_command = sub { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=3 SCAR=24.8
| |||||||||||||||||||||||||||||||||||||||||||
| 37 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 38 | |||||||||||||||||||||||||||||||||||||||||||
| 39 | 0 | ▶ | ($self->builder eq 'DZ' or $self->builder eq 'MB') | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$self->builder eq "DZ" or $self->builder eq "MB"
MC/DC0%0/2
$self->builder eq "DZ" or $self->builder eq "MB"
$self->builder eq "DZ"
$self->builder eq "MB"
Truth table0%0/3
A or B
A= $self->builder eq "DZ"B= $self->builder eq "MB"
| |||||||||||||||||||||||||||||||||||||||||||
| 40 | and return 'perl Build.PL && ./Build testcover'; | ||||||||||||||||||||||||||||||||||||||||||
| 41 | |||||||||||||||||||||||||||||||||||||||||||
| 42 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 43 | 1 | }; | |||||||||||||||||||||||||||||||||||||||||
| 44 | |||||||||||||||||||||||||||||||||||||||||||
| 45 | 0 | ▶ | my $_get_cover_build_command = sub { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||
| 46 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 47 | |||||||||||||||||||||||||||||||||||||||||||
| 48 | 0 | ▶ | $self->builder eq 'DZ' and return 'dzil build'; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 49 | |||||||||||||||||||||||||||||||||||||||||||
| 50 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 51 | 1 | }; | |||||||||||||||||||||||||||||||||||||||||
| 52 | |||||||||||||||||||||||||||||||||||||||||||
| 53 | 0 | ▶ | my $_get_test_command = sub { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=3 SCAR=24.8
| |||||||||||||||||||||||||||||||||||||||||||
| 54 | 0 | ▶ | return $_[ 1 ] ? 'prove -lv '.$_[ 1 ] | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 55 | : $_[ 0 ]->builder eq 'DZ' ? 'dzil test' | ||||||||||||||||||||||||||||||||||||||||||
| 56 | : 'prove t'; | ||||||||||||||||||||||||||||||||||||||||||
| 57 | 1 | }; | |||||||||||||||||||||||||||||||||||||||||
| 58 | |||||||||||||||||||||||||||||||||||||||||||
| 59 | 0 | ▶ | my $_project_file_path = sub { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 60 | 0 | return $_[ 0 ]->appldir->catfile( $_[ 0 ]->project_file ); | |||||||||||||||||||||||||||||||||||||||||
| 61 | 1 | }; | |||||||||||||||||||||||||||||||||||||||||
| 62 | |||||||||||||||||||||||||||||||||||||||||||
| 63 | # Construction | ||||||||||||||||||||||||||||||||||||||||||
| 64 | 0 | ▶ | around '_build_appbase' => sub { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||
| 65 | 0 | my ($orig, $self, @args) = @_; my $appbase = $orig->( $self, @args ); | |||||||||||||||||||||||||||||||||||||||||
| 66 | |||||||||||||||||||||||||||||||||||||||||||
| 67 | 0 | ▶ | return $self->method eq 'dist' | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 68 | ? $self->base->absolute( $self->initial_wd )->catdir( $self->distname ) | ||||||||||||||||||||||||||||||||||||||||||
| 69 | : $appbase; | ||||||||||||||||||||||||||||||||||||||||||
| 70 | 1 | }; | |||||||||||||||||||||||||||||||||||||||||
| 71 | |||||||||||||||||||||||||||||||||||||||||||
| 72 | 0 | ▶ | around '_build_appldir' => sub { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=3 SCAR=24.8
| |||||||||||||||||||||||||||||||||||||||||||
| 73 | 0 | my ($next, $self, @args) = @_; my $appldir = $self->$next( @args ); | |||||||||||||||||||||||||||||||||||||||||
| 74 | |||||||||||||||||||||||||||||||||||||||||||
| 75 | 0 | ▶ | return !$appldir && $self->method eq 'dist' | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
not $appldir and $self->method eq "dist"
MC/DC0%0/2
not $appldir and $self->method eq "dist"
not $appldir
$self->method eq "dist"
Truth table0%0/3
not(A) and B
A= not $appldirB= $self->method eq "dist"
| |||||||||||||||||||||||||||||||||||||||||||
| 76 | ? $self->appbase->catdir( $self->branch ) : $appldir ; | ||||||||||||||||||||||||||||||||||||||||||
| 77 | 1 | }; | |||||||||||||||||||||||||||||||||||||||||
| 78 | |||||||||||||||||||||||||||||||||||||||||||
| 79 | 0 | ▶ | around '_build_builder' => sub { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=3 SCAR=24.8
| |||||||||||||||||||||||||||||||||||||||||||
| 80 | 0 | my ($next, $self, @args) = @_; my $builder = $self->$next( @args ); | |||||||||||||||||||||||||||||||||||||||||
| 81 | |||||||||||||||||||||||||||||||||||||||||||
| 82 | 0 | ▶ | return !$builder && $self->method eq 'dist' | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
not $builder and $self->method eq "dist"
MC/DC0%0/2
not $builder and $self->method eq "dist"
not $builder
$self->method eq "dist"
Truth table0%0/3
not(A) and B
A= not $builderB= $self->method eq "dist"
| |||||||||||||||||||||||||||||||||||||||||||
| 83 | ? $self->config->builder : $builder; | ||||||||||||||||||||||||||||||||||||||||||
| 84 | 1 | }; | |||||||||||||||||||||||||||||||||||||||||
| 85 | |||||||||||||||||||||||||||||||||||||||||||
| 86 | 0 | ▶ | around '_build_project' => sub { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=3 SCAR=24.8
| |||||||||||||||||||||||||||||||||||||||||||
| 87 | 0 | my ($next, $self, @args) = @_; my $project; | |||||||||||||||||||||||||||||||||||||||||
| 88 | |||||||||||||||||||||||||||||||||||||||||||
| 89 | 0 | ▶ | $self->method eq 'dist' and $project = $self->next_argv and return $project; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$self->method eq "dist" and $project = $self->next_argv
MC/DC0%0/2
$self->method eq "dist" and $project = $self->next_argv
$self->method eq "dist"
$project = $self->next_argv
Truth table0%0/3
A and B
A= $self->method eq "dist"B= $project = $self->next_argv
| |||||||||||||||||||||||||||||||||||||||||||
| 90 | |||||||||||||||||||||||||||||||||||||||||||
| 91 | 0 | return $self->$next( @args ); | |||||||||||||||||||||||||||||||||||||||||
| 92 | 1 | }; | |||||||||||||||||||||||||||||||||||||||||
| 93 | |||||||||||||||||||||||||||||||||||||||||||
| 94 | 0 | ▶ | around '_build_vcs' => sub { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=3 SCAR=24.8
| |||||||||||||||||||||||||||||||||||||||||||
| 95 | 0 | my ($next, $self, @args) = @_; my $vcs = $self->$next( @args ); | |||||||||||||||||||||||||||||||||||||||||
| 96 | |||||||||||||||||||||||||||||||||||||||||||
| 97 | 0 | ▶ | return $vcs eq 'none' && $self->method eq 'dist' ? $self->config->vcs : $vcs; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$vcs eq "none" and $self->method eq "dist"
MC/DC0%0/2
$vcs eq "none" and $self->method eq "dist"
$vcs eq "none"
$self->method eq "dist"
Truth table0%0/3
A and B
A= $vcs eq "none"B= $self->method eq "dist"
| |||||||||||||||||||||||||||||||||||||||||||
| 98 | 1 | }; | |||||||||||||||||||||||||||||||||||||||||
| 99 | |||||||||||||||||||||||||||||||||||||||||||
| 100 | # Public Methods | ||||||||||||||||||||||||||||||||||||||||||
| 101 | 0 | ▶ | sub build_distribution : method { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
build_distribution: not called CC=5 SCAR=34.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 102 | 0 | my ($self, $verbose) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 103 | |||||||||||||||||||||||||||||||||||||||||||
| 104 | 0 | ▶ | if ($self->builder eq 'DZ') { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 105 | 0 | ▶ | $self->run_cmd( 'dzil build', $verbose ? { out => 'stdout' } : {} ); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 106 | } | ||||||||||||||||||||||||||||||||||||||||||
| 107 | elsif ($self->builder eq 'MB') { | ||||||||||||||||||||||||||||||||||||||||||
| 108 | 0 | $self->run_cmd( 'perl Build.PL' ); | |||||||||||||||||||||||||||||||||||||||||
| 109 | 0 | ▶ | $self->run_cmd( './Build dist', $verbose ? { out => 'stdout' } : {} ); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 110 | } | ||||||||||||||||||||||||||||||||||||||||||
| 111 | |||||||||||||||||||||||||||||||||||||||||||
| 112 | 0 | return OK; | |||||||||||||||||||||||||||||||||||||||||
| 113 | } | ||||||||||||||||||||||||||||||||||||||||||
| 114 | |||||||||||||||||||||||||||||||||||||||||||
| 115 | 0 | ▶ | sub clean_distribution : method { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
clean_distribution: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 116 | 0 | my ($self, $verbose) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 117 | |||||||||||||||||||||||||||||||||||||||||||
| 118 | 0 | ▶ | if ($self->builder eq 'DZ') { $self->run_cmd( 'dzil clean' ) } | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 119 | 0 | elsif ($self->builder eq 'MB') { $self->run_cmd( './Build distclean' ) } | |||||||||||||||||||||||||||||||||||||||||
| 120 | |||||||||||||||||||||||||||||||||||||||||||
| 121 | 0 | return OK; | |||||||||||||||||||||||||||||||||||||||||
| 122 | } | ||||||||||||||||||||||||||||||||||||||||||
| 123 | |||||||||||||||||||||||||||||||||||||||||||
| 124 | 0 | ▶ | sub cover : method { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
cover: not called CC=7 SCAR=40.3
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 125 | 0 | my $self = shift; $self->chdir( $self->appldir ); | |||||||||||||||||||||||||||||||||||||||||
| 126 | |||||||||||||||||||||||||||||||||||||||||||
| 127 | 0 | ▶ | $self->quiet or | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 128 | $self->output( 'Testing coverage [_1]', { args => [ $self->appldir ] } ); | ||||||||||||||||||||||||||||||||||||||||||
| 129 | |||||||||||||||||||||||||||||||||||||||||||
| 130 | 0 | my $cmd = $self->$_get_cover_build_command; | |||||||||||||||||||||||||||||||||||||||||
| 131 | |||||||||||||||||||||||||||||||||||||||||||
| 132 | 0 | ▶ | $cmd and $self->run_cmd( $cmd, $self->quiet ? {} : { out => 'stdout' } ); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 133 | 0 | $_set_env_true->( @{ $self->config->test_env_vars } ); | |||||||||||||||||||||||||||||||||||||||||
| 134 | 0 | $ENV{DEVEL_COVER_OPTIONS} = '-ignore,MyModuleBuilder.pm,/home'; | |||||||||||||||||||||||||||||||||||||||||
| 135 | 0 | ▶ | $self->builder eq 'DZ' | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 136 | and $self->chdir( $self->distname.'-'.$self->dist_version ); | ||||||||||||||||||||||||||||||||||||||||||
| 137 | 0 | $cmd = $self->$_get_cover_command; | |||||||||||||||||||||||||||||||||||||||||
| 138 | 0 | ▶ | $cmd and $self->run_cmd( $cmd, $self->quiet ? {} : { out => 'stdout' } ); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 139 | 0 | $self->chdir( $self->appldir ); | |||||||||||||||||||||||||||||||||||||||||
| 140 | 0 | $_set_env_false->( @{ $self->config->test_env_vars } ); | |||||||||||||||||||||||||||||||||||||||||
| 141 | 0 | delete $ENV{DEVEL_COVER_OPTIONS}; | |||||||||||||||||||||||||||||||||||||||||
| 142 | 0 | return OK; | |||||||||||||||||||||||||||||||||||||||||
| 143 | } | ||||||||||||||||||||||||||||||||||||||||||
| 144 | |||||||||||||||||||||||||||||||||||||||||||
| 145 | 0 | ▶ | sub create_directories { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
create_directories: not called CC=7 SCAR=40.3
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 146 | 0 | my $self = shift; my $perms = $self->exec_perms; | |||||||||||||||||||||||||||||||||||||||||
| 147 | |||||||||||||||||||||||||||||||||||||||||||
| 148 | 0 | ▶ | $self->quiet or $self->output( 'Creating directories' ); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 149 | 0 | ▶ | $self->appldir->exists or $self->appldir->mkpath( $perms ); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 150 | 0 | ▶ | $self->builder eq 'MB' | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/6
$self->builder eq 'MB' && ($self->incdir->exists || $self->incdir->mkpath($perms))
$self->incdir->exists or $self->incdir->mkpath($perms)
MC/DC0%0/3
$self->builder eq 'MB' && ($self->incdir->exists || $self->incdir->mkpath($perms))
$self->builder eq 'MB'
$self->incdir->exists
$self->incdir->mkpath($perms)
Truth table0%0/4
A && B or C
A= $self->builder eq 'MB'B= $self->incdir->existsC= $self->incdir->mkpath($perms)
| |||||||||||||||||||||||||||||||||||||||||||
| 151 | and ($self->incdir->exists or $self->incdir->mkpath( $perms )); | ||||||||||||||||||||||||||||||||||||||||||
| 152 | 0 | ▶ | $self->testdir->exists or $self->testdir->mkpath( $perms ); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 153 | 0 | ▶ | $self->homedir->parent->exists or $self->homedir->parent->mkpath( $perms ); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 154 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 155 | } | ||||||||||||||||||||||||||||||||||||||||||
| 156 | |||||||||||||||||||||||||||||||||||||||||||
| 157 | 0 | ▶ | sub dist : method { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
dist: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 158 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 159 | |||||||||||||||||||||||||||||||||||||||||||
| 160 | 0 | $self->dist_pre_hook; | |||||||||||||||||||||||||||||||||||||||||
| 161 | 0 | $self->create_directories; | |||||||||||||||||||||||||||||||||||||||||
| 162 | 0 | $self->render_templates; | |||||||||||||||||||||||||||||||||||||||||
| 163 | 0 | $self->dist_post_hook; | |||||||||||||||||||||||||||||||||||||||||
| 164 | 0 | return OK; | |||||||||||||||||||||||||||||||||||||||||
| 165 | } | ||||||||||||||||||||||||||||||||||||||||||
| 166 | |||||||||||||||||||||||||||||||||||||||||||
| 167 | 0 | ▶ | sub dist_post_hook { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
dist_post_hook: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 168 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 169 | |||||||||||||||||||||||||||||||||||||||||||
| 170 | 0 | $self->generate_metadata( TRUE ); $self->prove; | |||||||||||||||||||||||||||||||||||||||||
| 171 | |||||||||||||||||||||||||||||||||||||||||||
| 172 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 173 | } | ||||||||||||||||||||||||||||||||||||||||||
| 174 | |||||||||||||||||||||||||||||||||||||||||||
| 175 | 0 | ▶ | sub dist_pre_hook { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
dist_pre_hook: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 176 | 0 | my $self = shift; umask $self->$_create_mask; | |||||||||||||||||||||||||||||||||||||||||
| 177 | |||||||||||||||||||||||||||||||||||||||||||
| 178 | 0 | ▶ | $self->appbase->exists or $self->appbase->mkpath( $self->exec_perms ); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 179 | 0 | ▶ | $self->stash->{abstract} = $self->next_argv || $self->stash->{abstract}; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$self->next_argv || $self->stash->{'abstract'}
MC/DC0%0/2
$self->next_argv || $self->stash->{'abstract'}
$self->next_argv
$self->stash->{'abstract'}
Truth table0%0/3
A || B
A= $self->next_argvB= $self->stash->{'abstract'}
| |||||||||||||||||||||||||||||||||||||||||||
| 180 | 0 | $self->chdir( $self->appbase ); | |||||||||||||||||||||||||||||||||||||||||
| 181 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 182 | } | ||||||||||||||||||||||||||||||||||||||||||
| 183 | |||||||||||||||||||||||||||||||||||||||||||
| 184 | 0 | ▶ | sub edit_project : method { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
edit_project: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 185 | 0 | my $self = shift; my $path = $self->$_project_file_path; | |||||||||||||||||||||||||||||||||||||||||
| 186 | |||||||||||||||||||||||||||||||||||||||||||
| 187 | 0 | $self->run_cmd( $self->editor.SPC.$path, { async => TRUE } ); | |||||||||||||||||||||||||||||||||||||||||
| 188 | 0 | return OK; | |||||||||||||||||||||||||||||||||||||||||
| 189 | } | ||||||||||||||||||||||||||||||||||||||||||
| 190 | |||||||||||||||||||||||||||||||||||||||||||
| 191 | 0 | ▶ | sub generate_metadata { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
generate_metadata: not called CC=7 SCAR=40.3
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 192 | 0 | my ($self, $create) = @_; $self->chdir( $self->appldir ); | |||||||||||||||||||||||||||||||||||||||||
| 193 | |||||||||||||||||||||||||||||||||||||||||||
| 194 | 0 | ▶ | my $verbose = $create ? FALSE : TRUE; my $mdf = 'README.md'; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 195 | |||||||||||||||||||||||||||||||||||||||||||
| 196 | 0 | ▶ | if ($self->builder eq 'DZ') { $self->build_distribution( $verbose ) } | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 197 | elsif ($self->builder eq 'MB') { | ||||||||||||||||||||||||||||||||||||||||||
| 198 | 0 | $self->run_cmd( 'perl '.$self->project_file ); | |||||||||||||||||||||||||||||||||||||||||
| 199 | 0 | ▶ | $self->run_cmd( './Build manifest', $verbose ? { out => 'stdout' } : {} ); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 200 | 0 | ▶ | $self->run_cmd( './Build distmeta', $verbose ? { out => 'stdout' } : {} ); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 201 | } | ||||||||||||||||||||||||||||||||||||||||||
| 202 | |||||||||||||||||||||||||||||||||||||||||||
| 203 | 0 | $self->clean_distribution( $verbose ); | |||||||||||||||||||||||||||||||||||||||||
| 204 | 0 | ▶ | return $create ? $mdf : undef; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 205 | } | ||||||||||||||||||||||||||||||||||||||||||
| 206 | |||||||||||||||||||||||||||||||||||||||||||
| 207 | 0 | ▶ | sub metadata : method { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
metadata: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 208 | 0 | my $self = shift; $self->generate_metadata( FALSE ); return OK; | |||||||||||||||||||||||||||||||||||||||||
| 209 | } | ||||||||||||||||||||||||||||||||||||||||||
| 210 | |||||||||||||||||||||||||||||||||||||||||||
| 211 | 0 | ▶ | sub prove : method { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
prove: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 212 | 0 | my $self = shift; $self->chdir( $self->appldir ); | |||||||||||||||||||||||||||||||||||||||||
| 213 | |||||||||||||||||||||||||||||||||||||||||||
| 214 | 0 | my $cmd = $self->$_get_test_command( $self->next_argv ); | |||||||||||||||||||||||||||||||||||||||||
| 215 | |||||||||||||||||||||||||||||||||||||||||||
| 216 | 0 | $_set_env_true->( @{ $self->config->test_env_vars } ); | |||||||||||||||||||||||||||||||||||||||||
| 217 | |||||||||||||||||||||||||||||||||||||||||||
| 218 | 0 | $self->output ( 'Testing [_1]', { args => [ $self->appldir ] } ); | |||||||||||||||||||||||||||||||||||||||||
| 219 | 0 | ▶ | $self->run_cmd( $cmd, $self->quiet ? {} : { out => 'stdout' } ); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 220 | |||||||||||||||||||||||||||||||||||||||||||
| 221 | 0 | $_set_env_false->( @{ $self->config->test_env_vars } ); | |||||||||||||||||||||||||||||||||||||||||
| 222 | 0 | return OK; | |||||||||||||||||||||||||||||||||||||||||
| 223 | } | ||||||||||||||||||||||||||||||||||||||||||
| 224 | |||||||||||||||||||||||||||||||||||||||||||
| 225 | 0 | ▶ | sub select_project : method { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
select_project: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 226 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 227 | 0 | my @projects = $self->base->all_dirs; | |||||||||||||||||||||||||||||||||||||||||
| 228 | 0 | my @options = map { $_->basename } @projects; | |||||||||||||||||||||||||||||||||||||||||
| 229 | 0 | my $prompt = 'Select a project from the following list'; | |||||||||||||||||||||||||||||||||||||||||
| 230 | 0 | my $index = $self->get_option( $prompt, undef, TRUE, undef, \@options ); | |||||||||||||||||||||||||||||||||||||||||
| 231 | |||||||||||||||||||||||||||||||||||||||||||
| 232 | 0 | ▶ | $index < 0 and return FAILED; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 233 | |||||||||||||||||||||||||||||||||||||||||||
| 234 | 0 | my $name = $projects[ $index ]->basename; | |||||||||||||||||||||||||||||||||||||||||
| 235 | 0 | my $project = Module::Provision->new | |||||||||||||||||||||||||||||||||||||||||
| 236 | ( noask => TRUE, project => $name, quiet => TRUE ); | ||||||||||||||||||||||||||||||||||||||||||
| 237 | |||||||||||||||||||||||||||||||||||||||||||
| 238 | 0 | $self->chdir( my $dir = $project->appldir ); | |||||||||||||||||||||||||||||||||||||||||
| 239 | |||||||||||||||||||||||||||||||||||||||||||
| 240 | 0 | io()->fdopen( 3, 'w' )->print( $dir )->close; | |||||||||||||||||||||||||||||||||||||||||
| 241 | |||||||||||||||||||||||||||||||||||||||||||
| 242 | 0 | return Module::Provision->new | |||||||||||||||||||||||||||||||||||||||||
| 243 | ( method => 'edit_project', noask => TRUE, quiet => TRUE )->run; | ||||||||||||||||||||||||||||||||||||||||||
| 244 | } | ||||||||||||||||||||||||||||||||||||||||||
| 245 | |||||||||||||||||||||||||||||||||||||||||||
| 246 | 0 | ▶ | sub show_tab_title : method { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
show_tab_title: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 247 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 248 | 0 | ▶ | my $file = $self->next_argv || $self->$_project_file_path; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$self->next_argv || $self->$_project_file_path
MC/DC0%0/2
$self->next_argv || $self->$_project_file_path
$self->next_argv
$self->$_project_file_path
Truth table0%0/3
A || B
A= $self->next_argvB= $self->$_project_file_path
| |||||||||||||||||||||||||||||||||||||||||||
| 249 | 0 | ▶ | my $text = (grep { m{ tab-title: }msx } io( $file )->getlines)[ -1 ] | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
(grep {/ tab-title: /msx;} &io($file)->getlines)[-1] || ':' . $self->distname
MC/DC0%0/1
(grep {/ tab-title: /msx;} &io($file)->getlines)[-1] || ':' . $self->distname
(grep {/ tab-title: /msx;} &io($file)->getlines)[-1]
Truth table0%0/2
A
A= (grep {/ tab-title: /msx;} &io($file)->getlines)[-1]
| |||||||||||||||||||||||||||||||||||||||||||
| 250 | || ':'.$self->distname; | ||||||||||||||||||||||||||||||||||||||||||
| 251 | |||||||||||||||||||||||||||||||||||||||||||
| 252 | 0 | emit trim( (split m{ : }msx, $text, 2)[ 1 ] ).SPC.$self->appbase; | |||||||||||||||||||||||||||||||||||||||||
| 253 | 0 | return OK; | |||||||||||||||||||||||||||||||||||||||||
| 254 | } | ||||||||||||||||||||||||||||||||||||||||||
| 255 | |||||||||||||||||||||||||||||||||||||||||||
| 256 | 1 | 1; | |||||||||||||||||||||||||||||||||||||||||
| 257 | |||||||||||||||||||||||||||||||||||||||||||
| 258 | __END__ | ||||||||||||||||||||||||||||||||||||||||||