File Coverage

blib/lib/Alien/git.pm
Criterion Covered Total %
statement 22 24 91.6
branch 1 2 50.0
condition 1 2 50.0
subroutine 12 15 80.0
pod 1 8 12.5
total 37 51 72.5


line stmt bran cond sub pod time code
1             package Alien::git;
2              
3 4     4   433678 use strict;
  4         14  
  4         101  
4 4     4   17 use warnings;
  4         7  
  4         75  
5 4     4   69 use 5.008001;
  4         13  
6 4     4   451 use Capture::Tiny qw( capture );
  4         20153  
  4         196  
7 4     4   788 use File::Which qw( which );
  4         1730  
  4         1043  
8              
9             # ABSTRACT: Find system git
10             our $VERSION = '0.09'; # VERSION
11              
12              
13 0     0 0 0 sub cflags {''}
14 0     0 0 0 sub libs {''}
15       0 0   sub dynamic_libs {}
16 1     1 0 57 sub install_type { 'system' }
17              
18             # IF you are reading the documentation and wondering
19             # why it says that you need to add bin_dir to your
20             # PATH, and you are looking at the source here and seeing
21             # that it just returns an empty list, and wondering
22             # why? It is because in the future Alien::git MAY
23             # support share installs, at which point your code will
24             # break if you are NOT adding bin_dir to your PATH.
25 3     3 1 98337 sub bin_dir {()}
26              
27 13   50 13 0 300031 sub exe { scalar which $ENV{ALIEN_GIT} || 'git' }
28              
29             sub version
30             {
31             my($out) = capture {
32 4     4   4821 system(
33             __PACKAGE__->exe,
34             '--version',
35             );
36 4     4 0 14644 };
37              
38 4 50       26333 $out =~ /git version ([0-9\.]+)/
39             ? $1
40             : 'unknown';
41             }
42              
43             sub alien_helper
44             {
45             return {
46 4     4   1253 git => sub { __PACKAGE__->exe },
47             }
48 4     4 0 7134 }
49              
50             1;
51              
52             __END__