File Coverage

_build/lib/App/Asciio.pm
Criterion Covered Total %
statement 9 33 27.2
branch 0 8 0.0
condition n/a
subroutine 3 7 42.8
pod 0 4 0.0
total 12 52 23.0


line stmt bran cond sub pod time code
1             package App::Asciio;
2 1     1   684 use Module::Build;
  1         109398  
  1         61  
3             our @ISA = qw(Module::Build);
4 1     1   9 use strict ;
  1         2  
  1         26  
5 1     1   5 use warnings ;
  1         2  
  1         523  
6              
7             sub GetVersionAndRevisionFrom
8             {
9 0     0 0   my ($file) = @_ ;
10              
11 0           my $version_from = File::Spec->catfile( split '/', $file );
12 0           my $version = Module::Build->version_from_file($version_from);
13              
14 0 0         if($ENV{'App_Asciio_USE_GIT_VERSION_FOR_DIST'})
15             {
16 0           my $number_of_commits = `git log | grep -E 'commit [0-9a-f]{40}' | wc -l` ;
17 0           chomp $number_of_commits ;
18            
19 0 0         if($number_of_commits)
20             {
21             #print "number of git revision: $number_of_commits.\n" ;
22 0           return("${version}.${number_of_commits}") ;
23             }
24             else
25             {
26 0           print "Couldn't get git revision, using version from '$file'!\n" ;
27 0           return($version) ;
28             }
29             }
30             else
31             {
32 0           return($version) ;
33             }
34             }
35              
36             sub ACTION_author_test
37             {
38 0     0 0   my $self = shift;
39 0           local $self->{properties}{test_files} = 'xt/author/*.t' ;
40 0           $self->SUPER::ACTION_test();
41             }
42              
43             sub ACTION_build
44             {
45 0     0 0   my $self = shift;
46              
47 0 0         if($ENV{'App_Asciio_USE_GIT_VERSION_FOR_DIST'})
48             {
49 0           my ($version) = GetVersionAndRevisionFrom('lib/App/Asciio.pm') ;
50            
51             #~ print "Generating version module ($version)\n" ;
52            
53 0 0         open VERSION, '>', 'Version.pm' or die "can't generate Version module: $!\n" ;
54            
55 0           print VERSION <
56            
57             # version module automatically generated by the build system
58            
59             package Config::Version ;
60            
61             sub GetVersion {return '$version'} ;
62            
63             1 ;
64            
65             # end of generated version module
66             EOV
67            
68 0           close VERSION ;
69             }
70            
71 0           $self->SUPER::ACTION_build(@_);
72             }
73              
74             sub ACTION_dist
75             {
76 0     0 0   my $self = shift;
77              
78 0           $self->SUPER::ACTION_test() ;
79              
80 0           $self->SUPER::ACTION_dist();
81             };
82              
83              
84              
85             1;