blib/lib/Liveman/App/liveman.pm

filter: Statementstmt 42.5% 20 / 47 Branchbran 13.6% 3 / 22 Conditioncond 0.0% 0 / 2 MC/DCmcdc 0.0% 0 / 1 Subroutinesub 100% 5 / 5 Podpod n/a totaltotal 36.3% 28 / 77 CC 1 SCAR 0.0
CC
1
Cov
32%
BEGIN
1.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.0
« /usr/local/bin/prove ↑ Summary script/liveman »
1 package Liveman::App::liveman;
2 1 ▶use common::sense;
Subroutine BEGIN: called CC=1 SCAR=0.0
3  
4 1 ▶use Getopt::Long qw(:config no_ignore_case bundling);
Subroutine BEGIN: called CC=1 SCAR=0.0
5 1 ▶use Pod::Usage;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 1 ▶use Term::ANSIColor qw/:constants/;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 1 ▶use Liveman;
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 1 $| = 1;
11  
12 1 my $parse_options_ok = GetOptions(
13 'help|h' => \( my $help = 0 ),
14 'version|v' => \( my $version = 0 ),
15 'man' => \( my $man = 0 ),
16 'O|options=s' => \( my $options ),
17 'p|prove!' => \( my $prove = 0 ),
18 'o|open!' => \( my $open = 0 ),
19 'c|compile!' => \( my $compile_only = 0 ),
20 'f|force!' => \( my $compile_force = 0 ),
21 'a|append!' => \( my $append = 0 ),
22 'A|new!' => \( my $project = 0 ),
23 'V|with-version!' => \( my $cpanfile_with_version = 0 ),
24 'D|cpanfile!' => \( my $cpanfile = 0 ),
25 'd|diff_cpanfile:s' => \( my $diff_cpanfile ),
26 );
27  
28 1 ▶if( !$parse_options_ok ) {
Branch: 8 branches
BranchTrueFalseTotal
if (not $parse_options_ok) { } 0 1 1
elsif ($help) { } 0 1 1
elsif ($version) { } 1 0 1
elsif ($man) { } 0 0 0
elsif ($project) { } 0 0 0
elsif ($append) { } 0 0 0
elsif ($cpanfile) { } 0 0 0
elsif (defined $diff_cpanfile) { } 0 0 0
29 0 pod2usage(2);
30 }
31 elsif($help) {
32 pod2usage(
33 0 -input => $INC{__PACKAGE__ =~ s/::/\//gr . ".pm"},
34 -sections => "NAME|SYNOPSIS|DESCRIPTION|OPTIONS",
35 -verbose => 99
36 );
37 }
38 elsif($version) {
39 1 print Liveman->VERSION, "\n";
40 }
41 elsif($man) {
42 pod2usage(
43 0 -input => $INC{__PACKAGE__ =~ s/::/\//gr . ".pm"},
44 -exitval => 0,
45 -verbose => 2,
46 );
47 }
48 elsif($project) {
49 0 require Liveman::Project;
50 0 Liveman::Project->new(pkg => $ARGV[0], license => $ARGV[1])->make;
51 }
52 elsif($append) {
53 0 require Liveman::Append;
54 0 my $liveman = Liveman::Append->new(files => \@ARGV)->appends;
55 0 ▶ exit $liveman->{count} > 0? 0: 1;
Branch: 1 branch
BranchTrueFalseTotal
exit $liveman->{'count'} > 0 ? : 0 0 0
56 }
57 elsif($cpanfile) {
58 0 require Liveman::Cpanfile;
59 0 print Liveman::Cpanfile->new->cpanfile($cpanfile_with_version);
60 }
61 elsif(defined $diff_cpanfile) {
62 0 require File::Spec;
63 0 require File::Slurper;
64 0 require File::Path;
65 0 require Liveman::Cpanfile;
66 0 my $cpanfile = Liveman::Cpanfile->new->cpanfile($cpanfile_with_version);
67  
68 0 my $cpanfile_path = File::Spec->catdir(File::Spec->tmpdir, '.liveman');
69 0 File::Path::mkpath($cpanfile_path);
70 0 $cpanfile_path = File::Spec->catfile($cpanfile_path , 'cpanfile');
71 0 File::Slurper::write_text($cpanfile_path, $cpanfile);
72
73 0 ▶ $diff_cpanfile ||= 'meld';
Condition0%0/2
$diff_cpanfile ||= "meld"
l!l
00
MC/DC0%0/1
$diff_cpanfile ||= "meld"
$diff_cpanfile
Truth table0%0/2
A
A= $diff_cpanfile
Aresult
11
00
74  
75 0 my $res = system $diff_cpanfile, $cpanfile_path, 'cpanfile';
76 0 ▶ print "$diff_cpanfile failed\n" if $res;
Branch: 1 branch
BranchTrueFalseTotal
if $res 0 0 0
77 0 exit $res;
78 }
79 else {
80 0 my $liveman = Liveman->new(
81 files => \@ARGV,
82 options => $options,
83 prove => $prove,
84 open => $open,
85 compile_force => $compile_force,
86 );
87 0 $liveman->transforms;
88 0 ▶ exit 0 if $compile_only;
Branch: 1 branch
BranchTrueFalseTotal
if $compile_only 0 0 0
89 0 exit $liveman->tests->{exit_code};
90 }
91  
92 1 1;
93  
94 __END__
« /usr/local/bin/prove ↑ Summary script/liveman »