lib/Module/Provision/TraitFor/VCS.pm

filter: Statementstmt 23.4% 63 / 269 Branchbran 0.0% 0 / 84 Conditioncond 0.0% 0 / 42 MC/DCmcdc 0.0% 0 / 24 Subroutinesub 19.1% 9 / 47 Podpod 100% 6 / 6 totaltotal 16.5% 78 / 472 CC 60 SCAR 29.6
CC
60
Cov
16%
set_branch
72.0
__ANON__
56.0
_build_cmd_line_flags
30.0
CRAP 19.3
« lib/Module/Provision/TraitFor/CreatingDistributions.pm ↑ Summary lib/Module/Provision/TraitFor/UpdatingContent.pm »
1 package Module::Provision::TraitFor::VCS;
2  
3 1 ▶use namespace::autoclean;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 1 ▶use Class::Usul::Constants qw( EXCEPTION_CLASS FALSE OK TRUE );
Subroutine BEGIN: called CC=1 SCAR=0.0
6 1 ▶use Class::Usul::Functions qw( io is_win32 throw );
Subroutine BEGIN: called CC=1 SCAR=0.0
7 1 ▶use Class::Usul::Types qw( Bool HashRef Str );
Subroutine BEGIN: called CC=1 SCAR=0.0
8 1 ▶use Perl::Version;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 1 ▶use Scalar::Util qw( blessed );
Subroutine BEGIN: called CC=1 SCAR=0.0
10 1 ▶use Unexpected::Functions qw( Unspecified );
Subroutine BEGIN: called CC=1 SCAR=0.0
11 1 ▶use Moo::Role;
Subroutine BEGIN: called CC=1 SCAR=0.0
12 1 ▶use Class::Usul::Options;
Subroutine BEGIN: called CC=1 SCAR=0.0
13  
14 1 requires qw( add_leader appbase appldir branch build_distribution chdir config
15 cpan_upload default_branch dist_version distname editor exec_perms
16 extra_argv generate_metadata get_line loc next_argv output quiet
17 run_cmd test_upload update_version vcs );
18  
19 # Attribute constructors
20 0 ▶my $_build_cmd_line_flags = sub {
Subroutine _build_cmd_line_flags: not called CC=5 SCAR=34.0
21 0 my $self = shift; my $opts = {};
22  
23 0 for my $k (qw( release test upload nopush )) {
24 $self->extra_argv->[ 0 ] and $self->extra_argv->[ 0 ] eq $k
25 0 ▶ and $self->next_argv and $opts->{ $k } = TRUE;
Branch: 1 branch
BranchTrueFalseTotal
$self->extra_argv->[0] and $self->extra_argv->[0] eq $k and $self->next_argv and $opts->{$k} = 1 0 0 0
Condition0%0/6
$self->extra_argv->[0] and $self->extra_argv->[0] eq $k and $self->next_argv
!ll&&!rl&&r
000
$self->extra_argv->[0] and $self->extra_argv->[0] eq $k
!ll&&!rl&&r
000
MC/DC0%0/3
$self->extra_argv->[0] and $self->extra_argv->[0] eq $k and $self->next_argv
$self->extra_argv->[0] $self->extra_argv->[0] eq $k $self->next_argv
Truth table0%0/4
A and B and C
A= $self->extra_argv->[0]B= $self->extra_argv->[0] eq $kC= $self->next_argv
ABCresult
0XX0
10X0
1100
1111
26 }
27  
28 0 return $opts;
29 1 };
30  
31 # Public attributes
32 1 option 'no_auto_rev' => is => 'ro', isa => Bool, default => FALSE,
33 documentation => 'Do not turn on Revision keyword expansion';
34  
35 1 has 'cmd_line_flags' => is => 'lazy', isa => HashRef[Bool],
36 builder => $_build_cmd_line_flags;
37  
38 # Private attributes
39 1 has '_new_version' => is => 'rwp', isa => Str;
40  
41 # Private functions
42 0 ▶my $_get_state_file_name = sub {
Subroutine __ANON__: not called CC=1 SCAR=6.9
43 0 return (map { m{ load-project-state \s+ [\'\"](.+)[\'\"] }mx; }
44 0 grep { m{ eval: \s+ \( \s* load-project-state }mx }
45 io( $_[ 0 ] )->getlines)[ -1 ];
46 1 };
47  
48 0 ▶my $_tag_from_version = sub {
Subroutine __ANON__: not called CC=1 SCAR=6.9
49 0 my $ver = shift; return $ver->component( 0 ).'.'.$ver->component( 1 );
50 1 };
51  
52 # Private methods
53 0 ▶my $_add_git_hooks = sub {
Subroutine __ANON__: not called CC=3 SCAR=24.8
54 0 my ($self, @hooks) = @_;
55  
56 0 for my $hook (grep { -e ".git${_}" } @hooks) {
57 0 my $dest = $self->appldir->catfile( '.git', 'hooks', $hook );
58  
59 0 ▶ $dest->exists and $dest->unlink; link ".git${hook}", $dest;
Branch: 1 branch
BranchTrueFalseTotal
$dest->exists and $dest->unlink 0 0 0
60 0 chmod $self->exec_perms, ".git${hook}";
61 }
62  
63 0 return;
64 1 };
65  
66 0 ▶my $_add_tag_to_git = sub {
Subroutine __ANON__: not called CC=2 SCAR=17.9
67 0 my ($self, $tag) = @_;
68  
69 0 my $message = $self->loc( $self->config->tag_message );
70 0 ▶ my $sign = $self->config->signing_key; $sign and $sign = "-u ${sign}";
Branch: 1 branch
BranchTrueFalseTotal
$sign and $sign = "-u $sign" 0 0 0
71  
72 0 $self->run_cmd( "git tag -d v${tag}", { err => 'null', expected_rv => 1 } );
73 0 $self->run_cmd( "git tag ${sign} -m '${message}' v${tag}" );
74 0 return;
75 1 };
76  
77 0 ▶my $_add_to_git = sub {
Subroutine __ANON__: not called CC=2 SCAR=17.9
78 0 my ($self, $target, $type) = @_;
79  
80 0 ▶ my $params = $self->quiet ? {} : { out => 'stdout' };
Branch: 1 branch
BranchTrueFalseTotal
$self->quiet ? : 0 0 0
81  
82 0 $self->run_cmd( "git add ${target}", $params );
83 0 return;
84 1 };
85  
86 0 ▶my $_add_to_svn = sub {
Subroutine __ANON__: not called CC=4 SCAR=30.0
87 0 my ($self, $target, $type) = @_;
88  
89 0 ▶ my $params = $self->quiet ? {} : { out => 'stdout' };
Branch: 1 branch
BranchTrueFalseTotal
$self->quiet ? : 0 0 0
90  
91 0 $self->run_cmd( "svn add ${target} --parents", $params );
92 0 $self->run_cmd( "svn propset svn:keywords 'Id Revision Auth' ${target}",
93 $params );
94 0 ▶ $type and $type eq 'program'
Branch: 1 branch
BranchTrueFalseTotal
$type and $type eq "program" and $self->run_cmd("svn propset svn:executable '*' $target", $params) 0 0 0
Condition0%0/3
$type and $type eq "program"
!ll&&!rl&&r
000
MC/DC0%0/2
$type and $type eq "program"
$type $type eq "program"
Truth table0%0/3
A and B
A= $typeB= $type eq "program"
ABresult
0X0
100
111
95 and $self->run_cmd( "svn propset svn:executable '*' ${target}", $params );
96 0 return;
97 1 };
98  
99 0 ▶my $_commit_release_to_git = sub {
Subroutine __ANON__: not called CC=1 SCAR=6.9
100 0 my ($self, $msg) = @_;
101  
102 0 $self->run_cmd( 'git add .' ); $self->run_cmd( "git commit -m '${msg}'" );
103  
104 0 return;
105 1 };
106  
107 0 ▶my $_commit_release_to_svn = sub {
Subroutine __ANON__: not called CC=1 SCAR=0.0
108 # TODO: Fill this in
109 1 };
110  
111 0 ▶my $_get_rev_file = sub {
Subroutine __ANON__: not called CC=3 SCAR=24.8
112 0 ▶ my $self = shift; ($self->no_auto_rev or $self->vcs ne 'git') and return;
Branch: 1 branch
BranchTrueFalseTotal
$self->no_auto_rev || $self->vcs ne "git" and return 0 0 0
Condition0%0/3
$self->no_auto_rev or $self->vcs ne "git"
l!l&&r!l&&!r
000
MC/DC0%0/2
$self->no_auto_rev or $self->vcs ne "git"
$self->no_auto_rev $self->vcs ne "git"
Truth table0%0/3
A or B
A= $self->no_auto_revB= $self->vcs ne "git"
ABresult
1X1
011
000
113  
114 0 return $self->appldir->parent->catfile( lc '.'.$self->distname.'.rev' );
115 1 };
116  
117 0 ▶my $_get_svn_repository = sub {
Subroutine __ANON__: not called CC=1 SCAR=6.9
118 0 my $self = shift; my $info = $self->run_cmd( 'svn info' )->stdout;
119  
120 0 return (split m{ : \s }mx, (grep { m{ \A Repository \s Root: }mx }
121 split m{ \n }mx, $info)[ 0 ])[ 1 ];
122 1 };
123  
124 0 ▶my $_get_version_numbers = sub {
Subroutine __ANON__: not called CC=7 SCAR=40.3
125 0 ▶ my ($self, @args) = @_; $args[ 0 ] and $args[ 1 ] and return @args;
Branch: 1 branch
BranchTrueFalseTotal
$args[0] and $args[1] and return @args 0 0 0
Condition0%0/3
$args[0] and $args[1]
!ll&&!rl&&r
000
MC/DC0%0/2
$args[0] and $args[1]
$args[0] $args[1]
Truth table0%0/3
A and B
A= $args[0]B= $args[1]
ABresult
0X0
100
111
126  
127 0 my $prompt = '+Enter major/minor 0 or 1';
128 0 my $comp = $self->get_line( $prompt, 1, TRUE, 0 );
129 0 $prompt = '+Enter increment/decrement';
130 0 ▶ my $bump = $self->get_line( $prompt, 1, TRUE, 0 ) or return @args;
Branch: 1 branch
BranchTrueFalseTotal
my $bump = $self->get_line($prompt, 1, 1, 0) or return @args 0 0 0
131 0 my ($from, $ver);
132  
133 0 ▶ if ($from = $args[ 0 ]) { $ver = Perl::Version->new( $from ) }
Branch: 1 branch
BranchTrueFalseTotal
if ($from = $args[0]) { } 0 0 0
134 else {
135 0 ▶ $ver = $self->dist_version or return @args;
Branch: 1 branch
BranchTrueFalseTotal
$ver = $self->dist_version or return @args 0 0 0
136 0 $from = $_tag_from_version->( $ver );
137 }
138  
139 0 $ver->component( $comp, $ver->component( $comp ) + $bump );
140 0 ▶ $comp == 0 and $ver->component( 1, 0 );
Branch: 1 branch
BranchTrueFalseTotal
$comp == 0 and $ver->component(1, 0) 0 0 0
141  
142 0 return ($from, $_tag_from_version->( $ver ));
143 1 };
144  
145 0 ▶my $_initialize_svn = sub {
Subroutine __ANON__: not called CC=2 SCAR=17.9
146 0 my $self = shift; my $class = blessed $self; $self->chdir( $self->appbase );
147  
148 0 my $repository = $self->appbase->catdir( $self->repository );
149  
150 0 $self->run_cmd( "svnadmin create ${repository}" );
151  
152 0 my $branch = $self->branch;
153 0 my $url = 'file://'.$repository->catdir( $branch );
154 0 my $msg = $self->loc( 'Initialised by [_1]', $class );
155  
156 0 $self->run_cmd( "svn import ${branch} ${url} -m '${msg}'" );
157  
158 0 my $appldir = $self->appldir; $appldir->rmtree;
159  
160 0 $self->run_cmd( "svn co ${url}" );
161 0 ▶ $appldir->filter( sub { $_ !~ m{ \.git }msx and $_ !~ m{ \.svn }msx } );
Subroutine __ANON__: not called CC=2 SCAR=17.9
Condition0%0/3
$_ =~ / \.git /msx || $_ =~ / \.svn /msx
l!l&&r!l&&!r
000
MC/DC0%0/2
$_ =~ / \.git /msx || $_ =~ / \.svn /msx
$_ =~ / \.git /msx $_ =~ / \.svn /msx
Truth table0%0/3
A || B
A= $_ =~ / \.git /msxB= $_ =~ / \.svn /msx
ABresult
1X1
011
000
162  
163 0 for my $target ($appldir->deep->all_files) {
164 0 $self->run_cmd( "svn propset svn:keywords 'Id Revision Auth' ${target}" );
165 }
166  
167 0 $msg = $self->loc( 'Add RCS keywords to project files' );
168 0 $self->run_cmd( "svn commit ${branch} -m '${msg}'" );
169 0 $self->chdir( $self->appldir );
170 0 $self->run_cmd( 'svn update' );
171 0 return;
172 1 };
173  
174 0 ▶my $_push_to_git_remote = sub {
Subroutine __ANON__: not called CC=3 SCAR=24.8
175 0 my $self = shift; my $info = $self->run_cmd( 'git remote -v' )->stdout;
176  
177 0 ▶ (grep { m{ \(push\) \z }mx } split m{ \n }mx, $info)[ 0 ] or return;
Branch: 1 branch
BranchTrueFalseTotal
(grep {/ \(push\) \z /mx;} split(/ \n /mx, $info, 0))[0] or return 0 0 0
178  
179 0 ▶ my $params = $self->quiet ? {} : { out => 'stdout' };
Branch: 1 branch
BranchTrueFalseTotal
$self->quiet ? : 0 0 0
180  
181 0 $self->run_cmd( 'git push --all', $params );
182 0 $self->run_cmd( 'git push --tags', $params );
183 0 return;
184 1 };
185  
186 0 ▶my $_push_to_remote = sub {
Subroutine __ANON__: not called CC=2 SCAR=17.9
187 0 my $self = shift;
188  
189 0 ▶ $self->vcs eq 'git' and $self->$_push_to_git_remote;
Branch: 1 branch
BranchTrueFalseTotal
$self->vcs eq "git" and $self->$_push_to_git_remote 0 0 0
190 0 return;
191 1 };
192  
193 0 ▶my $_svn_ignore_meta_files = sub {
Subroutine __ANON__: not called CC=1 SCAR=6.9
194 0 my $self = shift; $self->chdir( $self->appldir );
195  
196 0 my $ignores = "LICENSE\nMANIFEST\nMETA.json\nMETA.yml\nREADME\nREADME.md";
197  
198 0 $self->run_cmd( "svn propset svn:ignore '${ignores}' ." );
199 0 $self->run_cmd( 'svn commit -m "Ignoring meta files" .' );
200 0 $self->run_cmd( 'svn update' );
201 0 return;
202 1 };
203  
204 0 ▶my $_wrap = sub {
Subroutine __ANON__: not called CC=1 SCAR=6.9
205 0 my $self = shift; my $method = shift; return not $self->$method( @_ );
206 1 };
207  
208 0 ▶my $_add_tag_to_svn = sub {
Subroutine __ANON__: not called CC=2 SCAR=17.9
209 0 ▶ my ($self, $tag) = @_; my $params = $self->quiet ? {} : { out => 'stdout' };
Branch: 1 branch
BranchTrueFalseTotal
$self->quiet ? : 0 0 0
210  
211 0 my $repo = $self->$_get_svn_repository;
212 0 my $from = "${repo}/trunk";
213 0 my $to = "${repo}/tags/v${tag}";
214 0 my $message = $self->loc( $self->config->tag_message )." v${tag}";
215 0 my $cmd = "svn copy --parents -m '${message}' ${from} ${to}";
216  
217 0 $self->run_cmd( $cmd, $params );
218 0 return;
219 1 };
220  
221 0 ▶my $_commit_release = sub {
Subroutine __ANON__: not called CC=3 SCAR=24.8
222 0 my ($self, $tag) = @_; my $msg = $self->config->tag_message." v${tag}";
223  
224 0 ▶ $self->vcs eq 'git' and $self->$_commit_release_to_git( $msg );
Branch: 1 branch
BranchTrueFalseTotal
$self->vcs eq "git" and $self->$_commit_release_to_git($msg) 0 0 0
225 0 ▶ $self->vcs eq 'svn' and $self->$_commit_release_to_svn( $msg );
Branch: 1 branch
BranchTrueFalseTotal
$self->vcs eq "svn" and $self->$_commit_release_to_svn($msg) 0 0 0
226 0 return;
227 1 };
228  
229 0 ▶my $_initialize_git = sub {
Subroutine __ANON__: not called CC=1 SCAR=6.9
230 0 my $self = shift;
231 0 my $msg = $self->loc( 'Initialised by [_1]', blessed $self );
232  
233 0 $self->chdir( $self->appldir ); $self->run_cmd( 'git init' );
234  
235 0 $self->add_hooks; $self->$_commit_release_to_git( $msg );
236  
237 0 return;
238 1 };
239  
240 0 ▶my $_reset_rev_file = sub {
Subroutine __ANON__: not called CC=5 SCAR=34.0
241 0 my ($self, $create) = @_; my $file = $self->$_get_rev_file;
242  
243 0 ▶ $file and ($create or $file->exists)
Branch: 2 branches
BranchTrueFalseTotal
$file and $create || $file->exists and $file->println($create ? 1 : 0) 0 0 0
$create ? : 0 0 0
Condition0%0/6
$file and $create || $file->exists
!ll&&!rl&&r
000
$create or $file->exists
l!l&&r!l&&!r
000
MC/DC0%0/3
$file and $create || $file->exists
$file $create $file->exists
Truth table0%0/4
A and B or C
A= $fileB= $createC= $file->exists
ABCresult
0XX0
1000
11X1
1011
244 and $file->println( $create ? '1' : '0' );
245 0 return;
246 1 };
247  
248 0 ▶my $_reset_rev_keyword = sub {
Subroutine __ANON__: not called CC=2 SCAR=17.9
249 0 my ($self, $path) = @_;
250  
251 0 my $zero = 0; # Zero variable prevents unwanted Rev keyword expansion
252  
253 0 ▶ $self->$_get_rev_file and $path->substitute
Branch: 1 branch
BranchTrueFalseTotal
$self->$_get_rev_file and $path->substitute("\\\$ (Rev (?:ision)?) (?:[:] \\s+ (\\d+) \\s+)? \\\$", '$Rev: ' . $zero . ' $') 0 0 0
254 ( '\$ (Rev (?:ision)?) (?:[:] \s+ (\d+) \s+)? \$', '$Rev: '.$zero.' $' );
255 0 return;
256 1 };
257  
258 0 ▶my $_add_tag = sub {
Subroutine __ANON__: not called CC=4 SCAR=30.0
259 0 my ($self, $tag) = @_;
260  
261 0 ▶ $tag or throw Unspecified, [ 'VCS tag version' ];
Branch: 1 branch
BranchTrueFalseTotal
$tag or &throw(Unspecified(), ["VCS tag version"]) 0 0 0
262 0 $self->output( 'Creating tagged release v[_1]', { args => [ $tag ] } );
263 0 ▶ $self->vcs eq 'git' and $self->$_add_tag_to_git( $tag );
Branch: 1 branch
BranchTrueFalseTotal
$self->vcs eq "git" and $self->$_add_tag_to_git($tag) 0 0 0
264 0 ▶ $self->vcs eq 'svn' and $self->$_add_tag_to_svn( $tag );
Branch: 1 branch
BranchTrueFalseTotal
$self->vcs eq "svn" and $self->$_add_tag_to_svn($tag) 0 0 0
265 0 return;
266 1 };
267  
268 0 ▶my $_initialize_vcs = sub {
Subroutine __ANON__: not called CC=4 SCAR=30.0
269 0 my $self = shift;
270  
271 0 ▶ $self->vcs ne 'none' and $self->output( 'Initialising VCS' );
Branch: 1 branch
BranchTrueFalseTotal
$self->vcs ne "none" and $self->output("Initialising VCS") 0 0 0
272 0 ▶ $self->vcs eq 'git' and $self->$_initialize_git;
Branch: 1 branch
BranchTrueFalseTotal
$self->vcs eq "git" and $self->$_initialize_git 0 0 0
273 0 ▶ $self->vcs eq 'svn' and $self->$_initialize_svn;
Branch: 1 branch
BranchTrueFalseTotal
$self->vcs eq "svn" and $self->$_initialize_svn 0 0 0
274 0 return;
275 1 };
276  
277 # Construction
278 0 ▶around 'dist_post_hook' => sub {
Subroutine __ANON__: not called CC=3 SCAR=24.8
279 0 my ($next, $self, @args) = @_; $self->$_initialize_vcs;
280  
281 0 my $r = $self->$next( @args );
282  
283 0 ▶ $self->vcs eq 'git' and $self->$_reset_rev_file( TRUE );
Branch: 1 branch
BranchTrueFalseTotal
$self->vcs eq "git" and $self->$_reset_rev_file(1) 0 0 0
284 0 ▶ $self->vcs eq 'svn' and $self->$_svn_ignore_meta_files;
Branch: 1 branch
BranchTrueFalseTotal
$self->vcs eq "svn" and $self->$_svn_ignore_meta_files 0 0 0
285 0 return $r;
286 1 };
287  
288 0 ▶around 'release_distribution' => sub {
Subroutine __ANON__: not called CC=3 SCAR=24.8
289 0 my ($orig, $self) = @_;
290  
291 $self->cmd_line_flags->{test}
292 0 ▶ and $self->$_wrap( 'build_distribution' )
Branch: 1 branch
BranchTrueFalseTotal
$self->cmd_line_flags->{"test"} and $self->$_wrap("build_distribution") and $self->$_wrap("test_upload", $self->dist_version) 0 0 0
Condition0%0/3
$self->cmd_line_flags->{"test"} and $self->$_wrap("build_distribution")
!ll&&!rl&&r
000
MC/DC0%0/2
$self->cmd_line_flags->{"test"} and $self->$_wrap("build_distribution")
$self->cmd_line_flags->{"test"} $self->$_wrap("build_distribution")
Truth table0%0/3
A and B
A= $self->cmd_line_flags->{"test"}B= $self->$_wrap("build_distribution")
ABresult
0X0
100
111
293 and $self->$_wrap( 'test_upload', $self->dist_version );
294  
295 0 return $orig->( $self );
296 1 };
297  
298 0 ▶around 'release_distribution' => sub {
Subroutine __ANON__: not called CC=4 SCAR=30.0
299 0 my ($orig, $self) = @_; my $res = $orig->( $self );
300  
301 $self->cmd_line_flags->{upload}
302 0 ▶ and $self->$_wrap( 'build_distribution' )
Branch: 1 branch
BranchTrueFalseTotal
$self->cmd_line_flags->{"upload"} and $self->$_wrap("build_distribution") and $self->$_wrap("cpan_upload") and $self->$_wrap("clean_distribution") 0 0 0
Condition0%0/6
$self->cmd_line_flags->{"upload"} and $self->$_wrap("build_distribution") and $self->$_wrap("cpan_upload")
!ll&&!rl&&r
000
$self->cmd_line_flags->{"upload"} and $self->$_wrap("build_distribution")
!ll&&!rl&&r
000
MC/DC0%0/3
$self->cmd_line_flags->{"upload"} and $self->$_wrap("build_distribution") and $self->$_wrap("cpan_upload")
$self->cmd_line_flags->{"upload"} $self->$_wrap("build_distribution") $self->$_wrap("cpan_upload")
Truth table0%0/4
A and B and C
A= $self->cmd_line_flags->{"upload"}B= $self->$_wrap("build_distribution")C= $self->$_wrap("cpan_upload")
ABCresult
0XX0
10X0
1100
1111
303 and $self->$_wrap( 'cpan_upload' )
304 and $self->$_wrap( 'clean_distribution' );
305  
306 0 return $res;
307 1 };
308  
309 0 ▶around 'release_distribution' => sub {
Subroutine __ANON__: not called CC=2 SCAR=17.9
310 0 my ($orig, $self) = @_; my $res = $orig->( $self );
311  
312 0 ▶ $self->cmd_line_flags->{nopush} or $self->$_push_to_remote;
Branch: 1 branch
BranchTrueFalseTotal
$self->cmd_line_flags->{"nopush"} or $self->$_push_to_remote 0 0 0
313  
314 0 return $res;
315 1 };
316  
317 0 ▶around 'substitute_version' => sub {
Subroutine __ANON__: not called CC=2 SCAR=17.9
318 0 my ($next, $self, $path, @args) = @_; my $r = $self->$next( $path, @args );
319  
320 0 ▶ $self->vcs eq 'git' and $self->$_reset_rev_keyword( $path );
Branch: 1 branch
BranchTrueFalseTotal
$self->vcs eq "git" and $self->$_reset_rev_keyword($path) 0 0 0
321 0 return $r;
322 1 };
323  
324 0 ▶around 'update_version_pre_hook' => sub {
Subroutine __ANON__: not called CC=1 SCAR=6.9
325 0 my ($next, $self, @args) = @_;
326  
327 0 return $self->$next( $self->$_get_version_numbers( @args ) );
328 1 };
329  
330 0 ▶around 'update_version_post_hook' => sub {
Subroutine __ANON__: not called CC=2 SCAR=17.9
331 0 my ($next, $self, @args) = @_;
332  
333 0 $self->_set__new_version( $args[ 1 ] );
334 0 $self->clear_dist_version; $self->clear_module_metadata;
335  
336 0 my $result = $self->$next( @args );
337  
338 0 ▶ $self->vcs eq 'git' and $self->$_reset_rev_file( FALSE );
Branch: 1 branch
BranchTrueFalseTotal
$self->vcs eq "git" and $self->$_reset_rev_file(0) 0 0 0
339  
340 0 return $result;
341 1 };
342  
343 # Public methods
344 0 ▶sub add_hooks : method {
Subroutine add_hooks: not called CC=2 SCAR=17.9
Pod documented
345 0 my $self = shift;
346  
347 0 ▶ $self->vcs eq 'git' and $self->$_add_git_hooks( @{ $self->config->hooks } );
Branch: 1 branch
BranchTrueFalseTotal
$self->vcs eq "git" and $self->$_add_git_hooks(@{$self->config->hooks;}) 0 0 0
348  
349 0 return OK;
350 }
351  
352 0 ▶sub add_to_vcs {
Subroutine add_to_vcs: not called CC=4 SCAR=30.0
Pod documented
353 0 my ($self, $target, $type) = @_;
354  
355 0 ▶ $target or throw Unspecified, [ 'VCS target' ];
Branch: 1 branch
BranchTrueFalseTotal
$target or &throw(Unspecified(), ["VCS target"]) 0 0 0
356 0 ▶ $self->vcs eq 'git' and $self->$_add_to_git( $target, $type );
Branch: 1 branch
BranchTrueFalseTotal
$self->vcs eq "git" and $self->$_add_to_git($target, $type) 0 0 0
357 0 ▶ $self->vcs eq 'svn' and $self->$_add_to_svn( $target, $type );
Branch: 1 branch
BranchTrueFalseTotal
$self->vcs eq "svn" and $self->$_add_to_svn($target, $type) 0 0 0
358 0 return;
359 }
360  
361 0 ▶sub get_emacs_state_file_path {
Subroutine get_emacs_state_file_path: not called CC=1 SCAR=6.9
Pod documented
362 0 my ($self, $file) = @_; my $home = $self->config->my_home;
363  
364 0 return $home->catfile( '.emacs.d', 'config', "state.${file}" );
365 }
366  
367 0 ▶sub release : method {
Subroutine release: not called CC=1 SCAR=6.9
Pod documented
368 0 my $self = shift; $self->release_distribution; return OK;
369 }
370  
371 0 ▶sub release_distribution {
Subroutine release_distribution: not called CC=1 SCAR=6.9
Pod documented
372 0 my $self = shift;
373  
374 0 $self->update_version;
375 0 $self->generate_metadata;
376 0 $self->$_commit_release( $self->_new_version );
377 0 $self->$_add_tag( $self->_new_version );
378 0 return TRUE;
379 }
380  
381 0 ▶sub set_branch : method {
Subroutine set_branch: not called CC=8 SCAR=42.8
Pod documented
382 0 my $self = shift; my $bfile = $self->branch_file;
383  
384 0 my $old_branch = $self->branch;
385 0 ▶ my $new_branch = $self->next_argv // $self->default_branch;
Condition0%0/3
$self->next_argv // $self->default_branch
l!l&&r!l&&!r
000
MC/DC0%0/2
$self->next_argv // $self->default_branch
$self->next_argv $self->default_branch
Truth table0%0/3
A // B
A= $self->next_argvB= $self->default_branch
ABresult
1X1
011
000
386  
387 0 ▶ not $new_branch and $bfile->exists and $bfile->unlink and return OK;
Branch: 1 branch
BranchTrueFalseTotal
not $new_branch and $bfile->exists and $bfile->unlink and return 0 0 0 0
Condition0%0/6
not $new_branch and $bfile->exists and $bfile->unlink
!ll&&!rl&&r
000
not $new_branch and $bfile->exists
!ll&&!rl&&r
000
MC/DC0%0/3
not $new_branch and $bfile->exists and $bfile->unlink
not $new_branch $bfile->exists $bfile->unlink
Truth table0%0/4
not(A) and B and C
A= not $new_branchB= $bfile->existsC= $bfile->unlink
ABCresult
0XX0
10X0
1100
1111
388 0 ▶ $new_branch and $bfile->println( $new_branch );
Branch: 1 branch
BranchTrueFalseTotal
$new_branch and $bfile->println($new_branch) 0 0 0
389  
390 0 my $method = 'get_'.$self->editor.'_state_file_path';
391  
392 0 ▶ $self->can( $method ) or return OK;
Branch: 1 branch
BranchTrueFalseTotal
$self->can($method) or return 0 0 0 0
393  
394 0 my $sfname = $_get_state_file_name->( $self->project_file );
395 0 my $sfpath = $self->$method( $sfname );
396 0 ▶ my $sep = is_win32 ? "\\" : '/';
Branch: 1 branch
BranchTrueFalseTotal
&is_win32() ? : 0 0 0
397  
398 0 $sfpath->substitute( "${sep}\Q${old_branch}\E${sep}",
399 "${sep}${new_branch}${sep}" );
400 0 return OK;
401 }
402  
403 1 1;
404  
405 __END__
« lib/Module/Provision/TraitFor/CreatingDistributions.pm ↑ Summary lib/Module/Provision/TraitFor/UpdatingContent.pm »