line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package App::Rakubrew::Shell::Bash; |
2
|
1
|
|
|
1
|
|
7
|
use App::Rakubrew::Shell; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
43
|
|
3
|
|
|
|
|
|
|
our @ISA = "App::Rakubrew::Shell"; |
4
|
1
|
|
|
1
|
|
5
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
18
|
|
5
|
1
|
|
|
1
|
|
4
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
37
|
|
6
|
1
|
|
|
1
|
|
17
|
use 5.010; |
|
1
|
|
|
|
|
3
|
|
7
|
|
|
|
|
|
|
|
8
|
1
|
|
|
1
|
|
5
|
use App::Rakubrew::Variables; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
165
|
|
9
|
1
|
|
|
1
|
|
7
|
use App::Rakubrew::Tools; |
|
1
|
|
|
|
|
46
|
|
|
1
|
|
|
|
|
68
|
|
10
|
1
|
|
|
1
|
|
9
|
use App::Rakubrew::VersionHandling; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
155
|
|
11
|
1
|
|
|
1
|
|
482
|
use App::Rakubrew::Build; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
634
|
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
sub supports_hooking { |
14
|
0
|
|
|
0
|
0
|
0
|
my $self = shift; |
15
|
0
|
|
|
|
|
0
|
1; |
16
|
|
|
|
|
|
|
} |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
sub install_note { |
19
|
1
|
|
|
1
|
0
|
550
|
my $text = <
|
20
|
|
|
|
|
|
|
Load $brew_name automatically in `bash` by adding |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
eval "\$($brew_exec init Bash)" |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
to ~/.bashrc. This can be easily done using: |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
echo 'eval "\$($brew_exec init Bash)"' >> ~/.bashrc |
27
|
|
|
|
|
|
|
EOT |
28
|
|
|
|
|
|
|
|
29
|
1
|
50
|
|
|
|
5
|
if ($prefix =~ / /) { |
30
|
0
|
|
|
|
|
0
|
$text .= <
|
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
=================================== WARNING ================================== |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
rakubrews home directory is currently |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
$prefix |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
That folder contains spaces. This will break building rakudos as the build |
39
|
|
|
|
|
|
|
system currently doesn't work in such a path. You can work around this problem |
40
|
|
|
|
|
|
|
by changing that folder to a directory without spaces. Do so by putting |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
export RAKUBREW_HOME=/some/folder/without/space/rakubrew |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
in your `~/.bashrc` file *before* the `eval` line. |
45
|
|
|
|
|
|
|
EOW |
46
|
|
|
|
|
|
|
} |
47
|
1
|
|
|
|
|
16
|
return $text; |
48
|
|
|
|
|
|
|
} |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
sub get_init_code { |
51
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
52
|
0
|
|
|
|
|
|
my $path = $ENV{PATH}; |
53
|
0
|
|
|
|
|
|
$path = $self->clean_path($path); |
54
|
0
|
0
|
|
|
|
|
if (get_brew_mode() eq 'env') { |
55
|
0
|
|
|
|
|
|
my $version = get_global_version(); |
56
|
0
|
0
|
0
|
|
|
|
if ($version && $version ne 'system' && !is_version_broken($version)) { |
|
|
|
0
|
|
|
|
|
57
|
0
|
|
|
|
|
|
$path = join(':', get_bin_paths($version), $path); |
58
|
|
|
|
|
|
|
} |
59
|
|
|
|
|
|
|
} |
60
|
|
|
|
|
|
|
else { # get_brew_mode() eq 'shim' |
61
|
0
|
|
|
|
|
|
$path = join(':', $shim_dir, $path); |
62
|
|
|
|
|
|
|
} |
63
|
0
|
|
|
|
|
|
return <
|
64
|
|
|
|
|
|
|
export PATH="$path" |
65
|
|
|
|
|
|
|
$brew_name() { |
66
|
|
|
|
|
|
|
command $brew_exec internal_hooked Bash "\$@" && |
67
|
|
|
|
|
|
|
eval "`command $brew_exec internal_shell_hook Bash post_call_eval "\$@"`" |
68
|
|
|
|
|
|
|
} |
69
|
|
|
|
|
|
|
_${brew_name}_completions() { |
70
|
|
|
|
|
|
|
COMPREPLY=(\$(command $brew_exec internal_shell_hook Bash completions \$COMP_CWORD \$COMP_LINE)) |
71
|
|
|
|
|
|
|
\$(command $brew_exec internal_shell_hook Bash completion_options \$COMP_CWORD \$COMP_LINE) |
72
|
|
|
|
|
|
|
} |
73
|
|
|
|
|
|
|
complete -F _${brew_name}_completions $brew_name |
74
|
|
|
|
|
|
|
EOT |
75
|
|
|
|
|
|
|
} |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
sub post_call_eval { |
78
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
79
|
0
|
|
|
|
|
|
$self->print_shellmod_code(@_); |
80
|
|
|
|
|
|
|
} |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
sub get_path_setter_code { |
83
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
84
|
0
|
|
|
|
|
|
my $path = shift; |
85
|
0
|
|
|
|
|
|
return "export PATH=\"$path\""; |
86
|
|
|
|
|
|
|
} |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
sub get_shell_setter_code { |
89
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
90
|
0
|
|
|
|
|
|
my $version = shift; |
91
|
0
|
|
|
|
|
|
return "export $env_var=\"$version\""; |
92
|
|
|
|
|
|
|
} |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
sub get_shell_unsetter_code { |
95
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
96
|
0
|
|
|
|
|
|
return "unset $env_var"; |
97
|
|
|
|
|
|
|
} |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
sub completions { |
100
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
101
|
0
|
|
|
|
|
|
my $index = shift; |
102
|
0
|
|
|
|
|
|
say join(' ', $self->get_completions($self->strip_executable($index, @_))); |
103
|
|
|
|
|
|
|
} |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
sub completion_options { |
106
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
107
|
0
|
|
|
|
|
|
my $index = shift; |
108
|
0
|
|
|
|
|
|
my @words = @_; |
109
|
|
|
|
|
|
|
|
110
|
0
|
0
|
0
|
|
|
|
if($index == 3 && $words[1] eq 'register') { |
111
|
0
|
|
|
|
|
|
say 'compopt -o nospace'; |
112
|
|
|
|
|
|
|
} |
113
|
|
|
|
|
|
|
else { |
114
|
0
|
|
|
|
|
|
say ''; |
115
|
|
|
|
|
|
|
} |
116
|
|
|
|
|
|
|
} |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
1; |
119
|
|
|
|
|
|
|
|