line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Dist::Zilla::Plugin::Author::Plicease::Init2 2.41 { |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
880
|
use 5.014; |
|
1
|
|
|
|
|
4
|
|
4
|
1
|
|
|
1
|
|
5
|
use Moose; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
7
|
|
5
|
1
|
|
|
1
|
|
5809
|
use Dist::Zilla::File::InMemory; |
|
1
|
|
|
|
|
357693
|
|
|
1
|
|
|
|
|
35
|
|
6
|
1
|
|
|
1
|
|
520
|
use Dist::Zilla::File::FromCode; |
|
1
|
|
|
|
|
57644
|
|
|
1
|
|
|
|
|
38
|
|
7
|
1
|
|
|
1
|
|
8
|
use Dist::Zilla::MintingProfile::Author::Plicease; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
25
|
|
8
|
1
|
|
|
1
|
|
747
|
use JSON::PP qw( encode_json ); |
|
1
|
|
|
|
|
11814
|
|
|
1
|
|
|
|
|
90
|
|
9
|
1
|
|
|
1
|
|
8
|
use Encode qw( encode_utf8 ); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
2329
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
# ABSTRACT: Dist::Zilla initialization tasks for Plicease |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
with 'Dist::Zilla::Role::AfterMint'; |
15
|
|
|
|
|
|
|
with 'Dist::Zilla::Role::ModuleMaker'; |
16
|
|
|
|
|
|
|
with 'Dist::Zilla::Role::FileGatherer'; |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
our $chrome; |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
sub chrome |
21
|
|
|
|
|
|
|
{ |
22
|
0
|
0
|
|
0
|
0
|
|
return $chrome if defined $chrome; |
23
|
0
|
|
|
|
|
|
shift->zilla->chrome; |
24
|
|
|
|
|
|
|
} |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
has abstract => ( |
27
|
|
|
|
|
|
|
is => 'ro', |
28
|
|
|
|
|
|
|
isa => 'Str', |
29
|
|
|
|
|
|
|
lazy => 1, |
30
|
|
|
|
|
|
|
default => sub { |
31
|
|
|
|
|
|
|
my($self) = @_; |
32
|
|
|
|
|
|
|
$self->chrome->prompt_str("abstract"); |
33
|
|
|
|
|
|
|
}, |
34
|
|
|
|
|
|
|
); |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
has include_tests => ( |
37
|
|
|
|
|
|
|
is => 'ro', |
38
|
|
|
|
|
|
|
isa => 'Int', |
39
|
|
|
|
|
|
|
lazy => 1, |
40
|
|
|
|
|
|
|
default => sub { |
41
|
|
|
|
|
|
|
1, |
42
|
|
|
|
|
|
|
}, |
43
|
|
|
|
|
|
|
); |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
has type_dzil => ( |
46
|
|
|
|
|
|
|
is => 'ro', |
47
|
|
|
|
|
|
|
lazy => 1, |
48
|
|
|
|
|
|
|
default => sub { |
49
|
|
|
|
|
|
|
my $name = shift->zilla->name; |
50
|
|
|
|
|
|
|
$name =~ /^Dist-Zilla/ ? 1 : 0; |
51
|
|
|
|
|
|
|
}, |
52
|
|
|
|
|
|
|
); |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
has type_alien => ( |
55
|
|
|
|
|
|
|
is => 'ro', |
56
|
|
|
|
|
|
|
lazy => 1, |
57
|
|
|
|
|
|
|
default => sub { |
58
|
|
|
|
|
|
|
my $name = shift->zilla->name; |
59
|
|
|
|
|
|
|
$name =~ /^Alien-[A-Za-z0-9]+$/ ? 1 : 0; |
60
|
|
|
|
|
|
|
}, |
61
|
|
|
|
|
|
|
); |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
has perl_version => ( |
64
|
|
|
|
|
|
|
is => 'ro', |
65
|
|
|
|
|
|
|
lazy => 1, |
66
|
|
|
|
|
|
|
default => sub { |
67
|
|
|
|
|
|
|
my($self) = @_; |
68
|
|
|
|
|
|
|
if(defined $ENV{V} && $ENV{V} =~ /^5\.([0-9]+)$/) |
69
|
|
|
|
|
|
|
{ |
70
|
|
|
|
|
|
|
return sprintf '5.%03d', $1; |
71
|
|
|
|
|
|
|
} |
72
|
|
|
|
|
|
|
elsif(defined $ENV{V} && $ENV{V} =~ /^5\.([0-9]+)\.([0-9]+)$/) |
73
|
|
|
|
|
|
|
{ |
74
|
|
|
|
|
|
|
return sprintf '5.%03d%03d', $1, $2; |
75
|
|
|
|
|
|
|
} |
76
|
|
|
|
|
|
|
else |
77
|
|
|
|
|
|
|
{ |
78
|
|
|
|
|
|
|
if($self->type_dzil) |
79
|
|
|
|
|
|
|
{ |
80
|
|
|
|
|
|
|
return '5.014'; |
81
|
|
|
|
|
|
|
} |
82
|
|
|
|
|
|
|
else |
83
|
|
|
|
|
|
|
{ |
84
|
|
|
|
|
|
|
return '5.008001'; |
85
|
|
|
|
|
|
|
} |
86
|
|
|
|
|
|
|
} |
87
|
|
|
|
|
|
|
}, |
88
|
|
|
|
|
|
|
); |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
sub make_module |
91
|
|
|
|
|
|
|
{ |
92
|
0
|
|
|
0
|
0
|
|
my($self, $arg) = @_; |
93
|
0
|
|
|
|
|
|
(my $filename = $arg->{name}) =~ s{::}{/}g; |
94
|
|
|
|
|
|
|
|
95
|
0
|
|
|
|
|
|
my $name = $arg->{name}; |
96
|
0
|
|
|
|
|
|
my $content; |
97
|
|
|
|
|
|
|
|
98
|
0
|
0
|
|
|
|
|
if($self->type_dzil) |
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
99
|
|
|
|
|
|
|
{ |
100
|
0
|
|
|
|
|
|
$content = join("\n", qq{use strict;} , |
101
|
|
|
|
|
|
|
qq{use warnings;} , |
102
|
0
|
|
|
|
|
|
qq{use @{[ $self->perl_version ]};} , |
103
|
|
|
|
|
|
|
qq{}, |
104
|
|
|
|
|
|
|
qq(package $name {), |
105
|
|
|
|
|
|
|
qq{} , |
106
|
|
|
|
|
|
|
qq{ use Moose;}, |
107
|
|
|
|
|
|
|
qq{ use namespace::autoclean;}, |
108
|
|
|
|
|
|
|
qq{}, |
109
|
0
|
|
|
|
|
|
qq{ # ABSTRACT: @{[ $self->abstract ]}} , |
110
|
|
|
|
|
|
|
qq{} , |
111
|
|
|
|
|
|
|
qq{ __PACKAGE__->meta->make_immutable;}, |
112
|
|
|
|
|
|
|
qq(}), |
113
|
|
|
|
|
|
|
qq{}, |
114
|
|
|
|
|
|
|
qq{1;}, |
115
|
|
|
|
|
|
|
); |
116
|
|
|
|
|
|
|
} |
117
|
|
|
|
|
|
|
elsif($self->type_alien) |
118
|
|
|
|
|
|
|
{ |
119
|
0
|
|
|
|
|
|
$content = join("\n", qq{package $name;} , |
120
|
|
|
|
|
|
|
qq{} , |
121
|
|
|
|
|
|
|
qq{use strict;} , |
122
|
|
|
|
|
|
|
qq{use warnings;} , |
123
|
0
|
|
|
|
|
|
qq{use @{[ $self->perl_version ]};} , |
124
|
|
|
|
|
|
|
qq{use base qw( Alien::Base );}, |
125
|
|
|
|
|
|
|
qq{} , |
126
|
0
|
|
|
|
|
|
qq{# ABSTRACT: @{[ $self->abstract ]}} , |
127
|
|
|
|
|
|
|
qq{# VERSION} , |
128
|
|
|
|
|
|
|
qq{} , |
129
|
|
|
|
|
|
|
qq{1;}, |
130
|
|
|
|
|
|
|
); |
131
|
|
|
|
|
|
|
} |
132
|
|
|
|
|
|
|
elsif($self->perl_version >= 5.020) |
133
|
|
|
|
|
|
|
{ |
134
|
0
|
|
|
|
|
|
$content = join("\n", qq{use strict;} , |
135
|
|
|
|
|
|
|
qq{use warnings;} , |
136
|
0
|
|
|
|
|
|
qq{use @{[ $self->perl_version ]};} , |
137
|
|
|
|
|
|
|
qq{use experimental qw( postderef signatures );}, |
138
|
|
|
|
|
|
|
qq{}, |
139
|
|
|
|
|
|
|
qq(package $name {), |
140
|
|
|
|
|
|
|
qq{} , |
141
|
0
|
|
|
|
|
|
qq{ # ABSTRACT: @{[ $self->abstract ]}} , |
142
|
|
|
|
|
|
|
qq{} , |
143
|
|
|
|
|
|
|
qq(}), |
144
|
|
|
|
|
|
|
qq{}, |
145
|
|
|
|
|
|
|
qq{1;}, |
146
|
|
|
|
|
|
|
); |
147
|
|
|
|
|
|
|
} |
148
|
|
|
|
|
|
|
elsif($self->perl_version >= 5.014) |
149
|
|
|
|
|
|
|
{ |
150
|
0
|
|
|
|
|
|
$content = join("\n", qq{use strict;} , |
151
|
|
|
|
|
|
|
qq{use warnings;} , |
152
|
0
|
|
|
|
|
|
qq{use @{[ $self->perl_version ]};} , |
153
|
|
|
|
|
|
|
qq{}, |
154
|
|
|
|
|
|
|
qq(package $name {), |
155
|
|
|
|
|
|
|
qq{} , |
156
|
0
|
|
|
|
|
|
qq{ # ABSTRACT: @{[ $self->abstract ]}} , |
157
|
|
|
|
|
|
|
qq{} , |
158
|
|
|
|
|
|
|
qq(}), |
159
|
|
|
|
|
|
|
qq{}, |
160
|
|
|
|
|
|
|
qq{1;}, |
161
|
|
|
|
|
|
|
); |
162
|
|
|
|
|
|
|
} |
163
|
|
|
|
|
|
|
else |
164
|
|
|
|
|
|
|
{ |
165
|
0
|
|
|
|
|
|
$content = join("\n", qq{package $name;} , |
166
|
|
|
|
|
|
|
qq{} , |
167
|
|
|
|
|
|
|
qq{use strict;} , |
168
|
|
|
|
|
|
|
qq{use warnings;} , |
169
|
0
|
|
|
|
|
|
qq{use @{[ $self->perl_version ]};} , |
170
|
|
|
|
|
|
|
qq{} , |
171
|
0
|
|
|
|
|
|
qq{# ABSTRACT: @{[ $self->abstract ]}} , |
172
|
|
|
|
|
|
|
qq{# VERSION} , |
173
|
|
|
|
|
|
|
qq{} , |
174
|
|
|
|
|
|
|
qq{1;}, |
175
|
|
|
|
|
|
|
); |
176
|
|
|
|
|
|
|
} |
177
|
|
|
|
|
|
|
|
178
|
0
|
|
|
|
|
|
my $file = Dist::Zilla::File::InMemory->new({ |
179
|
|
|
|
|
|
|
name => "lib/$filename.pm", |
180
|
|
|
|
|
|
|
content => $content, |
181
|
|
|
|
|
|
|
}); |
182
|
|
|
|
|
|
|
|
183
|
0
|
|
|
|
|
|
$self->add_file($file); |
184
|
|
|
|
|
|
|
} |
185
|
|
|
|
|
|
|
|
186
|
|
|
|
|
|
|
sub gather_files |
187
|
|
|
|
|
|
|
{ |
188
|
0
|
|
|
0
|
0
|
|
my($self, $arg) = @_; |
189
|
|
|
|
|
|
|
|
190
|
0
|
|
|
|
|
|
$self->gather_file_dist_ini($arg); |
191
|
0
|
|
|
|
|
|
$self->gather_file_changes($arg); |
192
|
0
|
|
|
|
|
|
$self->gather_files_tests($arg); |
193
|
0
|
|
|
|
|
|
$self->gather_file_gitignore($arg); |
194
|
0
|
|
|
|
|
|
$self->gather_file_gitattributes($arg); |
195
|
0
|
|
|
|
|
|
$self->gather_file_travis_yml($arg); |
196
|
0
|
|
|
|
|
|
$self->gather_file_appveyor_yml($arg); |
197
|
0
|
|
|
|
|
|
$self->gather_file_author_yml($arg); |
198
|
0
|
0
|
|
|
|
|
$self->gather_file_alienfile($arg) if $self->type_alien; |
199
|
|
|
|
|
|
|
} |
200
|
|
|
|
|
|
|
|
201
|
|
|
|
|
|
|
sub gather_file_alienfile |
202
|
|
|
|
|
|
|
{ |
203
|
0
|
|
|
0
|
0
|
|
my($self) = @_; |
204
|
|
|
|
|
|
|
|
205
|
0
|
|
|
|
|
|
my $file = Dist::Zilla::File::InMemory->new({ |
206
|
|
|
|
|
|
|
name => 'alienfile', |
207
|
|
|
|
|
|
|
content => join("\n", q{use alienfile;}, |
208
|
|
|
|
|
|
|
q{plugin 'PkgConfig' => 'libfoo';}, |
209
|
|
|
|
|
|
|
q(share {), |
210
|
|
|
|
|
|
|
q{ plugin Download => (}, |
211
|
|
|
|
|
|
|
q{ url => 'http://...',}, |
212
|
|
|
|
|
|
|
q{ filter => qr/*\.tar\.gz$/,}, |
213
|
|
|
|
|
|
|
q{ version => qr/([0-9\.]+)/,}, |
214
|
|
|
|
|
|
|
q{ );}, |
215
|
|
|
|
|
|
|
q{ plugin Extract => 'tar.gz';}, |
216
|
|
|
|
|
|
|
q{ plugin 'Build::Autoconf';}, |
217
|
|
|
|
|
|
|
q(}), |
218
|
|
|
|
|
|
|
), |
219
|
|
|
|
|
|
|
}); |
220
|
|
|
|
|
|
|
|
221
|
0
|
|
|
|
|
|
$self->add_file($file); |
222
|
|
|
|
|
|
|
} |
223
|
|
|
|
|
|
|
|
224
|
|
|
|
|
|
|
sub gather_file_author_yml |
225
|
|
|
|
|
|
|
{ |
226
|
0
|
|
|
0
|
0
|
|
my($self, $arg) = @_; |
227
|
|
|
|
|
|
|
|
228
|
0
|
|
|
|
|
|
my $file = Dist::Zilla::File::InMemory->new({ |
229
|
|
|
|
|
|
|
name => 'author.yml', |
230
|
|
|
|
|
|
|
content => join("\n", q{---}, |
231
|
|
|
|
|
|
|
q{pod_spelling_system:}, |
232
|
|
|
|
|
|
|
q{ skip: 0}, |
233
|
|
|
|
|
|
|
q{ # list of words that are spelled correctly}, |
234
|
|
|
|
|
|
|
q{ # (regardless of what spell check thinks)}, |
235
|
|
|
|
|
|
|
q{ # or stuff that I like to spell incorrectly}, |
236
|
|
|
|
|
|
|
q{ # intentionally}, |
237
|
|
|
|
|
|
|
q{ stopwords: []}, |
238
|
|
|
|
|
|
|
q{}, |
239
|
|
|
|
|
|
|
q{pod_coverage:}, |
240
|
|
|
|
|
|
|
q{ skip: 0}, |
241
|
|
|
|
|
|
|
q{ # format is "Class#method" or "Class",regex allowed}, |
242
|
|
|
|
|
|
|
q{ # for either Class or method.}, |
243
|
|
|
|
|
|
|
q{ private: []}, |
244
|
|
|
|
|
|
|
), |
245
|
|
|
|
|
|
|
}); |
246
|
|
|
|
|
|
|
|
247
|
0
|
|
|
|
|
|
$self->add_file($file); |
248
|
|
|
|
|
|
|
} |
249
|
|
|
|
|
|
|
|
250
|
|
|
|
|
|
|
sub gather_file_travis_yml |
251
|
|
|
|
|
|
|
{ |
252
|
0
|
|
|
0
|
0
|
|
my($self, $arg) = @_; |
253
|
|
|
|
|
|
|
|
254
|
0
|
|
|
|
|
|
my $file = Dist::Zilla::File::InMemory->new({ |
255
|
|
|
|
|
|
|
name => '.travis.yml', |
256
|
|
|
|
|
|
|
content => join("\n", |
257
|
|
|
|
|
|
|
q{language: minimal}, |
258
|
|
|
|
|
|
|
q{dist: xenial}, |
259
|
|
|
|
|
|
|
q{services:}, |
260
|
|
|
|
|
|
|
q{ - docker}, |
261
|
|
|
|
|
|
|
q{before_install:}, |
262
|
|
|
|
|
|
|
q{ - curl https://raw.githubusercontent.com/plicease/cip/master/bin/travis-bootstrap | bash}, |
263
|
|
|
|
|
|
|
q{ - cip before-install}, |
264
|
|
|
|
|
|
|
q{install:}, |
265
|
|
|
|
|
|
|
q{ - cip diag}, |
266
|
|
|
|
|
|
|
q{ - cip install}, |
267
|
|
|
|
|
|
|
q{script:}, |
268
|
|
|
|
|
|
|
q{ - cip script}, |
269
|
|
|
|
|
|
|
q{jobs:}, |
270
|
|
|
|
|
|
|
q{ include:}, |
271
|
|
|
|
|
|
|
q{ - env: CIP_TAG=5.31}, |
272
|
|
|
|
|
|
|
q{ - env: CIP_TAG=5.30}, |
273
|
|
|
|
|
|
|
q{ - env: CIP_TAG=5.28}, |
274
|
|
|
|
|
|
|
q{ - env: CIP_TAG=5.26}, |
275
|
|
|
|
|
|
|
q{ - env: CIP_TAG=5.24}, |
276
|
|
|
|
|
|
|
q{ - env: CIP_TAG=5.22}, |
277
|
|
|
|
|
|
|
q{ - env: CIP_TAG=5.20}, |
278
|
|
|
|
|
|
|
q{ - env: CIP_TAG=5.18}, |
279
|
|
|
|
|
|
|
q{ - env: CIP_TAG=5.16}, |
280
|
|
|
|
|
|
|
q{ - env: CIP_TAG=5.14}, |
281
|
|
|
|
|
|
|
q{ - env: CIP_TAG=5.12}, |
282
|
|
|
|
|
|
|
q{ - env: CIP_TAG=5.10}, |
283
|
|
|
|
|
|
|
q{ - env: CIP_TAG=5.8}, |
284
|
|
|
|
|
|
|
q{cache:}, |
285
|
|
|
|
|
|
|
q{ directories:}, |
286
|
|
|
|
|
|
|
q{ - "$HOME/.cip"}, |
287
|
|
|
|
|
|
|
), |
288
|
|
|
|
|
|
|
}); |
289
|
|
|
|
|
|
|
|
290
|
0
|
|
|
|
|
|
$self->add_file($file); |
291
|
|
|
|
|
|
|
|
292
|
|
|
|
|
|
|
} |
293
|
|
|
|
|
|
|
|
294
|
|
|
|
|
|
|
sub gather_file_appveyor_yml |
295
|
|
|
|
|
|
|
{ |
296
|
0
|
|
|
0
|
0
|
|
my($self, $arg) =@_; |
297
|
|
|
|
|
|
|
|
298
|
0
|
|
|
|
|
|
my $file = Dist::Zilla::File::InMemory->new({ |
299
|
|
|
|
|
|
|
name => '.appveyor.yml', |
300
|
|
|
|
|
|
|
content => join("\n", |
301
|
|
|
|
|
|
|
q{---}, |
302
|
|
|
|
|
|
|
q{}, |
303
|
|
|
|
|
|
|
q{install:}, |
304
|
|
|
|
|
|
|
q{ - choco install strawberryperl}, |
305
|
|
|
|
|
|
|
q{ - SET PATH=C:\Perl5\bin;C:\strawberry\c\bin;C:\strawberry\perl\site\bin;C:\strawberry\perl\bin;%PATH%}, |
306
|
|
|
|
|
|
|
q{ - perl -v}, |
307
|
|
|
|
|
|
|
q{ - if not exist C:\\Perl5 mkdir C:\\Perl5}, |
308
|
|
|
|
|
|
|
q{ - SET PERL5LIB=C:/Perl5/lib/perl5}, |
309
|
|
|
|
|
|
|
q{ - SET PERL_LOCAL_LIB_ROOT=C:/Perl5}, |
310
|
|
|
|
|
|
|
q{ - SET PERL_MB_OPT=--install_base C:/Perl5}, |
311
|
|
|
|
|
|
|
q{ - SET PERL_MM_OPT=INSTALL_BASE=C:/Perl5}, |
312
|
|
|
|
|
|
|
q{ - cpanm -n Dist::Zilla}, |
313
|
|
|
|
|
|
|
q{ - dzil authordeps --missing | cpanm -n}, |
314
|
|
|
|
|
|
|
q{ - dzil listdeps --missing | cpanm -n}, |
315
|
|
|
|
|
|
|
q{}, |
316
|
|
|
|
|
|
|
q{build: off}, |
317
|
|
|
|
|
|
|
q{}, |
318
|
|
|
|
|
|
|
q{test_script:}, |
319
|
|
|
|
|
|
|
q{ - dzil test -v}, |
320
|
|
|
|
|
|
|
q{}, |
321
|
|
|
|
|
|
|
q{cache:}, |
322
|
|
|
|
|
|
|
q{ - C:\\Perl5}, |
323
|
|
|
|
|
|
|
q{}, |
324
|
|
|
|
|
|
|
q{shallow_clone: true}, |
325
|
|
|
|
|
|
|
), |
326
|
|
|
|
|
|
|
}); |
327
|
|
|
|
|
|
|
|
328
|
0
|
|
|
|
|
|
$self->add_file($file); |
329
|
|
|
|
|
|
|
} |
330
|
|
|
|
|
|
|
|
331
|
|
|
|
|
|
|
sub gather_file_dist_ini |
332
|
|
|
|
|
|
|
{ |
333
|
0
|
|
|
0
|
0
|
|
my($self, $arg) = @_; |
334
|
|
|
|
|
|
|
|
335
|
0
|
|
|
|
|
|
my $zilla = $self->zilla; |
336
|
|
|
|
|
|
|
|
337
|
|
|
|
|
|
|
my $code = sub { |
338
|
0
|
|
|
0
|
|
|
my $content = ''; |
339
|
|
|
|
|
|
|
|
340
|
0
|
|
|
|
|
|
$content .= sprintf "name = %s\n", $zilla->name; |
341
|
0
|
|
|
|
|
|
$content .= sprintf "author = Graham Ollis <plicease\@cpan.org>\n"; |
342
|
0
|
|
|
|
|
|
$content .= sprintf "license = Perl_5\n"; |
343
|
0
|
|
|
|
|
|
$content .= sprintf "copyright_holder = Graham Ollis\n"; |
344
|
0
|
|
|
|
|
|
$content .= sprintf "copyright_year = %s\n", (localtime)[5]+1900; |
345
|
0
|
|
|
|
|
|
$content .= sprintf "version = 0.01\n"; |
346
|
0
|
|
|
|
|
|
$content .= "\n"; |
347
|
|
|
|
|
|
|
|
348
|
0
|
0
|
|
|
|
|
$content .= "[\@Author::Plicease]\n" |
349
|
0
|
|
|
|
|
|
. (__PACKAGE__->VERSION ? ":version = @{[ __PACKAGE__->VERSION ]}\n" : '') |
350
|
|
|
|
|
|
|
. "travis_status = 1\n" |
351
|
0
|
|
|
|
|
|
. "release_tests = @{[ $self->include_tests ]}\n" |
352
|
|
|
|
|
|
|
. "installer = Author::Plicease::MakeMaker\n" |
353
|
|
|
|
|
|
|
. "test2_v0 = 1\n"; |
354
|
|
|
|
|
|
|
|
355
|
0
|
0
|
|
|
|
|
$content .= "version_plugin = PkgVersion::Block\n" if $self->perl_version >= 5.014; |
356
|
|
|
|
|
|
|
|
357
|
0
|
|
|
|
|
|
$content .= "\n"; |
358
|
|
|
|
|
|
|
|
359
|
0
|
|
|
|
|
|
$content .= "[Author::Plicease::Core]\n"; |
360
|
|
|
|
|
|
|
|
361
|
0
|
|
|
|
|
|
$content .= ";[Prereqs]\n" |
362
|
|
|
|
|
|
|
. ";Foo::Bar = 0\n" |
363
|
|
|
|
|
|
|
. "\n"; |
364
|
|
|
|
|
|
|
|
365
|
0
|
|
|
|
|
|
$content .= "[Author::Plicease::Upload]\n" |
366
|
|
|
|
|
|
|
. "cpan = 0\n" |
367
|
|
|
|
|
|
|
. "\n"; |
368
|
|
|
|
|
|
|
|
369
|
0
|
|
|
|
|
|
$content; |
370
|
0
|
|
|
|
|
|
}; |
371
|
|
|
|
|
|
|
|
372
|
0
|
|
|
|
|
|
my $file = Dist::Zilla::File::FromCode->new({ |
373
|
|
|
|
|
|
|
name => 'dist.ini', |
374
|
|
|
|
|
|
|
code => $code, |
375
|
|
|
|
|
|
|
}); |
376
|
|
|
|
|
|
|
|
377
|
0
|
|
|
|
|
|
$self->add_file($file); |
378
|
|
|
|
|
|
|
} |
379
|
|
|
|
|
|
|
|
380
|
|
|
|
|
|
|
sub gather_file_changes |
381
|
|
|
|
|
|
|
{ |
382
|
0
|
|
|
0
|
0
|
|
my($self, $arg) = @_; |
383
|
|
|
|
|
|
|
|
384
|
0
|
|
|
|
|
|
my $file = Dist::Zilla::File::InMemory->new({ |
385
|
|
|
|
|
|
|
name => 'Changes', |
386
|
|
|
|
|
|
|
content => join("\n", q{Revision history for {{$dist->name}}}, |
387
|
|
|
|
|
|
|
q{}, |
388
|
|
|
|
|
|
|
q{{{$NEXT}}}, |
389
|
|
|
|
|
|
|
q{ - initial version}, |
390
|
|
|
|
|
|
|
), |
391
|
|
|
|
|
|
|
}); |
392
|
|
|
|
|
|
|
|
393
|
0
|
|
|
|
|
|
$self->add_file($file); |
394
|
|
|
|
|
|
|
} |
395
|
|
|
|
|
|
|
|
396
|
|
|
|
|
|
|
sub gather_files_tests |
397
|
|
|
|
|
|
|
{ |
398
|
0
|
|
|
0
|
0
|
|
my($self, $arg) = @_; |
399
|
|
|
|
|
|
|
|
400
|
0
|
|
|
|
|
|
my $name = $self->zilla->name; |
401
|
0
|
|
|
|
|
|
$name =~ s{-}{::}g; |
402
|
|
|
|
|
|
|
|
403
|
0
|
|
|
|
|
|
my $use_t_file = Dist::Zilla::File::InMemory->new({ |
404
|
|
|
|
|
|
|
name => 't/01_use.t', |
405
|
|
|
|
|
|
|
content => join("\n", q{use Test2::V0 -no_srand => 1;}, |
406
|
|
|
|
|
|
|
q{sub require_ok ($);}, |
407
|
|
|
|
|
|
|
q{}, |
408
|
|
|
|
|
|
|
q{require_ok '} . $name . q{';}, |
409
|
|
|
|
|
|
|
q{}, |
410
|
|
|
|
|
|
|
q{done_testing;}, |
411
|
|
|
|
|
|
|
q{}, |
412
|
|
|
|
|
|
|
q{sub require_ok ($)}, |
413
|
|
|
|
|
|
|
'{', |
414
|
|
|
|
|
|
|
q{ # special case of when I really do want require_ok.}, |
415
|
|
|
|
|
|
|
q{ # I just want a test that checks that the modules}, |
416
|
|
|
|
|
|
|
q{ # will compile okay. I won't be trying to use them.}, |
417
|
|
|
|
|
|
|
q{ my($mod) = @_;}, |
418
|
|
|
|
|
|
|
q{ my $ctx = context();}, |
419
|
|
|
|
|
|
|
q{ eval qq{ require $mod };}, |
420
|
|
|
|
|
|
|
q{ my $error = $@;}, |
421
|
|
|
|
|
|
|
q{ my $ok = !$error;}, |
422
|
|
|
|
|
|
|
q{ $ctx->ok($ok, "require $mod");}, |
423
|
|
|
|
|
|
|
q{ $ctx->diag("error: $error") if $error ne '';}, |
424
|
|
|
|
|
|
|
q{ $ctx->release;}, |
425
|
|
|
|
|
|
|
'}', |
426
|
|
|
|
|
|
|
), |
427
|
|
|
|
|
|
|
}); |
428
|
|
|
|
|
|
|
|
429
|
0
|
|
|
|
|
|
$self->add_file($use_t_file); |
430
|
|
|
|
|
|
|
|
431
|
0
|
|
|
|
|
|
my $test_name = lc $name; |
432
|
0
|
|
|
|
|
|
$test_name =~ s{::}{_}g; |
433
|
0
|
|
|
|
|
|
$test_name = "t/$test_name.t"; |
434
|
|
|
|
|
|
|
|
435
|
0
|
|
|
|
|
|
my $main_test = Dist::Zilla::File::InMemory->new({ |
436
|
|
|
|
|
|
|
name => $test_name, |
437
|
|
|
|
|
|
|
content => join("\n", q{use Test2::V0 -no_srand => 1;}, |
438
|
|
|
|
|
|
|
q{use } . $name . q{;}, |
439
|
|
|
|
|
|
|
q{}, |
440
|
|
|
|
|
|
|
q{ok 1, 'todo';}, |
441
|
|
|
|
|
|
|
q{}, |
442
|
|
|
|
|
|
|
q{done_testing}, |
443
|
|
|
|
|
|
|
), |
444
|
|
|
|
|
|
|
}); |
445
|
|
|
|
|
|
|
|
446
|
0
|
|
|
|
|
|
$self->add_file($main_test); |
447
|
|
|
|
|
|
|
} |
448
|
|
|
|
|
|
|
|
449
|
|
|
|
|
|
|
sub gather_file_gitignore |
450
|
|
|
|
|
|
|
{ |
451
|
0
|
|
|
0
|
0
|
|
my($self, $arg) = @_; |
452
|
|
|
|
|
|
|
|
453
|
0
|
|
|
|
|
|
my $name = $self->zilla->name; |
454
|
|
|
|
|
|
|
|
455
|
0
|
|
|
|
|
|
my $file = Dist::Zilla::File::InMemory->new({ |
456
|
|
|
|
|
|
|
name => '.gitignore', |
457
|
|
|
|
|
|
|
content => "/$name-*\n/.build\n", |
458
|
|
|
|
|
|
|
}); |
459
|
|
|
|
|
|
|
|
460
|
0
|
|
|
|
|
|
$self->add_file($file); |
461
|
|
|
|
|
|
|
} |
462
|
|
|
|
|
|
|
|
463
|
|
|
|
|
|
|
sub gather_file_gitattributes |
464
|
|
|
|
|
|
|
{ |
465
|
0
|
|
|
0
|
0
|
|
my($self, $arg) = @_; |
466
|
|
|
|
|
|
|
|
467
|
0
|
|
|
|
|
|
my $name = $self->zilla->name; |
468
|
|
|
|
|
|
|
|
469
|
0
|
|
|
|
|
|
my $file = Dist::Zilla::File::InMemory->new({ |
470
|
|
|
|
|
|
|
name => '.gitattributes', |
471
|
|
|
|
|
|
|
content => "*.pm linguist-language=Perl\n*.t linguist-language=Perl\n*.h linguist-language=C\n", |
472
|
|
|
|
|
|
|
}); |
473
|
|
|
|
|
|
|
|
474
|
0
|
|
|
|
|
|
$self->add_file($file); |
475
|
|
|
|
|
|
|
} |
476
|
|
|
|
|
|
|
|
477
|
|
|
|
|
|
|
has github_login => ( |
478
|
|
|
|
|
|
|
is => 'ro', |
479
|
|
|
|
|
|
|
isa => 'Str', |
480
|
|
|
|
|
|
|
lazy => 1, |
481
|
|
|
|
|
|
|
default => sub { |
482
|
|
|
|
|
|
|
my($self) = @_; |
483
|
|
|
|
|
|
|
$self->chrome->prompt_str("github user", { default => 'plicease' }); |
484
|
|
|
|
|
|
|
}, |
485
|
|
|
|
|
|
|
); |
486
|
|
|
|
|
|
|
|
487
|
|
|
|
|
|
|
has github_pass => ( |
488
|
|
|
|
|
|
|
is => 'ro', |
489
|
|
|
|
|
|
|
isa => 'Str', |
490
|
|
|
|
|
|
|
lazy => 1, |
491
|
|
|
|
|
|
|
default => sub { |
492
|
|
|
|
|
|
|
my($self) = @_; |
493
|
|
|
|
|
|
|
$self->chrome->prompt_str("github pass", { noecho => 1 }); |
494
|
|
|
|
|
|
|
}, |
495
|
|
|
|
|
|
|
); |
496
|
|
|
|
|
|
|
|
497
|
|
|
|
|
|
|
sub after_mint |
498
|
|
|
|
|
|
|
{ |
499
|
0
|
|
|
0
|
0
|
|
my($self, $opts) = @_; |
500
|
|
|
|
|
|
|
|
501
|
0
|
0
|
|
|
|
|
unless(eval q{ use Git::Wrapper; 1; }) |
502
|
|
|
|
|
|
|
{ |
503
|
0
|
|
|
|
|
|
$self->zilla->log("no Git::Wrapper, can't create repository"); |
504
|
0
|
|
|
|
|
|
return; |
505
|
|
|
|
|
|
|
} |
506
|
|
|
|
|
|
|
|
507
|
0
|
|
|
|
|
|
my $git = Git::Wrapper->new($opts->{mint_root}); |
508
|
0
|
|
|
|
|
|
$git->init; |
509
|
0
|
|
|
|
|
|
$git->commit({ 'allow-empty' => 1, message => "Start with a blank" }); |
510
|
0
|
|
|
|
|
|
$git->add($opts->{mint_root}); |
511
|
0
|
|
|
|
|
|
$git->commit({ message => "Initial structure" }); |
512
|
|
|
|
|
|
|
|
513
|
0
|
0
|
|
|
|
|
unless(eval q{ use LWP::UserAgent; use HTTP::Request; 1; }) |
514
|
|
|
|
|
|
|
{ |
515
|
0
|
|
|
|
|
|
$self->zilla->log("no LWP, can't create github repo"); |
516
|
|
|
|
|
|
|
} |
517
|
|
|
|
|
|
|
|
518
|
0
|
|
|
|
|
|
my $no_github = 1; |
519
|
|
|
|
|
|
|
|
520
|
0
|
0
|
|
|
|
|
unless($ENV{DIST_ZILLA_PLUGIN_AUTHOR_PLICEASE_INIT2_NO_GITHUB}) |
521
|
|
|
|
|
|
|
{ |
522
|
0
|
|
|
|
|
|
my $ua = LWP::UserAgent->new; |
523
|
0
|
|
|
|
|
|
my $request = HTTP::Request->new( |
524
|
|
|
|
|
|
|
POST => "https://api.github.com/user/repos", |
525
|
|
|
|
|
|
|
); |
526
|
|
|
|
|
|
|
|
527
|
0
|
|
|
|
|
|
my $data = encode_json({ name => $self->zilla->name, description => $self->abstract }); |
528
|
0
|
|
|
|
|
|
$request->content($data); |
529
|
0
|
|
|
|
|
|
$request->header( 'Content-Length' => length encode_utf8 $data ); |
530
|
0
|
|
|
|
|
|
$request->authorization_basic($self->github_login, $self->github_pass); |
531
|
0
|
|
|
|
|
|
my $response = $ua->request($request); |
532
|
0
|
0
|
|
|
|
|
if($response->is_success) |
533
|
|
|
|
|
|
|
{ |
534
|
0
|
|
|
|
|
|
$no_github = 0; |
535
|
|
|
|
|
|
|
} |
536
|
|
|
|
|
|
|
else |
537
|
|
|
|
|
|
|
{ |
538
|
0
|
|
|
|
|
|
$self->zilla->log("could not create a github repo!"); |
539
|
|
|
|
|
|
|
} |
540
|
|
|
|
|
|
|
} |
541
|
|
|
|
|
|
|
|
542
|
0
|
|
|
|
|
|
$git->remote('add', 'origin', "git\@github.com:" . $self->github_login . '/' . $self->zilla->name . '.git'); |
543
|
0
|
0
|
|
|
|
|
$git->push('origin', 'master') unless $no_github; |
544
|
|
|
|
|
|
|
|
545
|
0
|
|
|
|
|
|
return; |
546
|
|
|
|
|
|
|
} |
547
|
|
|
|
|
|
|
|
548
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |
549
|
|
|
|
|
|
|
} |
550
|
|
|
|
|
|
|
|
551
|
|
|
|
|
|
|
1; |
552
|
|
|
|
|
|
|
|
553
|
|
|
|
|
|
|
__END__ |
554
|
|
|
|
|
|
|
|
555
|
|
|
|
|
|
|
=pod |
556
|
|
|
|
|
|
|
|
557
|
|
|
|
|
|
|
=encoding UTF-8 |
558
|
|
|
|
|
|
|
|
559
|
|
|
|
|
|
|
=head1 NAME |
560
|
|
|
|
|
|
|
|
561
|
|
|
|
|
|
|
Dist::Zilla::Plugin::Author::Plicease::Init2 - Dist::Zilla initialization tasks for Plicease |
562
|
|
|
|
|
|
|
|
563
|
|
|
|
|
|
|
=head1 VERSION |
564
|
|
|
|
|
|
|
|
565
|
|
|
|
|
|
|
version 2.41 |
566
|
|
|
|
|
|
|
|
567
|
|
|
|
|
|
|
=head1 DESCRIPTION |
568
|
|
|
|
|
|
|
|
569
|
|
|
|
|
|
|
Create a dist in plicease style. |
570
|
|
|
|
|
|
|
|
571
|
|
|
|
|
|
|
=head1 AUTHOR |
572
|
|
|
|
|
|
|
|
573
|
|
|
|
|
|
|
Graham Ollis <plicease@cpan.org> |
574
|
|
|
|
|
|
|
|
575
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
576
|
|
|
|
|
|
|
|
577
|
|
|
|
|
|
|
This software is copyright (c) 2017 by Graham Ollis. |
578
|
|
|
|
|
|
|
|
579
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
580
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
581
|
|
|
|
|
|
|
|
582
|
|
|
|
|
|
|
=cut |