Dist-Zilla-PluginBundle-LOGIE-0.03/lib/Dist/Zilla/PluginBundle/LOGIE.pm

filter: Statementstmt 39.5% 32 / 81 Branchbran 0.0% 0 / 22 Conditioncond 0.0% 0 / 4 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 23.5% 4 / 17 Podpod 0.0% 0 / 1 totaltotal 28.3% 36 / 127 CC 16 SCAR 31.0
CC
16
Cov
30%
__ANON__
72.0
_repository_data
12.0
__ANON__
12.0
CRAP 22.2
« Dist-Zilla-PluginBundle-LOGIE-0.02/lib/Dist/Zilla/PluginBundle/LOGIE.pm ↑ Summary blib/lib/Dist/Zilla/PluginBundle/Author/LOGIE.pm »
1 package Dist::Zilla::PluginBundle::LOGIE;
2 1 ▶BEGIN {
Subroutine BEGIN: called CC=1 SCAR=0.0
3 1 $Dist::Zilla::PluginBundle::LOGIE::AUTHORITY = 'cpan:LOGIE';
4 }
5 {
6 1 $Dist::Zilla::PluginBundle::LOGIE::VERSION = '0.03';
7 }
8 1 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 # ABSTRACT: Dist::Zilla plugins for me
10  
11 1 ▶use Dist::Zilla;
Subroutine BEGIN: called CC=1 SCAR=0.0
12 1 with 'Dist::Zilla::Role::PluginBundle::Easy';
13  
14  
15 1 has dist => (
16 is => 'ro',
17 isa => 'Str',
18 required => 1,
19 );
20  
21 1 has authority => (
22 is => 'ro',
23 isa => 'Str',
24 default => 'cpan:LOGIE',
25 );
26  
27 1 has github_user => (
28 is => 'ro',
29 isa => 'Str',
30 default => 'logie17',
31 );
32  
33 has github_name => (
34 is => 'ro',
35 isa => 'Str',
36 lazy => 1,
37 0 ▶ default => sub { lc $_[0]->dist },
Subroutine __ANON__: not called CC=1 SCAR=6.9
38 1 );
39  
40 1 has repository => (
41 is => 'ro',
42 isa => 'Str',
43 );
44  
45 1 for my $attr (qw(repository_type repository_url repository_web)) {
46 has $attr => (
47 is => 'ro',
48 isa => 'Maybe[Str]',
49 lazy => 1,
50 0 ▶ default => sub {
Subroutine __ANON__: not called CC=2 SCAR=17.9
51 0 my $self = shift;
52 0 my $data = $self->_repository_data;
53 0 ▶ return unless $data;
Branch: 1 branch
BranchTrueFalseTotal
unless $data 0 0 0
54 0 return $data->{$attr};
55 },
56 3 );
57 }
58  
59 0 ▶sub _repository_data {
Subroutine _repository_data: not called CC=3 SCAR=24.8
60 0 my $self = shift;
61  
62 0 my $host = $self->repository;
63 0 ▶ return unless defined $host;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $host 0 0 0
64  
65 die "Unknown repository host $host"
66 0 ▶ unless exists $self->_repository_host_map->{$host};
Branch: 1 branch
BranchTrueFalseTotal
unless exists $self->_repository_host_map->{$host} 0 0 0
67  
68 0 return $self->_repository_host_map->{$host};
69 }
70  
71 has _repository_host_map => (
72 is => 'ro',
73 isa => 'HashRef[HashRef[Str]]',
74 lazy => 1,
75 0 ▶ default => sub {
Subroutine __ANON__: not called CC=1 SCAR=6.9
76 0 my $self = shift;
77 return {
78 0 'github' => {
79 repository_type => 'git',
80 repository_url => sprintf('git://github.com/%s/%s.git', $self->github_user, $self->github_name),
81 repository_web => sprintf('https://github.com/%s/%s', $self->github_user, $self->github_name),
82 },
83 }
84 },
85 1 );
86  
87 has bugtracker_web => (
88 is => 'ro',
89 isa => 'Str',
90 lazy => 1,
91 0 ▶ default => sub {
Subroutine __ANON__: not called CC=1 SCAR=6.9
92 0 sprintf('http://rt.cpan.org/Public/Dist/Display.html?Name=%s',
93 shift->dist);
94 },
95 1 );
96  
97 has bugtracker_mailto => (
98 is => 'ro',
99 isa => 'Str',
100 lazy => 1,
101 0 ▶ default => sub { sprintf('bug-%s@rt.cpan.org', lc shift->dist); },
Subroutine __ANON__: not called CC=1 SCAR=6.9
102 1 );
103  
104 has homepage => (
105 is => 'ro',
106 isa => 'Str',
107 lazy => 1,
108 0 ▶ default => sub { sprintf('http://metacpan.org/release/%s', shift->dist) },
Subroutine __ANON__: not called CC=1 SCAR=6.9
109 1 );
110  
111 1 has dynamic_config => (
112 is => 'ro',
113 isa => 'Str',
114 );
115  
116 has is_task => (
117 is => 'ro',
118 isa => 'Bool',
119 lazy => 1,
120 0 ▶ default => sub { shift->dist =~ /^Task-/ ? 1 : 0 },
Subroutine __ANON__: not called CC=2 SCAR=17.9
Branch: 1 branch
BranchTrueFalseTotal
(shift())->dist =~ /^Task-/ ? : 0 0 0
121 1 );
122  
123 has is_test_dist => (
124 is => 'ro',
125 isa => 'Bool',
126 lazy => 1,
127 0 ▶ default => sub {
Subroutine __ANON__: not called CC=2 SCAR=17.9
128 0 my $self = shift;
129 0 ▶ return 1 if $ENV{DZIL_FAKE_RELEASE};
Branch: 1 branch
BranchTrueFalseTotal
if $ENV{"DZIL_FAKE_RELEASE"} 0 0 0
130 },
131 1 );
132  
133 1 has git_remote => (
134 is => 'ro',
135 isa => 'Str',
136 );
137  
138 has _plugins => (
139 is => 'ro',
140 isa => 'ArrayRef[Str]',
141 lazy => 1,
142 0 ▶ default => sub {
Subroutine __ANON__: not called CC=3 SCAR=24.8
143 0 my $self = shift;
144 [
145 0 ▶ qw(
Branch: 2 branches
BranchTrueFalseTotal
$self->is_task ? : 0 0 0
$self->is_test_dist ? : 0 0 0
146 GatherDir
147 PruneCruft
148 ManifestSkip
149 MetaYAML
150 License
151 Readme
152 ExtraTests
153 ExecDir
154 ShareDir
155 MakeMaker
156 Manifest
157 TestRelease
158 ConfirmRelease
159 MetaConfig
160 MetaJSON
161 NextRelease
162 CheckChangesHasContent
163 PkgVersion
164 Authority
165 PodCoverageTests
166 PodSyntaxTests
167 NoTabsTests
168 EOLTests
169 Test::Compile
170 Metadata
171 MetaResources
172 Git::Check
173 Git::Commit
174 Git::Tag
175 Git::NextVersion
176 ),
177 ($self->is_task ? 'TaskWeaver' : 'PodWeaver'),
178 ($self->is_test_dist ? 'FakeRelease' : 'UploadToCPAN'),
179 qw(
180 Twitter
181 ),
182 ]
183 },
184 1 );
185  
186 has plugin_options => (
187 is => 'ro',
188 isa => 'HashRef[HashRef[Str]]',
189 init_arg => undef,
190 lazy => 1,
191 0 ▶ default => sub {
Subroutine __ANON__: not called CC=8 SCAR=42.8
192 0 my $self = shift;
193 0 my %opts = (
194 'NextRelease' => { format => '%-5v %{yyyy-MM-dd}d' },
195 'Authority' => { authority => $self->authority },
196 'Git::Check' => { allow_dirty => '' },
197 'Git::Tag' => { tag_format => '%v', tag_message => '' },
198 'Git::NextVersion' => {
199 version_regexp => '^(\d+\.\d+)$',
200 first_version => '0.01'
201 },
202 'Git::Commit' => {
203 commit_msg => 'changelog',
204 },
205 );
206  
207 $opts{Metadata} = {
208 0 ▶ dynamic_config => 1,
Branch: 1 branch
BranchTrueFalseTotal
if $self->dynamic_config 0 0 0
209 } if $self->dynamic_config;
210  
211 0 for my $metaresource (qw(repository.type repository.url repository.web bugtracker.web bugtracker.mailto homepage)) {
212 0 (my $method = $metaresource) =~ s/\./_/g;
213 0 my $value = $self->$method;
214 0 ▶ if (!$value) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($value) 0 0 0
215 0 warn "*** resources.$metaresource is not configured! This needs to be fixed! ***";
216 0 next;
217 }
218 0 $opts{MetaResources}{$metaresource} = $value;
219 }
220 0 ▶ delete $opts{MetaResources}{'repository.type'} unless exists $opts{MetaResources}{'repository.url'};
Branch: 1 branch
BranchTrueFalseTotal
unless exists $opts{"MetaResources"}{"repository.url"} 0 0 0
221  
222 0 for my $option (keys %{ $self->payload }) {
223 0 ▶ next unless $option =~ /^([A-Z][^_]*)_(.+)$/;
Branch: 1 branch
BranchTrueFalseTotal
unless $option =~ /^([A-Z][^_]*)_(.+)$/ 0 0 0
224 0 my ($plugin, $plugin_option) = ($1, $2);
225 0 ▶ $opts{$plugin} ||= {};
Condition0%0/2
$opts{$plugin} ||= {}
l!l
00
MC/DC0%0/1
$opts{$plugin} ||= {}
$opts{$plugin}
Truth table0%0/2
A
A= $opts{$plugin}
Aresult
11
00
226 0 $opts{$plugin}->{$plugin_option} = $self->payload->{$option};
227 }
228  
229 0 return \%opts;
230 },
231 1 );
232  
233 0 ▶around BUILDARGS => sub {
Subroutine __ANON__: not called CC=1 SCAR=6.9
234 0 my $orig = shift;
235 0 my $class = shift;
236 0 my $args = $class->$orig(@_);
237 0 return { %{ $args->{payload} }, %{ $args } };
238 1 };
239  
240 0 ▶sub configure {
Subroutine configure: not called CC=2 SCAR=17.9
Pod undocumented
241 0 my $self = shift;
242  
243 0 $self->add_plugins(
244 [ 'Prereqs' => 'TestMoreDoneTesting' => {
245 -phase => 'test',
246 -type => 'requires',
247 'Test::Most' => '0',
248 } ]
249 );
250 $self->add_plugins(
251 0 ▶ map { [ $_ => ($self->plugin_options->{$_} || {}) ] }
Condition0%0/2
$self->plugin_options->{$_} || {}
l!l
00
MC/DC0%0/1
$self->plugin_options->{$_} || {}
$self->plugin_options->{$_}
Truth table0%0/2
A
A= $self->plugin_options->{$_}
Aresult
11
00
252 0 @{ $self->_plugins },
253 );
254 }
255  
256  
257 1 __PACKAGE__->meta->make_immutable;
258 1 ▶no Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
259  
260 __END__
« Dist-Zilla-PluginBundle-LOGIE-0.02/lib/Dist/Zilla/PluginBundle/LOGIE.pm ↑ Summary blib/lib/Dist/Zilla/PluginBundle/Author/LOGIE.pm »