line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
4
|
|
|
4
|
|
16963
|
use strict; use warnings; |
|
4
|
|
|
4
|
|
82
|
|
|
4
|
|
|
|
|
234
|
|
|
4
|
|
|
|
|
18
|
|
|
4
|
|
|
|
|
6
|
|
|
4
|
|
|
|
|
191
|
|
2
|
|
|
|
|
|
|
package Module::Manifest::Skip; |
3
|
|
|
|
|
|
|
our $VERSION = '0.23'; |
4
|
|
|
|
|
|
|
|
5
|
4
|
|
|
4
|
|
4989
|
use Moo; |
|
4
|
|
|
|
|
105347
|
|
|
4
|
|
|
|
|
25
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
has text => ( |
8
|
|
|
|
|
|
|
is => 'ro', |
9
|
|
|
|
|
|
|
builder => 'text__', |
10
|
|
|
|
|
|
|
lazy => 1, |
11
|
|
|
|
|
|
|
); |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
has old_text => ( |
14
|
|
|
|
|
|
|
is => 'ro', |
15
|
|
|
|
|
|
|
default => sub { |
16
|
|
|
|
|
|
|
my $self = shift; |
17
|
|
|
|
|
|
|
return $self->read_file('MANIFEST.SKIP', 1); |
18
|
|
|
|
|
|
|
}, |
19
|
|
|
|
|
|
|
); |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
sub import { |
22
|
5
|
|
|
5
|
|
39712
|
my ($package, $command) = @_; |
23
|
5
|
50
|
33
|
|
|
43
|
if ($command and $command eq 'create') { |
24
|
0
|
|
|
|
|
0
|
my $text = $package->new->text; |
25
|
0
|
0
|
|
|
|
0
|
open MS, '>', 'MANIFEST.SKIP' |
26
|
|
|
|
|
|
|
or die "Can't open MANIFEST.SKIP for output:\n$!"; |
27
|
0
|
|
|
|
|
0
|
print MS $text; |
28
|
0
|
|
|
|
|
0
|
close MS; |
29
|
0
|
|
|
|
|
0
|
exit; |
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
else { |
32
|
5
|
|
|
|
|
42
|
goto &Moo::import; |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
sub add { |
37
|
0
|
|
|
0
|
0
|
0
|
my $self = shift; |
38
|
0
|
0
|
|
|
|
0
|
my $addition = shift or return; |
39
|
0
|
|
|
|
|
0
|
chomp $addition; |
40
|
0
|
0
|
|
|
|
0
|
if (not $self->{add_occurred}++) { |
41
|
0
|
|
|
|
|
0
|
$self->{text} =~ s/\n+\z/\n\n/; |
42
|
|
|
|
|
|
|
} |
43
|
0
|
|
|
|
|
0
|
$self->{text} .= $addition . "\n"; |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
sub remove { |
47
|
0
|
|
|
0
|
0
|
0
|
my $self = shift; |
48
|
0
|
0
|
|
|
|
0
|
my $exclude = shift or return; |
49
|
0
|
|
|
|
|
0
|
$self->{text} =~ s/^(\Q$exclude\E)$/# $1/mg; |
50
|
|
|
|
|
|
|
} |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
sub text__ { |
53
|
1
|
|
|
1
|
0
|
362
|
my $self = shift; |
54
|
1
|
|
|
|
|
6
|
my $old = $self->old_text; |
55
|
1
|
50
|
|
|
|
4
|
my $text = ($old =~ /\A(\S.*?\n\n)/s) ? $1 : ''; |
56
|
1
|
|
|
|
|
2
|
chomp $text; |
57
|
1
|
|
|
|
|
4
|
$text .= $self->skip_template; |
58
|
1
|
|
|
|
|
3
|
local $self->{text} = $text; |
59
|
1
|
|
|
|
|
5
|
$self->reduce; |
60
|
1
|
|
|
|
|
9
|
return $self->{text}; |
61
|
|
|
|
|
|
|
} |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
sub reduce { |
64
|
1
|
|
|
1
|
0
|
1
|
my $self = shift; |
65
|
1
|
|
|
|
|
6
|
while ($self->{text} =~ s/^- (.*)$/* $1/m) { |
66
|
0
|
|
|
|
|
0
|
$self->remove($1); |
67
|
|
|
|
|
|
|
} |
68
|
1
|
|
|
|
|
4
|
$self->{text} =~ s/^\* /- /mg; |
69
|
|
|
|
|
|
|
} |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
sub skip_template { |
72
|
1
|
|
|
1
|
0
|
2
|
my $self = shift; |
73
|
1
|
50
|
|
|
|
3
|
my $path = $INC{'Module/Manifest/Skip.pm'} or die; |
74
|
1
|
50
|
0
|
|
|
27
|
if (-e 'lib/Module/Manifest/Skip.pm') { |
|
|
0
|
|
|
|
|
|
75
|
1
|
|
|
|
|
4
|
return $self->read_file('share/MANIFEST.SKIP'); |
76
|
|
|
|
|
|
|
} |
77
|
|
|
|
|
|
|
elsif ($path =~ s!(\S.*?)[\\/]?\blib\b.*!$1! and -e "$path/share") { |
78
|
0
|
|
|
|
|
0
|
return $self->read_file("$path/share/MANIFEST.SKIP"); |
79
|
|
|
|
|
|
|
} |
80
|
|
|
|
|
|
|
else { |
81
|
0
|
|
|
|
|
0
|
require File::ShareDir; |
82
|
0
|
|
|
|
|
0
|
require File::Spec; |
83
|
0
|
|
|
|
|
0
|
my $dir = File::ShareDir::dist_dir('Module-Manifest-Skip'); |
84
|
0
|
|
|
|
|
0
|
my $file = File::Spec->catfile($dir, 'MANIFEST.SKIP'); |
85
|
0
|
0
|
0
|
|
|
0
|
die "Can't find MANIFEST.SKIP share file for Module::Manifest::Skip" |
|
|
|
0
|
|
|
|
|
86
|
|
|
|
|
|
|
unless $dir and -f $file and -r $file; |
87
|
0
|
|
|
|
|
0
|
return $self->read_file($file); |
88
|
|
|
|
|
|
|
} |
89
|
|
|
|
|
|
|
} |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
sub read_file { |
92
|
10
|
|
|
10
|
0
|
441393
|
my ($self, $file, $ignore) = @_; |
93
|
10
|
0
|
50
|
|
|
620
|
open FILE, $file or |
|
|
|
66
|
|
|
|
|
94
|
|
|
|
|
|
|
$ignore and return '' or |
95
|
|
|
|
|
|
|
die "Can't open '$file' for input:\n$!"; |
96
|
9
|
|
|
|
|
81
|
my $text = do { local $/; }; |
|
9
|
|
|
|
|
85
|
|
|
9
|
|
|
|
|
403
|
|
97
|
9
|
|
|
|
|
116
|
close FILE; |
98
|
9
|
|
|
|
|
114
|
$text =~ s/\r//g; |
99
|
9
|
|
|
|
|
101
|
return $text; |
100
|
|
|
|
|
|
|
} |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
1; |