lib/Rex/Apache/Build/Base.pm

filter: Statementstmt 41.5% 22 / 53 Branchbran 0.0% 0 / 4 Conditioncond 0.0% 0 / 36 MC/DCmcdc 0.0% 0 / 19 Subroutinesub 60.0% 6 / 10 Podpod 0.0% 0 / 3 totaltotal 22.4% 28 / 125 CC 19 SCAR 50.6
CC
19
Cov
24%
new
272.0
prefix
12.0
__ANON__
4.5
CRAP 157.3
↑ Summary lib/Rex/Apache/Inject/Properties.pm »
1 #
2 # (c) Jan Gehring <jan.gehring@gmail.com>
3 #
4 # vim: set ts=2 sw=2 tw=0:
5 # vim: set expandtab:
6
7 package Rex::Apache::Build::Base;
8  
9 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
10 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
11  
12 1 ▶use Data::Dumper;
Subroutine BEGIN: called CC=1 SCAR=0.0
13 1 ▶use Rex::Commands::Gather;
Subroutine BEGIN: called CC=1 SCAR=0.0
14  
15 0 ▶sub new {
Subroutine new: not called CC=16 SCAR=56.1
Pod undocumented
16 0 my $that = shift;
17 0 ▶ my $proto = ref($that) || $that;
Condition0%0/3
ref $that || $that
l!l&&r!l&&!r
000
MC/DC0%0/2
ref $that || $that
ref $that $that
Truth table0%0/3
A || B
A= ref $thatB= $that
ABresult
1X1
011
000
18 0 my $self = { @_ };
19  
20 0 my %sys_info = get_system_information();
21  
22 0 ▶ $self->{maintainer} ||= ($ENV{USER} || "unknown");
Condition0%0/5
$self->{"maintainer"} ||= $ENV{"USER"} || "unknown"
l!l&&r!l&&!r
000
$ENV{'USER'} || 'unknown'
l!l
00
MC/DC0%0/2
$self->{"maintainer"} ||= $ENV{"USER"} || "unknown"
$self->{"maintainer"} $ENV{'USER'}
Truth table0%0/3
A ||= B
A= $self->{"maintainer"}B= $ENV{'USER'}
ABresult
1X1
011
000
23 $self->{arch} ||= $sys_info{architecture},
24 0 ▶ $self->{section} ||= "none";
Condition0%0/5
$self->{"arch"} ||= $sys_info{"architecture"}
l!l&&r!l&&!r
000
$self->{"section"} ||= "none"
l!l
00
MC/DC0%0/2
$self->{"arch"} ||= $sys_info{"architecture"}
$self->{"arch"} $sys_info{"architecture"}
MC/DC0%0/1
$self->{"section"} ||= "none"
$self->{"section"}
Truth table0%0/3
A ||= B
A= $self->{"arch"}B= $sys_info{"architecture"}
ABresult
1X1
011
000
Truth table0%0/2
A
A= $self->{"section"}
Aresult
11
00
25 0 ▶ $self->{url} ||= "http://example.tld/";
Condition0%0/2
$self->{"url"} ||= "http://example.tld/"
l!l
00
MC/DC0%0/1
$self->{"url"} ||= "http://example.tld/"
$self->{"url"}
Truth table0%0/2
A
A= $self->{"url"}
Aresult
11
00
26 0 ▶ $self->{version} ||= "1.0";
Condition0%0/2
$self->{"version"} ||= "1.0"
l!l
00
MC/DC0%0/1
$self->{"version"} ||= "1.0"
$self->{"version"}
Truth table0%0/2
A
A= $self->{"version"}
Aresult
11
00
27 0 ▶ $self->{description} ||= "No Description";
Condition0%0/2
$self->{"description"} ||= "No Description"
l!l
00
MC/DC0%0/1
$self->{"description"} ||= "No Description"
$self->{"description"}
Truth table0%0/2
A
A= $self->{"description"}
Aresult
11
00
28 0 ▶ $self->{target} ||= "linux";
Condition0%0/2
$self->{"target"} ||= "linux"
l!l
00
MC/DC0%0/1
$self->{"target"} ||= "linux"
$self->{"target"}
Truth table0%0/2
A
A= $self->{"target"}
Aresult
11
00
29 0 ▶ $self->{depends} ||= [];
Condition0%0/2
$self->{"depends"} ||= []
l!l
00
MC/DC0%0/1
$self->{"depends"} ||= []
$self->{"depends"}
Truth table0%0/2
A
A= $self->{"depends"}
Aresult
11
00
30 0 ▶ $self->{provides} ||= [];
Condition0%0/2
$self->{"provides"} ||= []
l!l
00
MC/DC0%0/1
$self->{"provides"} ||= []
$self->{"provides"}
Truth table0%0/2
A
A= $self->{"provides"}
Aresult
11
00
31 0 ▶ $self->{conflicts} ||= [];
Condition0%0/2
$self->{"conflicts"} ||= []
l!l
00
MC/DC0%0/1
$self->{"conflicts"} ||= []
$self->{"conflicts"}
Truth table0%0/2
A
A= $self->{"conflicts"}
Aresult
11
00
32 0 ▶ $self->{config_files} ||= [];
Condition0%0/2
$self->{"config_files"} ||= []
l!l
00
MC/DC0%0/1
$self->{"config_files"} ||= []
$self->{"config_files"}
Truth table0%0/2
A
A= $self->{"config_files"}
Aresult
11
00
33  
34 0 ▶ $self->{exclude} ||= [];
Condition0%0/2
$self->{"exclude"} ||= []
l!l
00
MC/DC0%0/1
$self->{"exclude"} ||= []
$self->{"exclude"}
Truth table0%0/2
A
A= $self->{"exclude"}
Aresult
11
00
35 0 push(@{ $self->{exclude} }, qr{^Rexfile$}, qr{^Rexfile\.lock$}, qr{^\.git}, qr{^\.svn}, qr{.*~$}, qr{\.sw[a-z]$}, qr{^tmp$}, qr{\.cache$});
36  
37 0 ▶ $self->{source} ||= ".";
Condition0%0/2
$self->{"source"} ||= "."
l!l
00
MC/DC0%0/1
$self->{"source"} ||= "."
$self->{"source"}
Truth table0%0/2
A
A= $self->{"source"}
Aresult
11
00
38  
39  
40 0 bless($self, $proto);
41  
42 0 return $self;
43 }
44  
45 1 for my $name (qw/
46 path
47 source
48 release
49 epoch
50 version
51 vendor
52 license
53 depends
54 conflicts
55 provides
56 arch
57 target
58 description
59 section
60 url
61 post_install
62 pre_install
63 post_uninstall
64 pre_uninstall
65 exclude
66 maintainer
67 priority
68 name
69 config_files
70 file_user
71 file_group
72 0 /) {
73 1 ▶ no strict 'refs';
Subroutine BEGIN: called CC=1 SCAR=0.0
74 26 ▶ *{__PACKAGE__ . "::$name"} = sub {
Subroutine __ANON__: not called CC=2 SCAR=15.1
75 0 my ($self, $data) = @_;
76  
77 0 ▶ if($data) {
Branch: 1 branch
BranchTrueFalseTotal
if ($data) 0 0 0
78 0 $self->{$name} = $data;
79 }
80  
81 0 $self->{$name};
82  
83 26 };
84 1 ▶ use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
85 }
86  
87 0 ▶sub prefix {
Subroutine prefix: not called CC=3 SCAR=24.8
Pod undocumented
88 0 my ($self, $prefix) = @_;
89  
90 0 ▶ if($prefix) {
Branch: 1 branch
BranchTrueFalseTotal
if ($prefix) 0 0 0
91 0 $self->{prefix} = $prefix;
92 }
93  
94 0 ▶ return $self->{prefix} || $self->{path};
Condition0%0/3
$self->{'prefix'} || $self->{'path'}
l!l&&r!l&&!r
000
MC/DC0%0/2
$self->{'prefix'} || $self->{'path'}
$self->{'prefix'} $self->{'path'}
Truth table0%0/3
A || B
A= $self->{'prefix'}B= $self->{'path'}
ABresult
1X1
011
000
95 }
96  
97 0 ▶sub build {
Subroutine build: not called CC=1 SCAR=6.9
Pod undocumented
98 0 my ($self, $target) = @_;
99 0 die("Must be implemented by Class.");
100 }
101  
102 1 1;
↑ Summary lib/Rex/Apache/Inject/Properties.pm »