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