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 CC 4 SCAR 4.5
CC
4
Cov
100%
_validate_deploy_path
3.0
initialize
2.0
BEGIN
1.0
CRAP 1.6
« Enbld/Exception.pm ↑ Summary Enbld/Target/Attribute/DownloadSite.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 37 ▶sub initialize {
Subroutine initialize: called CC=2 SCAR=6.9
Pod undocumented
16 37 my $pkg = shift;
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 8 ▶sub set_deploy_mode {
Subroutine set_deploy_mode: called CC=1 SCAR=0.0
Pod undocumented
30 8 my $pkg = shift;
31 8 my $path = shift;
32  
33 8 $pkg->_validate_deploy_path( $path );
34  
35 6 $feature->{deploy} = $path;
36 }
37  
38 8 ▶sub _validate_deploy_path {
Subroutine _validate_deploy_path: called CC=3 SCAR=11.0
39 8 my $pkg = shift;
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 Enbld::Error->throw( $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 Enbld::Error->throw( $err );
50 }
51  
52 6 return $deploy_path;
53 }
54  
55 90 ▶sub is_deploy_mode {
Subroutine is_deploy_mode: called CC=1 SCAR=0.0
Pod undocumented
56 90 return $feature->{deploy};
57 }
58  
59 6 ▶sub deploy_path {
Subroutine deploy_path: called CC=1 SCAR=0.0
Pod undocumented
60 6 return $feature->{deploy};
61 }
62  
63 29 ▶sub is_force_install {
Subroutine is_force_install: called CC=1 SCAR=0.0
Pod undocumented
64 29 return $feature->{force};
65 }
66  
67 29 ▶sub is_make_test_all {
Subroutine is_make_test_all: called CC=1 SCAR=0.0
Pod undocumented
68 29 return $feature->{make_test};
69 }
70  
71 4 ▶sub is_current_mode {
Subroutine is_current_mode: called CC=1 SCAR=0.0
Pod undocumented
72 4 return $feature->{current};
73 }
74  
75 33 ▶sub reset {
Subroutine reset: called CC=1 SCAR=0.0
Pod undocumented
76  
77 33 $feature = {
78 force => undef,
79 make_test => undef,
80 deploy => undef,
81 current => undef,
82 };
83  
84 }
85  
86 6 1;
« Enbld/Exception.pm ↑ Summary Enbld/Target/Attribute/DownloadSite.pm »