File Coverage

blib/lib/Dist/Zilla/PluginBundle/Author/CCM.pm
Criterion Covered Total %
statement 20 43 46.5
branch 0 14 0.0
condition n/a
subroutine 7 8 87.5
pod 1 1 100.0
total 28 66 42.4


line stmt bran cond sub pod time code
1             # ABSTRACT: A plugin bundle for distributions built by CCM
2             # KEYWORDS: dzil author bundle distribution tool
3              
4              
5             use 5.014;
6 1     1   525 use warnings;
  1         3  
7 1     1   4 use strict;
  1         2  
  1         17  
8 1     1   4  
  1         1  
  1         23  
9             our $VERSION = '0.012'; # VERSION
10              
11             use Dist::Zilla::Util;
12 1     1   338 use Moose;
  1         39144  
  1         25  
13 1     1   375 use Perl::Version;
  1         315128  
  1         5  
14 1     1   6303 use namespace::autoclean;
  1         3270  
  1         25  
15 1     1   5  
  1         2  
  1         7  
16              
17             has max_target_perl => (
18             is => 'ro',
19             isa => 'Str',
20             lazy => 1,
21             default => sub {
22             my $self = shift;
23             $self->payload->{'Test::MinimumVersion.max_target_perl'}
24             // $self->payload->{max_target_perl}
25             // '5.10.1';
26             },
27             );
28              
29              
30             has no_index => (
31             is => 'ro',
32             isa => 'ArrayRef',
33             lazy => 1,
34             default => sub {
35             my $self = shift;
36             [split(/\s+/, $self->payload->{'MetaNoIndex.directories'}
37             // $self->payload->{no_index}
38             // 'eg share shares t xt')];
39             },
40             );
41              
42              
43             has authority => (
44             is => 'ro',
45             isa => 'Str',
46             lazy => 1,
47             default => sub {
48             my $self = shift;
49             $self->payload->{'Authority.authority'} // $self->payload->{authority} // 'cpan:CCM';
50             },
51             );
52              
53              
54             has installer => (
55             is => 'ro',
56             isa => 'Str',
57             lazy => 1,
58             default => sub { shift->payload->{installer} // 'MakeMaker' },
59             );
60              
61              
62             has airplane => (
63             is => 'ro',
64             isa => 'Bool',
65             lazy => 1,
66             default => sub { $ENV{DZIL_AIRPLANE} // shift->payload->{airplane} // 0 },
67             );
68              
69              
70             has no_upload => (
71             is => 'ro',
72             isa => 'Bool',
73             lazy => 1,
74             default => sub { $ENV{DZIL_NO_UPLOAD} // shift->payload->{no_upload} // 0 },
75             );
76              
77              
78             my $self = shift;
79              
80 0     0 1   my @copy_from_build = qw(LICENSE);
81             my @network_plugins = qw(Git::Push Test::Pod::No404s UploadToCPAN);
82 0           my @gather_exclude = (@copy_from_build, qw(README.md));
83 0           my @gather_prune = qw(dist.ini);
84 0           my @no_index = @{$self->no_index};
85 0           my @allow_dirty = (@copy_from_build, qw(Changes LICENSE README.md));
86 0           my @git_remotes = qw(github origin);
  0            
87 0           my @check_files = qw(:InstallModules :ExecFiles :TestFiles :ExtraTestFiles);
88 0           my $perl_version_target = $self->max_target_perl;
89 0           my $installer = $self->installer;
90 0            
91 0           if ($self->no_upload) {
92             say '[@Author::CCM] WARNING! WARNING! WARNING! *** You are in no_upload mode!! ***';
93 0 0         }
94 0            
95             my @plugins = (
96              
97 0 0         # VERSION
    0          
    0          
    0          
98             ['Git::NextVersion'],
99              
100             # GATHER
101             ['Git::GatherDir' => {exclude_filename => [@gather_exclude]}],
102             ['PruneCruft'],
103             ['PruneFiles' => {filename => [@gather_prune]}],
104              
105             ['CopyFilesFromBuild' => {copy => [@copy_from_build]}],
106             ['ExecDir'],
107              
108             # PREREQS
109             ['AutoPrereqs'],
110             -f 'cpanfile' ? ['Prereqs::FromCPANfile'] : (),
111             ['Prereqs::AuthorDeps'],
112              
113             # TESTS
114             ['MetaTests'],
115             ['Test::CPAN::Changes'],
116             ['PodCoverageTests'],
117             ['PodSyntaxTests'],
118             ['Test::Pod::No404s'],
119             ['Test::Compile'],
120             ['Test::MinimumVersion' => {max_target_perl => $perl_version_target}],
121             ['Test::EOL' => {finder => [@check_files]}],
122             ['Test::NoTabs' => {finder => [@check_files]}],
123             ['Test::Perl::Critic'],
124             ['Test::Portability'],
125             ['Test::CleanNamespaces'],
126             ['Test::ReportPrereqs'],
127              
128             # METADATA
129             ['Authority' => {authority => $self->authority, do_munging => 0}],
130             ['MetaJSON'],
131             ['MetaYAML'],
132             ['MetaNoIndex' => {directory => [@no_index]}],
133             ['MetaProvides::Package'],
134             ['Keywords'],
135             ['Git::Contributors' => {order_by => 'commits'}],
136             ['GithubMeta' => {remote => [@git_remotes], issues => 1}],
137              
138             # MUNGE
139             ['PodWeaver' => {config_plugin => '@Author::CCM'}],
140             ['OverridePkgVersion'],
141              
142             # GENERATE FILES
143             ['License'],
144             ['ReadmeAnyFromPod' => 'RepoReadme' => {filename => 'README.md', location => 'root', type => 'markdown', phase => 'release'}],
145             ['ReadmeAnyFromPod' => 'DistReadme' => {filename => 'README', location => 'build', type => 'text'}],
146             ['Manifest'],
147             ['ManifestSkip'],
148              
149             $installer ? $self->installer : (), # e.g. MakeMaker
150              
151             # RELEASE
152             ['NextRelease' => {format => '%-9v %{yyyy-MM-dd HH:mm:ssZZZ}d%{ (TRIAL RELEASE)}T'}],
153             ['CheckChangesHasContent'],
154             ['Git::Check' => {allow_dirty => [@allow_dirty], untracked_files => 'ignore'}],
155             ['RunExtraTests'],
156             ['TestRelease'],
157             # ['ConfirmRelease'],
158             $self->no_upload ? ['FakeRelease'] : ['UploadToCPAN'],
159             ['Git::Commit' => {allow_dirty => [@allow_dirty], commit_msg => 'Release %N %v%t%n%n%c'}],
160             ['Git::CommitBuild' => {branch => '', release_branch => 'dist', release_message => 'Version %v%t'}],
161             ['Git::Tag' => {tag_message => 'Version %v%t%n%n%c'}],
162             $self->no_upload ? () : ['Git::Push' => {push_to => 'origin master +master:refs/heads/release +dist', remotes_must_exist => 0}],
163              
164             );
165              
166             if ($self->airplane) {
167             my %network_plugins = map { Dist::Zilla::Util->expand_config_package_name($_) => 1 } @network_plugins;
168 0 0          
169 0           @plugins = grep { !$network_plugins{Dist::Zilla::Util->expand_config_package_name(ref eq 'ARRAY' ? $_->[0] : $_)} } @plugins;
  0            
170             push @plugins, 'BlockRelease';
171 0 0         }
  0            
172 0            
173             push @plugins, 'ConfirmRelease';
174              
175 0           $self->add_plugins(@plugins);
176             }
177 0            
178             with 'Dist::Zilla::Role::PluginBundle::Easy';
179             with 'Dist::Zilla::Role::PluginBundle::PluginRemover';
180             with 'Dist::Zilla::Role::PluginBundle::Config::Slicer';
181              
182             __PACKAGE__->meta->make_immutable;
183             1;
184              
185              
186             =pod
187              
188             =encoding UTF-8
189              
190             =head1 NAME
191              
192             Dist::Zilla::PluginBundle::Author::CCM - A plugin bundle for distributions built by CCM
193              
194             =head1 VERSION
195              
196             version 0.012
197              
198             =head1 SYNOPSIS
199              
200             # In your dist.ini file:
201             [@Author::CCM]
202              
203             =head1 DESCRIPTION
204              
205             You probably don't want to use this.
206              
207             ; VERSION
208             [Git::NextVersion]
209              
210             ; GATHER
211             [Git::GatherDir]
212             exclude_filename = LICENSE
213             exclude_filename = README.md
214             [PruneCruft]
215             [PruneFiles]
216             filename = dist.ini
217              
218             [CopyFilesFromBuild]
219             copy = LICENSE
220             [ExecDir]
221              
222             ; PREREQS
223             [AutoPrereqs]
224             [Prereqs::FromCPANfile] ; if a cpanfile exists in root
225             [Prereqs::AuthorDeps]
226              
227             ; TESTS
228             [MetaTests]
229             [Test::CPAN::Changes]
230             [PodCoverageTests]
231             [PodSyntaxTests]
232             [Test::Pod::No404s]
233             [Test::Compile]
234             [Test::MinimumVersion]
235             max_target_perl = 5.10.1
236             [Test::EOL]
237             [Test::NoTabs]
238             [Test::Perl::Critic]
239             [Test::Portability]
240             [Test::CleanNamespaces]
241             [Test::ReportPrereqs]
242              
243             ; METADATA
244             [Authority]
245             do_munging = 0
246             [MetaJSON]
247             [MetaYAML]
248             [MetaNoIndex]
249             directory = eg
250             directory = share
251             directory = shares
252             directory = t
253             directory = xt
254             [MetaProvides::Package]
255             [Keywords]
256             [Git::Contributors]
257             order_by = commits
258             [GithubMeta]
259             issues = 1
260              
261             ; MUNGE
262             [PodWeaver]
263             config_plugin = @Author::CCM
264             [OverridePkgVersion]
265              
266             ; GENERATE FILES
267             [License]
268             [ReadmeAnyFromPod]
269             filename = README.md
270             locaton = root
271             type = markdown
272             phase = release
273             [ReadmeAnyFromPod]
274             filename = README
275             location = build
276             type = text
277             [Manifest]
278             [ManifestSkip]
279              
280             [MakeMaker] ; override with the "installer" attribute
281              
282             ; RELEASE
283             [NextRelease]
284             [CheckChangesHasContent]
285             [Git::Check]
286             [RunExtraTests]
287             [TestRelease]
288             [ConfirmRelease]
289             [UploadToCPAN] ; disable with the "no_upload" attribute
290             [Git::Commit]
291             commit_msg = Release %N %v%t%n%n%c
292             [Git::CommitBuild]
293             branch =
294             release_branch = dist
295             release_message = Version %v%t
296             [Git::Tag]
297             tag_message = Version %v%t%n%n%c
298             [Git::Push]
299             push_to = origin master +master:refs/heads/release +dist
300             remotes_must_exist = 0
301              
302             =head1 ATTRIBUTES
303              
304             =head2 max_target_perl
305              
306             Specify the minimum perl version. Defaults to C<5.10.1>.
307              
308             =head2 no_index
309              
310             Set directories to not index.
311              
312             Default:
313              
314             =head2 authority
315              
316             Specify the release authority. Defaults to C<cpan:CCM>.
317              
318             =head2 installer
319              
320             Specify which installer to use, such as:
321              
322             =over 4
323              
324             =item *
325              
326             C<MakeMaker> (default)
327              
328             =item *
329              
330             C<MakeMaker::Custom>
331              
332             =back
333              
334             =head2 airplane
335              
336             Disable plugins that use the network, and prevent releasing.
337              
338             =head2 no_upload
339              
340             Do not upload to CPAN or git push.
341              
342             =head1 METHODS
343              
344             =head2 configure
345              
346             Required by L<Dist::Zilla::Role::PluginBundle::Easy>.
347              
348             =head1 SEE ALSO
349              
350             =over 4
351              
352             =item *
353              
354             L<Dist::Zilla>
355              
356             =item *
357              
358             L<Dist::Zilla::PluginBundle::Author::ETHER>
359              
360             =back
361              
362             =head1 BUGS
363              
364             Please report any bugs or feature requests on the bugtracker website
365             L<https://github.com/chazmcgarvey/Dist-Zilla-PluginBundle-Author-CCM/issues>
366              
367             When submitting a bug or request, please include a test-file or a
368             patch to an existing test-file that illustrates the bug or desired
369             feature.
370              
371             =head1 AUTHOR
372              
373             Charles McGarvey <ccm@cpan.org>
374              
375             =head1 COPYRIGHT AND LICENSE
376              
377             This software is copyright (c) 2016 by Charles McGarvey.
378              
379             This is free software; you can redistribute it and/or modify it under
380             the same terms as the Perl 5 programming language system itself.
381              
382             =cut