File Coverage

blib/lib/Dist/Zilla/PluginBundle/BAREFOOT.pm
Criterion Covered Total %
statement 109 109 100.0
branch 2 4 50.0
condition n/a
subroutine 38 38 100.0
pod 0 1 0.0
total 149 152 98.0


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