line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
4
|
|
|
4
|
|
2196
|
use strict; |
|
4
|
|
|
|
|
5
|
|
|
4
|
|
|
|
|
155
|
|
2
|
4
|
|
|
4
|
|
21
|
use warnings; |
|
4
|
|
|
|
|
6
|
|
|
4
|
|
|
|
|
173
|
|
3
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
package App::Embra::Role::FilePruner; |
5
|
|
|
|
|
|
|
$App::Embra::Role::FilePruner::VERSION = '0.001'; # TRIAL |
6
|
|
|
|
|
|
|
# ABSTRACT: something that stops files from appearing in a site |
7
|
|
|
|
|
|
|
|
8
|
4
|
|
|
4
|
|
16
|
use List::MoreUtils qw< part >; |
|
4
|
|
|
|
|
4
|
|
|
4
|
|
|
|
|
49
|
|
9
|
4
|
|
|
4
|
|
1653
|
use Method::Signatures; |
|
4
|
|
|
|
|
6
|
|
|
4
|
|
|
|
|
27
|
|
10
|
4
|
|
|
4
|
|
1295
|
use Moo::Role; |
|
4
|
|
|
|
|
8
|
|
|
4
|
|
|
|
|
25
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
with 'App::Embra::Role::Plugin'; |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
requires 'exclude_file'; |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
|
18
|
4
|
50
|
|
4
|
|
5370
|
method prune_files { |
|
3
|
|
|
3
|
|
139
|
|
|
3
|
|
|
|
|
11
|
|
19
|
3
|
|
|
|
|
22
|
my $files = $self->embra->files; |
20
|
3
|
|
|
9
|
|
17
|
my ($remove, $keep) = part { ! $self->exclude_file( $_ ) } @{ $files }; |
|
9
|
|
|
|
|
29
|
|
|
3
|
|
|
|
|
17
|
|
21
|
|
|
|
|
|
|
|
22
|
3
|
|
|
|
|
382
|
$self->debug( "pruning $_" ) for @{ $remove }; |
|
3
|
|
|
|
|
17
|
|
23
|
3
|
|
|
|
|
53
|
splice @{ $files }, 0, @{ $files }, @{ $keep }; |
|
3
|
|
|
|
|
4
|
|
|
3
|
|
|
|
|
11
|
|
|
3
|
|
|
|
|
9
|
|
24
|
|
|
|
|
|
|
|
25
|
3
|
|
|
|
|
59
|
return; |
26
|
|
|
|
|
|
|
} |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
1; |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
__END__ |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
=pod |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
=encoding UTF-8 |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
=head1 NAME |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
App::Embra::Role::FilePruner - something that stops files from appearing in a site |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
=head1 VERSION |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
version 0.001 |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
=head1 DESCRIPTION |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
This role should be implemented by any plugin which prevents files from appearing in your site. It provides one method (C<L</prune_files>>), and requires plugins provide an C<exclude_file> method, which accepts a single L<App::Embra::File> object and return true if the file should be removed. |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
C<prune_files> will be called after all L<FileGatherer|App::Embra::Role::FileGatherer>-type plugins have added files, and will remove from the site all files which cause C<L</exclude_file>> to return true. |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
=head1 METHODS |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
=head2 prune_files |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
$plugin->prune_files; |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
Passes each of the site's files to the plugin's C<exclude_file> method, and removes the file from the site if the method returns true. |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
=head1 AUTHOR |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
Daniel Holz <dgholz@gmail.com> |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
This software is copyright (c) 2015 by Daniel Holz. |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
67
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
=cut |