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