_build/lib/MyModuleBuilder.pm

filter: Statementstmt 30.5% 40 / 131 Branchbran 8.0% 5 / 62 Conditioncond 50.0% 3 / 6 MC/DCmcdc 33.3% 1 / 3 Subroutinesub 50.0% 11 / 22 Podpod 0.0% 0 / 14 totaltotal 25.2% 60 / 238 CC 34 SCAR 49.1
CC
34
Cov
24%
ACTION_post_install
380.0
process_etc_files
12.0
process_sbin_files
12.0
CRAP 135.4
« blib/lib/XAS/Lib/Stomp/Parser.pm ↑ Summary blib/lib/XAS/Lib/Services.pm »
1 package MyModuleBuilder;
2 1 ▶use Module::Build;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 1 our @ISA = qw(Module::Build);
4  
5 1 ▶ use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 1 ▶ use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 1 ▶ use IO::File;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 1 ▶ use File::Find;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 1 ▶ use File::Basename;
Subroutine BEGIN: called CC=1 SCAR=0.0
10 1 ▶ use File::Spec::Functions qw( catfile catdir rel2abs );
Subroutine BEGIN: called CC=1 SCAR=0.0
11  
12 sub ACTION_post_install {
13 0 ▶ my $self = shift;
Subroutine ACTION_post_install: not called CC=19 SCAR=59.4
Pod undocumented
14  
15 # create xas owner/group
16  
17 0 ▶ unless ($^O eq 'MSWin32') {
Branch: 1 branch
BranchTrueFalseTotal
if ($^O eq 'MSWin32') { } 0 0 0
18  
19 0 ▶ unless (getpwnam('xas')) {
Branch: 1 branch
BranchTrueFalseTotal
unless (getpwnam "xas") 0 0 0
20  
21 0 system("groupadd -f -r xas");
22 0 system("useradd -r -g xas -d /var/lib/xas -s /sbin/nologin -c \"XAS\" xas");
23  
24 }
25  
26 # using the standard filesystem layout
27  
28 0 ▶ system("mkdir /etc/xas") unless ( -e '/etc/xas');
Branch: 1 branch
BranchTrueFalseTotal
unless -e "/etc/xas" 0 0 0
29 0 ▶ system("mkdir /var/log/xas") unless ( -e '/var/log/xas');
Branch: 1 branch
BranchTrueFalseTotal
unless -e "/var/log/xas" 0 0 0
30 0 ▶ system("mkdir /var/lib/xas") unless ( -e '/var/lib/xas');
Branch: 1 branch
BranchTrueFalseTotal
unless -e "/var/lib/xas" 0 0 0
31 0 ▶ system("mkdir /var/run/xas") unless ( -e '/var/run/xas');
Branch: 1 branch
BranchTrueFalseTotal
unless -e "/var/run/xas" 0 0 0
32 0 ▶ system("mkdir /var/spool/xas") unless ( -e '/var/spool/xas');
Branch: 1 branch
BranchTrueFalseTotal
unless -e "/var/spool/xas" 0 0 0
33  
34 # create some spool directories
35  
36 0 ▶ system("mkdir /var/spool/xas/alerts") unless ( -e '/var/spool/xas/alerts');
Branch: 1 branch
BranchTrueFalseTotal
unless -e "/var/spool/xas/alerts" 0 0 0
37 0 ▶ system("mkdir /var/spool/xas/logstash") unless ( -e '/var/spool/xas/logstash');
Branch: 1 branch
BranchTrueFalseTotal
unless -e "/var/spool/xas/logstash" 0 0 0
38  
39 # set ownership/permissions on the files/directories
40  
41 0 system("chown -R root:xas /etc/xas");
42 0 system("chown -R xas:xas /var/log/xas");
43 0 system("chown -R xas:xas /var/lib/xas");
44 0 system("chown -R xas:xas /var/run/xas");
45 0 system("chown -R xas:xas /var/spool/xas");
46  
47 0 system("chmod 0664 /var/spool/xas/alerts");
48 0 system("chmod 0664 /var/spool/xas/logstash");
49  
50 } else {
51  
52 0 my $dir;
53 0 ▶ my $base = defined($ENV{'XAS_ROOT'}) ? $ENV{'XAS_ROOT'} : 'C:\\xas';
Branch: 1 branch
BranchTrueFalseTotal
defined $ENV{'XAS_ROOT'} ? : 0 0 0
54  
55 0 $dir = catdir($base, 'tmp');
56 0 ▶ system("mkdir $dir") unless ( -e $dir);
Branch: 1 branch
BranchTrueFalseTotal
unless -e $dir 0 0 0
57  
58 0 $dir = catdir($base, 'var');
59 0 ▶ system("mkdir $dir") unless ( -e $dir);
Branch: 1 branch
BranchTrueFalseTotal
unless -e $dir 0 0 0
60  
61 0 $dir = catdir($base, 'var', 'log');
62 0 ▶ system("mkdir $dir") unless ( -e $dir);
Branch: 1 branch
BranchTrueFalseTotal
unless -e $dir 0 0 0
63  
64 0 $dir = catdir($base, 'var', 'run');
65 0 ▶ system("mkdir $dir") unless ( -e $dir);
Branch: 1 branch
BranchTrueFalseTotal
unless -e $dir 0 0 0
66  
67 0 $dir = catdir($base, 'var', 'lib');
68 0 ▶ system("mkdir $dir") unless ( -e $dir);
Branch: 1 branch
BranchTrueFalseTotal
unless -e $dir 0 0 0
69  
70 0 $dir = catdir($base, 'var', 'spool');
71 0 ▶ system("mkdir $dir") unless ( -e $dir);
Branch: 1 branch
BranchTrueFalseTotal
unless -e $dir 0 0 0
72  
73 0 $dir = catdir($base, 'var', 'spool', 'alerts');
74 0 ▶ system("mkdir $dir") unless ( -e $dir);
Branch: 1 branch
BranchTrueFalseTotal
unless -e $dir 0 0 0
75  
76 0 $dir = catdir($base, 'var', 'spool', 'logstash');
77 0 ▶ system("mkdir $dir") unless ( -e $dir);
Branch: 1 branch
BranchTrueFalseTotal
unless -e $dir 0 0 0
78  
79 }
80  
81 0 return $self;
82  
83 }
84  
85 sub process_etc_files {
86 0 ▶ my $self = shift;
Subroutine process_etc_files: not called CC=3 SCAR=24.8
Pod undocumented
87  
88 0 my $result;
89 0 my $dir = catfile('blib', 'etc');
90 0 my $files = $self->find_etc_files;
91  
92 0 ▶ mkdir $dir unless (-e $dir);
Branch: 1 branch
BranchTrueFalseTotal
unless -e $dir 0 0 0
93  
94 0 ▶ while (my ($from, $to) = each %$files) {
Branch: 1 branch
BranchTrueFalseTotal
if (() = each %$files) 0 0 0
95  
96 0 $to = catfile('blib', $to);
97 0 $result = $self->copy_if_modified(from => $from, to => $to);
98  
99 }
100  
101 0 return $self;
102  
103 }
104  
105 sub process_sbin_files {
106 0 ▶ my $self = shift;
Subroutine process_sbin_files: not called CC=3 SCAR=24.8
Pod undocumented
107  
108 0 my $result;
109 0 my $dir = catfile('blib', 'sbin');
110 0 my $files = $self->find_sbin_files;
111  
112 0 ▶ mkdir $dir unless (-e $dir);
Branch: 1 branch
BranchTrueFalseTotal
unless -e $dir 0 0 0
113  
114 0 ▶ while (my ($from, $to) = each %$files) {
Branch: 1 branch
BranchTrueFalseTotal
if (() = each %$files) 0 0 0
115  
116 0 $to = catfile('blib', $to);
117 0 $self->make_executable($from);
118 0 $result = $self->copy_if_modified(from => $from, to => $to);
119  
120 }
121  
122 0 return $self;
123  
124 }
125  
126 sub process_initd_files {
127 0 ▶ my $self = shift;
Subroutine process_initd_files: not called CC=3 SCAR=24.8
Pod undocumented
128  
129 0 my $result;
130 0 my $dir = catfile('blib', 'init.d');
131 0 my $files = $self->find_initd_files;
132  
133 0 ▶ mkdir $dir unless (-e $dir);
Branch: 1 branch
BranchTrueFalseTotal
unless -e $dir 0 0 0
134  
135 0 ▶ while (my ($from, $to) = each %$files) {
Branch: 1 branch
BranchTrueFalseTotal
if (() = each %$files) 0 0 0
136  
137 0 $to = catfile('blib', $to);
138 0 $self->make_executable($from);
139 0 $result = $self->copy_if_modified(from => $from, to => $to);
140  
141 }
142  
143 0 return $self;
144  
145 }
146  
147 sub process_sysconf_files {
148 0 ▶ my $self = shift;
Subroutine process_sysconf_files: not called CC=3 SCAR=24.8
Pod undocumented
149  
150 0 my $result;
151 0 my $dir = catfile('blib', 'sysconfig');
152 0 my $files = $self->find_sysconf_files;
153  
154 0 ▶ mkdir $dir unless (-e $dir);
Branch: 1 branch
BranchTrueFalseTotal
unless -e $dir 0 0 0
155  
156 0 ▶ while (my ($from, $to) = each %$files) {
Branch: 1 branch
BranchTrueFalseTotal
if (() = each %$files) 0 0 0
157  
158 0 $to = catfile('blib', $to);
159 0 $self->make_executable($from);
160 0 $result = $self->copy_if_modified(from => $from, to => $to);
161  
162 }
163  
164 0 return $self;
165  
166 }
167  
168 sub process_profiled_files {
169 1 ▶ my $self = shift;
Subroutine process_profiled_files: called CC=3 SCAR=11.0
Pod undocumented
170  
171 1 my $result;
172 1 my $dir = catfile('blib', 'profile.d');
173 1 my $files = $self->find_profiled_files;
174  
175 1 ▶ mkdir $dir unless (-e $dir);
Branch: 1 branch
BranchTrueFalseTotal
unless -e $dir 0 1 1
176  
177 1 ▶ while (my ($from, $to) = each %$files) {
Branch: 1 branch
BranchTrueFalseTotal
if (() = each %$files) 2 1 3
178  
179 2 $to = catfile('blib', $to);
180 2 $self->make_executable($from);
181 2 $result = $self->copy_if_modified(from => $from, to => $to);
182  
183 }
184  
185 1 return $self;
186  
187 }
188  
189 sub process_logrotated_files {
190 0 ▶ my $self = shift;
Subroutine process_logrotated_files: not called CC=3 SCAR=24.8
Pod undocumented
191  
192 0 my $result;
193 0 my $dir = catfile('blib', 'logrotate.d');
194 0 my $files = $self->find_logrotated_files;
195  
196 0 ▶ mkdir $dir unless (-e $dir);
Branch: 1 branch
BranchTrueFalseTotal
unless -e $dir 0 0 0
197  
198 0 ▶ while (my ($from, $to) = each %$files) {
Branch: 1 branch
BranchTrueFalseTotal
if (() = each %$files) 0 0 0
199  
200 0 $to = catfile('blib', $to);
201 0 $result = $self->copy_if_modified(from => $from, to => $to);
202  
203 }
204  
205 0 return $self;
206  
207 }
208  
209 0 ▶ sub find_etc_files { shift->find_all_files_no_svn('etc'); }
Subroutine find_etc_files: not called CC=1 SCAR=6.9
Pod undocumented
210 0 ▶ sub find_sbin_files { shift->find_all_files_no_svn('sbin'); }
Subroutine find_sbin_files: not called CC=1 SCAR=6.9
Pod undocumented
211 0 ▶ sub find_initd_files { shift->find_all_files_no_svn('init.d'); }
Subroutine find_initd_files: not called CC=1 SCAR=6.9
Pod undocumented
212 0 ▶ sub find_sysconf_files { shift->find_all_files_no_svn('sysconfig'); }
Subroutine find_sysconf_files: not called CC=1 SCAR=6.9
Pod undocumented
213 1 ▶ sub find_profiled_files { shift->find_all_files_no_svn('profile.d'); }
Subroutine find_profiled_files: called CC=1 SCAR=0.0
Pod undocumented
214 0 ▶ sub find_logrotated_files { shift->find_all_files_no_svn('logrotate.d'); }
Subroutine find_logrotated_files: not called CC=1 SCAR=6.9
Pod undocumented
215  
216 sub find_all_files_no_svn {
217 1 ▶ my ($self, $dir) = @_;
Subroutine find_all_files_no_svn: called CC=1 SCAR=0.1
Pod undocumented
218  
219 my $sub = sub {
220 3 ▶ return 1 if (($File::Find::dir !~ /SVN/i or
Subroutine __ANON__: called CC=4 SCAR=15.2
Branch: 1 branch
BranchTrueFalseTotal
if not $File::Find::dir =~ /SVN/i && $File::Find::Dir =~ /GIT/i and -f $File::Find::name 2 1 3
Condition50%3/6
not $File::Find::dir =~ /SVN/i && $File::Find::Dir =~ /GIT/i and -f $File::Find::name
!ll&&!rl&&r
012
$File::Find::dir =~ /SVN/i && $File::Find::Dir =~ /GIT/i
!ll&&!rl&&r
300
MC/DC33%1/3
not $File::Find::dir =~ /SVN/i && $File::Find::Dir =~ /GIT/i and -f $File::Find::name
$File::Find::dir =~ /SVN/i $File::Find::Dir =~ /GIT/i -f $File::Find::name
Truth table40%2/5
not(A && B) and C
A= $File::Find::dir =~ /SVN/iB= $File::Find::Dir =~ /GIT/iC= -f $File::Find::name
ABCresult
11X0
0X00
1000
0X11
1011
221 $File::Find::Dir !~ /GIT/i) and
222 -f $File::Find::name);
223 1 };
224  
225 1 return { map {$_, $_} @{ $self->rscan_dir($dir, $sub) } };
226  
227 }
228  
229 1 1;
« blib/lib/XAS/Lib/Stomp/Parser.pm ↑ Summary blib/lib/XAS/Lib/Services.pm »