line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
1
|
|
|
1
|
|
122495
|
use strict; |
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
27
|
|
2
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
18
|
|
3
|
1
|
|
|
1
|
|
20
|
use 5.014; |
|
1
|
|
|
|
|
3
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
package Dist::Zilla::Plugin::TextTabs 0.04 { |
6
|
|
|
|
|
|
|
|
7
|
1
|
|
|
1
|
|
293
|
use Moose; |
|
1
|
|
|
|
|
344781
|
|
|
1
|
|
|
|
|
6
|
|
8
|
1
|
|
|
1
|
|
6308
|
use Text::Tabs qw( expand unexpand ); |
|
1
|
|
|
|
|
598
|
|
|
1
|
|
|
|
|
76
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
# ABSTRACT: Expand or unexpand tabs in your dist |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
with 'Dist::Zilla::Role::FileMunger', |
14
|
|
|
|
|
|
|
'Dist::Zilla::Role::FileFinderUser' => { |
15
|
|
|
|
|
|
|
default_finders => [ ':InstallModules', ':ExecFiles' ], |
16
|
|
|
|
|
|
|
}, |
17
|
|
|
|
|
|
|
'Dist::Zilla::Role::InstallTool', |
18
|
|
|
|
|
|
|
; |
19
|
|
|
|
|
|
|
|
20
|
1
|
|
|
1
|
|
234
|
use namespace::autoclean; |
|
1
|
|
|
|
|
5369
|
|
|
1
|
|
|
|
|
3
|
|
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
has tabstop => ( |
23
|
|
|
|
|
|
|
is => 'ro', |
24
|
|
|
|
|
|
|
isa => 'Int', |
25
|
|
|
|
|
|
|
default => 8, |
26
|
|
|
|
|
|
|
); |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
has unexpand => ( |
29
|
|
|
|
|
|
|
is => 'ro', |
30
|
|
|
|
|
|
|
isa => 'Bool', |
31
|
|
|
|
|
|
|
default => 0, |
32
|
|
|
|
|
|
|
); |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
has installer => ( |
35
|
|
|
|
|
|
|
is => 'ro', |
36
|
|
|
|
|
|
|
isa => 'Bool', |
37
|
|
|
|
|
|
|
default => 0, |
38
|
|
|
|
|
|
|
); |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
sub munge_files |
41
|
|
|
|
|
|
|
{ |
42
|
4
|
|
|
4
|
0
|
92773
|
my($self) = @_; |
43
|
4
|
100
|
|
|
|
117
|
return if $self->installer; |
44
|
3
|
|
|
|
|
6
|
$self->munge_file($_) for @{ $self->found_files }; |
|
3
|
|
|
|
|
14
|
|
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
sub munge_file |
48
|
|
|
|
|
|
|
{ |
49
|
4
|
|
|
4
|
0
|
3682
|
my($self, $file) = @_; |
50
|
4
|
100
|
|
|
|
107
|
$self->log(($self->unexpand ? 'un' : '') . 'expanding ' . $file->name); |
51
|
4
|
|
|
|
|
1520
|
local $Text::Tabs::tabstop = $self->tabstop; |
52
|
4
|
100
|
|
|
|
21
|
$file->content(join("\n", map { $self->unexpand ? unexpand @$_ : expand @$_ } [split /\n/, $file->content])); |
|
4
|
|
|
|
|
3006
|
|
53
|
4
|
|
|
|
|
1286
|
return; |
54
|
|
|
|
|
|
|
} |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
sub setup_installer |
57
|
|
|
|
|
|
|
{ |
58
|
4
|
|
|
4
|
0
|
35611
|
my($self) = @_; |
59
|
4
|
100
|
|
|
|
115
|
return unless $self->installer; |
60
|
1
|
|
|
|
|
3
|
foreach my $file (@{ $self->zilla->files }) |
|
1
|
|
|
|
|
23
|
|
61
|
|
|
|
|
|
|
{ |
62
|
3
|
100
|
|
|
|
76
|
next unless $file->name =~ /^(Makefile|Build).PL$/; |
63
|
1
|
|
|
|
|
38
|
$self->munge_file($file); |
64
|
|
|
|
|
|
|
} |
65
|
|
|
|
|
|
|
} |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |
68
|
|
|
|
|
|
|
} |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
1; |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
__END__ |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
=pod |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
=encoding UTF-8 |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
=head1 NAME |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
Dist::Zilla::Plugin::TextTabs - Expand or unexpand tabs in your dist |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
=head1 VERSION |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
version 0.04 |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
=head1 SYNOPSIS |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
[TextTabs] |
89
|
|
|
|
|
|
|
tabstop = 8 |
90
|
|
|
|
|
|
|
unexapand = 0 |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
=head1 DESCRIPTION |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
This L<Dist::Zilla> plugin expands or unexpands tabs using L<Text::Tab>. |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
=head1 ATTRIBUTES |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
=head2 tabstop |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
The length of the tabstop in characters. This is usually 8, but some people prefer 4 or 2. |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
=head2 unexpand |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
if set to true, then an unexpand is used on all the targeted files, that is spaces of the |
105
|
|
|
|
|
|
|
right length are converted into an equivalent number of tabs. The default is false, or |
106
|
|
|
|
|
|
|
expand mode. |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
=head2 installer |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
Instead of doing its work during the usual file munger stage, if this |
111
|
|
|
|
|
|
|
attribute is true (the default is false), then this plugin will munge |
112
|
|
|
|
|
|
|
just the C<Makefile.PL> or C<Build.PL> (or both if you have both) files |
113
|
|
|
|
|
|
|
during the C<InstallTool> phase. This allows you to remove nauty |
114
|
|
|
|
|
|
|
tabs from the installer than may have been put there by a nauty |
115
|
|
|
|
|
|
|
C<InstallTool> plugin (take care to put C<[TextTabs]> in your C<dist.ini> |
116
|
|
|
|
|
|
|
after the nauty installer plugin). |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
=head1 SEE ALSO |
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
L<Text::Tabs> |
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
=head1 AUTHOR |
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
Graham Ollis <plicease@cpan.org> |
125
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
This software is copyright (c) 2013 by Graham Ollis. |
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
131
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
132
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
=cut |