line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package App::Midgen::Role::Output::MI; |
2
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
891
|
use constant {NONE => q{},}; |
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
101
|
|
4
|
|
|
|
|
|
|
|
5
|
2
|
|
|
2
|
|
6
|
use Moo::Role; |
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
10
|
|
6
|
|
|
|
|
|
|
requires qw( no_index verbose ); |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
# Load time and dependencies negate execution time |
9
|
|
|
|
|
|
|
# use namespace::clean -except => 'meta'; |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
our $VERSION = '0.33_05'; |
12
|
|
|
|
|
|
|
$VERSION = eval $VERSION; ## no critic |
13
|
|
|
|
|
|
|
|
14
|
2
|
|
|
2
|
|
3455
|
use English qw( -no_match_vars ); # Avoids reg-ex performance penalty |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
9
|
|
15
|
|
|
|
|
|
|
local $OUTPUT_AUTOFLUSH = 1; |
16
|
|
|
|
|
|
|
|
17
|
2
|
|
|
2
|
|
556
|
use Term::ANSIColor qw( :constants colored ); |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
425
|
|
18
|
2
|
|
|
2
|
|
10
|
use File::Spec; |
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
1248
|
|
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
####### |
22
|
|
|
|
|
|
|
# header_mi |
23
|
|
|
|
|
|
|
####### |
24
|
|
|
|
|
|
|
sub header_mi { |
25
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
26
|
0
|
|
0
|
|
|
|
my $package_name = shift || NONE; |
27
|
0
|
|
0
|
|
|
|
my $mi_ver = shift || NONE; |
28
|
|
|
|
|
|
|
|
29
|
0
|
|
|
|
|
|
print "\nuse strict;\n"; |
30
|
0
|
|
|
|
|
|
print "use warnings;\n"; |
31
|
0
|
|
|
|
|
|
print "use inc::Module::Install " . colored($mi_ver, 'yellow') . ";\n"; |
32
|
|
|
|
|
|
|
|
33
|
0
|
0
|
|
|
|
|
if ($package_name ne NONE) { |
34
|
0
|
|
|
|
|
|
$package_name =~ s{::}{-}g; |
35
|
0
|
|
|
|
|
|
print "name '$package_name';\n"; |
36
|
0
|
|
|
|
|
|
$package_name =~ tr{-}{/}; |
37
|
0
|
|
|
|
|
|
print "all_from 'lib/$package_name.pm';\n"; |
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
|
40
|
0
|
|
|
|
|
|
print BRIGHT_BLACK . "license 'perl';" . CLEAR . "\n"; |
41
|
0
|
|
|
|
|
|
return; |
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
####### |
44
|
|
|
|
|
|
|
# body_mi |
45
|
|
|
|
|
|
|
####### |
46
|
|
|
|
|
|
|
sub body_mi { |
47
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
48
|
0
|
|
|
|
|
|
my $title = shift; |
49
|
0
|
|
0
|
|
|
|
my $required_ref = shift || return; |
50
|
|
|
|
|
|
|
|
51
|
0
|
0
|
|
|
|
|
return if not %{$required_ref}; |
|
0
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
|
53
|
0
|
|
|
|
|
|
my $pm_length = 0; |
54
|
0
|
|
|
|
|
|
foreach my $module_name (sort keys %{$required_ref}) { |
|
0
|
|
|
|
|
|
|
55
|
0
|
0
|
|
|
|
|
if (length $module_name > $pm_length) { |
56
|
0
|
|
|
|
|
|
$pm_length = length $module_name; |
57
|
|
|
|
|
|
|
} |
58
|
|
|
|
|
|
|
} |
59
|
|
|
|
|
|
|
|
60
|
0
|
0
|
|
|
|
|
print "perl_version '$App::Midgen::Min_Version';\n" if $title eq 'RuntimeRequires'; |
61
|
0
|
|
|
|
|
|
print "\n"; |
62
|
|
|
|
|
|
|
|
63
|
0
|
|
|
|
|
|
$title =~ s/^RuntimeRequires/requires/; |
64
|
0
|
|
|
|
|
|
$title =~ s/^TestRequires/test_requires/; |
65
|
|
|
|
|
|
|
|
66
|
0
|
|
|
|
|
|
foreach my $module_name (sort keys %{$required_ref}) { |
|
0
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
next |
69
|
|
|
|
|
|
|
if $title eq 'test_requires' |
70
|
0
|
0
|
0
|
|
|
|
&& $required_ref->{$module_name} =~ m/mcpan/; |
71
|
|
|
|
|
|
|
|
72
|
0
|
0
|
|
|
|
|
if ($module_name =~ /^Win32/sxm) { |
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
73
|
0
|
|
|
|
|
|
my $sq_key = "'$module_name'"; |
74
|
|
|
|
|
|
|
printf "%s %-*s => '%s' %s;\n", $title, $pm_length + 2, $sq_key, |
75
|
0
|
|
|
|
|
|
$required_ref->{$module_name}, colored('if win32', 'bright_green'); |
76
|
|
|
|
|
|
|
} |
77
|
|
|
|
|
|
|
elsif ($module_name =~ /XS/sxm) { |
78
|
0
|
|
|
|
|
|
my $sq_key = "'$module_name'"; |
79
|
|
|
|
|
|
|
printf "%s %-*s => '%s' %s;\n", $title, $pm_length + 2, $sq_key, |
80
|
0
|
|
|
|
|
|
$required_ref->{$module_name}, colored('if can_xs', 'bright_blue'); |
81
|
|
|
|
|
|
|
} |
82
|
|
|
|
|
|
|
elsif ($module_name eq 'MRO::Compat') { |
83
|
0
|
|
|
|
|
|
my $sq_key = "'$module_name'"; |
84
|
|
|
|
|
|
|
printf "%s %-*s => '%s' %s;\n", $title, $pm_length + 2, $sq_key, |
85
|
0
|
|
|
|
|
|
$required_ref->{$module_name}, |
86
|
|
|
|
|
|
|
colored('if $] < 5.009005', 'bright_blue'); |
87
|
|
|
|
|
|
|
} |
88
|
|
|
|
|
|
|
else { |
89
|
0
|
|
|
|
|
|
my $sq_key = "'$module_name'"; |
90
|
|
|
|
|
|
|
printf "%s %-*s => '%s';\n", lc $title, $pm_length + 2, $sq_key, |
91
|
0
|
|
|
|
|
|
$required_ref->{$module_name}; |
92
|
|
|
|
|
|
|
} |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
} |
95
|
|
|
|
|
|
|
|
96
|
0
|
|
|
|
|
|
return; |
97
|
|
|
|
|
|
|
} |
98
|
|
|
|
|
|
|
####### |
99
|
|
|
|
|
|
|
# footer_mi |
100
|
|
|
|
|
|
|
####### |
101
|
|
|
|
|
|
|
sub footer_mi { |
102
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
103
|
0
|
|
0
|
|
|
|
my $package_name = shift || NONE; |
104
|
0
|
|
|
|
|
|
$package_name =~ s{::}{-}g; |
105
|
|
|
|
|
|
|
|
106
|
0
|
0
|
|
|
|
|
if ($self->verbose > 0) { |
107
|
0
|
|
|
|
|
|
print BRIGHT_BLACK "\n"; |
108
|
0
|
|
|
|
|
|
print "homepage 'https://github.com/.../$package_name';\n"; |
109
|
0
|
|
|
|
|
|
print "bugtracker 'https://github.com/.../$package_name/issues';\n"; |
110
|
0
|
|
|
|
|
|
print "repository 'git://github.com/.../$package_name.git';\n"; |
111
|
0
|
|
|
|
|
|
print "\n"; |
112
|
0
|
|
|
|
|
|
print "Meta->add_metadata(\n"; |
113
|
0
|
|
|
|
|
|
print "\tx_contributors => [\n"; |
114
|
0
|
|
|
|
|
|
print "\t\t'brian d foy (ADOPTME) <brian.d.foy\@gmail.com>',\n"; |
115
|
0
|
|
|
|
|
|
print "\t\t'Fred Bloggs <fred\@bloggs.org>',\n"; |
116
|
0
|
|
|
|
|
|
print "\t],\n"; |
117
|
0
|
|
|
|
|
|
print ");\n"; |
118
|
0
|
|
|
|
|
|
print CLEAR; |
119
|
|
|
|
|
|
|
} |
120
|
|
|
|
|
|
|
|
121
|
0
|
|
|
|
|
|
print "\n"; |
122
|
|
|
|
|
|
|
|
123
|
0
|
0
|
|
|
|
|
if (defined -d File::Spec->catdir($App::Midgen::Working_Dir, 'share')) { |
124
|
0
|
|
|
|
|
|
print "install_share;\n\n"; |
125
|
|
|
|
|
|
|
} |
126
|
|
|
|
|
|
|
|
127
|
0
|
0
|
|
|
|
|
if (defined -d File::Spec->catdir($App::Midgen::Working_Dir, 'script')) { |
|
|
0
|
|
|
|
|
|
128
|
0
|
|
|
|
|
|
print "install_script 'script/...';\n\n"; |
129
|
|
|
|
|
|
|
} |
130
|
|
|
|
|
|
|
elsif (defined -d File::Spec->catdir($App::Midgen::Working_Dir, 'bin')) { |
131
|
0
|
|
|
|
|
|
print "install_script 'bin/...';\n\n"; |
132
|
|
|
|
|
|
|
} |
133
|
|
|
|
|
|
|
|
134
|
0
|
|
|
|
|
|
my @no_index = $self->no_index; |
135
|
0
|
0
|
|
|
|
|
if (@no_index) { |
136
|
0
|
|
|
|
|
|
print "no_index 'directory' => qw{ @no_index };\n\n"; |
137
|
|
|
|
|
|
|
} |
138
|
|
|
|
|
|
|
|
139
|
0
|
|
|
|
|
|
print "WriteAll\n\n"; |
140
|
|
|
|
|
|
|
|
141
|
0
|
|
|
|
|
|
return; |
142
|
|
|
|
|
|
|
} |
143
|
|
|
|
|
|
|
|
144
|
2
|
|
|
2
|
|
9
|
no Moo; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
9
|
|
145
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
1; |
147
|
|
|
|
|
|
|
|
148
|
|
|
|
|
|
|
__END__ |
149
|
|
|
|
|
|
|
|
150
|
|
|
|
|
|
|
=pod |
151
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
=encoding UTF-8 |
153
|
|
|
|
|
|
|
|
154
|
|
|
|
|
|
|
=head1 NAME |
155
|
|
|
|
|
|
|
|
156
|
|
|
|
|
|
|
App::Midgen::Role::Output::MI - Output Format - Module::Install, |
157
|
|
|
|
|
|
|
used by L<App::Midgen> |
158
|
|
|
|
|
|
|
|
159
|
|
|
|
|
|
|
=head1 VERSION |
160
|
|
|
|
|
|
|
|
161
|
|
|
|
|
|
|
version: 0.33_05 |
162
|
|
|
|
|
|
|
|
163
|
|
|
|
|
|
|
=head1 DESCRIPTION |
164
|
|
|
|
|
|
|
|
165
|
|
|
|
|
|
|
The output format uses colour to add visualization of module version number |
166
|
|
|
|
|
|
|
types, be that mcpan, dual-life or added distribution. |
167
|
|
|
|
|
|
|
|
168
|
|
|
|
|
|
|
=head1 METHODS |
169
|
|
|
|
|
|
|
|
170
|
|
|
|
|
|
|
=over 4 |
171
|
|
|
|
|
|
|
|
172
|
|
|
|
|
|
|
=item * header_mi |
173
|
|
|
|
|
|
|
|
174
|
|
|
|
|
|
|
=item * body_mi |
175
|
|
|
|
|
|
|
|
176
|
|
|
|
|
|
|
=item * footer_mi |
177
|
|
|
|
|
|
|
|
178
|
|
|
|
|
|
|
=back |
179
|
|
|
|
|
|
|
|
180
|
|
|
|
|
|
|
=head1 DEPENDENCIES |
181
|
|
|
|
|
|
|
|
182
|
|
|
|
|
|
|
L<Term::ANSIColor> |
183
|
|
|
|
|
|
|
|
184
|
|
|
|
|
|
|
=head1 SEE ALSO |
185
|
|
|
|
|
|
|
|
186
|
|
|
|
|
|
|
L<App::Midgen> |
187
|
|
|
|
|
|
|
|
188
|
|
|
|
|
|
|
=head1 AUTHOR |
189
|
|
|
|
|
|
|
|
190
|
|
|
|
|
|
|
See L<App::Midgen> |
191
|
|
|
|
|
|
|
|
192
|
|
|
|
|
|
|
=head2 CONTRIBUTORS |
193
|
|
|
|
|
|
|
|
194
|
|
|
|
|
|
|
See L<App::Midgen> |
195
|
|
|
|
|
|
|
|
196
|
|
|
|
|
|
|
=head1 COPYRIGHT |
197
|
|
|
|
|
|
|
|
198
|
|
|
|
|
|
|
See L<App::Midgen> |
199
|
|
|
|
|
|
|
|
200
|
|
|
|
|
|
|
=head1 LICENSE |
201
|
|
|
|
|
|
|
|
202
|
|
|
|
|
|
|
This library is free software; you can redistribute it and/or modify |
203
|
|
|
|
|
|
|
it under the same terms as Perl itself. |
204
|
|
|
|
|
|
|
|
205
|
|
|
|
|
|
|
=cut |
206
|
|
|
|
|
|
|
|