line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package App::Rakubrew::Variables; |
2
|
|
|
|
|
|
|
require Exporter; |
3
|
|
|
|
|
|
|
our @ISA = qw( Exporter ); |
4
|
|
|
|
|
|
|
our @EXPORT = qw( $brew_name $brew_exec $env_var $local_filename $prefix $versions_dir $shim_dir $zef_dir $git_reference $GIT $GIT_PROTO $PERL5 %git_repos %impls ); |
5
|
|
|
|
|
|
|
|
6
|
3
|
|
|
3
|
|
23
|
use strict; |
|
3
|
|
|
|
|
11
|
|
|
3
|
|
|
|
|
85
|
|
7
|
3
|
|
|
3
|
|
24
|
use warnings; |
|
3
|
|
|
|
|
12
|
|
|
3
|
|
|
|
|
97
|
|
8
|
3
|
|
|
3
|
|
65
|
use 5.010; |
|
3
|
|
|
|
|
14
|
|
9
|
|
|
|
|
|
|
|
10
|
3
|
|
|
3
|
|
445
|
use FindBin qw($RealBin); |
|
3
|
|
|
|
|
1038
|
|
|
3
|
|
|
|
|
371
|
|
11
|
3
|
|
|
3
|
|
22
|
use File::Spec::Functions qw(catfile catdir updir); |
|
3
|
|
|
|
|
23
|
|
|
3
|
|
|
|
|
190
|
|
12
|
3
|
|
|
3
|
|
19
|
use Cwd qw(abs_path); |
|
3
|
|
|
|
|
19
|
|
|
3
|
|
|
|
|
136
|
|
13
|
3
|
|
|
3
|
|
2774
|
use File::HomeDir; |
|
3
|
|
|
|
|
17729
|
|
|
3
|
|
|
|
|
159
|
|
14
|
3
|
|
|
3
|
|
1305
|
use App::Rakubrew::Config; |
|
3
|
|
|
|
|
15
|
|
|
3
|
|
|
|
|
1983
|
|
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
our $brew_name = 'rakubrew'; |
17
|
|
|
|
|
|
|
our $brew_exec = catfile($RealBin, $brew_name); |
18
|
|
|
|
|
|
|
if ($^O =~ /win32/i ) { |
19
|
|
|
|
|
|
|
$brew_exec .= $distro_format eq 'cpan' ? '.bat' : '.exe'; |
20
|
|
|
|
|
|
|
} |
21
|
|
|
|
|
|
|
our $home_env_var = 'RAKUBREW_HOME'; |
22
|
|
|
|
|
|
|
our $env_var = 'RAKUBREW_VERSION'; |
23
|
|
|
|
|
|
|
our $local_filename = '.raku-version'; |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
our $prefix = $ENV{$home_env_var} |
26
|
|
|
|
|
|
|
// ($^O =~ /win32/i ? 'C:\rakubrew' |
27
|
|
|
|
|
|
|
: catdir(File::HomeDir->my_home, '.rakubrew')); |
28
|
|
|
|
|
|
|
$prefix = abs_path($prefix) if (-d $prefix); |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
our $versions_dir = catdir($prefix, 'versions'); |
31
|
|
|
|
|
|
|
our $shim_dir = catdir($prefix, 'shims'); |
32
|
|
|
|
|
|
|
our $git_reference = catdir($prefix, 'git_reference'); |
33
|
|
|
|
|
|
|
our $zef_dir = catdir($prefix, 'repos', 'zef'); |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
our $GIT = $ENV{GIT_BINARY} // 'git'; |
36
|
|
|
|
|
|
|
our $GIT_PROTO = $ENV{GIT_PROTOCOL} // 'https'; |
37
|
|
|
|
|
|
|
our $PERL5 = $^X; |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
sub get_git_url { |
40
|
12
|
|
|
12
|
0
|
28
|
my ($protocol, $host, $user, $project) = @_; |
41
|
12
|
50
|
|
|
|
23
|
if ($protocol eq "ssh") { |
42
|
0
|
|
|
|
|
0
|
return "git\@${host}:${user}/${project}.git"; |
43
|
|
|
|
|
|
|
} else { |
44
|
12
|
|
|
|
|
51
|
return "${protocol}://${host}/${user}/${project}.git"; |
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
} |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
our %git_repos = ( |
49
|
|
|
|
|
|
|
rakudo => get_git_url($GIT_PROTO, 'github.com', 'rakudo', 'rakudo'), |
50
|
|
|
|
|
|
|
MoarVM => get_git_url($GIT_PROTO, 'github.com', 'MoarVM', 'MoarVM'), |
51
|
|
|
|
|
|
|
nqp => get_git_url($GIT_PROTO, 'github.com', 'perl6', 'nqp'), |
52
|
|
|
|
|
|
|
zef => get_git_url($GIT_PROTO, 'github.com', 'ugexe', 'zef'), |
53
|
|
|
|
|
|
|
); |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
our %impls = ( |
56
|
|
|
|
|
|
|
jvm => { |
57
|
|
|
|
|
|
|
name => "jvm", |
58
|
|
|
|
|
|
|
weight => 20, |
59
|
|
|
|
|
|
|
configure => "$PERL5 Configure.pl --backends=jvm --gen-nqp --make-install", |
60
|
|
|
|
|
|
|
need_repo => ['rakudo', 'nqp'], |
61
|
|
|
|
|
|
|
}, |
62
|
|
|
|
|
|
|
moar => { |
63
|
|
|
|
|
|
|
name => "moar", |
64
|
|
|
|
|
|
|
weight => 30, |
65
|
|
|
|
|
|
|
configure => "$PERL5 Configure.pl --backends=moar --gen-moar --make-install", |
66
|
|
|
|
|
|
|
need_repo => ['rakudo', 'nqp', 'MoarVM'], |
67
|
|
|
|
|
|
|
}, |
68
|
|
|
|
|
|
|
'moar-blead' => { |
69
|
|
|
|
|
|
|
name => "moar-blead", |
70
|
|
|
|
|
|
|
weight => 35, |
71
|
|
|
|
|
|
|
configure => "$PERL5 Configure.pl --backends=moar --gen-moar=master --gen-nqp=main --make-install", |
72
|
|
|
|
|
|
|
need_repo => ['rakudo', 'nqp', 'MoarVM'], |
73
|
|
|
|
|
|
|
}, |
74
|
|
|
|
|
|
|
); |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
sub available_backends { |
77
|
0
|
|
|
0
|
0
|
|
map {$_->{name}} sort {$a->{weight} <=> $b->{weight}} values %impls; |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
} |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
1; |
82
|
|
|
|
|
|
|
|