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

filter: Statementstmt 39.0% 32 / 82 Branchbran 0.0% 0 / 24 Conditioncond 0.0% 0 / 4 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 23.5% 4 / 17 Podpod 0.0% 0 / 1 totaltotal 27.6% 36 / 130 CC 17 SCAR 31.0
CC
17
Cov
29%
__ANON__
72.0
_repository_data
12.0
__ANON__
12.0
CRAP 22.3
« Dist-Zilla-PluginBundle-LOGIE-0.01/lib/Dist/Zilla/PluginBundle/LOGIE.pm ↑ Summary Dist-Zilla-PluginBundle-LOGIE-0.03/lib/Dist/Zilla/PluginBundle/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.02';
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=3 SCAR=24.8
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 0 ▶ return $self->dist =~ /^Foo-/ ? 1 : 0
Branch: 1 branch
BranchTrueFalseTotal
$self->dist =~ /^Foo-/ ? : 0 0 0
131 },
132 1 );
133  
134 1 has git_remote => (
135 is => 'ro',
136 isa => 'Str',
137 );
138  
139 has _plugins => (
140 is => 'ro',
141 isa => 'ArrayRef[Str]',
142 lazy => 1,
143 0 ▶ default => sub {
Subroutine __ANON__: not called CC=3 SCAR=24.8
144 0 my $self = shift;
145 [
146 0 ▶ qw(
Branch: 2 branches
BranchTrueFalseTotal
$self->is_task ? : 0 0 0
$self->is_test_dist ? : 0 0 0
147 GatherDir
148 PruneCruft
149 ManifestSkip
150 MetaYAML
151 License
152 Readme
153 ExtraTests
154 ExecDir
155 ShareDir
156 MakeMaker
157 Manifest
158 TestRelease
159 ConfirmRelease
160 MetaConfig
161 MetaJSON
162 NextRelease
163 CheckChangesHasContent
164 PkgVersion
165 Authority
166 PodCoverageTests
167 PodSyntaxTests
168 NoTabsTests
169 EOLTests
170 Test::Compile
171 Metadata
172 MetaResources
173 Git::Check
174 Git::Commit
175 Git::Tag
176 Git::NextVersion
177 ),
178 ($self->is_task ? 'TaskWeaver' : 'PodWeaver'),
179 ($self->is_test_dist ? 'FakeRelease' : 'UploadToCPAN'),
180 qw(
181 Twitter
182 ),
183 ]
184 },
185 1 );
186  
187 has plugin_options => (
188 is => 'ro',
189 isa => 'HashRef[HashRef[Str]]',
190 init_arg => undef,
191 lazy => 1,
192 0 ▶ default => sub {
Subroutine __ANON__: not called CC=8 SCAR=42.8
193 0 my $self = shift;
194 0 my %opts = (
195 'NextRelease' => { format => '%-5v %{yyyy-MM-dd}d' },
196 'Authority' => { authority => $self->authority },
197 'Git::Check' => { allow_dirty => '' },
198 'Git::Tag' => { tag_format => '%v', tag_message => '' },
199 'Git::NextVersion' => {
200 version_regexp => '^(\d+\.\d+)$',
201 first_version => '0.01'
202 },
203 'Git::Commit' => {
204 commit_msg => 'changelog',
205 },
206 );
207  
208 $opts{Metadata} = {
209 0 ▶ dynamic_config => 1,
Branch: 1 branch
BranchTrueFalseTotal
if $self->dynamic_config 0 0 0
210 } if $self->dynamic_config;
211  
212 0 for my $metaresource (qw(repository.type repository.url repository.web bugtracker.web bugtracker.mailto homepage)) {
213 0 (my $method = $metaresource) =~ s/\./_/g;
214 0 my $value = $self->$method;
215 0 ▶ if (!$value) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($value) 0 0 0
216 0 warn "*** resources.$metaresource is not configured! This needs to be fixed! ***";
217 0 next;
218 }
219 0 $opts{MetaResources}{$metaresource} = $value;
220 }
221 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
222  
223 0 for my $option (keys %{ $self->payload }) {
224 0 ▶ next unless $option =~ /^([A-Z][^_]*)_(.+)$/;
Branch: 1 branch
BranchTrueFalseTotal
unless $option =~ /^([A-Z][^_]*)_(.+)$/ 0 0 0
225 0 my ($plugin, $plugin_option) = ($1, $2);
226 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
227 0 $opts{$plugin}->{$plugin_option} = $self->payload->{$option};
228 }
229  
230 0 return \%opts;
231 },
232 1 );
233  
234 0 ▶around BUILDARGS => sub {
Subroutine __ANON__: not called CC=1 SCAR=6.9
235 0 my $orig = shift;
236 0 my $class = shift;
237 0 my $args = $class->$orig(@_);
238 0 return { %{ $args->{payload} }, %{ $args } };
239 1 };
240  
241 0 ▶sub configure {
Subroutine configure: not called CC=2 SCAR=17.9
Pod undocumented
242 0 my $self = shift;
243  
244 0 $self->add_plugins(
245 [ 'Prereqs' => 'TestMoreDoneTesting' => {
246 -phase => 'test',
247 -type => 'requires',
248 'Test::Most' => '0',
249 } ]
250 );
251 $self->add_plugins(
252 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
253 0 @{ $self->_plugins },
254 );
255 }
256  
257  
258 1 __PACKAGE__->meta->make_immutable;
259 1 ▶no Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
260  
261 __END__
« Dist-Zilla-PluginBundle-LOGIE-0.01/lib/Dist/Zilla/PluginBundle/LOGIE.pm ↑ Summary Dist-Zilla-PluginBundle-LOGIE-0.03/lib/Dist/Zilla/PluginBundle/LOGIE.pm »