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