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