]> Dogcows Code - chaz/p5-Dist-Zilla-PluginBundle-Author-CCM/blob - lib/Dist/Zilla/PluginBundle/Author/CCM.pm
7381c41c01c89818c81c03f5cd9be6a3dbbdea18
[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.
161
162 =cut
163
164 has no_upload => (
165 is => 'ro',
166 isa => 'Bool',
167 lazy => 1,
168 default => 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 my @copy_from_build = qw(LICENSE);
181 my @network_plugins = qw(Git::Push Test::Pod::No404s UploadToCPAN);
182 my @gather_exclude = (@copy_from_build, qw(README.md));
183 my @gather_prune = qw(dist.ini);
184 my @no_index = qw(eg share shares t xt);
185 my @allow_dirty = (@copy_from_build, qw(.travis.yml Changes LICENSE README.md));
186 my @git_remotes = qw(github origin);
187 my @check_files = qw(:InstallModules :ExecFiles :TestFiles :ExtraTestFiles);
188
189 my @plugins = (
190
191 # VERSION
192 ['Git::NextVersion'],
193 ['NextRelease'],
194 ['ReversionOnRelease' => {prompt => 1}],
195
196 ['ExecDir'],
197 ['ExtraTests'],
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
206 # PREREQS
207 ['AutoPrereqs'],
208 -f 'cpanfile' ? ['Prereqs::FromCPANfile'] : (),
209 ['Prereqs::AuthorDeps'],
210
211 # TESTS
212 ['MetaTests'],
213 ['Test::CPAN::Changes'],
214 ['PodCoverageTests'],
215 ['PodSyntaxTests'],
216 ['Test::Pod::No404s'],
217 ['Test::Compile'],
218 ['Test::EOL' => {finder => [@check_files]}],
219 ['Test::NoTabs' => {finder => [@check_files]}],
220 ['Test::Perl::Critic'],
221 ['Test::Portability'],
222 ['Test::CleanNamespaces'],
223 ['Test::ReportPrereqs'],
224
225 # METADATA
226 ['Authority' => {do_munging => 0}],
227 ['MetaJSON'],
228 ['MetaYAML'],
229 ['MetaNoIndex' => {directory => [@no_index]}],
230 ['MetaProvides::Package'],
231 ['Keywords'],
232 ['Git::Contributors' => {order_by => 'commits'}],
233 ['GithubMeta' => {remote => [@git_remotes], issues => 1}],
234
235 # MUNGE
236 ['PodWeaver' => {config_plugin => '@Author::CCM'}],
237 ['OverridePkgVersion'],
238
239 # GENERATE FILES
240 ['License'],
241 ['ReadmeAnyFromPod' => 'repo readme' => {filename => 'README.md', location => 'root', type => 'markdown', phase => 'release'}],
242 ['ReadmeAnyFromPod' => 'dist readme' => {filename => 'README', location => 'build', type => 'text'}],
243 ['TravisYML'],
244 ['Manifest'],
245 ['ManifestSkip'],
246
247 $self->installer, # e.g. MakeMaker
248
249 # RELEASE
250 ['CheckChangesHasContent'],
251 ['Git::Check' => {allow_dirty => [@allow_dirty], untracked_files => 'ignore'}],
252 ['TestRelease'],
253 # ['ConfirmRelease'],
254 $self->no_upload ? ['FakeRelease'] : ['UploadToCPAN'],
255 ['Git::Commit' => {allow_dirty => [@allow_dirty], commit_msg => 'Release %N %v%t%n%n%c'}],
256 ['Git::CommitBuild' => {branch => '', release_branch => 'dist', release_message => 'Version %v%t'}],
257 ['Git::Tag' => {tag_message => 'Version %v%t%n%n%c'}],
258 ['Git::Push' => {push_to => 'origin master +master:refs/heads/release +dist', remotes_must_exist => 0}],
259
260 );
261
262 if ($self->airplane) {
263 my %network_plugins = map { Dist::Zilla::Util->expand_config_package_name($_) => 1 } @network_plugins;
264
265 @plugins = grep { !$network_plugins{Dist::Zilla::Util->expand_config_package_name(ref eq 'ARRAY' ? $_->[0] : $_)} } @plugins;
266 push @plugins, 'BlockRelease';
267 }
268
269 push @plugins, 'ConfirmRelease';
270
271 $self->add_plugins(@plugins);
272 }
273
274 with 'Dist::Zilla::Role::PluginBundle::Easy';
275 with 'Dist::Zilla::Role::PluginBundle::PluginRemover';
276 with 'Dist::Zilla::Role::PluginBundle::Config::Slicer';
277
278 __PACKAGE__->meta->make_immutable;
279 1;
This page took 0.046688 seconds and 3 git commands to generate.