File Coverage

lib/Path/IsDev/Heuristic/VCS/Git.pm
Criterion Covered Total %
statement 19 21 90.4
branch 1 2 50.0
condition n/a
subroutine 7 7 100.0
pod 2 2 100.0
total 29 32 90.6


line stmt bran cond sub pod time code
1 4     4   15841 use 5.008; # utf8
  4         15  
  4         189  
2 4     4   23 use strict;
  4         6  
  4         147  
3 4     4   21 use warnings;
  4         51  
  4         111  
4 4     4   1637 use utf8;
  4         25  
  4         108  
5              
6             package Path::IsDev::Heuristic::VCS::Git;
7              
8             our $VERSION = '1.001002';
9              
10              
11              
12              
13              
14              
15              
16              
17              
18              
19              
20              
21              
22              
23              
24              
25             # ABSTRACT: Determine if a path contains a .git repository
26              
27             our $AUTHORITY = 'cpan:KENTNL'; # AUTHORITY
28              
29 4     4   2058 use Role::Tiny::With qw( with );
  4         9011  
  4         864  
30              
31             with 'Path::IsDev::Role::Heuristic', 'Path::IsDev::Role::Matcher::Child::Exists::Any::Dir';
32              
33              
34              
35              
36              
37              
38              
39              
40              
41 3     3 1 21 sub dirs { return qw( .git ) }
42              
43              
44              
45              
46              
47              
48              
49             sub matches {
50 3     3 1 11 my ( $self, $result_object ) = @_;
51 3 50       14 if ( $self->child_exists_any_dir( $result_object, $self->dirs ) ) {
52 0         0 $result_object->result(1);
53 0         0 return 1;
54             }
55 3         21 return;
56             }
57              
58             1;
59              
60             __END__
61              
62             =pod
63              
64             =encoding UTF-8
65              
66             =head1 NAME
67              
68             Path::IsDev::Heuristic::VCS::Git - Determine if a path contains a .git repository
69              
70             =head1 VERSION
71              
72             version 1.001002
73              
74             =head1 METHODS
75              
76             =head2 C<dirs>
77              
78             Directories relevant to this heuristic:
79              
80             .git
81              
82             =head2 C<matches>
83              
84             Return a match if any children of C<path> exist called C<.git> and are directories
85              
86             =begin MetaPOD::JSON v1.1.0
87              
88             {
89             "namespace":"Path::IsDev::Heuristic::VCS::Git",
90             "interface":"single_class",
91             "does":[
92             "Path::IsDev::Role::Heuristic",
93             "Path::IsDev::Role::Matcher::Child::Exists::Any::Dir"
94             ]
95             }
96              
97              
98             =end MetaPOD::JSON
99              
100             =head1 AUTHOR
101              
102             Kent Fredric <kentfredric@gmail.com>
103              
104             =head1 COPYRIGHT AND LICENSE
105              
106             This software is copyright (c) 2014 by Kent Fredric <kentfredric@gmail.com>.
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             =cut