lib/Rex/Service/VoidLinux.pm

filter: Statementstmt 50.0% 13 / 26 Branchbran 0.0% 0 / 2 Conditioncond 0.0% 0 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 66.6% 4 / 6 Podpod 0.0% 0 / 2 totaltotal 41.4% 17 / 41 CC 3 SCAR 12.5
CC
3
Cov
42%
new
6.0
action
6.0
BEGIN
1.0
CRAP 3.5
« lib/Rex/Group/Lookup/INI.pm ↑ Summary lib/Rex/PkgConf/Base.pm »
1 #
2 # (c) 2019 Leah Neukirchen <leah@vuxu.org>
3 # based on Rex::Service::Gentoo
4 # (c) Jan Gehring <jan.gehring@gmail.com>
5 #
6  
7 package Rex::Service::VoidLinux;
8  
9 1 ▶use v5.14.4;
Subroutine BEGIN: called CC=1 SCAR=0.0
10 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
11  
12 1 our $VERSION = '1.16.1'; # VERSION
13  
14 1 ▶use Rex::Helper::Run;
Subroutine BEGIN: called CC=1 SCAR=0.0
15  
16 1 ▶use base qw(Rex::Service::Base);
Subroutine BEGIN: called CC=1 SCAR=0.0
17  
18 0 ▶sub new {
Subroutine new: not called CC=2 SCAR=17.9
Pod undocumented
19 0 my $that = shift;
20 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
21 0 my $self = $proto->SUPER::new(@_);
22  
23 0 bless( $self, $proto );
24  
25 $self->{commands} = {
26 0 start => 'ln -sf /etc/sv/%s /var/service',
27 restart => 'sv restart %s',
28 stop => 'rm /var/service/%s',
29 reload => 'sv reload %s',
30 status => 'sv status %s | grep -q ^run:',
31 ensure_stop => 'rm /var/service/%s',
32 ensure_start => 'ln -sf /etc/sv/%s /var/service',
33 service_exists => 'test -d /etc/sv/%s',
34 };
35  
36 0 return $self;
37 }
38  
39 0 ▶sub action {
Subroutine action: not called CC=2 SCAR=17.9
Pod undocumented
40 0 my ( $self, $service, $action ) = @_;
41  
42 0 my $ret_val;
43 eval {
44 0 i_run "sv $action $service >/dev/null", nohup => 1;
45 0 $ret_val = 1;
46 0 ▶ } or do {
Branch: 1 branch
BranchTrueFalseTotal
eval { do { i_run("sv $action $service >/dev/null", "nohup", 1); $ret_val = 1 } } or do { $ret_val = 0 } 0 0 0
47 0 $ret_val = 0;
48 };
49  
50 0 return $ret_val;
51 }
52  
53 1 1;
« lib/Rex/Group/Lookup/INI.pm ↑ Summary lib/Rex/PkgConf/Base.pm »