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