Minilla/Release/Commit.pm

filter: Statementstmt 45.7% 16 / 35 Branchbran 0.0% 0 / 8 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 71.4% 5 / 7 Podpod 0.0% 0 / 1 totaltotal 41.1% 21 / 51 CC 5 SCAR 21.8
CC
5
Cov
37%
run
20.0
_push_to_origin
6.0
BEGIN
1.0
CRAP 8.8
« Minilla/ModuleMaker/ModuleBuild.pm ↑ Summary Minilla/Profile/Base.pm »
1 package Minilla::Release::Commit;
2 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use utf8;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 1 ▶use Minilla::Util qw(find_file cmd);
Subroutine BEGIN: called CC=1 SCAR=0.0
7 1 ▶use Minilla::Logger;
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 0 ▶sub run {
Subroutine run: not called CC=4 SCAR=30.0
Pod undocumented
10 0 my ($self, $project, $opts) = @_;
11  
12 0 my @modified_files = split /\0/, `git ls-files --deleted --modified -z`;
13 0 ▶ return if @modified_files == 0;
Branch: 1 branch
BranchTrueFalseTotal
if @modified_files == 0 0 0 0
14  
15 0 $project->clear_metadata();
16 0 my $ver = $project->metadata->version;
17  
18 0 my $msg = "Checking in changes prior to tagging of version $ver.";
19 0 ▶ if ($project->manage_changes) {
Branch: 1 branch
BranchTrueFalseTotal
if ($project->manage_changes) 0 0 0
20 0 $msg .= "\n\nChangelog diff is:\n\n";
21 0 $msg .= `git diff Changes`;
22 }
23  
24 0 ▶ if ($opts->{dry_run}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($opts->{"dry_run"}) 0 0 0
25 0 infof("DRY-RUN. Would have committed message of:\n----------------\n$msg\n-----------\n");
26 0 return;
27 }
28  
29 0 cmd('git', 'commit', '-a', '-m', $msg, '--cleanup=verbatim');
30  
31 0 $self->_push_to_origin();
32 }
33  
34 0 ▶sub _push_to_origin {
Subroutine _push_to_origin: not called CC=2 SCAR=17.9
35 0 my ($self) = @_;
36  
37 # git v1.7.10 is required?
38 0 ▶ my $branch = `git symbolic-ref --short HEAD`
Branch: 1 branch
BranchTrueFalseTotal
my $branch = `git symbolic-ref --short HEAD` or return 0 0 0
39 or return;
40 0 $branch =~ s/\n//g;
41 0 infof("Pushing to origin\n");
42 0 cmd('git', 'push', 'origin', $branch);
43 }
44  
45 1 1;
« Minilla/ModuleMaker/ModuleBuild.pm ↑ Summary Minilla/Profile/Base.pm »