]> Dogcows Code - chaz/p5-Dist-Zilla-PluginBundle-Author-CCM/blob - lib/Dist/Zilla/PluginBundle/Author/CCM.pm
fd3da4643a684e0514ca7b9b8c643ca85f7d9ba8
[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 [NextRelease]
17 [ReversionOnRelease]
18 prompt = 1
19
20 ; GATHER
21 [Git::GatherDir]
22 exclude_filename = LICENSE
23 exclude_filename = README.md
24 [PruneCruft]
25 [PruneFiles]
26 filename = dist.ini
27
28 [CopyFilesFromBuild]
29 copy = LICENSE
30 [ExecDir]
31
32 ; PREREQS
33 [AutoPrereqs]
34 [Prereqs::FromCPANfile] ; if a cpanfile exists in root
35 [Prereqs::AuthorDeps]
36
37 ; TESTS
38 [MetaTests]
39 [Test::CPAN::Changes]
40 [PodCoverageTests]
41 [PodSyntaxTests]
42 [Test::Pod::No404s]
43 [Test::Compile]
44 [Test::MinimumVersion]
45 max_target_perl = 5.10.1
46 [Test::EOL]
47 [Test::NoTabs]
48 [Test::Perl::Critic]
49 [Test::Portability]
50 [Test::CleanNamespaces]
51 [Test::ReportPrereqs]
52
53 ; METADATA
54 [Authority]
55 do_munging = 0
56 [MetaJSON]
57 [MetaYAML]
58 [MetaNoIndex]
59 directory = eg
60 directory = share
61 directory = shares
62 directory = t
63 directory = xt
64 [MetaProvides::Package]
65 [Keywords]
66 [Git::Contributors]
67 order_by = commits
68 [GithubMeta]
69 issues = 1
70
71 ; MUNGE
72 [PodWeaver]
73 config_plugin = @Author::CCM
74 [OverridePkgVersion]
75
76 ; GENERATE FILES
77 [License]
78 [ReadmeAnyFromPod]
79 filename = README.md
80 locaton = root
81 type = markdown
82 phase = release
83 [ReadmeAnyFromPod]
84 filename = README
85 location = build
86 type = text
87 [TravisYML]
88 build_branch = /^(dist|build\/.*)$/
89 [Manifest]
90 [ManifestSkip]
91
92 [MakeMaker] ; override with the "installer" attribute
93
94 ; RELEASE
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 ['NextRelease'],
241 ['ReversionOnRelease' => {prompt => 1}],
242
243 # GATHER
244 ['Git::GatherDir' => {exclude_filename => [@gather_exclude]}],
245 ['PruneCruft'],
246 ['PruneFiles' => {filename => [@gather_prune]}],
247
248 ['CopyFilesFromBuild' => {copy => [@copy_from_build]}],
249 ['ExecDir'],
250
251 # PREREQS
252 ['AutoPrereqs'],
253 -f 'cpanfile' ? ['Prereqs::FromCPANfile'] : (),
254 ['Prereqs::AuthorDeps'],
255
256 # TESTS
257 ['MetaTests'],
258 ['Test::CPAN::Changes'],
259 ['PodCoverageTests'],
260 ['PodSyntaxTests'],
261 ['Test::Pod::No404s'],
262 ['Test::Compile'],
263 ['Test::MinimumVersion' => {max_target_perl => $perl_version_target}],
264 ['Test::EOL' => {finder => [@check_files]}],
265 ['Test::NoTabs' => {finder => [@check_files]}],
266 ['Test::Perl::Critic'],
267 ['Test::Portability'],
268 ['Test::CleanNamespaces'],
269 ['Test::ReportPrereqs'],
270
271 # METADATA
272 ['Authority' => {authority => $self->authority, do_munging => 0}],
273 ['MetaJSON'],
274 ['MetaYAML'],
275 ['MetaNoIndex' => {directory => [@no_index]}],
276 ['MetaProvides::Package'],
277 ['Keywords'],
278 ['Git::Contributors' => {order_by => 'commits'}],
279 ['GithubMeta' => {remote => [@git_remotes], issues => 1}],
280
281 # MUNGE
282 ['PodWeaver' => {config_plugin => '@Author::CCM'}],
283 ['OverridePkgVersion'],
284
285 # GENERATE FILES
286 ['License'],
287 ['ReadmeAnyFromPod' => 'RepoReadme' => {filename => 'README.md', location => 'root', type => 'markdown', phase => 'release'}],
288 ['ReadmeAnyFromPod' => 'DistReadme' => {filename => 'README', location => 'build', type => 'text'}],
289 ['TravisYML' => {build_branch => '/^(dist|build\/.*)$/', perl_version => $perl_version, perl_version_build => $perl_version_build}],
290 ['Manifest'],
291 ['ManifestSkip'],
292
293 $self->installer, # e.g. MakeMaker
294
295 # RELEASE
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.048532 seconds and 3 git commands to generate.