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