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   507990 use strict;
  4         20  
  4         116  
4 4     4   21 use warnings;
  4         8  
  4         90  
5 4     4   74 use 5.008001;
  4         13  
6 4     4   502 use Capture::Tiny qw( capture );
  4         25131  
  4         246  
7 4     4   850 use File::Which qw( which );
  4         2033  
  4         1180  
8              
9             # ABSTRACT: Find system git
10             our $VERSION = '0.08'; # 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 14 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 103899 sub bin_dir {()}
26              
27 14   50 14 0 316250 sub exe { scalar which $ENV{ALIEN_GIT} || 'git' }
28              
29             sub version
30             {
31             my($out) = capture {
32 3     3   4440 system(
33             __PACKAGE__->exe,
34             '--version',
35             );
36 3     3 0 18282 };
37            
38 3 50       18288 $out =~ /git version ([0-9\.]+)/
39             ? $1
40             : 'unknown';
41             }
42              
43             sub alien_helper
44             {
45             return {
46 5     5   1587 git => sub { __PACKAGE__->exe },
47             }
48 4     4 0 6936 }
49              
50             1;
51              
52             __END__