VW/Install.pm untested

filter: Statementstmt 0.0% 0 / 36 Branchbran 0.0% 0 / 2 Conditioncond 0.0% 0 / 6 MC/DCmcdc 0.0% 0 / 3 Subroutinesub 0.0% 0 / 8 Podpod 0.0% 0 / 3 totaltotal 0.0% 0 / 58 CC 2 SCAR 10.6
CC
2
Cov
0%
run
6.0
options
2.0
post_installation_message
2.0
CRAP 2.9
1 package App::VW::Install;
2 use strict;
3 use warnings;
4 use base 'App::VW::Command';
5 use File::Copy;
6 use File::ShareDir 'module_dir';
7  
8 sub options {
9 my ($class) = @_;
10 (
11 $class->SUPER::options,
12 );
13 }
14  
15 our %systems;
16 $systems{debian} = {};
17 $systems{ubuntu} = $systems{debian};
18 $systems{gentoo} = undef;
19 $systems{centos} = undef;
20  
21 sub post_installation_message {
22 my ($self) = @_;
23 qq|---
24  
25 The installation of vw was successful.
26  
27 To start, stop, and restart vw:
28  
29 sudo /etc/init.d/vw start
30 sudo /etc/init.d/vw stop
31 sudo /etc/init.d/vw restart
32  
33 To make vw start upon bootup:
34  
35 sudo update-rc.d vw defaults
36  
37 To disable vw from starting upon boot:
38  
39 sudo update-rc.d -f vw remove
40  
41 |;
42 };
43  
44 sub run {
45 my ($self) = @_;
46 my $src = module_dir('App::VW') . "/etc/init.d/vw-ubuntu";
47 my $dst = "/etc/init.d/vw";
48 $self->verbose("Copying $src to $dst .\n");
49 copy($src, $dst) || die "Can't copy file to $dst: $!";
50 $self->verbose("Making $dst executable.\n");
51 chmod(0755, $dst) || die "Can't make $dst executable: $!";
52 $self->verbose("Creating /etc/vw .\n");
53 if (! -d "/etc/vw" ) {
54 mkdir "/etc/vw" || die "Can't create /etc/vw: $!";
55 }
56 print $self->post_installation_message;
57 return;
58 }
59  
60 1;
61  
62 =head1 NAME
63  
64 App::VW::Install - install init script and config dir for vw
65  
66 =head1 SYNOPSIS
67  
68 Installing the init script and creating the config directory
69  
70 sudo vw install
71  
72 =head1 DESCRIPTION
73  
74 Running the install command will copy an init script into
75 F</etc/init.d/vw> and it will create a config directory in
76 F</etc/vw> that C<vw setup> will populate with YAML files.
77  
78 The format of these YAML files is described in the documentation
79 for L<App::VW>.
80  
81 =cut