lib/Dist/Zilla/Plugin/Author/GSG.pm

filter: Statementstmt 54.7% 23 / 42 Branchbran 8.3% 1 / 12 Conditioncond 0.0% 0 / 6 MC/DCmcdc 0.0% 0 / 3 Subroutinesub 85.7% 6 / 7 Podpod n/a totaltotal 42.8% 30 / 70 CC 10 SCAR 39.4
CC
10
Cov
40%
:before
90.0
_git_version_ok
2.0
BEGIN
1.0
CRAP 51.2
↑ Summary lib/Dist/Zilla/PluginBundle/Author/GSG.pm »
1 package Dist::Zilla::Plugin::Author::GSG;
2 3 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 3 with qw(
4 Dist::Zilla::Role::Plugin
5 );
6 3 ▶use Git::Wrapper qw();
Subroutine BEGIN: called CC=1 SCAR=0.0
7 3 ▶use version;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 3 ▶use namespace::autoclean;
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 # ABSTRACT: Grant Street Group defaults CPAN dists
11 3 ▶use version;
Subroutine BEGIN: called CC=1 SCAR=0.0
12 3 our $VERSION = 'v0.6.2'; # VERSION
13  
14 3 before 'BUILDARGS' => \&_BUILDARGS;
15  
16 2 ▶sub _git_version_ok {
Subroutine _git_version_ok: called CC=2 SCAR=7.1
17 2 my ($git_version) = @_;
18  
19 # Apple says: "2.21.1 (Apple Git-122.3)" so we need the regex
20 2 ▶ $git_version = $1 if $git_version =~ /^(\d+(?:\.\d+)*)/;
Branch: 1 branch
BranchTrueFalseTotal
if $git_version =~ /^(\d+(?:\.\d+)*)/ 2 0 2
21  
22 2 return version->parse("v$git_version") >= v1.7.5;
23 }
24  
25 # Use a named sub for Devel::Cover
26 0 ▶sub _BUILDARGS {
Subroutine :before: not called CC=9 SCAR=45.0
27 0 my ($class, $args) = @_;
28  
29 $args->{zilla}->{authors}
30 0 ▶ ||= ['Grant Street Group <developers@grantstreet.com>'];
Condition0%0/2
$args->{"zilla"}{"authors"} ||= ["Grant Street Group <developers\@grantstreet.com>"]
l!l
00
MC/DC0%0/1
$args->{"zilla"}{"authors"} ||= ["Grant Street Group <developers\@grantstreet.com>"]
$args->{"zilla"}{"authors"}
Truth table0%0/2
A
A= $args->{"zilla"}{"authors"}
Aresult
11
00
31  
32 0 ▶ $args->{zilla}->{_license_class} ||= 'Artistic_2_0';
Condition0%0/2
$args->{"zilla"}{"_license_class"} ||= "Artistic_2_0"
l!l
00
MC/DC0%0/1
$args->{"zilla"}{"_license_class"} ||= "Artistic_2_0"
$args->{"zilla"}{"_license_class"}
Truth table0%0/2
A
A= $args->{"zilla"}{"_license_class"}
Aresult
11
00
33 0 ▶ $args->{zilla}->{_copyright_holder} ||= 'Grant Street Group';
Condition0%0/2
$args->{"zilla"}{"_copyright_holder"} ||= "Grant Street Group"
l!l
00
MC/DC0%0/1
$args->{"zilla"}{"_copyright_holder"} ||= "Grant Street Group"
$args->{"zilla"}{"_copyright_holder"}
Truth table0%0/2
A
A= $args->{"zilla"}{"_copyright_holder"}
Aresult
11
00
34  
35 0 ▶ if ( not $args->{zilla}->{_copyright_year} ) {
Branch: 1 branch
BranchTrueFalseTotal
if (not $args->{"zilla"}{"_copyright_year"}) 0 0 0
36 0 my $git = Git::Wrapper->new( $args->{zilla}->root );
37  
38 # We need v1.7.5 of git in order to get all the flags
39 # necessary to do all the things.
40 0 my $git_version = $git->version;
41  
42 $args->{zilla}
43 0 ▶ ->log_fatal( "[Author::GSG] Git 1.7.5 or greater is required"
Branch: 1 branch
BranchTrueFalseTotal
unless _git_version_ok($git_version) 0 0 0
44 . ", only have $git_version." )
45 unless _git_version_ok($git_version);
46  
47 0 local $@;
48 0 my ( $commit, $date ) = eval { local $SIG{__DIE__};
49 0 $git->rev_list(qw( --max-parents=0 --pretty=format:%ai HEAD )) };
50  
51 0 my $year = 1900 + (localtime)[5];
52 0 ▶ if ($date) {
Branch: 1 branch
BranchTrueFalseTotal
if ($date) { } 0 0 0
53 0 my $this_year = $year;
54 0 ▶ $year = $1 if $date =~ /^(\d{4})/;
Branch: 1 branch
BranchTrueFalseTotal
if $date =~ /^(\d{4})/ 0 0 0
55 0 ▶ $year .= " - $this_year" unless $year == $this_year;
Branch: 1 branch
BranchTrueFalseTotal
unless $year == $this_year 0 0 0
56 }
57 else {
58 0 $args->{zilla}->log("Didn't find copyright start date: $@");
59 }
60  
61 0 $args->{zilla}->{_copyright_year} = $year;
62 }
63 }
64  
65 3 __PACKAGE__->meta->make_immutable;
66 3 1;
67  
68 __END__
↑ Summary lib/Dist/Zilla/PluginBundle/Author/GSG.pm »