File Coverage

blib/lib/Dist/Zilla/PluginBundle/BAREFOOT.pm
Criterion Covered Total %
statement 106 106 100.0
branch 2 4 50.0
condition n/a
subroutine 37 37 100.0
pod 0 1 0.0
total 145 148 97.9


line stmt bran cond sub pod time code
1 2     2   1623713 use 5.012;
  2         5  
2 2     2   774 use MooseX::Declare;
  2         2494626  
  2         6  
3 2     2   3849 use Method::Signatures::Modifiers;
  2         67168  
  2         12  
4              
5             class Dist::Zilla::PluginBundle::BAREFOOT with Dist::Zilla::Role::PluginBundle::Easy
6 2     2   68552 {
  2     2   3  
  2     2   60  
  2     2   15632  
  2         4  
  2         11  
  2         7491  
  2         2  
  2         15  
  2         156  
7 2     2   714 use autodie 2.00 ;
  2         10760  
  2         9  
8 2     2   7523 use PerlX::Maybe 0.003 'provided' ;
  2         2621  
  2         98  
9 2     2   9 use List::MoreUtils 'uniq' ;
  2         3  
  2         26  
10 2     2   1397 use MooseX::Has::Sugar ;
  2         939  
  2         8  
11 2     2   163 use MooseX::Types::Moose ':all' ;
  2         3  
  2         25  
12 2     2   11732 use MooseX::ClassAttribute ;
  2         103294  
  2         7  
13              
14             # Dependencies
15 2     2   312659 use Dist::Zilla 4.3 ; # authordeps
  2         616644  
  2         76  
16              
17             # supplies: Git::Check, Git::Commit, Git::NextVersion, Git::Push, Git::Tag
18 2     2   1101 use Dist::Zilla::PluginBundle::Git 2.013 ();
  2         913688  
  2         66  
19              
20 2     2   1095 use Dist::Zilla::Plugin::PodWeaver ();
  2         1142701  
  2         69  
21 2     2   1022 use Dist::Zilla::Plugin::GithubMeta 0.10 ();
  2         208958  
  2         99  
22 2     2   1042 use Dist::Zilla::Plugin::Bugtracker 1.102670 ();
  2         49356  
  2         64  
23 2     2   1031 use Dist::Zilla::Plugin::MetaNoIndex ();
  2         74177  
  2         65  
24 2     2   1218 use Dist::Zilla::Plugin::MinimumPerl ();
  2         349475  
  2         97  
25 2     2   1345 use Dist::Zilla::Plugin::OurPkgVersion 0.001008 ();
  2         86648  
  2         64  
26 2     2   1136 use Dist::Zilla::Plugin::ReadmeFromPod ();
  2         364420  
  2         80  
27 2     2   1713 use Dist::Zilla::Plugin::Test::Version ();
  2         405089  
  2         88  
28 2     2   1476 use Dist::Zilla::Plugin::CheckExtraTests ();
  2         62025  
  2         93  
29 2     2   1377 use Dist::Zilla::Plugin::InsertCopyright 0.001 ();
  2         75638  
  2         101  
30 2     2   1543 use Dist::Zilla::Plugin::ReadmeAnyFromPod 0.120051 ();
  2         175888  
  2         77  
31 2     2   1167 use Dist::Zilla::Plugin::Test::PodSpelling 2.001002 ();
  2         236380  
  2         89  
32 2     2   1353 use Dist::Zilla::Plugin::CopyFilesFromBuild ();
  2         87632  
  2         75  
33 2     2   1081 use Dist::Zilla::Plugin::CheckPrereqsIndexed 0.002 ();
  2         33048  
  2         77  
34 2     2   1166 use Dist::Zilla::Plugin::CheckVersionIncrement 0.121750 ();
  2         114009  
  2         86  
35             #use Dist::Zilla::Plugin::MetaProvides::Package 1.14 (); # hides DB/main/private packages
36 2     2   1083 use Dist::Zilla::Plugin::MetaProvides::Class 2.001 (); # adds 'provides' to META.* for `class`
  2         434018  
  2         68  
37 2     2   1080 use Dist::Zilla::Plugin::PodnameFromClassname (); # stops Pod::Weaver from complaining
  2         55927  
  2         81  
38 2     2   1383 use Dist::Zilla::Plugin::CheckChangesHasContent ();
  2         84219  
  2         325  
39              
40              
41             our $VERSION = '0.05_01'; # TRIAL VERSION
42              
43             my @dirty_files = qw< dist.ini Changes >;
44             my @exclude_generated_files = qw< README.pod META.json >;
45              
46             class_has weaver_payload => ( ro, writer => '_store_weaver_data', isa => HashRef, lazy,
47             default => sub { die "class attribute weaver_payload called too soon!" }, );
48              
49              
50 1     1 0 187 sub mvp_multivalue_args { qw/stopwords/ }
51              
52             has stopwords => ( ro, isa => ArrayRef, lazy, default => method { $self->payload->{'stopwords'} // [] } );
53             has fake_release => ( ro, isa => Bool, lazy, default => method { $self->payload->{'fake_release'} } );
54             has no_spellcheck => ( ro, isa => Bool, default => 0 );
55             has auto_prereq => ( ro, isa => Bool, lazy, default => method { $self->payload->{'auto_prereq'} // 1 } );
56             has tag_format => ( ro, isa => Str, lazy, default => method { $self->payload->{'tag_format'} // 'v%v' } );
57             has version_regexp => ( ro, isa => Str, lazy, default => method { $self->payload->{'version_regexp'} // '^v(.+)$' } );
58             has git_remote => ( ro, isa => Str, lazy, default => method { $self->payload->{'git_remote'} // 'origin' } );
59             has legal_addendum => ( ro, isa => Str, lazy, default => method { $self->payload->{'legal_addendum'} // '' } );
60              
61              
62             method configure
63 2 50   2   56194 {
  1     1   6  
  1         3  
64 1         31 my @push_to = uniq 'origin', $self->git_remote;
65              
66 1 50       44 $self->add_plugins (
67              
68             # version number
69             #[ 'Git::NextVersion' => { first_version => '0.01', version_regexp => $self->version_regexp } ],
70              
71             # gather and prune
72             [ GatherDir => { exclude_filename => [@exclude_generated_files] }],# core
73             #PruneCruft => # core
74             #ManifestSkip => # core
75              
76             provided $self->auto_prereq,
77             [ AutoPrereqs => { skip => "^t::lib" } ],
78             #
79             # file munging
80             OurPkgVersion =>
81             PodnameFromClassname =>
82             #InsertCopyright =>
83             [ PodWeaver => { config_plugin => '@BAREFOOT', } ],
84              
85             # generated distribution files
86             License => # core
87             [ ReadmeAnyFromPod => { # generate in root for github, etc.
88             type => 'pod',
89             filename => 'README.pod',
90             location => 'root',
91             }
92             ],
93             [ Bugtracker => { web => 'http://github.com/barefootcoder/%l/issues' } ],
94              
95             # # generated xt/ tests
96             #provided not $self->no_spellcheck,
97             # [ 'Test::PodSpelling' => { stopwords => $self->stopwords } ],
98             # MetaTests => # core
99             # PodSyntaxTests => # core
100             # PodCoverageTests => # core
101             # 'Test::Version' =>
102              
103             # metadata
104             #MinimumPerl =>
105             [ GithubMeta => { remote => $self->git_remote } ],
106             #[ MetaNoIndex => {
107             # directory => [qw< t xt examples corpus >],
108             # package => [qw< DB >]
109             # }
110             #],
111             #[ 'MetaProvides::Package' => { meta_noindex => 1 } ],
112             [ 'MetaProvides::Class' => { inherit_version => 1 } ], # AFTER MetaNoIndex
113             #MetaYAML => # core
114             MetaJSON => # core
115              
116             # build system
117             ExecDir => # core
118             ShareDir => # core
119             MakeMaker => # core
120              
121             # manifest -- must come after all generated files
122             Manifest => # core
123              
124             # before release
125             [ 'Git::Check' => {
126             allow_dirty => [@dirty_files, @exclude_generated_files]
127             }
128             ],
129             CheckVersionIncrement =>
130             #CheckPrereqsIndexed =>
131             CheckChangesHasContent =>
132             #CheckExtraTests =>
133             TestRelease => # core
134             ConfirmRelease => # core
135              
136             # release
137             $self->fake_release
138             ? 'FakeRelease'
139             : 'UploadToCPAN', # core
140              
141             # after release
142             # Note -- NextRelease is here to get the ordering right with
143             # git actions. It is *also* a file munger that acts earlier.
144              
145             [ 'Git::Tag' => {
146             tag_format => $self->tag_format,
147             tag_message => 'version %v for CPAN',
148             }
149             ],
150             # bumps Changes
151             NextRelease => # core (also munges files)
152             # commit dirty Changes, dist.ini, README.pod
153             [ 'Git::Commit' =>
154             {
155             allow_dirty => [@dirty_files],
156             commit_msg => "packaging for CPAN: %v",
157             }
158             ],
159              
160             [ 'Git::Push' => { push_to => [@push_to] } ],
161              
162             );
163              
164 1         395 my @weaver_params = qw< repository_link >;
165 1         2 $self->_store_weaver_data({ map { $_ => $self->payload->{$_} } @weaver_params });
  1         26  
166              
167             }
168              
169 2     2   14521 }
170              
171             1;
172              
173             # ABSTRACT: Dist::Zilla configuration the way BAREFOOT does it
174             # COPYRIGHT
175              
176             __END__
177              
178             =pod
179              
180             =head1 NAME
181              
182             Dist::Zilla::PluginBundle::BAREFOOT - Dist::Zilla configuration the way BAREFOOT does it
183              
184             =head1 VERSION
185              
186             This document describes version 0.05_01 of Dist::Zilla::PluginBundle::BAREFOOT.
187              
188             =head1 SYNOPSIS
189              
190             # in dist.ini
191             [@BAREFOOT]
192              
193             =head1 DESCRIPTION
194              
195             This is a L<Dist::Zilla> PluginBundle. It is roughly equivalent to the following dist.ini:
196              
197             ; version provider
198             ; hopefully soemething here soon
199            
200             ; choose files to include
201             [GatherDir] ; everything under top dir
202             exclude_filename = README.pod ; skip this generated file
203             exclude_filename = META.json ; skip this generated file
204            
205             ;[PruneCruft] ; default stuff to skip
206             ;[ManifestSkip] ; if -f MANIFEST.SKIP, skip those, too
207            
208             ; this should probably be moved to metadata section
209             [AutoPrereqs] ; find prereqs from code
210             skip = ^t::lib
211            
212             ; file modifications
213             [OurPkgVersion] ; add $VERSION = ... to all files
214             ;[InsertCopyright ; add copyright at "# COPYRIGHT"
215             [PodWeaver] ; generate Pod
216             config_plugin = @BAREFOOT ; allows Pod::WikiDoc and a few other bits and bobs
217            
218             ; generated files
219             [License] ; boilerplate license
220             [ReadmeAnyFromPod] ; create README.pod in repo directory
221             type = pod
222             filename = README.pod
223             location = root
224            
225             ; should this be in metadata section?
226             [Bugtracker]
227             web = http://github.com/barefootcoder/%l/issues
228            
229             ; xt tests
230             ;[Test::PodSpelling] ; xt/author/pod-spell.t
231             ;[MetaTests] ; xt/release/meta-yaml.t
232             ;[PodSyntaxTests] ; xt/release/pod-syntax.t
233             ;[PodCoverageTests] ; xt/release/pod-coverage.t
234             ;[Test::Version] ; xt/release/test-version.t
235            
236             ; metadata
237             ;[MinimumPerl] ; determine minimum perl version
238             [GithubMeta]
239             remote = origin
240            
241             ;[MetaYAML] ; generate META.yml (v1.4)
242             [MetaJSON] ; generate META.json (v2)
243            
244             ;[MetaNoIndex] ; sets 'no_index' in META
245             ;directory = t
246             ;directory = xt
247             ;directory = examples
248             ;directory = corpus
249             ;package = DB ; just in case
250            
251             ; can't get this one to work right ATM
252             ; [MetaProvides::Package] ; add 'provides' to META files
253             ; meta_noindex = 1 ; respect prior no_index directives
254             [MetaProvides::Class] ; add 'provides' to META files for classes
255             inherit_version = 1 ; use version from dist.ini
256            
257             ; build system
258             [ExecDir] ; include 'bin/*' as executables
259             [ShareDir] ; include 'share/' for File::ShareDir
260             [MakeMaker] ; create Makefile.PL
261            
262             ; manifest (after all generated files)
263             [Manifest] ; create MANIFEST
264            
265             ; before release
266             [Git::Check] ; ensure all files checked in
267             allow_dirty = dist.ini
268             allow_dirty = Changes
269             allow_dirty = README.pod ; ignore this generated file
270             allow_dirty = META.json ; ignore this generated file
271            
272             ;[CheckPrereqsIndexed] ; ensure prereqs are on CPAN
273             [CheckVersionIncrement] ; ensure version has been bumped
274             [CheckChangesHasContent] ; ensure Changes has been updated
275             ;[CheckExtraTests] ; ensure xt/ tests pass
276             [TestRelease] ; ensure t/ tests pass
277             [ConfirmRelease] ; prompt before uploading
278            
279             ; releaser
280             [UploadToCPAN] ; uploads to CPAN
281            
282             ; after release
283             [Git::Tag] ; tag repo with custom tag
284             tag_format = v%v ; this one is overridable
285             tag_message = version %v for CPAN ; this one isn't
286            
287             ; NextRelease acts *during* pre-release to write $VERSION and
288             ; timestamp to Changes and *after* release to add a new {{$NEXT}}
289             ; section, so to act at the right time after release, it must come
290             ; after UploadToCPAN but before Git::Commit in the dist.ini. It
291             ; will still act during pre-release as usual.
292             [NextRelease]
293            
294             [Git::Commit] ; commit Changes (for new dev)
295            
296             [Git::Push] ; push repo to remote
297             push_to = origin
298              
299             =begin stopwords
300              
301              
302              
303              
304             =end stopwords
305              
306             =for Pod::Coverage configure mvp_multivalue_args
307              
308             =head1 USAGE
309              
310             To use this PluginBundle, just add it to your dist.ini. You can provide the following options:
311              
312             =over
313              
314             =item *
315              
316             C<<< auto_prereq >>> -- This indicates whether AutoPrereq should be used or not. Default is 1.
317              
318             =item *
319              
320             C<<< tag_format >>> -- Given to C<<< Git::Tag >>>. Default is 'v%v'.
321              
322             =item *
323              
324             C<<< version_regexp >>> -- Given to C<<< Git::NextVersion >>>. Default is '^v(.+)$'.
325              
326             =item *
327              
328             C<<< git_remote >>> -- Given to C<<< Git::Push >>> _in addition to_ origin; given to GithubMeta _instead of_
329             origin.
330              
331             =item *
332              
333             C<<< fake_release >>> -- Swaps FakeRelease for UploadToCPAN. Mostly useful for testing a dist.ini without
334             risking a real release.
335              
336             =item *
337              
338             C<<< stopwords >>> -- Add stopword for Test::PodSpelling (can be repeated).
339              
340             =item *
341              
342             C<<< no_spellcheck >>> -- Omit Test::PodSpelling tests.
343              
344             =item *
345              
346             C<<< repository_link >>> -- Override the Pod::Weaver L<Support> section default (which is "both").
347              
348             =back
349              
350             =head1 INSTALLATION
351              
352             If you want to make sure you have all the necessary prereqs, try this (from the dir you checked out
353             the distro into):
354              
355             perl -lne 'print $1 if /Dependencies/../VERSION/ and /use\s+(\S+)/' lib/*/*/PluginBundle/BAREFOOT.pm | cpanm -n
356              
357             =head1 SEE ALSO
358              
359             =over
360              
361             =item *
362              
363             L<Dist::Zilla>
364              
365             =item *
366              
367             L<Dist::Zilla::Plugin::PodWeaver>
368              
369             =back
370              
371             =for :stopwords cpan testmatrix url annocpan anno bugtracker rt cpants kwalitee diff irc mailto metadata placeholders metacpan
372              
373             =head1 SUPPORT
374              
375             =head2 Perldoc
376              
377             You can find documentation for this module with the perldoc command.
378              
379             perldoc Dist::Zilla::PluginBundle::BAREFOOT
380              
381             =head2 Bugs / Feature Requests
382              
383             This module is on GitHub. Feel free to fork and submit patches. Please note that I develop
384             via TDD (Test-Driven Development), so a patch that includes a failing test is much more
385             likely to get accepted (or least likely to get accepted more quickly).
386              
387             If you just want to report a problem or suggest a feature, that's okay too. You can create
388             an issue on GitHub here: L<http://github.com/barefootcoder/dist-zilla-pluginbundle-barefoot/issues>.
389              
390             =head2 Source Code
391              
392             none
393             L<https://github.com/barefootcoder/dist-zilla-pluginbundle-barefoot>
394              
395             git clone https://github.com/barefootcoder/dist-zilla-pluginbundle-barefoot.git
396              
397             =head1 AUTHOR
398              
399             Buddy Burden <barefoot@cpan.org>
400              
401             =head1 COPYRIGHT AND LICENSE
402              
403             This software is Copyright (c) 2016 by Buddy Burden.
404              
405             This is free software, licensed under:
406              
407             The Artistic License 2.0 (GPL Compatible)
408              
409             =cut