line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
## no critic (RequireUseStrict) |
2
|
|
|
|
|
|
|
package Dist::Zilla::Plugin::Git::ExcludeUntracked; |
3
|
|
|
|
|
|
|
$Dist::Zilla::Plugin::Git::ExcludeUntracked::VERSION = '0.04'; |
4
|
|
|
|
|
|
|
## use critic (RequireUseStrict) |
5
|
2
|
|
|
2
|
|
2480922
|
use Moose; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
17
|
|
6
|
2
|
|
|
2
|
|
13251
|
use File::Find; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
989
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
with 'Dist::Zilla::Role::FilePruner'; |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
sub _gather_files_under_dir { |
11
|
0
|
|
|
0
|
|
0
|
my ( $self, $dirname ) = @_; |
12
|
|
|
|
|
|
|
|
13
|
0
|
|
|
|
|
0
|
my @files; |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
find(sub { |
16
|
0
|
0
|
|
0
|
|
0
|
return if -d; |
17
|
|
|
|
|
|
|
|
18
|
0
|
|
|
|
|
0
|
push @files, $File::Find::name; |
19
|
0
|
|
|
|
|
0
|
}, $dirname); |
20
|
|
|
|
|
|
|
|
21
|
0
|
|
|
|
|
0
|
return @files; |
22
|
|
|
|
|
|
|
} |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
sub _assemble_untracked_lookup { |
25
|
2
|
|
|
2
|
|
7
|
my ( $self ) = @_; |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
my @untracked_files = map { |
28
|
2
|
|
|
|
|
27704
|
chomp; $_ |
|
7
|
|
|
|
|
54
|
|
|
7
|
|
|
|
|
58
|
|
29
|
|
|
|
|
|
|
} qx(git ls-files --other); |
30
|
|
|
|
|
|
|
|
31
|
2
|
|
|
|
|
22
|
my @subdir_files; |
32
|
2
|
|
|
|
|
25
|
foreach my $file (@untracked_files) { |
33
|
7
|
50
|
|
|
|
78
|
if($file =~ m{/$}) { |
34
|
0
|
|
|
|
|
0
|
push @subdir_files, $self->_gather_files_under_dir($file); |
35
|
0
|
|
|
|
|
0
|
undef $file; |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
} |
38
|
2
|
|
|
|
|
15
|
@untracked_files = grep { defined() } @untracked_files; |
|
7
|
|
|
|
|
39
|
|
39
|
2
|
|
|
|
|
17
|
push @untracked_files, @subdir_files; |
40
|
|
|
|
|
|
|
|
41
|
2
|
|
|
|
|
10
|
return map { $_ => 1 } @untracked_files; |
|
7
|
|
|
|
|
88
|
|
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
sub prune_files { |
45
|
2
|
|
|
2
|
1
|
466237
|
my ( $self ) = @_; |
46
|
|
|
|
|
|
|
|
47
|
2
|
|
|
|
|
131
|
my $zilla = $self->zilla; |
48
|
2
|
|
|
|
|
20
|
my @files = @{ $zilla->files }; |
|
2
|
|
|
|
|
64
|
|
49
|
2
|
|
|
|
|
36
|
my %untracked_lookup = $self->_assemble_untracked_lookup; |
50
|
|
|
|
|
|
|
|
51
|
2
|
|
|
|
|
24
|
foreach my $file (@files) { |
52
|
30
|
100
|
|
|
|
2977
|
if(exists $untracked_lookup{$file->name}) { |
53
|
7
|
|
|
|
|
631
|
$self->log_debug([ 'pruning %s', $file->name ]); |
54
|
7
|
|
|
|
|
1357
|
$zilla->prune_file($file); |
55
|
|
|
|
|
|
|
} |
56
|
|
|
|
|
|
|
} |
57
|
|
|
|
|
|
|
} |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
1; |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
=pod |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
=encoding UTF-8 |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
=head1 NAME |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
Dist::Zilla::Plugin::Git::ExcludeUntracked - Excludes untracked files from your dist [DEPRECATED] |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
=head1 VERSION |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
version 0.04 |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
=head1 SYNOPSIS |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
[Git::ExcludeUntracked] |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
=head1 DESCRIPTION |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
B<NOTE> This module is deprecated in favor of L<Dist::Zilla::Plugin::Git::GatherDir>. |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
This L<Dist::Zilla> plugin automatically excludes any files from your |
84
|
|
|
|
|
|
|
distribution that are not currently tracked by Git. |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
=head1 SEE ALSO |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
L<Dist::Zilla>, L<Dist::Zilla::Plugin::Git::GatherDir> |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
=begin comment |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
=over |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
=item prune_files |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
=back |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
=end comment |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
=head1 AUTHOR |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
Rob Hoelz <rob@hoelz.ro> |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
This software is copyright (c) 2013 by Rob Hoelz. |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
109
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
=head1 BUGS |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
Please report any bugs or feature requests on the bugtracker website |
114
|
|
|
|
|
|
|
https://github.com/hoelzro/dist-zilla-plugin-git-excludeuntracked/issues |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
When submitting a bug or request, please include a test-file or a |
117
|
|
|
|
|
|
|
patch to an existing test-file that illustrates the bug or desired |
118
|
|
|
|
|
|
|
feature. |
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
=cut |
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
__END__ |
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
# ABSTRACT: Excludes untracked files from your dist [DEPRECATED] |
125
|
|
|
|
|
|
|
|