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