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