Enbld/Feature.pm

filter: Statementstmt 100% 31 / 31 Branchbran 100% 6 / 6 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 11 / 11 Podpod 0.0% 0 / 8 totaltotal 85.7% 48 / 56 SCAR 13.9
CC
4
Cov
100%
_validate_deploy_path
3.0
initialize
2.0
BEGIN
1.0
CRAP 4.0
« Enbld/Target/AttributeExtension/Command.pm ↑ Summary Enbld/Target/Attribute/AdditionalArgument.pm »
1 package Enbld::Feature;
2  
3 6 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 6 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 6 require Enbld::Error;
7  
8 6 our $feature = {
9 force => undef,
10 make_test => undef,
11 deploy => undef,
12 current => undef,
13 };
14  
15 sub initialize {
16 37 ▶ my $pkg = shift;
Subroutine initialize: called CC=2 SCAR=6.9
Pod undocumented
17  
18 37 $feature = {
19 force => undef,
20 make_test => undef,
21 deploy => undef,
22 current => undef,
23 @_,
24 };
25  
26 37 ▶ $pkg->set_deploy_mode( $feature->{deploy} ) if $feature->{deploy};
Branch: 1 branch
BranchTrueFalseTotal
if $Enbld::Feature::feature->{"deploy"} 5 32 37
27 }
28  
29 sub set_deploy_mode {
30 8 ▶ my $pkg = shift;
Subroutine set_deploy_mode: called CC=1 SCAR=0.0
Pod undocumented
31 8 my $path = shift;
32  
33 8 $pkg->_validate_deploy_path( $path );
34  
35 6 $feature->{deploy} = $path;
36 }
37  
38 sub _validate_deploy_path {
39 8 ▶ my $pkg = shift;
Subroutine _validate_deploy_path: called CC=3 SCAR=11.0
40 8 my $deploy_path = shift;
41
42 8 ▶ if ( ! -d $deploy_path ) {
Branch: 1 branch
BranchTrueFalseTotal
unless (-d $deploy_path) 1 7 8
43 1 my $err = "'$deploy_path' is nonexistent directory.";
44 1 die( Enbld::Error->new( $err ));
45 }
46  
47 7 ▶ if ( ! -w $deploy_path ) {
Branch: 1 branch
BranchTrueFalseTotal
unless (-w $deploy_path) 1 6 7
48 1 my $err = "no permission to write directory:$deploy_path";
49 1 die( Enbld::Error->new( $err ));
50 }
51  
52 6 return $deploy_path;
53 }
54  
55 sub is_deploy_mode {
56 90 ▶ return $feature->{deploy};
Subroutine is_deploy_mode: called CC=1 SCAR=0.0
Pod undocumented
57 }
58  
59 sub deploy_path {
60 6 ▶ return $feature->{deploy};
Subroutine deploy_path: called CC=1 SCAR=0.0
Pod undocumented
61 }
62  
63 sub is_force_install {
64 29 ▶ return $feature->{force};
Subroutine is_force_install: called CC=1 SCAR=0.0
Pod undocumented
65 }
66  
67 sub is_make_test_all {
68 29 ▶ return $feature->{make_test};
Subroutine is_make_test_all: called CC=1 SCAR=0.0
Pod undocumented
69 }
70  
71 sub is_current_mode {
72 5 ▶ return $feature->{current};
Subroutine is_current_mode: called CC=1 SCAR=0.0
Pod undocumented
73 }
74  
75 sub reset {
76  
77 33 ▶ $feature = {
Subroutine reset: called CC=1 SCAR=0.0
Pod undocumented
78 force => undef,
79 make_test => undef,
80 deploy => undef,
81 current => undef,
82 };
83  
84 }
85  
86 6 1;
« Enbld/Target/AttributeExtension/Command.pm ↑ Summary Enbld/Target/Attribute/AdditionalArgument.pm »