Dist/Zilla/PluginBundle/Author/DBOOK.pm

filter: Statementstmt 86.2% 50 / 58 Branchbran 54.1% 13 / 24 Conditioncond 41.6% 5 / 12 MC/DCmcdc 16.6% 1 / 6 Subroutinesub 100% 5 / 5 Podpod 0.0% 0 / 1 totaltotal 69.8% 74 / 106 CC 19 SCAR 32.9
CC
19
Cov
72%
configure
32.4
BEGIN
1.0
BEGIN
1.0
CRAP 26.9
↑ Summary auto/share/module/Dist-Zilla-MintingProfile-Author-DBOOK/default/Module.pm »
1 package Dist::Zilla::PluginBundle::Author::DBOOK;
2  
3 3 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 3 ▶use Scalar::Util 'blessed';
Subroutine BEGIN: called CC=1 SCAR=0.0
5 3 with 'Dist::Zilla::Role::PluginBundle::Easy',
6 'Dist::Zilla::Role::PluginBundle::Config::Slicer',
7 'Dist::Zilla::Role::PluginBundle::PluginRemover';
8 3 ▶use namespace::clean;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 3 ▶use Data::Section -setup;
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 3 our $VERSION = 'v1.0.10';
12  
13 2 ▶sub configure {
Subroutine configure: called CC=19 SCAR=34.8
Pod undocumented
14 2 my $self = shift;
15
16 2 my %accepted_installers = map { ($_ => 1) }
17 qw(MakeMaker MakeMaker::Awesome ModuleBuildTiny ModuleBuildTiny::Fallback);
18 2 ▶ my $installer = $self->payload->{installer} // 'MakeMaker';
Condition100%2/2
$self->payload->{"installer"} // "MakeMaker"
l!l
11
MC/DC100%1/1
$self->payload->{"installer"} // "MakeMaker"
$self->payload->{"installer"}
Truth table100%2/2
A
A= $self->payload->{"installer"}
Aresult
11
00
19 2 ▶ unless (exists $accepted_installers{$installer}) {
Branch: 1 branch
BranchTrueFalseTotal
unless (exists $accepted_installers{$installer}) 0 2 2
20 0 die "Invalid installer $installer. Possible installers: " .
21 join(', ', sort keys %accepted_installers) . "\n";
22 }
23 2 ▶ my $install_with_makemaker = ($installer =~ /^ModuleBuild/) ? 0 : 1;
Branch: 1 branch
BranchTrueFalseTotal
$installer =~ /^ModuleBuild/ ? : 1 1 2
24
25 2 ▶ my $user = $self->payload->{github_user} // 'Grinnz';
Condition50%1/2
$self->payload->{"github_user"} // "Grinnz"
l!l
02
MC/DC0%0/1
$self->payload->{"github_user"} // "Grinnz"
$self->payload->{"github_user"}
Truth table50%1/2
A
A= $self->payload->{"github_user"}
Aresult
11
00
26 2 my %githubmeta_config = (issues => 1);
27 2 ▶ $githubmeta_config{user} = $user if length $user;
Branch: 1 branch
BranchTrueFalseTotal
if length $user 2 0 2
28 2 $self->add_plugins([GithubMeta => \%githubmeta_config]);
29 2 $self->add_plugins([ReadmeAnyFromPod => 'Readme_Github' => { type => 'pod', filename => 'README.pod', location => 'root', phase => 'release' }]);
30 2 $self->add_plugins(['GenerateFile::FromShareDir' => 'Generate_Contrib' => { -filename => 'CONTRIBUTING.md', -source_filename => 'CONTRIBUTING.md.tmpl', -dist => 'Dist-Zilla-PluginBundle-Author-DBOOK' }]);
31 2 $self->add_plugins('MetaProvides::Package', 'Prereqs::FromCPANfile', 'PrereqsFile', 'Git::Contributors');
32 2 $self->add_plugins([MetaNoIndex => { directory => [ qw/t xt inc share eg examples/ ] }]);
33
34 2 ▶ my $irc = $self->payload->{irc} // '';
Condition50%1/2
$self->payload->{"irc"} // ""
l!l
02
MC/DC0%0/1
$self->payload->{"irc"} // ""
$self->payload->{"irc"}
Truth table50%1/2
A
A= $self->payload->{"irc"}
Aresult
11
00
35 2 ▶ if (length $irc) {
Branch: 1 branch
BranchTrueFalseTotal
if (length $irc) 0 2 2
36 0 $self->add_plugins([MetaResources => { x_IRC => $irc }]);
37 }
38 2 ▶ my $irc_channel = $self->payload->{irc_channel} // '';
Condition50%1/2
$self->payload->{"irc_channel"} // ""
l!l
02
MC/DC0%0/1
$self->payload->{"irc_channel"} // ""
$self->payload->{"irc_channel"}
Truth table50%1/2
A
A= $self->payload->{"irc_channel"}
Aresult
11
00
39 2 ▶ if (length $irc_channel) {
Branch: 1 branch
BranchTrueFalseTotal
if (length $irc_channel) 0 2 2
40 0 ▶ my $irc_network = $self->payload->{irc_network} // '';
Condition0%0/2
$self->payload->{"irc_network"} // ""
l!l
00
MC/DC0%0/1
$self->payload->{"irc_network"} // ""
$self->payload->{"irc_network"}
Truth table0%0/2
A
A= $self->payload->{"irc_network"}
Aresult
11
00
41 0 ▶ my $irc_host = $self->payload->{irc_host} // '';
Condition0%0/2
$self->payload->{"irc_host"} // ""
l!l
00
MC/DC0%0/1
$self->payload->{"irc_host"} // ""
$self->payload->{"irc_host"}
Truth table0%0/2
A
A= $self->payload->{"irc_host"}
Aresult
11
00
42 0 my %irc_config = (channel => $irc_channel);
43 0 ▶ $irc_config{network} = $irc_network if length $irc_network;
Branch: 1 branch
BranchTrueFalseTotal
if length $irc_network 0 0 0
44 0 ▶ $irc_config{host} = $irc_host if length $irc_host;
Branch: 1 branch
BranchTrueFalseTotal
if length $irc_host 0 0 0
45 0 $self->add_plugins([IRC => \%irc_config]);
46 }
47
48 2 my @from_build = qw(LICENSE CONTRIBUTING.md META.json);
49 2 ▶ push @from_build, $install_with_makemaker ? 'Makefile.PL' : 'Build.PL';
Branch: 1 branch
BranchTrueFalseTotal
$install_with_makemaker ? : 1 1 2
50 2 my @ignore_files = qw(Build.PL Makefile.PL);
51 2 my @dirty_files = qw(dist.ini Changes README.pod);
52
53 # @Git and versioning
54 2 $self->add_plugins(
55 'CheckChangesHasContent',
56 ['Git::Check' => { allow_dirty => \@dirty_files }],
57 'RewriteVersion',
58 [NextRelease => { format => '%-9v %{yyyy-MM-dd HH:mm:ss VVV}d%{ (TRIAL RELEASE)}T' }],
59 [CopyFilesFromRelease => { filename => \@from_build }],
60 ['Git::Commit' => { allow_dirty => [@dirty_files, @from_build], add_files_in => '/', commit_msg => '%v%n%n%c' }],
61 ['Git::Tag' => { tag_format => '%v', tag_message => '%v' }],
62 [BumpVersionAfterRelease => { munge_makefile_pl => 0, munge_build_pl => 0 }],
63 ['Git::Commit' => 'Commit_Version_Bump' => { allow_dirty_match => '^', commit_msg => 'Bump version' }],
64 'Git::Push');
65
66 # Pod tests
67 2 ▶ if ($self->payload->{pod_tests}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->payload->{"pod_tests"}) 2 0 2
68 2 $self->add_plugins('PodSyntaxTests');
69 2 ▶ $self->add_plugins('PodCoverageTests') unless $self->payload->{pod_tests} eq 'syntax';
Branch: 1 branch
BranchTrueFalseTotal
unless $self->payload->{"pod_tests"} eq "syntax" 2 0 2
70 }
71
72 # Report prereqs
73 2 ▶ my $version_extractor = $install_with_makemaker ? 'ExtUtils::MakeMaker' : 'Module::Metadata';
Branch: 1 branch
BranchTrueFalseTotal
$install_with_makemaker ? : 1 1 2
74 2 $self->add_plugins(['Test::ReportPrereqs' => { version_extractor => $version_extractor }]);
75
76 2 $self->add_plugins(
77 ['Git::GatherDir' => { exclude_filename => [@ignore_files, @from_build] }],
78 ['Regenerate::AfterReleasers' => { plugins => [$self->name . '/Readme_Github', $self->name . '/CopyFilesFromRelease'] }]);
79 # @Basic, with some modifications
80 2 $self->add_plugins(qw/PruneCruft ManifestSkip MetaYAML MetaJSON
81 License Readme::Brief ExecDir ShareDir/);
82 2 $self->add_plugins([ExecDir => 'ScriptDir' => { dir => 'script' }]);
83 2 $self->add_plugins($installer);
84 2 $self->add_plugins(qw/RunExtraTests Manifest TestRelease ConfirmRelease/);
85 2 ▶ $self->add_plugins($ENV{FAKE_RELEASE} ? 'FakeRelease' : 'UploadToCPAN');
Branch: 1 branch
BranchTrueFalseTotal
$ENV{'FAKE_RELEASE'} ? : 0 2 2
86 }
87  
88 3 __PACKAGE__->meta->make_immutable;
89 3 1;
90  
91 =head1 NAME
92  
93 Dist::Zilla::PluginBundle::Author::DBOOK - A plugin bundle for distributions
94 built by DBOOK
95  
96 =head1 SYNOPSIS
97  
98 [@Author::DBOOK]
99 pod_tests = 1
100 installer = MakeMaker::Awesome
101 MakeMaker::Awesome.test_file[] = t/*.t
102 Git::GatherDir.exclude_filename[0] = bad_file
103 Git::GatherDir.exclude_filename[1] = another_file
104  
105 =head1 DESCRIPTION
106  
107 This is the plugin bundle that DBOOK uses. It is equivalent to:
108  
109 [GithubMeta]
110 issues = 1
111 user = Grinnz
112
113 [ReadmeAnyFromPod / Readme_Github]
114 type = pod
115 filename = README.pod
116 location = root
117 phase = release
118
119 [GenerateFile::FromShareDir / Generate_Contrib]
120 -filename = CONTRIBUTING.md
121 -source_filename = CONTRIBUTING.md.tmpl
122 -dist = Dist-Zilla-PluginBundle-Author-DBOOK
123
124 [MetaProvides::Package]
125 [Prereqs::FromCPANfile]
126 [PrereqsFile]
127 [Git::Contributors]
128 [MetaNoIndex]
129 directory = t
130 directory = xt
131 directory = inc
132 directory = share
133 directory = eg
134 directory = examples
135
136 [CheckChangesHasContent]
137 [Git::Check]
138 allow_dirty = dist.ini
139 allow_dirty = Changes
140 allow_dirty = README.pod
141 [RewriteVersion]
142 [NextRelease]
143 format = %-9v %{yyyy-MM-dd HH:mm:ss VVV}d%{ (TRIAL RELEASE)}T
144 [CopyFilesFromRelease]
145 filename = LICENSE
146 filename = CONTRIBUTING.md
147 filename = META.json
148 filename = Makefile.PL
149 [Git::Commit]
150 add_files_in = /
151 allow_dirty = dist.ini
152 allow_dirty = Changes
153 allow_dirty = README.pod
154 allow_dirty = LICENSE
155 allow_dirty = CONTRIBUTING.md
156 allow_dirty = META.json
157 allow_dirty = Makefile.PL
158 commit_msg = %v%n%n%c
159 [Git::Tag]
160 tag_format = %v
161 tag_message = %v
162 [BumpVersionAfterRelease]
163 munge_makefile_pl = 0
164 munge_build_pl = 0
165 [Git::Commit / Commit_Version_Bump]
166 allow_dirty_match = ^
167 commit_msg = Bump version
168 [Git::Push]
169
170 [Test::ReportPrereqs]
171 [Git::GatherDir]
172 exclude_filename = LICENSE
173 exclude_filename = CONTRIBUTING.md
174 exclude_filename = META.json
175 exclude_filename = Makefile.PL
176 exclude_filename = Build.PL
177 [Regenerate::AfterReleasers]
178 plugin = Readme_Github
179 plugin = CopyFilesFromRelease
180 [PruneCruft]
181 [ManifestSkip]
182 [MetaYAML]
183 [MetaJSON]
184 [License]
185 [Readme::Brief]
186 [ExecDir]
187 [ExecDir / ScriptDir]
188 dir = script
189 [ShareDir]
190 [MakeMaker]
191 [RunExtraTests]
192 [Manifest]
193 [TestRelease]
194 [ConfirmRelease]
195 [UploadToCPAN]
196  
197 This bundle assumes that your git repo has the following: a L<cpanfile>,
198 F<prereqs.json>, or F<prereqs.yml> with the dist's prereqs, a F<Changes>
199 populated for the current version (see L<Dist::Zilla::Plugin::NextRelease>),
200 and a F<.gitignore> including C</Name-Of-Dist-*> but not
201 C<Makefile.PL>/C<Build.PL> or C<META.json>.
202  
203 To faciliate building the distribution for testing or installation without
204 L<Dist::Zilla>, and provide important information about the distribution in
205 the repository, several files can be copied to the repository from the build
206 by running L<dzil regenerate|Dist::Zilla::App::Command::regenerate>, and are
207 copied and committed automatically on release. These files are:
208 C<CONTRIBUTING.md>, C<LICENSE>, C<Makefile.PL>/C<Build.PL>, and
209 C<META.json>. The file C<README.pod> will also be generated in the repository
210 (but not the build) by C<dzil regenerate> and C<dzil release>.
211  
212 To test releasing, set the env var C<FAKE_RELEASE=1> to run everything except
213 the upload to CPAN.
214  
215 $ FAKE_RELEASE=1 dzil release
216  
217 =head1 OPTIONS
218  
219 This bundle composes the L<Dist::Zilla::Role::PluginBundle::Config::Slicer>
220 role, so options for any included plugin may be specified in that format. It
221 also composes L<Dist::Zilla::Role::PluginBundle::PluginRemover> so that plugins
222 may be removed. Additionally, the following options are provided.
223  
224 =head2 github_user
225  
226 github_user = gitster
227  
228 Set the user whose repository should be linked in metadata. Defaults to
229 C<Grinnz>, change this when the main repository is elsewhere. Set to an empty
230 string value to use the GitHub remote URL as found in the local repository, as
231 L<Dist::Zilla::Plugin::GithubMeta> does by default.
232  
233 =head2 installer
234  
235 installer = MakeMaker::Awesome
236 MakeMaker::Awesome.WriteMakefile_arg[] = (clean => { FILES => 'autogen.dat' })
237 MakeMaker::Awesome.delimiter = |
238 MakeMaker::Awesome.footer[00] = |{
239 MakeMaker::Awesome.footer[01] = | ...
240 MakeMaker::Awesome.footer[20] = |}
241  
242 installer = ModuleBuildTiny
243 ModuleBuildTiny.version_method = installed
244  
245 Set the installer plugin to use. Allowed installers are
246 L<MakeMaker|Dist::Zilla::Plugin::MakeMaker>,
247 L<MakeMaker::Awesome|Dist::Zilla::Plugin::MakeMaker::Awesome>,
248 L<ModuleBuildTiny|Dist::Zilla::Plugin::ModuleBuildTiny>, and
249 L<ModuleBuildTiny::Fallback|Dist::Zilla::Plugin::ModuleBuildTiny::Fallback>.
250 The default is C<MakeMaker>. Options for the selected installer can be
251 specified using config slicing.
252  
253 =head2 irc
254  
255 irc = irc://irc.perl.org/#distzilla
256  
257 Set the x_IRC resource metadata using L<Dist::Zilla::Plugin::MetaResources>.
258 Deprecated; use L</"irc_channel">.
259  
260 =head2 irc_channel
261  
262 irc_channel = distzilla
263  
264 Set the channel for IRC resource metadata using L<Dist::Zilla::Plugin::IRC>.
265  
266 =head2 irc_network
267  
268 irc_network = perl
269  
270 Set the network for IRC resource metadata using L<Dist::Zilla::Plugin::IRC>.
271  
272 =head2 irc_host
273  
274 irc_host = irc.perl.org
275  
276 Set the host for IRC resource metadata using L<Dist::Zilla::Plugin::IRC>.
277 Only for IRC hosts that cannot be set via L</"irc_network">.
278  
279 =head2 pod_tests
280  
281 pod_tests = 1
282  
283 Set to a true value to add L<Dist::Zilla::Plugin::PodSyntaxTests> and
284 L<Dist::Zilla::Plugin::PodCoverageTests>. Set to C<syntax> to only add the
285 syntax tests.
286  
287 =head1 BUGS
288  
289 Report any issues on the public bugtracker.
290  
291 =head1 AUTHOR
292  
293 Dan Book, C<book.d.wit@proton.me>
294  
295 =head1 COPYRIGHT AND LICENSE
296  
297 Copyright 2015, Dan Book.
298  
299 This library is free software; you may redistribute it and/or modify it under
300 the terms of the Artistic License version 2.0.
301  
302 =head1 SEE ALSO
303  
304 L<Dist::Zilla>, L<cpanfile>, L<Dist::Zilla::MintingProfile::Author::DBOOK>
↑ Summary auto/share/module/Dist-Zilla-MintingProfile-Author-DBOOK/default/Module.pm »