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