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