File Coverage

lib/Path/IsDev/NegativeHeuristic/IsDev/IgnoreFile.pm
Criterion Covered Total %
statement 19 20 95.0
branch 1 2 50.0
condition n/a
subroutine 7 7 100.0
pod 2 2 100.0
total 29 31 93.5


line stmt bran cond sub pod time code
1 12     12   16278 use 5.008; # utf8
  12         95  
  12         541  
2 12     12   336 use strict;
  12         27  
  12         525  
3 12     12   74 use warnings;
  12         29  
  12         527  
4 12     12   1687 use utf8;
  12         37  
  12         150  
5              
6             package Path::IsDev::NegativeHeuristic::IsDev::IgnoreFile;
7              
8             our $VERSION = '1.001002';
9              
10             # ABSTRACT: An explicit exclusion file heuristic
11              
12             our $AUTHORITY = 'cpan:KENTNL'; # AUTHORITY
13              
14              
15              
16              
17              
18              
19              
20              
21              
22              
23              
24              
25              
26              
27              
28              
29              
30              
31              
32              
33              
34              
35              
36              
37              
38              
39              
40              
41              
42              
43              
44              
45              
46              
47              
48              
49              
50              
51 12     12   2305 use Role::Tiny::With qw( with );
  12         6017  
  12         2121  
52             with 'Path::IsDev::Role::NegativeHeuristic', 'Path::IsDev::Role::Matcher::Child::Exists::Any::File';
53              
54              
55              
56              
57              
58              
59              
60              
61              
62             sub excludes_files {
63 16     16 1 90 return ('.path_isdev_ignore');
64             }
65              
66              
67              
68              
69              
70              
71              
72             sub excludes {
73 16     16 1 46 my ( $self, $result_object ) = @_;
74 16 50       69 if ( $self->child_exists_any_file( $result_object, $self->excludes_files ) ) {
75 0         0 return 1;
76             }
77 16         70 return;
78             }
79             1;
80              
81             __END__
82              
83             =pod
84              
85             =encoding UTF-8
86              
87             =head1 NAME
88              
89             Path::IsDev::NegativeHeuristic::IsDev::IgnoreFile - An explicit exclusion file heuristic
90              
91             =head1 VERSION
92              
93             version 1.001002
94              
95             =head1 SYNOPSIS
96              
97             In a C<::HeuristicSet>:
98              
99             sub negative_heuristics { return 'IsDev::IgnoreFile' }
100              
101             Then on your file system:
102              
103             touch .path_isdev_ignore
104              
105             Then the given location will no longer be a possible candidate for being deemed a C<dev> root directory.
106              
107             However:
108              
109             =over 4
110              
111             =item * Its parents can still be deemed C<dev> directories
112              
113             =item * Its children can still be deemed C<dev> directories
114              
115             =back
116              
117             =head1 METHODS
118              
119             =head2 C<excludes_files>
120              
121             Files valid for triggering this heuristic:
122              
123             .path_isdev_ignore
124              
125             =head2 C<excludes>
126              
127             Returns an exclusion if any of C<excludes_files> exists, and are files.
128              
129             =begin MetaPOD::JSON v1.1.0
130              
131             {
132             "namespace":"Path::IsDev::NegativeHeuristic::IsDev::IgnoreFile",
133             "interface":"single_class",
134             "does":[
135             "Path::IsDev::Role::NegativeHeuristic",
136             "Path::IsDev::Role::Matcher::Child::Exists::Any::File"
137             ]
138             }
139              
140              
141             =end MetaPOD::JSON
142              
143             =head1 AUTHOR
144              
145             Kent Fredric <kentfredric@gmail.com>
146              
147             =head1 COPYRIGHT AND LICENSE
148              
149             This software is copyright (c) 2014 by Kent Fredric <kentfredric@gmail.com>.
150              
151             This is free software; you can redistribute it and/or modify it under
152             the same terms as the Perl 5 programming language system itself.
153              
154             =cut