File Coverage

blib/lib/Dist/Zilla/PluginBundle/BioPerl.pm
Criterion Covered Total %
statement 31 31 100.0
branch n/a
condition 1 3 33.3
subroutine 8 8 100.0
pod 0 2 0.0
total 40 44 90.9


line stmt bran cond sub pod time code
1             package Dist::Zilla::PluginBundle::BioPerl;
2             $Dist::Zilla::PluginBundle::BioPerl::VERSION = '0.26';
3 1     1   2912075 use utf8;
  1         3  
  1         8  
4              
5             # ABSTRACT: Build your distributions like Bioperl does
6             # AUTHOR: Florian Ragwitz <rafl@debian.org>
7             # AUTHOR: Sheena Scroggins
8             # AUTHOR: Carnë Draug <carandraug+dev@gmail.com>
9             # AUTHOR: Chris Fields <cjfields1@gmail.com>
10             # OWNER: 2010 Florian Ragwitz
11             # OWNER: 2011 Sheena Scroggins
12             # OWNER: 2013-2017 Carnë Draug
13             # LICENSE: Perl_5
14              
15 1     1   49 use Moose 1.00;
  1         27  
  1         10  
16 1     1   10161 use MooseX::AttributeShortcuts;
  1         255323  
  1         4  
17 1     1   48684 use MooseX::Types::Email qw(EmailAddress);
  1         188627  
  1         14  
18 1     1   1619 use MooseX::Types::Moose qw(ArrayRef Bool Str);
  1         5  
  1         8  
19 1     1   5038 use namespace::autoclean;
  1         3  
  1         8  
20              
21             with qw(
22             Dist::Zilla::Role::PluginBundle::Easy
23             Dist::Zilla::Role::PluginBundle::PluginRemover
24             Dist::Zilla::Role::PluginBundle::Config::Slicer
25             );
26              
27              
28              
29             sub get_value {
30 6     6 0 14 my ($self, $accessor) = @_;
31 6         29 my %defaults = (
32             'homepage' => 'https://metacpan.org/release/%{dist}',
33             'repository.github' => 'user:bioperl',
34             'bugtracker.github' => 'user:bioperl',
35             'bugtracker.mailto' => 'bioperl-l@bioperl.org',
36             'trailing_whitespace' => 1,
37             'allow_dirty' => ['Changes', 'dist.ini'],
38             );
39 6   33     142 return $self->payload->{$accessor} || $defaults{$accessor};
40             }
41              
42             has homepage => (
43             is => 'lazy',
44             isa => Str,
45             default => sub { shift->get_value('homepage') }
46             );
47              
48             has repository_github => (
49             is => 'lazy',
50             isa => Str,
51             default => sub { shift->get_value('repository.github') }
52             );
53              
54             has bugtracker_github => (
55             is => 'lazy',
56             isa => Str,
57             default => sub { shift->get_value('bugtracker.github') }
58             );
59              
60             has bugtracker_mailto => (
61             is => 'lazy',
62             isa => EmailAddress,
63             default => sub { shift->get_value('bugtracker.mailto') }
64             );
65              
66             has trailing_whitespace => (
67             is => 'lazy',
68             isa => Bool,
69             default => sub { shift->get_value('trailing_whitespace') }
70             );
71              
72              
73             sub mvp_multivalue_args { qw( allow_dirty ) }
74             has allow_dirty => (
75             is => 'lazy',
76             isa => ArrayRef,
77             default => sub { shift->get_value('allow_dirty') }
78             );
79              
80              
81             sub configure {
82 1     1 0 6 my $self = shift;
83              
84 1         9 $self->add_bundle('@Filter' => {
85             '-bundle' => '@Basic',
86             '-remove' => ['Readme'],
87             });
88              
89 1         67157 $self->add_plugins(qw(
90             MetaConfig
91             MetaJSON
92             PkgVersion
93             PodSyntaxTests
94             Test::NoTabs
95             Test::Compile
96             PodCoverageTests
97             MojibakeTests
98             AutoPrereqs
99             ));
100              
101 1         256 my @allow_dirty;
102 1         3 foreach (@{$self->allow_dirty}) {
  1         33  
103 2         6 push (@allow_dirty, 'allow_dirty', $_);
104             }
105              
106             $self->add_plugins(
107 1         32 [AutoMetaResources => [
108             'repository.github' => $self->repository_github,
109             'homepage' => $self->homepage,
110             'bugtracker.github' => $self->bugtracker_github,
111             ]],
112             [MetaResources => [
113             'bugtracker.mailto' => $self->bugtracker_mailto,
114             ]],
115             ['Test::EOL' => {
116             trailing_whitespace => $self->trailing_whitespace,
117             }],
118             [Encoding => [
119             'encoding' => 'bytes',
120             'match' => '^t/data/',
121             ]],
122             [PodWeaver => {
123             config_plugin => '@BioPerl',
124             }],
125             );
126              
127 1         248 $self->add_plugins(qw(
128             NextRelease
129             ));
130              
131 1         143 $self->add_plugins(
132             ['Git::Check' => [
133             @allow_dirty,
134             ]],
135             ['Git::Commit' => [
136             @allow_dirty,
137             ]],
138             ['Git::Tag' => [
139             tag_format => '%N-v%v',
140             tag_message => '%N-v%v',
141             ]],
142             );
143             }
144              
145             __PACKAGE__->meta->make_immutable;
146             1;
147              
148             __END__
149              
150             =pod
151              
152             =encoding UTF-8
153              
154             =head1 NAME
155              
156             Dist::Zilla::PluginBundle::BioPerl - Build your distributions like Bioperl does
157              
158             =head1 VERSION
159              
160             version 0.26
161              
162             =head1 SYNOPSIS
163              
164             # dist.ini
165             name = Dist-Zilla-Plugin-BioPerl
166             ...
167              
168             [@BioPerl]
169              
170             =head1 DESCRIPTION
171              
172             This is the L<Dist::Zilla> configuration for the BioPerl project. It is roughly
173             equivalent to:
174              
175             [@Filter]
176             -bundle = @Basic ; the basic to maintain and release CPAN distros
177             -remove = Readme ; avoid conflict since we already have a README file
178              
179             [MetaConfig] ; summarize Dist::Zilla configuration on distribution
180             [MetaJSON] ; produce a META.json
181             [PkgVersion] ; add a $version to the modules
182             [PodSyntaxTests] ; create a release test for Pod syntax
183             [Test::NoTabs] ; create a release tests making sure hard tabs aren't used
184             [Test::Compile] ; test syntax of all modules
185             [PodCoverageTests] ; create release test for Pod coverage
186             [MojibakeTests] ; create release test for correct encoding
187             [AutoPrereqs] ; automatically find the dependencies
188              
189             [AutoMetaResources] ; automatically fill resources fields on metadata
190             repository.github = user:bioperl
191             bugtracker.github = user:bioperl
192             homepage = https://metacpan.org/release/${dist}
193              
194             [MetaResources] ; fill resources fields on metadata
195             bugtracker.mailto = bioperl-l@bioperl.org
196              
197             [Test::EOL] ; create release tests for correct line endings
198             trailing_whitespace = 1
199              
200             ;; While data files for the test units are often text files, they
201             ;; need to be treated as bytes. This has the side effect of having
202             ;; them ignored by [Test::NoTabs] and [Test::EOL]
203             [Encoding]
204             encoding = bytes
205             match = ^t/data/
206              
207             [PodWeaver]
208             config_plugin = @BioPerl
209              
210             [NextRelease] ; update release number on Changes file
211             [Git::Check] ; check working path for any uncommitted stuff
212             allow_dirty = Changes
213             allow_dirty = dist.ini
214             [Git::Commit] ; commit the dzil-generated stuff
215             allow_dirty = Changes
216             allow_dirty = dist.ini
217             [Git::Tag] ; tag our new release
218             tag_format = %N-v%v
219             tag_message = %N-v%v
220              
221             In addition, this also has two roles, L<Dist::Zilla::PluginBundle::PluginRemover> and
222             Dist::Zilla::PluginBundle::Config::Slice, so one could do something like this for
223             problematic distributions:
224              
225             [@BioPerl]
226             -remove = MojibakeTests
227             -remove = PodSyntaxTests
228              
229             =head1 Pushing releases
230              
231             With this PluginBundle, there's a lot of things happening
232             automatically. It might not be clear what actually needs to be done
233             and what will be done automatically unless you are already familiar
234             with all the plugins being used. Assuming that F<Changes> is up
235             to date (you should be updating F<Changes> as the changes are made
236             and not when preparing a release. If you need to add notes to that
237             file, then do it do it at the same time you bump the version number in
238             F<dist.ini>), the following steps will make a release:
239              
240             =over 4
241              
242             =item 1
243              
244             Make sure the working directory is clean with `git status'.
245              
246             =item 2
247              
248             Run `dzil test --all'
249              
250             =item 3
251              
252             Edit dist.ini to bump the version number only.
253              
254             =item 4
255              
256             Run `dzil release'
257              
258             =item 5
259              
260             Run `git push --tags'
261              
262             =back
263              
264             These steps will automatically do the following:
265              
266             =over 4
267              
268             =item *
269              
270             Modify F<Changes> with the version number and time of release.
271              
272             =item *
273              
274             Make a git commit with the changes to F<Changes> and F<dist.ini> using a standard commit message.
275              
276             =item *
277              
278             Add a lightweight git tag for the release.
279              
280             =item *
281              
282             Run the tests (including a series of new tests for maintainers only) and push release to CPAN.
283              
284             =back
285              
286             =head1 CONFIGURATION
287              
288             Use the L<Dist::Zilla::PluginBundle::Filter> to filter any undesired plugin
289             that is part of the default set. This also allows to change those plugins
290             default values. However, the BioPerl bundle already recognizes some of the
291             plugins options and will pass it to the corresponding plugin. If any is missing,
292             please consider patching this bundle.
293              
294             In some cases, this bundle will also perform some sanity checks before passing
295             the value to the original plugin.
296              
297             =over 4
298              
299             =item *
300              
301             homepage
302              
303             Same option used by the L<Dist::Zilla::Plugin::AutoMetaResources>
304              
305             =item *
306              
307             repository.github
308              
309             Same option used by the L<Dist::Zilla::Plugin::AutoMetaResources>
310              
311             =item *
312              
313             bugtracker.github
314              
315             Same option used by the L<Dist::Zilla::Plugin::AutoMetaResources>
316              
317             =item *
318              
319             bugtracker.mailto
320              
321             Same option used by the L<Dist::Zilla::Plugin::MetaResources>
322              
323             =item *
324              
325             trailing_whitespace
326              
327             Same option used by the L<Dist::Zilla::Plugin::EOLTests>
328              
329             =item *
330              
331             allow_dirty
332              
333             Same option used by the L<Dist::Zilla::Plugin::Git::Commit> and
334             L<Dist::Zilla::Plugin::Git::Check>
335              
336             =back
337              
338             =for Pod::Coverage get_value
339              
340             =for Pod::Coverage mvp_multivalue_args
341              
342             =for Pod::Coverage configure
343              
344             =head1 FEEDBACK
345              
346             =head2 Mailing lists
347              
348             User feedback is an integral part of the evolution of this and other
349             Bioperl modules. Send your comments and suggestions preferably to
350             the Bioperl mailing list. Your participation is much appreciated.
351              
352             bioperl-l@bioperl.org - General discussion
353             http://bioperl.org/Support.html - About the mailing lists
354              
355             =head2 Support
356              
357             Please direct usage questions or support issues to the mailing list:
358             I<bioperl-l@bioperl.org>
359              
360             rather than to the module maintainer directly. Many experienced and
361             reponsive experts will be able look at the problem and quickly
362             address it. Please include a thorough description of the problem
363             with code and data examples if at all possible.
364              
365             =head2 Reporting bugs
366              
367             Report bugs to the Bioperl bug tracking system to help us keep track
368             of the bugs and their resolution. Bug reports can be submitted via the
369             web:
370              
371             https://github.com/bioperl/dist-zilla-pluginbundle-bioperl/issues
372              
373             =head1 AUTHORS
374              
375             Florian Ragwitz <rafl@debian.org>
376              
377             Sheena Scroggins
378              
379             Carnë Draug <carandraug+dev@gmail.com>
380              
381             Chris Fields <cjfields1@gmail.com>
382              
383             =head1 COPYRIGHT
384              
385             This software is copyright (c) 2010 by Florian Ragwitz, 2011 by Sheena Scroggins, and 2013-2017 by Carnë Draug.
386              
387             This software is available under the same terms as the perl 5 programming language system itself.
388              
389             =cut