File Coverage

blib/lib/App/bif/show/version.pm
Criterion Covered Total %
statement 33 34 97.0
branch 4 12 33.3
condition 1 3 33.3
subroutine 7 7 100.0
pod 1 1 100.0
total 46 57 80.7


line stmt bran cond sub pod time code
1             package App::bif::show::version;
2 1     1   1641 use strict;
  1         2  
  1         30  
3 1     1   3 use warnings;
  1         1  
  1         31  
4 1     1   295284 use App::bif::Build;
  1         3  
  1         35  
5 1     1   5 use Bif::Mo;
  1         1  
  1         7  
6 1     1   5 use Config;
  1         2  
  1         41  
7 1     1   4 use Path::Tiny;
  1         1  
  1         455  
8              
9             our $VERSION = '0.1.5_5';
10             extends 'App::bif';
11              
12             sub run {
13 1     1 1 2 my $self = shift;
14 1         4 my $opts = $self->opts;
15              
16             # Taken directly from perlvar(1)
17 1         2 my $this_perl = $^X;
18 1 50       4 if ( $^O ne 'VMS' ) {
19             $this_perl .= $Config{_exe}
20 1 50       57 unless $this_perl =~ m/$Config{_exe}$/i;
21             }
22              
23 1         8 my ( $bold, $reset ) = $self->colours( 'bold', 'reset' );
24              
25             my @data = (
26             [ $bold . 'Host' . $reset, '' ],
27             [ 'archname:', $Config{archname} ],
28             [ 'osname:', $Config{osname} ],
29             [
30             'perl:',
31             sprintf( '%s (%d.%d.%d)',
32             $this_perl, $Config{api_revision},
33             $Config{api_version}, $Config{api_subversion} )
34 1         113 ],
35             [ '-', '' ],
36             [ $bold . 'Software' . $reset, '' ],
37             [ 'built:', $App::bif::Build::DATE ],
38             [ 'commit:', $App::bif::Build::COMMIT ],
39             [ 'version:', $App::bif::Build::VERSION ],
40             [ '-', '' ],
41             [ $bold . 'Installation' . $reset, '' ],
42             [ 'bin:', path($0)->absolute ]
43             );
44              
45 1 50       125 push( @data, [ 'lib:', path($App::bif::Build::FILE)->parent(3) ] )
46             unless defined &static::find;
47              
48 1         587 my $repo = eval { $self->repo };
  1         9  
49 1         6 my $user_repo = eval { $self->user_repo };
  1         15  
50              
51 1 50 33     11 if ( $repo or $user_repo ) {
52 0 0       0 push( @data,
    0          
53             [ '-', '' ],
54             [ $bold . 'Repositories' . $reset, '' ],
55             [ 'current:', $repo ? $repo : '(not found)' ],
56             [ 'user:', $user_repo ? $user_repo : '(not found)' ],
57             );
58             }
59              
60 1         13 print $self->render_table( ' l l ', undef, \@data );
61              
62 1         2167 return $self->ok('ShowVersion');
63             }
64              
65             1;
66             __END__