]> Dogcows Code - chaz/p5-Dist-Zilla-PluginBundle-Author-CCM/blob - lib/Dist/Zilla/PluginBundle/Author/CCM.pm
Version 0.011
[chaz/p5-Dist-Zilla-PluginBundle-Author-CCM] / lib / Dist / Zilla / PluginBundle / Author / CCM.pm
1 package Dist::Zilla::PluginBundle::Author::CCM;
2 # ABSTRACT: A plugin bundle for distributions built by CCM
3 # KEYWORDS: dzil author bundle distribution tool
4
5
6 use 5.014;
7 use warnings;
8 use strict;
9
10 our $VERSION = '0.011'; # VERSION
11
12 use Dist::Zilla::Util;
13 use Moose;
14 use Perl::Version;
15 use namespace::autoclean;
16
17
18 has max_target_perl => (
19 is => 'ro',
20 isa => 'Str',
21 lazy => 1,
22 default => sub {
23 my $self = shift;
24 $self->payload->{'Test::MinimumVersion.max_target_perl'}
25 // $self->payload->{max_target_perl}
26 // '5.10.1';
27 },
28 );
29
30
31 has no_index => (
32 is => 'ro',
33 isa => 'ArrayRef',
34 lazy => 1,
35 default => sub {
36 my $self = shift;
37 [split(/\s+/, $self->payload->{'MetaNoIndex.directories'}
38 // $self->payload->{no_index}
39 // 'eg share shares t xt')];
40 },
41 );
42
43
44 has authority => (
45 is => 'ro',
46 isa => 'Str',
47 lazy => 1,
48 default => sub {
49 my $self = shift;
50 $self->payload->{'Authority.authority'} // $self->payload->{authority} // 'cpan:CCM';
51 },
52 );
53
54
55 has installer => (
56 is => 'ro',
57 isa => 'Str',
58 lazy => 1,
59 default => sub { shift->payload->{installer} // 'MakeMaker' },
60 );
61
62
63 has airplane => (
64 is => 'ro',
65 isa => 'Bool',
66 lazy => 1,
67 default => sub { $ENV{DZIL_AIRPLANE} // shift->payload->{airplane} // 0 },
68 );
69
70
71 has no_upload => (
72 is => 'ro',
73 isa => 'Bool',
74 lazy => 1,
75 default => sub { $ENV{DZIL_NO_UPLOAD} // shift->payload->{no_upload} // 0 },
76 );
77
78
79 sub configure {
80 my $self = shift;
81
82 my @copy_from_build = qw(LICENSE);
83 my @network_plugins = qw(Git::Push Test::Pod::No404s UploadToCPAN);
84 my @gather_exclude = (@copy_from_build, qw(README.md));
85 my @gather_prune = qw(dist.ini);
86 my @no_index = @{$self->no_index};
87 my @allow_dirty = (@copy_from_build, qw(Changes LICENSE README.md));
88 my @git_remotes = qw(github origin);
89 my @check_files = qw(:InstallModules :ExecFiles :TestFiles :ExtraTestFiles);
90 my $perl_version_target = $self->max_target_perl;
91
92 if ($self->no_upload) {
93 say '[@Author::CCM] WARNING! WARNING! WARNING! *** You are in no_upload mode!! ***';
94 }
95
96 my @plugins = (
97
98 # VERSION
99 ['Git::NextVersion'],
100
101 # GATHER
102 ['Git::GatherDir' => {exclude_filename => [@gather_exclude]}],
103 ['PruneCruft'],
104 ['PruneFiles' => {filename => [@gather_prune]}],
105
106 ['CopyFilesFromBuild' => {copy => [@copy_from_build]}],
107 ['ExecDir'],
108
109 # PREREQS
110 ['AutoPrereqs'],
111 -f 'cpanfile' ? ['Prereqs::FromCPANfile'] : (),
112 ['Prereqs::AuthorDeps'],
113
114 # TESTS
115 ['MetaTests'],
116 ['Test::CPAN::Changes'],
117 ['PodCoverageTests'],
118 ['PodSyntaxTests'],
119 ['Test::Pod::No404s'],
120 ['Test::Compile'],
121 ['Test::MinimumVersion' => {max_target_perl => $perl_version_target}],
122 ['Test::EOL' => {finder => [@check_files]}],
123 ['Test::NoTabs' => {finder => [@check_files]}],
124 ['Test::Perl::Critic'],
125 ['Test::Portability'],
126 ['Test::CleanNamespaces'],
127 ['Test::ReportPrereqs'],
128
129 # METADATA
130 ['Authority' => {authority => $self->authority, do_munging => 0}],
131 ['MetaJSON'],
132 ['MetaYAML'],
133 ['MetaNoIndex' => {directory => [@no_index]}],
134 ['MetaProvides::Package'],
135 ['Keywords'],
136 ['Git::Contributors' => {order_by => 'commits'}],
137 ['GithubMeta' => {remote => [@git_remotes], issues => 1}],
138
139 # MUNGE
140 ['PodWeaver' => {config_plugin => '@Author::CCM'}],
141 ['OverridePkgVersion'],
142
143 # GENERATE FILES
144 ['License'],
145 ['ReadmeAnyFromPod' => 'RepoReadme' => {filename => 'README.md', location => 'root', type => 'markdown', phase => 'release'}],
146 ['ReadmeAnyFromPod' => 'DistReadme' => {filename => 'README', location => 'build', type => 'text'}],
147 ['Manifest'],
148 ['ManifestSkip'],
149
150 $self->installer, # e.g. MakeMaker
151
152 # RELEASE
153 ['NextRelease' => {format => '%-9v %{yyyy-MM-dd HH:mm:ssZZZ}d%{ (TRIAL RELEASE)}T'}],
154 ['CheckChangesHasContent'],
155 ['Git::Check' => {allow_dirty => [@allow_dirty], untracked_files => 'ignore'}],
156 ['RunExtraTests'],
157 ['TestRelease'],
158 # ['ConfirmRelease'],
159 $self->no_upload ? ['FakeRelease'] : ['UploadToCPAN'],
160 ['Git::Commit' => {allow_dirty => [@allow_dirty], commit_msg => 'Release %N %v%t%n%n%c'}],
161 ['Git::CommitBuild' => {branch => '', release_branch => 'dist', release_message => 'Version %v%t'}],
162 ['Git::Tag' => {tag_message => 'Version %v%t%n%n%c'}],
163 $self->no_upload ? () : ['Git::Push' => {push_to => 'origin master +master:refs/heads/release +dist', remotes_must_exist => 0}],
164
165 );
166
167 if ($self->airplane) {
168 my %network_plugins = map { Dist::Zilla::Util->expand_config_package_name($_) => 1 } @network_plugins;
169
170 @plugins = grep { !$network_plugins{Dist::Zilla::Util->expand_config_package_name(ref eq 'ARRAY' ? $_->[0] : $_)} } @plugins;
171 push @plugins, 'BlockRelease';
172 }
173
174 push @plugins, 'ConfirmRelease';
175
176 $self->add_plugins(@plugins);
177 }
178
179 with 'Dist::Zilla::Role::PluginBundle::Easy';
180 with 'Dist::Zilla::Role::PluginBundle::PluginRemover';
181 with 'Dist::Zilla::Role::PluginBundle::Config::Slicer';
182
183 __PACKAGE__->meta->make_immutable;
184 1;
185
186 __END__
187
188 =pod
189
190 =encoding UTF-8
191
192 =head1 NAME
193
194 Dist::Zilla::PluginBundle::Author::CCM - A plugin bundle for distributions built by CCM
195
196 =head1 VERSION
197
198 version 0.011
199
200 =head1 SYNOPSIS
201
202 # In your dist.ini file:
203 [@Author::CCM]
204
205 =head1 DESCRIPTION
206
207 You probably don't want to use this.
208
209 ; VERSION
210 [Git::NextVersion]
211
212 ; GATHER
213 [Git::GatherDir]
214 exclude_filename = LICENSE
215 exclude_filename = README.md
216 [PruneCruft]
217 [PruneFiles]
218 filename = dist.ini
219
220 [CopyFilesFromBuild]
221 copy = LICENSE
222 [ExecDir]
223
224 ; PREREQS
225 [AutoPrereqs]
226 [Prereqs::FromCPANfile] ; if a cpanfile exists in root
227 [Prereqs::AuthorDeps]
228
229 ; TESTS
230 [MetaTests]
231 [Test::CPAN::Changes]
232 [PodCoverageTests]
233 [PodSyntaxTests]
234 [Test::Pod::No404s]
235 [Test::Compile]
236 [Test::MinimumVersion]
237 max_target_perl = 5.10.1
238 [Test::EOL]
239 [Test::NoTabs]
240 [Test::Perl::Critic]
241 [Test::Portability]
242 [Test::CleanNamespaces]
243 [Test::ReportPrereqs]
244
245 ; METADATA
246 [Authority]
247 do_munging = 0
248 [MetaJSON]
249 [MetaYAML]
250 [MetaNoIndex]
251 directory = eg
252 directory = share
253 directory = shares
254 directory = t
255 directory = xt
256 [MetaProvides::Package]
257 [Keywords]
258 [Git::Contributors]
259 order_by = commits
260 [GithubMeta]
261 issues = 1
262
263 ; MUNGE
264 [PodWeaver]
265 config_plugin = @Author::CCM
266 [OverridePkgVersion]
267
268 ; GENERATE FILES
269 [License]
270 [ReadmeAnyFromPod]
271 filename = README.md
272 locaton = root
273 type = markdown
274 phase = release
275 [ReadmeAnyFromPod]
276 filename = README
277 location = build
278 type = text
279 [Manifest]
280 [ManifestSkip]
281
282 [MakeMaker] ; override with the "installer" attribute
283
284 ; RELEASE
285 [NextRelease]
286 [CheckChangesHasContent]
287 [Git::Check]
288 [RunExtraTests]
289 [TestRelease]
290 [ConfirmRelease]
291 [UploadToCPAN] ; disable with the "no_upload" attribute
292 [Git::Commit]
293 commit_msg = Release %N %v%t%n%n%c
294 [Git::CommitBuild]
295 branch =
296 release_branch = dist
297 release_message = Version %v%t
298 [Git::Tag]
299 tag_message = Version %v%t%n%n%c
300 [Git::Push]
301 push_to = origin master +master:refs/heads/release +dist
302 remotes_must_exist = 0
303
304 =head1 ATTRIBUTES
305
306 =head2 max_target_perl
307
308 Specify the minimum perl version. Defaults to C<5.10.1>.
309
310 =head2 no_index
311
312 Set directories to not index.
313
314 Default:
315
316 =head2 authority
317
318 Specify the release authority. Defaults to C<cpan:CCM>.
319
320 =head2 installer
321
322 Specify which installer to use, such as:
323
324 =over 4
325
326 =item *
327
328 C<MakeMaker> (default)
329
330 =item *
331
332 C<MakeMaker::Custom>
333
334 =back
335
336 =head2 airplane
337
338 Disable plugins that use the network, and prevent releasing.
339
340 =head2 no_upload
341
342 Do not upload to CPAN or git push.
343
344 =head1 METHODS
345
346 =head2 configure
347
348 Required by L<Dist::Zilla::Role::PluginBundle::Easy>.
349
350 =head1 SEE ALSO
351
352 =over 4
353
354 =item *
355
356 L<Dist::Zilla>
357
358 =item *
359
360 L<Dist::Zilla::PluginBundle::Author::ETHER>
361
362 =back
363
364 =head1 BUGS
365
366 Please report any bugs or feature requests on the bugtracker website
367 L<https://github.com/chazmcgarvey/Dist-Zilla-PluginBundle-Author-CCM/issues>
368
369 When submitting a bug or request, please include a test-file or a
370 patch to an existing test-file that illustrates the bug or desired
371 feature.
372
373 =head1 AUTHOR
374
375 Charles McGarvey <ccm@cpan.org>
376
377 =head1 COPYRIGHT AND LICENSE
378
379 This software is copyright (c) 2016 by Charles McGarvey.
380
381 This is free software; you can redistribute it and/or modify it under
382 the same terms as the Perl 5 programming language system itself.
383
384 =cut
This page took 0.05485 seconds and 4 git commands to generate.