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