lib/Rex/Apache/Deploy/Package/tgz.pm

filter: Statementstmt 60.8% 28 / 46 Branchbran 0.0% 0 / 6 Conditioncond 0.0% 0 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 75.0% 9 / 12 Podpod 0.0% 0 / 2 totaltotal 52.1% 37 / 71 CC 5 SCAR 14.6
CC
5
Cov
51%
__ANON__
12.0
new
6.0
deploy
6.0
CRAP 4.3
« lib/Rex/Apache/Deploy/Package/rpm.pm ↑ Summary lib/Rex/Apache/Deploy.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 =head1 NAME
8  
9 Rex::Apache::Deploy::tgz - Deploy tgz package
10  
11 =head1 DESCRIPTION
12  
13 With this module you can deploy a TGZ packages.
14  
15 If the package is not build yet, it will pass all the arguments to the build() function and executes the build on the local machine.
16  
17 =head1 SYNOPSIS
18  
19 deploy "my-software.tgz";
20  
21 deploy "my-software",
22 type => "rpm",
23 version => "1.0",
24 # below this, it is all optional
25 source => "html",
26 path => "/var/www/html";
27  
28 =cut
29  
30 package Rex::Apache::Deploy::Package::tgz;
31  
32 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
33 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
34  
35 1 ▶use Rex::Apache::Build;
Subroutine BEGIN: called CC=1 SCAR=0.0
36 1 ▶use Rex::Commands;
Subroutine BEGIN: called CC=1 SCAR=0.0
37 1 ▶use Rex::Commands::Upload;
Subroutine BEGIN: called CC=1 SCAR=0.0
38 1 ▶use Rex::Commands::Run;
Subroutine BEGIN: called CC=1 SCAR=0.0
39 1 ▶use Rex::Commands::Fs;
Subroutine BEGIN: called CC=1 SCAR=0.0
40 1 ▶use Rex::Apache::Deploy::Package::Base;
Subroutine BEGIN: called CC=1 SCAR=0.0
41 1 ▶use base qw(Rex::Apache::Deploy::Package::Base);
Subroutine BEGIN: called CC=1 SCAR=0.0
42  
43 0 ▶sub new {
Subroutine new: not called CC=2 SCAR=17.9
Pod undocumented
44 0 my $that = shift;
45 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
46 0 my $self = $proto->SUPER::new(@_);
47  
48 0 bless( $self, $proto );
49  
50 0 return $self;
51 }
52  
53 0 ▶sub deploy {
Subroutine deploy: not called CC=2 SCAR=17.9
Pod undocumented
54 0 my ( $self, $package_name, %option ) = @_;
55  
56 0 ▶ LOCAL {
Subroutine __ANON__: not called CC=3 SCAR=24.8
57 0 ▶ if ( !-f $package_name ) {
Branch: 1 branch
BranchTrueFalseTotal
if (not -f $package_name) 0 0 0
58 0 $package_name = $self->name . "-" . $self->version . ".tar.gz";
59  
60 0 ▶ if ( !-f $package_name ) {
Branch: 1 branch
BranchTrueFalseTotal
if (not -f $package_name) 0 0 0
61 0 build( $self->name, %option );
62 }
63 }
64 0 };
65  
66 0 upload $package_name, "/tmp";
67  
68 0 my $to = $self->prefix;
69 0 run "tar -C $to -xzf /tmp/$package_name";
70 0 ▶ if ( $? != 0 ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($? != 0) 0 0 0
71 0 die("Error installing $package_name");
72 }
73  
74 0 Rex::Logger::info("Package $package_name installed.");
75  
76 0 unlink "/tmp/$package_name";
77 }
78  
79 1 1;
« lib/Rex/Apache/Deploy/Package/rpm.pm ↑ Summary lib/Rex/Apache/Deploy.pm »