line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Carmel::Environment; |
2
|
1
|
|
|
1
|
|
6
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
29
|
|
3
|
1
|
|
|
1
|
|
4
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
29
|
|
4
|
1
|
|
|
1
|
|
4
|
use Config; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
41
|
|
5
|
1
|
|
|
1
|
|
6
|
use Path::Tiny; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
52
|
|
6
|
1
|
|
|
1
|
|
6
|
use Carmel::CPANfile; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
29
|
|
7
|
1
|
|
|
1
|
|
335
|
use Carmel::Repository; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
125
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
use Class::Tiny { |
10
|
0
|
|
|
|
|
|
perl_arch => sub { "$Config{version}-$Config{archname}" }, |
11
|
0
|
|
|
|
|
|
repository_base => sub { $_[0]->build_repository_base }, |
12
|
0
|
|
|
|
|
|
repo => sub { $_[0]->build_repo }, |
13
|
0
|
|
0
|
|
|
|
home => sub { Path::Tiny->new($ENV{HOME} || $ENV{HOMEPATH}) }, |
14
|
0
|
|
|
|
|
|
cpanfile => sub { $_[0]->build_cpanfile }, |
15
|
0
|
|
|
|
|
|
snapshot => sub { $_[0]->build_snapshot }, |
16
|
1
|
|
|
1
|
|
7
|
}; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
1224
|
|
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
sub build_repository_base { |
19
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
20
|
0
|
|
0
|
|
|
|
Path::Tiny->new($ENV{PERL_CARMEL_REPO} || $self->home->child(".carmel/" . $self->perl_arch)); |
21
|
|
|
|
|
|
|
} |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
sub build_repo { |
24
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
25
|
0
|
|
|
|
|
|
Carmel::Repository->new(path => $self->repository_base->child('builds')); |
26
|
|
|
|
|
|
|
} |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
sub build_cpanfile { |
29
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
30
|
0
|
|
|
|
|
|
my $path = Path::Tiny->new($self->locate_cpanfile); |
31
|
0
|
|
|
|
|
|
Carmel::CPANfile->new(path => $path->absolute); |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
sub locate_cpanfile { |
35
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
36
|
|
|
|
|
|
|
|
37
|
0
|
|
|
|
|
|
my $path = $ENV{PERL_CARMEL_CPANFILE}; |
38
|
0
|
0
|
|
|
|
|
if ($path) { |
39
|
0
|
|
|
|
|
|
return $path; |
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
|
42
|
0
|
|
|
|
|
|
my $current = Path::Tiny->cwd; |
43
|
0
|
|
|
|
|
|
my $previous = ''; |
44
|
|
|
|
|
|
|
|
45
|
0
|
|
0
|
|
|
|
until ($current eq '/' or $current eq $previous) { |
46
|
0
|
|
|
|
|
|
my $try = $current->child('cpanfile'); |
47
|
0
|
0
|
|
|
|
|
return $try if $try->is_file; |
48
|
0
|
|
|
|
|
|
($previous, $current) = ($current, $current->parent); |
49
|
|
|
|
|
|
|
} |
50
|
|
|
|
|
|
|
|
51
|
0
|
|
|
|
|
|
return 'cpanfile'; # fallback, most certainly fails later |
52
|
|
|
|
|
|
|
} |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
sub build_snapshot { |
55
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
56
|
|
|
|
|
|
|
|
57
|
0
|
|
|
|
|
|
my $path = $self->snapshot_path; |
58
|
0
|
0
|
0
|
|
|
|
if ($path && $path->exists) { |
59
|
0
|
|
|
|
|
|
require Carton::Snapshot; |
60
|
0
|
|
|
|
|
|
my $snapshot = Carton::Snapshot->new(path => $path); |
61
|
0
|
|
|
|
|
|
$snapshot->load; |
62
|
0
|
|
|
|
|
|
return $snapshot; |
63
|
|
|
|
|
|
|
} |
64
|
|
|
|
|
|
|
|
65
|
0
|
|
|
|
|
|
return; |
66
|
|
|
|
|
|
|
} |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
sub snapshot_path { |
69
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
70
|
0
|
|
|
|
|
|
Path::Tiny->new($self->cpanfile->path . ".snapshot"); |
71
|
|
|
|
|
|
|
} |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
1; |