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