blib/lib/Dist/Zilla/Plugin/Author/KENTNL/DistINI.pm

filter: Statementstmt 92.3% 36 / 39 Branchbran 50.0% 1 / 2 Conditioncond 50.0% 2 / 4 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 83.3% 10 / 12 Podpod 100% 1 / 1 totaltotal 83.3% 50 / 60 CC 4 SCAR 7.4
CC
4
Cov
87%
__ANON__
4.6
__ANON__
2.0
__ANON__
2.0
CRAP 2.1
« blib/lib/Dist/Zilla/PluginBundle/Author/KENTNL.pm ↑ Summary blib/lib/auto/share/module/Dist-Zilla-MintingProfile-Author-KENTNL/default/skel/maint/perlcritic.rc.gen.pl »
1 5 ▶use 5.006; # our
Subroutine BEGIN: called CC=1 SCAR=0.0
2 5 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 5 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5  
6  
7  
8  
9 package Dist::Zilla::Plugin::Author::KENTNL::DistINI;
10  
11 # ABSTRACT: Generate a dist.ini for @Author::KENTNL projects.
12  
13 5 our $VERSION = '2.025021';
14  
15 5 our $AUTHORITY = 'cpan:KENTNL'; # AUTHORITY
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30 5 ▶use Moose qw( with );
Subroutine BEGIN: called CC=1 SCAR=0.0
31  
32 5 with qw(Dist::Zilla::Role::FileGatherer);
33  
34 5 __PACKAGE__->meta->make_immutable;
35 5 ▶no Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
36  
37 5 ▶use String::Formatter named_stringf => {
Subroutine BEGIN: called CC=1 SCAR=0.4
38 -as => 'str_rf',
39 codes => {
40 32 ▶ s => sub { "$_" },
Subroutine __ANON__: called CC=1 SCAR=0.0
41 0 ▶ S => sub { q{"} . "$_" . q{"} },
Subroutine __ANON__: not called CC=1 SCAR=6.9
42 0 ▶ n => sub { int },
Subroutine __ANON__: not called CC=1 SCAR=6.9
43 },
44 5 };
45  
46  
47  
48  
49  
50  
51  
52 4 ▶sub _template {
Subroutine _template: called CC=1 SCAR=0.0
53 4 my $empty = q{};
54 4 return <<"EOF";
55 ; Generated by %{GENPACKAGE}s version %{GENVERSION}s at %{GENTIME}s
56 ; vim: syntax=dosini
57 name = %{name}s
58 author = %{author}s
59 license = %{license}s
60 copyright_holder = %{copyrightholder}s
61 $empty
62 ; Uncomment this to bootstrap via self
63 ; [Bootstrap::lib]
64 $empty
65 [\@Author::KENTNL]
66 :version = %{depversion}s
67 normal_form = numify
68 mantissa = 6
69 toolkit = eumm
70 toolkit_hardness = soft
71 bumpversions = 1
72 srcreadme = mkdn
73 ; twitter_extra_hash_tags =
74 ; auto_prereqs_skip = File::Find
75 $empty
76 [Prereqs]
77 $empty
78 EOF
79 }
80  
81 4 ▶sub gather_files {
Subroutine gather_files: called CC=1 SCAR=0.1
Pod documented
82 4 my ( $self, ) = @_;
83 4 ▶ my $code = sub {
Subroutine __ANON__: called CC=4 SCAR=15.2
84 ## no critic (RegularExpressions)
85 4 my $license = ref $self->zilla->license;
86 4 ▶ if ( $license =~ /^Software::License::(.+)$/ ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($license =~ /^Software::License::(.+)$/) { } 4 0 4
87 4 $license = $1;
88 }
89 else {
90 0 $license = "=$license";
91 }
92  
93 # TODO: support >1 authors. Too lazy atm, its just me. -- Kentnl - 2010-06-10
94 # TODO: Actually workout whatever localtime is where Kentnl lives. Atm, its overkill. -- Kentnl - 2010-06-10
95 4 ▶ my $content = str_rf(
Condition50%2/4
__PACKAGE__->VERSION || '(unversioned:dist)'
l!l
40
__PACKAGE__->VERSION || '2.016000'
l!l
40
MC/DC0%0/1
__PACKAGE__->VERSION || '(unversioned:dist)'
__PACKAGE__->VERSION
MC/DC0%0/1
__PACKAGE__->VERSION || '2.016000'
__PACKAGE__->VERSION
Truth table50%1/2
A
A= __PACKAGE__->VERSION
Aresult
11
00
Truth table50%1/2
A
A= __PACKAGE__->VERSION
Aresult
11
00
96 $self->_template,
97 {
98 GENPACKAGE => __PACKAGE__,
99 GENVERSION => ( __PACKAGE__->VERSION || '(unversioned:dist)' ),
100 GENTIME => ( scalar localtime ),
101 name => $self->zilla->name,
102 author => $self->zilla->authors->[0],
103 license => $license,
104 copyrightholder => $self->zilla->copyright_holder,
105 rel_year => (localtime)[5] + 1900,
106 rel_month => (localtime)[4] + 1,
107 rel_day => (localtime)[3],
108 rel_hour => (localtime)[2],
109 tz => 'Pacific/Auckland',
110 tags => '#perl #cpan',
111 depversion => ( __PACKAGE__->VERSION || '2.016000' ),
112 },
113 );
114 4 return $content;
115 4 };
116 4 require Dist::Zilla::File::FromCode;
117 4 my $file = Dist::Zilla::File::FromCode->new(
118 {
119 name => 'dist.ini',
120 code => $code,
121 },
122 );
123 4 $self->add_file($file);
124 4 return 1;
125 }
126  
127 5 1;
128  
129 __END__
« blib/lib/Dist/Zilla/PluginBundle/Author/KENTNL.pm ↑ Summary blib/lib/auto/share/module/Dist-Zilla-MintingProfile-Author-KENTNL/default/skel/maint/perlcritic.rc.gen.pl »