| 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
| |||||||||||||
| 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>"]
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"}
| |||||||||||||
| 31 | |||||||||||||
| 32 | 0 | ▶ | $args->{zilla}->{_license_class} ||= 'Artistic_2_0'; | ||||||||||
|
Condition0%0/2
$args->{"zilla"}{"_license_class"} ||= "Artistic_2_0"
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"}
| |||||||||||||
| 33 | 0 | ▶ | $args->{zilla}->{_copyright_holder} ||= 'Grant Street Group'; | ||||||||||
|
Condition0%0/2
$args->{"zilla"}{"_copyright_holder"} ||= "Grant Street Group"
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"}
| |||||||||||||
| 34 | |||||||||||||
| 35 | 0 | ▶ | if ( not $args->{zilla}->{_copyright_year} ) { | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 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
| |||||||||||||
| 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
| |||||||||||||
| 53 | 0 | my $this_year = $year; | |||||||||||
| 54 | 0 | ▶ | $year = $1 if $date =~ /^(\d{4})/; | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 55 | 0 | ▶ | $year .= " - $this_year" unless $year == $this_year; | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 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__ | ||||||||||||