blib/lib/Dist/Zilla/PluginBundle/CJFIELDS.pm

filter: Statementstmt 46.5% 27 / 58 Branchbran 0.0% 0 / 14 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 45.4% 5 / 11 Podpod 0.0% 0 / 1 totaltotal 38.1% 32 / 84 CC 8 SCAR 21.1
CC
8
Cov
38%
__ANON__
20.0
__ANON__
12.0
__ANON__
6.0
CRAP 8.3
↑ Summary
1 package Dist::Zilla::PluginBundle::CJFIELDS;
2 1 ▶BEGIN {
Subroutine BEGIN: called CC=1 SCAR=0.0
3 1 $Dist::Zilla::PluginBundle::CJFIELDS::AUTHORITY = 'cpan:CJFIELDS';
4 }
5  
6 1 our $VERSION = '0.06'; # VERSION
7  
8 # ABSTRACT: Build your modules like CJFIELDS (not sure that's a recommendation)
9  
10 1 ▶use Moose 1.0;
Subroutine BEGIN: called CC=1 SCAR=0.0
11 1 ▶use Moose::Util::TypeConstraints;
Subroutine BEGIN: called CC=1 SCAR=0.0
12 1 ▶use MooseX::Types::Moose qw(Bool Str HashRef Any);
Subroutine BEGIN: called CC=1 SCAR=0.0
13 1 ▶use namespace::autoclean;
Subroutine BEGIN: called CC=1 SCAR=0.0
14  
15 1 extends qw(Dist::Zilla::PluginBundle::FLORA);
16  
17  
18 0 ▶sub BUILD {
Subroutine BUILD: not called CC=1 SCAR=6.9
Pod undocumented
19 0 my $self = shift;
20 0 $self->_set_config_plugin( map { $_ => {} } qw(
21 MetaConfig
22 MetaJSON
23 OurPkgVersion
24 PodSyntaxTests
25 NoTabsTests
26 Test::Compile
27 NextRelease
28 )
29 );
30 }
31  
32 1 has '+authority' => ( default => 'cpan:CJFIELDS');
33  
34 1 has '+github_user' => ( default => 'cjfields' );
35  
36 has 'create_readme' => (
37 isa => Bool,
38 is => 'ro',
39 default => 1,
40 0 ▶ trigger => sub {
Subroutine __ANON__: not called CC=2 SCAR=17.9
41 0 my ($self, $val) = @_;
42 0 ▶ if (!$val) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($val) 0 0 0
43 0 $self->_set_filter_plugin('Readme' => 1);
44 }
45 $val
46 0 }
47 1 );
48  
49 has 'use_module_build' => (
50 isa => Bool,
51 is => 'ro',
52 0 ▶ default => sub {
Subroutine __ANON__: not called CC=1 SCAR=6.9
53 0 my $self = shift;
54 0 $self->_set_filter_plugin('MakeMaker' => 1);
55 0 $self->_set_config_plugin('ModuleBuild' => {});
56 0 1;
57 },
58 0 ▶ trigger => sub {
Subroutine __ANON__: not called CC=2 SCAR=17.9
59 0 my ($self, $val) = @_;
60 0 ▶ if ($val) {
Branch: 1 branch
BranchTrueFalseTotal
if ($val) 0 0 0
61 0 $self->_set_filter_plugin('MakeMaker' => 1);
62 0 $self->_set_config_plugin('ModuleBuild' => {});
63 }
64 $val
65 0 }
66 1 );
67  
68 1 has 'install_scripts' => (
69 isa => Bool,
70 is => 'ro',
71 default => 0
72 );
73  
74 1 has 'scripts_dir' =>(
75 isa => 'Str',
76 is => 'ro',
77 default => 'scripts'
78 );
79  
80 has 'skip_build' => (
81 isa => Bool,
82 is => 'ro',
83 default => 0,
84 0 ▶ trigger => sub {
Subroutine __ANON__: not called CC=3 SCAR=24.8
85 0 my ($self, $val) = @_;
86 0 ▶ Carp::croak("Can't set both skip_build and use_module_build")
Branch: 1 branch
BranchTrueFalseTotal
if $self->use_module_build 0 0 0
87 if $self->use_module_build;
88 0 ▶ if ($val) {
Branch: 1 branch
BranchTrueFalseTotal
if ($val) 0 0 0
89 0 $self->_set_filter_plugin('MakeMaker' => 1, 'ModuleBuild' => 1);
90 0 $self->_set_config_plugin('ModuleBuild::Custom' => {} );
91 }
92 $val
93 0 }
94 1 );
95  
96 1 has '_plugins_filtered' => (
97 traits => ['Hash'],
98 isa => HashRef[Bool],
99 is => 'bare',
100 init_arg => undef,
101 handles => {
102 '_set_filter_plugin' => 'set',
103 '_filtered_plugins' => 'keys'
104 }
105 );
106  
107 1 has '_plugins_added' => (
108 traits => ['Hash'],
109 isa => HashRef[Any],
110 is => 'bare',
111 init_arg => undef,
112 handles => {
113 '_set_config_plugin' => 'set',
114 '_config_plugin_map' => 'kv'
115 }
116 );
117  
118 0 ▶override 'configure' => sub {
Subroutine __ANON__: not called CC=4 SCAR=30.0
119 0 my $self = shift;
120  
121 # these need to be moved into a trigger or builder or somethin'
122 0 my @filtered = $self->_filtered_plugins;
123  
124 0 ▶ if (@filtered) {
Branch: 1 branch
BranchTrueFalseTotal
if (@filtered) { } 0 0 0
125 0 $self->add_bundle('@Filter' => {-bundle => '@Basic',
126 -remove => \@filtered});
127 } else {
128 0 $self->add_bundle('@Basic');
129 }
130  
131 0 $self->add_plugins($self->_config_plugin_map);
132  
133 # these have to be set last-minute b/c they rely on secondary attributes
134 0 $self->add_plugins(
135 [MetaResources => {
136 'repository.type' => $self->repository_type,
137 'repository.url' => $self->repository_url,
138 'repository.web' => $self->repository_web,
139 'bugtracker.web' => $self->bugtracker_url,
140 'bugtracker.mailto' => $self->bugtracker_email,
141 'homepage' => $self->homepage_url,
142 }],
143 [Authority => {
144 authority => $self->authority,
145 do_metadata => 1,
146 }],
147 [EOLTests => {
148 trailing_whitespace => !$self->disable_trailing_whitespace_tests,
149 }],
150 );
151  
152 0 ▶ $self->add_plugins(['ExecDir' => {
Branch: 1 branch
BranchTrueFalseTotal
if $self->install_scripts 0 0 0
153 scripts => $self->scripts_dir
154 }]
155 ) if $self->install_scripts;
156  
157 0 ▶ $self->is_task
Branch: 1 branch
BranchTrueFalseTotal
$self->is_task ? : 0 0 0
158 ? $self->add_plugins('TaskWeaver')
159 : $self->add_plugins(
160 [PodWeaver => {
161 config_plugin => $self->weaver_config_plugin,
162 }],
163 );
164 1 };
165  
166 1 __PACKAGE__->meta->make_immutable;
167  
168 1 1;
169  
170 __END__
↑ Summary