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