lib/Rex/Pkg/SunOS/pkg.pm

filter: Statementstmt 47.5% 19 / 40 Branchbran 0.0% 0 / 6 Conditioncond 0.0% 0 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 75.0% 6 / 8 Podpod 0.0% 0 / 2 totaltotal 40.9% 25 / 61 CC 6 SCAR 25.6
CC
6
Cov
39%
get_installed
30.0
new
6.0
BEGIN
1.0
CRAP 12.9
« lib/Rex/Pkg/Redhat.pm ↑ Summary lib/Rex/Inventory/DMIDecode.pm »
1 #
2 # (c) Jan Gehring <jan.gehring@gmail.com>
3 #
4  
5 package Rex::Pkg::SunOS::pkg;
6  
7 1 ▶use v5.14.4;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 1 our $VERSION = '1.16.1'; # VERSION
11  
12 1 ▶use Rex::Helper::Run;
Subroutine BEGIN: called CC=1 SCAR=0.0
13 1 ▶use Rex::Commands::File;
Subroutine BEGIN: called CC=1 SCAR=0.0
14 1 ▶use Rex::Pkg::SunOS;
Subroutine BEGIN: called CC=1 SCAR=0.0
15  
16 1 ▶use base qw(Rex::Pkg::SunOS);
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 install => 'pkg install -q --accept %s',
27 install_version => 'pkg install -q --accept %s',
28 remove => 'pkg uninstall -r -q %s',
29 update_package_db => 'pkg refresh',
30 };
31  
32 0 return $self;
33 }
34  
35 0 ▶sub get_installed {
Subroutine get_installed: not called CC=5 SCAR=34.0
Pod undocumented
36 0 my ($self) = @_;
37  
38 0 my @lines = i_run "pkg info -l";
39  
40 0 my @pkg;
41  
42 0 my ( $version, $name );
43 0 for my $line (@lines) {
44 0 ▶ if ( $line =~ m/^$/ ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($line =~ /^$/u) 0 0 0
45 0 push(
46 @pkg,
47 {
48 name => $name,
49 version => $version,
50 }
51 );
52 0 next;
53 }
54  
55 0 ▶ if ( $line =~ m/Name: .*\/(.*?)$/ ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($line =~ m[Name: .*/(.*?)$]u) 0 0 0
56 0 $name = $1;
57 0 next;
58 }
59  
60 0 ▶ if ( $line =~ m/Version: (.*)$/ ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($line =~ /Version: (.*)$/u) 0 0 0
61 0 $version = $1;
62 0 next;
63 }
64 }
65  
66 0 return @pkg;
67 }
68  
69 1 1;
« lib/Rex/Pkg/Redhat.pm ↑ Summary lib/Rex/Inventory/DMIDecode.pm »