line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package App::Installer; |
2
|
|
|
|
|
|
|
BEGIN { |
3
|
1
|
|
|
1
|
|
1810
|
$App::Installer::AUTHORITY = 'cpan:GETTY'; |
4
|
|
|
|
|
|
|
} |
5
|
|
|
|
|
|
|
# ABSTRACT: Application class for Installer |
6
|
|
|
|
|
|
|
$App::Installer::VERSION = '0.903'; |
7
|
1
|
|
|
1
|
|
1200
|
use Moo; |
|
1
|
|
|
|
|
23793
|
|
|
1
|
|
|
|
|
7
|
|
8
|
1
|
|
|
1
|
|
3504
|
use Path::Class; |
|
1
|
|
|
|
|
239798
|
|
|
1
|
|
|
|
|
57
|
|
9
|
1
|
|
|
1
|
|
786
|
use IO::All; |
|
1
|
|
|
|
|
12887
|
|
|
1
|
|
|
|
|
9
|
|
10
|
1
|
|
|
1
|
|
1282
|
use namespace::clean; |
|
1
|
|
|
|
|
15606
|
|
|
1
|
|
|
|
|
10
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
has target => ( |
13
|
|
|
|
|
|
|
is => 'ro', |
14
|
|
|
|
|
|
|
required => 1, |
15
|
|
|
|
|
|
|
); |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
has file => ( |
18
|
|
|
|
|
|
|
is => 'ro', |
19
|
|
|
|
|
|
|
lazy => 1, |
20
|
|
|
|
|
|
|
default => sub { 'installer' }, |
21
|
|
|
|
|
|
|
); |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
has installer_code => ( |
24
|
|
|
|
|
|
|
is => 'ro', |
25
|
|
|
|
|
|
|
predicate => 1, |
26
|
|
|
|
|
|
|
); |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
has 'url' => ( |
29
|
|
|
|
|
|
|
is => 'ro', |
30
|
|
|
|
|
|
|
predicate => 1, |
31
|
|
|
|
|
|
|
); |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
sub install_to_target { |
34
|
0
|
|
|
0
|
0
|
|
my ( $self ) = @_; |
35
|
0
|
|
|
|
|
|
my $target = $self->target; |
36
|
0
|
|
|
|
|
|
$target = dir($target)->absolute->stringify; |
37
|
0
|
|
|
|
|
|
my $installer_code; |
38
|
0
|
0
|
|
|
|
|
if ($self->has_installer_code) { |
|
|
0
|
|
|
|
|
|
39
|
0
|
|
|
|
|
|
$installer_code = $self->installer_code; |
40
|
|
|
|
|
|
|
} elsif ($self->has_url) { |
41
|
0
|
|
|
|
|
|
$installer_code = io($self->url)->get->content; |
42
|
|
|
|
|
|
|
} else { |
43
|
0
|
|
|
|
|
|
$installer_code = io($self->file)->all; |
44
|
|
|
|
|
|
|
} |
45
|
0
|
|
|
|
|
|
my $target_class = 'App::Installer::Sandbox'.$$; |
46
|
|
|
|
|
|
|
|
47
|
0
|
|
|
|
|
|
my ( $err ); |
48
|
|
|
|
|
|
|
{ |
49
|
0
|
|
|
|
|
|
local $@; |
|
0
|
|
|
|
|
|
|
50
|
0
|
|
|
|
|
|
eval <
|
51
|
|
|
|
|
|
|
package $target_class; |
52
|
|
|
|
|
|
|
no strict; |
53
|
|
|
|
|
|
|
no warnings; |
54
|
|
|
|
|
|
|
use Installer; |
55
|
|
|
|
|
|
|
use IO::All -utf8; |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
install_to '$target' => sub { |
58
|
|
|
|
|
|
|
$installer_code; |
59
|
|
|
|
|
|
|
}; |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
EVAL |
62
|
0
|
|
|
|
|
|
$err = $@; |
63
|
|
|
|
|
|
|
} |
64
|
|
|
|
|
|
|
|
65
|
0
|
0
|
|
|
|
|
if ($err) { die "$err" }; |
|
0
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
} |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
1; |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
__END__ |