line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
## |
2
|
|
|
|
|
|
|
# name: Module::Package::Ingy |
3
|
|
|
|
|
|
|
# abstract: Ingy's Module::Package Plugins |
4
|
|
|
|
|
|
|
# author: Ingy döt Net <ingy@ingy.net> |
5
|
|
|
|
|
|
|
# license: perl |
6
|
|
|
|
|
|
|
# copyright: 2011 |
7
|
|
|
|
|
|
|
# see: |
8
|
|
|
|
|
|
|
# - Module::Package |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
# TODO: |
11
|
|
|
|
|
|
|
# - Look at auto_provides |
12
|
|
|
|
|
|
|
# - Look at other plugins |
13
|
|
|
|
|
|
|
|
14
|
1
|
|
|
1
|
|
595
|
use 5.008003; |
|
1
|
|
|
|
|
5
|
|
|
1
|
|
|
|
|
40
|
|
15
|
1
|
|
|
1
|
|
7
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
84
|
|
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
# Don't load experimental (Alt-) modules |
18
|
|
|
|
|
|
|
{ |
19
|
|
|
|
|
|
|
my @inc; |
20
|
|
|
|
|
|
|
BEGIN { |
21
|
1
|
|
|
1
|
|
6
|
@inc = @INC; |
22
|
1
|
|
|
|
|
36
|
@INC = grep not(/^lib$/), @INC; |
23
|
|
|
|
|
|
|
} |
24
|
1
|
|
|
1
|
|
913
|
use IO::All 0.44 (); |
|
1
|
|
|
|
|
14396
|
|
|
1
|
|
|
|
|
26
|
|
25
|
1
|
|
|
1
|
|
1101
|
use IO::All::File (); |
|
1
|
|
|
|
|
17588
|
|
|
1
|
|
|
|
|
38
|
|
26
|
|
|
|
|
|
|
BEGIN { |
27
|
1
|
|
|
1
|
|
33
|
@INC = @inc; |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
|
31
|
1
|
|
|
1
|
|
786
|
use Module::Package 0.30 (); |
|
1
|
|
|
|
|
24
|
|
|
1
|
|
|
|
|
25
|
|
32
|
1
|
|
|
1
|
|
1096
|
use Module::Install::AckXXX 0.18 (); |
|
1
|
|
|
|
|
37
|
|
|
1
|
|
|
|
|
30
|
|
33
|
1
|
|
|
1
|
|
1048
|
use Module::Install::AutoLicense 0.08 (); |
|
1
|
|
|
|
|
597
|
|
|
1
|
|
|
|
|
22
|
|
34
|
1
|
|
|
1
|
|
679
|
use Module::Install::GithubMeta 0.16 (); |
|
1
|
|
|
|
|
20
|
|
|
1
|
|
|
|
|
22
|
|
35
|
|
|
|
|
|
|
# use Module::Install::Gloom 0.16 (); |
36
|
|
|
|
|
|
|
# use Module::Install::MetaModule 0.01 (); |
37
|
1
|
|
|
1
|
|
890
|
use Module::Install::ReadmeFromPod 0.12 (); |
|
1
|
|
|
|
|
1277
|
|
|
1
|
|
|
|
|
30
|
|
38
|
1
|
|
|
1
|
|
906
|
use Module::Install::RequiresList 0.10 (); |
|
1
|
|
|
|
|
529
|
|
|
1
|
|
|
|
|
20
|
|
39
|
1
|
|
|
1
|
|
726
|
use Module::Install::Stardoc 0.18 (); |
|
1
|
|
|
|
|
621
|
|
|
1
|
|
|
|
|
25
|
|
40
|
1
|
|
|
1
|
|
543
|
use Module::Install::TestCommon 0.07 (); |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
use Module::Install::TestML 0.26 (); |
42
|
|
|
|
|
|
|
use Module::Install::VersionCheck 0.16 (); |
43
|
|
|
|
|
|
|
my $testbase_skip = " |
44
|
|
|
|
|
|
|
use Module::Install::TestBase 0; |
45
|
|
|
|
|
|
|
use Spiffy 0; |
46
|
|
|
|
|
|
|
use Test::More 0; |
47
|
|
|
|
|
|
|
use Test::Builder 0; |
48
|
|
|
|
|
|
|
use Test::Base::Filter 0; |
49
|
|
|
|
|
|
|
use Test::Builder::Module 0; |
50
|
|
|
|
|
|
|
"; |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
use Capture::Tiny 0.11 (); |
53
|
|
|
|
|
|
|
use Pegex 0.19 (); |
54
|
|
|
|
|
|
|
my $skip_pegex = " |
55
|
|
|
|
|
|
|
use Pegex::Mo 0; |
56
|
|
|
|
|
|
|
use Pegex::Grammar 0; |
57
|
|
|
|
|
|
|
use Pegex::Parser 0; |
58
|
|
|
|
|
|
|
use Pegex::Receiver 0; |
59
|
|
|
|
|
|
|
"; |
60
|
|
|
|
|
|
|
use Test::Base 0.60 (); |
61
|
|
|
|
|
|
|
use TestML 0.26 (); |
62
|
|
|
|
|
|
|
use YAML::XS 0.37 (); |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
#-----------------------------------------------------------------------------# |
65
|
|
|
|
|
|
|
package Module::Package::Ingy; |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
our $VERSION = '0.20'; |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
#-----------------------------------------------------------------------------# |
70
|
|
|
|
|
|
|
package Module::Package::Ingy::modern; |
71
|
|
|
|
|
|
|
# XXX Want to use Mo, but doesn't work yet for unknown reason. |
72
|
|
|
|
|
|
|
use Moo; |
73
|
|
|
|
|
|
|
extends 'Module::Package::Plugin'; |
74
|
|
|
|
|
|
|
use IO::All; |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
sub main { |
77
|
|
|
|
|
|
|
my ($self) = @_; |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
# These run before the Makefile.PL body. (During use inc::...) |
80
|
|
|
|
|
|
|
# $self->mi->meta_module_compile |
81
|
|
|
|
|
|
|
# if Module::Install::MetaModule->new->_has_meta(); |
82
|
|
|
|
|
|
|
$self->mi->stardoc_make_pod; |
83
|
|
|
|
|
|
|
$self->mi->stardoc_clean_pod; |
84
|
|
|
|
|
|
|
$self->mi->readme_from($self->pod_or_pm_file); |
85
|
|
|
|
|
|
|
# $self->check_use_gloom; |
86
|
|
|
|
|
|
|
$self->check_use_test_base; |
87
|
|
|
|
|
|
|
$self->check_use_testml; |
88
|
|
|
|
|
|
|
$self->check_test_common; |
89
|
|
|
|
|
|
|
$self->strip_extra_comments; |
90
|
|
|
|
|
|
|
$self->mi->ack_xxx; |
91
|
|
|
|
|
|
|
# $self->mi->sign; # XXX need to learn more about this |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
# These run later, as specified. |
94
|
|
|
|
|
|
|
$self->post_all_from(sub {$self->mi->version_check}); |
95
|
|
|
|
|
|
|
$self->post_all_from(sub {$self->mi->auto_license}); |
96
|
|
|
|
|
|
|
$self->post_all_from(sub {$self->mi->clean_files('LICENSE')}); |
97
|
|
|
|
|
|
|
$self->post_all_from(sub {$self->mi->githubmeta}); |
98
|
|
|
|
|
|
|
$self->post_WriteAll(sub {$self->mi->requires_list}); |
99
|
|
|
|
|
|
|
$self->post_WriteAll(sub {$self->make_release}); |
100
|
|
|
|
|
|
|
} |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
sub make_release { |
103
|
|
|
|
|
|
|
io('Makefile')->append(<<'...'); |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
release :: |
106
|
|
|
|
|
|
|
$(PERL) "-Ilib" "-MModule::Package::Ingy" -e "Module::Package::Ingy->make_release()" |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
... |
109
|
|
|
|
|
|
|
} |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
package Module::Package::Ingy; |
112
|
|
|
|
|
|
|
use Capture::Tiny qw(capture_merged); |
113
|
|
|
|
|
|
|
use IO::All; |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
sub run { |
116
|
|
|
|
|
|
|
my $cmd = shift; |
117
|
|
|
|
|
|
|
my %options = map {($_, 1)} @_; |
118
|
|
|
|
|
|
|
warn "******** >> $cmd ********\n"; |
119
|
|
|
|
|
|
|
my $error; |
120
|
|
|
|
|
|
|
my $output = capture_merged { |
121
|
|
|
|
|
|
|
system($cmd) == 0 or $error = 1; |
122
|
|
|
|
|
|
|
}; |
123
|
|
|
|
|
|
|
print $output unless $options{-quiet}; |
124
|
|
|
|
|
|
|
if ($error) { |
125
|
|
|
|
|
|
|
die "\nError. Command failed:\n$output"; |
126
|
|
|
|
|
|
|
} |
127
|
|
|
|
|
|
|
} |
128
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
# This is Ingy's personal release process. It probably won't match your own. |
130
|
|
|
|
|
|
|
# It requires a YAML Changes file and git and tagged releases and other stuff. |
131
|
|
|
|
|
|
|
sub make_release { |
132
|
|
|
|
|
|
|
my $class = shift or die; |
133
|
|
|
|
|
|
|
die "make release expects this to be a git repo\n\n" |
134
|
|
|
|
|
|
|
unless -e '.git'; |
135
|
|
|
|
|
|
|
my $meta = YAML::XS::LoadFile('META.yml'); |
136
|
|
|
|
|
|
|
my @changes = YAML::XS::LoadFile('Changes'); |
137
|
|
|
|
|
|
|
die "Failed to load 'Changes'" |
138
|
|
|
|
|
|
|
unless @changes; |
139
|
|
|
|
|
|
|
my $change = shift @changes; |
140
|
|
|
|
|
|
|
die "Changes entry has more than 3 keys" |
141
|
|
|
|
|
|
|
if @{[keys %$change]} > 3; |
142
|
|
|
|
|
|
|
die "Changes entry does not define 'version', 'date' and 'changes'" unless |
143
|
|
|
|
|
|
|
exists $change->{version} and |
144
|
|
|
|
|
|
|
exists $change->{date} and |
145
|
|
|
|
|
|
|
exists $change->{changes}; |
146
|
|
|
|
|
|
|
die "Changes entry 'date' should be blank for release\n\n" |
147
|
|
|
|
|
|
|
if $change->{date}; |
148
|
|
|
|
|
|
|
my $changes_version = $change->{version}; |
149
|
|
|
|
|
|
|
my $module_version = $meta->{version}; |
150
|
|
|
|
|
|
|
die "'Changes' version '$changes_version' " . |
151
|
|
|
|
|
|
|
"does not match module version '$module_version'\n\n" |
152
|
|
|
|
|
|
|
unless $changes_version eq $module_version; |
153
|
|
|
|
|
|
|
(my $branch = `git branch`) =~ s/^.*\* (\S+).*$/$1/s or die; |
154
|
|
|
|
|
|
|
my $tag_prefix = ($branch eq 'master') ? '' : "${branch}-"; |
155
|
|
|
|
|
|
|
my @lines = grep { |
156
|
|
|
|
|
|
|
s/^${tag_prefix}(\d+\.\d+)$/$1/; |
157
|
|
|
|
|
|
|
} map { |
158
|
|
|
|
|
|
|
chomp; |
159
|
|
|
|
|
|
|
$_; |
160
|
|
|
|
|
|
|
} sort `git tag`; |
161
|
|
|
|
|
|
|
my $tag_version = pop(@lines) or die "No relevant git tags!"; |
162
|
|
|
|
|
|
|
die "Module version '$module_version' is not 0.01 greater " . |
163
|
|
|
|
|
|
|
"than git tag version '$tag_version'" |
164
|
|
|
|
|
|
|
if abs($module_version - $tag_version - 0.01) > 0.0000001; |
165
|
|
|
|
|
|
|
my $date = `date`; |
166
|
|
|
|
|
|
|
chomp $date; |
167
|
|
|
|
|
|
|
my $Changes = io('Changes')->all; |
168
|
|
|
|
|
|
|
$Changes =~ s/date: *\n/date: $date\n/ or die; |
169
|
|
|
|
|
|
|
|
170
|
|
|
|
|
|
|
run "perl -Ilib Makefile.PL", -quiet; |
171
|
|
|
|
|
|
|
run "make purge", -quiet; |
172
|
|
|
|
|
|
|
my $status = `git status`; |
173
|
|
|
|
|
|
|
die "You have untracked files:\n\n$status" |
174
|
|
|
|
|
|
|
if $status =~ m!Untracked!; |
175
|
|
|
|
|
|
|
|
176
|
|
|
|
|
|
|
run "perl -Ilib Makefile.PL", -quiet; |
177
|
|
|
|
|
|
|
run "make test", -quiet; |
178
|
|
|
|
|
|
|
run "make purge", -quiet; |
179
|
|
|
|
|
|
|
|
180
|
|
|
|
|
|
|
run "perl -Ilib Makefile.PL", -quiet; |
181
|
|
|
|
|
|
|
run "make", -quiet; |
182
|
|
|
|
|
|
|
if ($branch eq 'master') { |
183
|
|
|
|
|
|
|
run "sudo -k make install", -quiet; |
184
|
|
|
|
|
|
|
} |
185
|
|
|
|
|
|
|
else { |
186
|
|
|
|
|
|
|
run "sudo -k echo 'not installing'", -quiet; |
187
|
|
|
|
|
|
|
} |
188
|
|
|
|
|
|
|
run "make purge", -quiet; |
189
|
|
|
|
|
|
|
|
190
|
|
|
|
|
|
|
io('Changes')->print($Changes); |
191
|
|
|
|
|
|
|
run "perl -Ilib Makefile.PL", -quiet; |
192
|
|
|
|
|
|
|
run "make manifest", -quiet; |
193
|
|
|
|
|
|
|
run "make upload", -quiet; |
194
|
|
|
|
|
|
|
run "make purge", -quiet; |
195
|
|
|
|
|
|
|
|
196
|
|
|
|
|
|
|
run qq{git commit -a -m "Released version $module_version"}, -quiet; |
197
|
|
|
|
|
|
|
run "git tag $tag_prefix$module_version", -quiet; |
198
|
|
|
|
|
|
|
run "git push", -quiet; |
199
|
|
|
|
|
|
|
run "git push --tag", -quiet; |
200
|
|
|
|
|
|
|
$status = `git status`; |
201
|
|
|
|
|
|
|
die "git status is not clean:\n\n$status" |
202
|
|
|
|
|
|
|
unless $status =~ /\(working directory clean\)/; |
203
|
|
|
|
|
|
|
run "git status"; |
204
|
|
|
|
|
|
|
|
205
|
|
|
|
|
|
|
print <<"..."; |
206
|
|
|
|
|
|
|
|
207
|
|
|
|
|
|
|
$meta->{name}-$meta->{version} successfully released. |
208
|
|
|
|
|
|
|
|
209
|
|
|
|
|
|
|
Relax. Have a beer. \\o/ |
210
|
|
|
|
|
|
|
|
211
|
|
|
|
|
|
|
... |
212
|
|
|
|
|
|
|
} |
213
|
|
|
|
|
|
|
|
214
|
|
|
|
|
|
|
1; |
215
|
|
|
|
|
|
|
|
216
|
|
|
|
|
|
|
=head1 SYNOPSIS |
217
|
|
|
|
|
|
|
|
218
|
|
|
|
|
|
|
In your Makefile.PL: |
219
|
|
|
|
|
|
|
|
220
|
|
|
|
|
|
|
use inc::Module::Package 'Ingy:modern'; |
221
|
|
|
|
|
|
|
|
222
|
|
|
|
|
|
|
=head1 DESCRIPTION |
223
|
|
|
|
|
|
|
|
224
|
|
|
|
|
|
|
This module defines the standard configurations for Module::Package based |
225
|
|
|
|
|
|
|
Makefile.PLs, used by Ingy döt Net. You don't have to be Ingy to use it. If |
226
|
|
|
|
|
|
|
you write a lot of CPAN modules, you might want to copy or subclass it under a |
227
|
|
|
|
|
|
|
name matching your own CPAN id. |
228
|
|
|
|
|
|
|
|
229
|
|
|
|
|
|
|
=head1 FLAVORS |
230
|
|
|
|
|
|
|
|
231
|
|
|
|
|
|
|
Currently this module only defines the C<:modern> flavor. |
232
|
|
|
|
|
|
|
|
233
|
|
|
|
|
|
|
=head2 :modern |
234
|
|
|
|
|
|
|
|
235
|
|
|
|
|
|
|
In addition to the inherited behavior, this flavor uses the following plugins: |
236
|
|
|
|
|
|
|
|
237
|
|
|
|
|
|
|
- Stardoc |
238
|
|
|
|
|
|
|
- ReadmeFromPod |
239
|
|
|
|
|
|
|
- AckXXX |
240
|
|
|
|
|
|
|
- VersionCheck |
241
|
|
|
|
|
|
|
|
242
|
|
|
|
|
|
|
It also conditionally uses these plugins if you need them: |
243
|
|
|
|
|
|
|
|
244
|
|
|
|
|
|
|
- TestBase |
245
|
|
|
|
|
|
|
- TestML |
246
|
|
|
|
|
|
|
|
247
|
|
|
|
|
|
|
=head1 OPTIONS |
248
|
|
|
|
|
|
|
|
249
|
|
|
|
|
|
|
This module does not add any usage options of than the ones inherited from |
250
|
|
|
|
|
|
|
L<Module::Package::Plugin>. |