-
Notifications
You must be signed in to change notification settings - Fork 1
/
JQUELIN.pm
327 lines (260 loc) · 8.71 KB
/
JQUELIN.pm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
use 5.008;
use strict;
use warnings;
package Dist::Zilla::PluginBundle::Author::JQUELIN;
# ABSTRACT: Build & release a distribution like jquelin
use Class::MOP;
use Moose;
use Moose::Autobox;
# plugins used
use Dist::Zilla::Plugin::AutoPrereqs;
use Dist::Zilla::Plugin::AutoVersion;
use Dist::Zilla::Plugin::Bugtracker;
use Dist::Zilla::Plugin::CheckChangeLog;
use Dist::Zilla::Plugin::Test::Compile 1.100220;
#use Dist::Zilla::Plugin::CriticTests;
use Dist::Zilla::Plugin::ExecDir;
use Dist::Zilla::Plugin::ExtraTests;
use Dist::Zilla::Plugin::GatherDir;
use Dist::Zilla::Plugin::HasVersionTests;
use Dist::Zilla::Plugin::Homepage;
#use Dist::Zilla::Plugin::InstallGuide;
use Dist::Zilla::Plugin::Test::Kwalitee;
use Dist::Zilla::Plugin::License;
use Dist::Zilla::Plugin::Manifest;
use Dist::Zilla::Plugin::ManifestSkip;
use Dist::Zilla::Plugin::MetaConfig;
use Dist::Zilla::Plugin::MetaJSON;
use Dist::Zilla::Plugin::MetaProvides::Package;
use Dist::Zilla::Plugin::MetaYAML;
#use Dist::Zilla::Plugin::MetaTests;
use Dist::Zilla::Plugin::ModuleBuild;
use Dist::Zilla::Plugin::Test::MinimumVersion;
use Dist::Zilla::Plugin::NextRelease 2.101230; # time_zone param
use Dist::Zilla::Plugin::PkgVersion;
use Dist::Zilla::Plugin::PodCoverageTests;
use Dist::Zilla::Plugin::PodSyntaxTests;
use Dist::Zilla::Plugin::PodWeaver;
#use Dist::Zilla::Plugin::PortabilityTests;
use Dist::Zilla::Plugin::Prepender 1.100130;
use Dist::Zilla::Plugin::PruneCruft;
use Dist::Zilla::Plugin::PruneFiles;
use Dist::Zilla::Plugin::Readme;
use Dist::Zilla::Plugin::ReportVersions::Tiny;
use Dist::Zilla::Plugin::Repository;
use Dist::Zilla::Plugin::ShareDir;
use Dist::Zilla::Plugin::TaskWeaver;
#use Dist::Zilla::Plugin::UnusedVarsTests;
use Dist::Zilla::Plugin::UploadToCPAN;
use Dist::Zilla::PluginBundle::Git;
with 'Dist::Zilla::Role::PluginBundle';
with 'Dist::Zilla::Role::PluginBundle::Config::Slicer';
sub bundle_config {
my ($self, $section) = @_;
my $arg = $section->{payload};
# params for AutoVersion
my $major_version = defined $arg->{major_version} ? $arg->{major_version} : 1;
my $version_format =
q<{{ $major }}.{{ cldr('yyDDD') }}>
. sprintf('%01u', ($ENV{N} || 0))
. ($ENV{DEV} ? (sprintf '_%03u', $ENV{DEV}) : '');
# params for autoprereq
my $prereq_params = defined $arg->{skip_prereq}
? { skip => $arg->{skip_prereq} }
: {};
# params for compiletests
my $compile_params = {};
$compile_params->{fake_home} = $arg->{fake_home}
if defined $arg->{fake_home};
$compile_params->{skip} = $arg->{skip_compile}
if defined $arg->{skip_compile};
# params for pod weaver
$arg->{weaver} ||= 'pod';
my $release_branch = 'releases';
# long list of plugins
my @wanted = (
# -- static meta-information
[ AutoVersion => {
major => $major_version,
format => $version_format,
time_zone => 'Europe/Paris',
}
],
# -- fetch & generate files
[ GatherDir => {} ],
[ 'Test::Compile' => $compile_params ],
#[ CriticTests => {} ],
[ HasVersionTests => {} ],
[ 'Test::Kwalitee' => {} ],
#[ MetaTests => {} ],
[ 'Test::MinimumVersion' => {} ],
[ PodCoverageTests => {} ],
[ PodSyntaxTests => {} ],
#[ PortabilityTests => {} ],
[ 'ReportVersions::Tiny' => {} ],
#[ UnusedVarsTests => {} ],
# -- remove some files
[ PruneCruft => {} ],
[ PruneFiles => { match => '~$' } ],
[ ManifestSkip => {} ],
# -- get prereqs
[ AutoPrereqs => $prereq_params ],
# -- munge files
[ ExtraTests => {} ],
[ NextRelease => { time_zone => 'Europe/Paris' } ],
[ PkgVersion => {} ],
[ ( $arg->{weaver} eq 'task' ? 'TaskWeaver' : 'PodWeaver' ) => {} ],
[ Prepender => {} ],
# -- dynamic meta-information
[ ExecDir => {} ],
[ ShareDir => {} ],
[ Bugtracker => {} ],
[ Homepage => {} ],
[ Repository => {} ],
[ 'MetaProvides::Package' => {} ],
[ MetaConfig => {} ],
# -- generate meta files
[ License => {} ],
[ MetaYAML => {} ],
[ MetaJSON => {} ],
[ ModuleBuild => {} ],
#[ InstallGuide => {} ],
[ Readme => {} ],
[ Manifest => {} ], # should come last
# -- release
[ CheckChangeLog => {} ],
[ "Git::Check" => {} ],
[ "Git::Commit" => {} ],
[ "Git::CommitBuild" => {
branch => '',
release_branch => $release_branch,
} ],
[ "Git::Tag" => "TagMaster" => {} ],
[ "Git::Tag" => "TagRelease" => {
tag_format => 'cpan-v%v',
branch => $release_branch,
} ],
[ "Git::Push" => {} ],
#[ @Git],
[ UploadToCPAN => {} ],
);
# create list of plugins
my @plugins;
for my $wanted (@wanted) {
my ($plugin, $name, $arg);
if ( scalar(@$wanted) == 2 ) {
($plugin, $arg) = @$wanted;
$name = $plugin;
} else {
($plugin, $name, $arg) = @$wanted;
}
my $class = "Dist::Zilla::Plugin::$plugin";
Class::MOP::load_class($class); # make sure plugin exists
push @plugins, [ "$section->{name}/$name" => $class => $arg ];
}
return @plugins;
}
__PACKAGE__->meta->make_immutable;
no Moose;
1;
__END__
=for Pod::Coverage::TrustPod
bundle_config
=head1 SYNOPSIS
In your F<dist.ini>:
[@Author::JQUELIN]
AutoVersion.major = 2
=head1 DESCRIPTION
This is a plugin bundle to load all plugins that I am using. It is
equivalent to:
[AutoVersion]
; -- fetch & generate files
[GatherDir]
[CompileTests]
[HasVersionTests]
[KwaliteeTests]
[MinimumVersionTests]
[PodCoverageTests]
[PodSyntaxTests]
[ReportVersions::Tiny]
; -- remove some files
[PruneCruft]
[PruneFiles]
match = ~$
[ManifestSkip]
; -- get prereqs
[AutoPrereqs]
; -- munge files
[ExtraTests]
[NextRelease]
[PkgVersion]
[PodWeaver]
[Prepender]
; -- dynamic meta-information
[ExecDir]
[ShareDir]
[Bugtracker]
[Homepage]
[Repository]
[MetaProvides::Package]
[MetaConfig]
; -- generate meta files
[License]
[ModuleBuild]
[MetaYAML]
[MetaJSON]
[Readme]
[Manifest] ; should come last
; -- release
[CheckChangeLog]
[Git::Check],
[Git::Commit],
[Git::CommitBuild]
branch =
release_branch = releases
[Git::Tag / TagMaster]
[Git::Tag / TagRelease]
tag_format = cpan-v%v
branch = releases
[Git::Push],
[UploadToCPAN]
The following options are accepted:
=over 4
=item * C<major_version> - passed as C<major> option to the
L<AutoVersion|Dist::Zilla::Plugin::AutoVersion> plugin. Default to 1.
=item * C<weaver> - can be either C<pod> (default) or C<task>, to load
respectively either L<PodWeaver|Dist::Zilla::Plugin::PodWeaver> or
L<TaskWeaver|Dist::Zilla::Plugin::TaskWeaver>.
=item * C<skip_prereq> - passed as C<skip> option to the
L<AutoPrereq|Dist::Zilla::Plugin::AutoPrereq> plugin if set. No default.
=item * C<skip_compile> - passed as C<skip> option to the
L<CompileTests|Dist::Zilla::Plugin::CompileTests> plugin if set. No
default.
=item * C<fake_home> - passed to
L<CompileTests|Dist::Zilla::Plugin::CompileTests> to control whether
to fake home.
=back
B<NOTE:> This bundle consumes
L<Dist::Zilla::Role::PluginBundle::Config::Slicer> so you can also
specify attributes for any of the bundled plugins. The option should be
the plugin name and the attribute separated by a dot:
[@JQUELIN]
AutoPrereqs.skip = Bad::Module
See L<Config::MVP::Slicer/CONFIGURATION SYNTAX> for more information.
=head1 SEE ALSO
You can look for information on this module at:
=over 4
=item * Search CPAN
L<http://search.cpan.org/dist/Dist-Zilla-PluginBundle-Author-JQUELIN>
=item * See open / report bugs
L<http://rt.cpan.org/NoAuth/Bugs.html?Dist=Dist-Zilla-PluginBundle-Author-JQUELIN>
=item * Mailing-list (same as dist-zilla)
L<http://www.listbox.com/subscribe/?list_id=139292>
=item * Git repository
L<http://github.com/jquelin/dist-zilla-pluginbundle-author-jquelin>
=item * AnnoCPAN: Annotated CPAN documentation
L<http://annocpan.org/dist/Dist-Zilla-PluginBundle-Author-JQUELIN>
=item * CPAN Ratings
L<http://cpanratings.perl.org/d/Dist-Zilla-PluginBundle-Author-JQUELIN>
=back
See also: L<Dist::Zilla::PluginBundle>.