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