line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Dist::Zilla::Plugin::Author::GSG; |
2
|
2
|
|
|
2
|
|
210282
|
use Moose; |
|
2
|
|
|
|
|
446267
|
|
|
2
|
|
|
|
|
12
|
|
3
|
|
|
|
|
|
|
with qw( |
4
|
|
|
|
|
|
|
Dist::Zilla::Role::Plugin |
5
|
|
|
|
|
|
|
); |
6
|
2
|
|
|
2
|
|
14754
|
use Git::Wrapper qw(); |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
39
|
|
7
|
2
|
|
|
2
|
|
11
|
use version; |
|
2
|
|
|
|
|
6
|
|
|
2
|
|
|
|
|
16
|
|
8
|
2
|
|
|
2
|
|
196
|
use namespace::autoclean; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
30
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
# ABSTRACT: Grant Street Group defaults CPAN dists |
11
|
2
|
|
|
2
|
|
175
|
use version; |
|
2
|
|
|
|
|
9
|
|
|
2
|
|
|
|
|
8
|
|
12
|
|
|
|
|
|
|
our $VERSION = 'v0.5.2'; # VERSION |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
before 'BUILDARGS' => \&_BUILDARGS; |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
sub _git_version_ok { |
17
|
24
|
|
|
24
|
|
314912
|
my ($git_version) = @_; |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
# Apple says: "2.21.1 (Apple Git-122.3)" so we need the regex |
20
|
24
|
50
|
|
|
|
834
|
$git_version = $1 if $git_version =~ /^(\d+(?:\.\d+)*)/; |
21
|
|
|
|
|
|
|
|
22
|
24
|
|
|
|
|
1468
|
return version->parse("v$git_version") >= v1.7.5; |
23
|
|
|
|
|
|
|
} |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
# Use a named sub for Devel::Cover |
26
|
|
|
|
|
|
|
sub _BUILDARGS { |
27
|
23
|
|
|
23
|
|
1044
|
my ($class, $args) = @_; |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
$args->{zilla}->{authors} |
30
|
23
|
|
100
|
|
|
328
|
||= ['Grant Street Group <developers@grantstreet.com>']; |
31
|
|
|
|
|
|
|
|
32
|
23
|
|
100
|
|
|
256
|
$args->{zilla}->{_license_class} ||= 'Artistic_2_0'; |
33
|
23
|
|
100
|
|
|
248
|
$args->{zilla}->{_copyright_holder} ||= 'Grant Street Group'; |
34
|
|
|
|
|
|
|
|
35
|
23
|
100
|
|
|
|
160
|
if ( not $args->{zilla}->{_copyright_year} ) { |
36
|
22
|
|
|
|
|
826
|
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
|
22
|
|
|
|
|
2017
|
my $git_version = $git->version; |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
$args->{zilla} |
43
|
22
|
100
|
|
|
|
165559
|
->log_fatal( "[Author::GSG] Git 1.7.5 or greater is required" |
44
|
|
|
|
|
|
|
. ", only have $git_version." ) |
45
|
|
|
|
|
|
|
unless _git_version_ok($git_version); |
46
|
|
|
|
|
|
|
|
47
|
18
|
|
|
|
|
91
|
local $@; |
48
|
18
|
|
|
|
|
69
|
my ( $commit, $date ) = eval { local $SIG{__DIE__}; |
|
18
|
|
|
|
|
382
|
|
49
|
18
|
|
|
|
|
504
|
$git->rev_list(qw( --max-parents=0 --pretty=format:%ai HEAD )) }; |
50
|
|
|
|
|
|
|
|
51
|
18
|
|
|
|
|
185072
|
my $year = 1900 + (localtime)[5]; |
52
|
18
|
100
|
|
|
|
222
|
if ($date) { |
53
|
8
|
|
|
|
|
80
|
my $this_year = $year; |
54
|
8
|
50
|
|
|
|
410
|
$year = $1 if $date =~ /^(\d{4})/; |
55
|
8
|
100
|
|
|
|
225
|
$year .= " - $this_year" unless $year == $this_year; |
56
|
|
|
|
|
|
|
} |
57
|
|
|
|
|
|
|
else { |
58
|
10
|
|
|
|
|
308
|
$args->{zilla}->log("Didn't find copyright start date: $@"); |
59
|
|
|
|
|
|
|
} |
60
|
|
|
|
|
|
|
|
61
|
18
|
|
|
|
|
16612
|
$args->{zilla}->{_copyright_year} = $year; |
62
|
|
|
|
|
|
|
} |
63
|
|
|
|
|
|
|
} |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |
66
|
|
|
|
|
|
|
1; |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
__END__ |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
=pod |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
=encoding UTF-8 |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
=head1 NAME |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
Dist::Zilla::Plugin::Author::GSG - Grant Street Group defaults CPAN dists |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
=head1 VERSION |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
version v0.5.2 |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
=head1 SYNOPSIS |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
If you don't want the whole L<Dist::Zilla::PluginBundle::Author::GSG> |
85
|
|
|
|
|
|
|
you can get the licence and author default from this Plugin. |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
name = Foo-Bar-GSG |
88
|
|
|
|
|
|
|
[@Basic] |
89
|
|
|
|
|
|
|
[Author::GSG] |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
Which is the same as |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
name = Foo-Bar-GSG |
94
|
|
|
|
|
|
|
author = Grant Street Group <developers@grantstreet.com> |
95
|
|
|
|
|
|
|
license = Artistic_2_0 |
96
|
|
|
|
|
|
|
copyright_holder = Grant Street Group |
97
|
|
|
|
|
|
|
copyright_year = # detected from git |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
[@Basic] |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
=head1 DESCRIPTION |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
Provides a default license L<Software::License::Artistic_2_0>, |
104
|
|
|
|
|
|
|
as well as default authors, copyright holder, and copyright years from git. |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
=head1 AUTHOR |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
Grant Street Group <developers@grantstreet.com> |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
This software is Copyright (c) 2019 - 2023 by Grant Street Group. |
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
This is free software, licensed under: |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
The Artistic License 2.0 (GPL Compatible) |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
=cut |