rvm 1.0.2 → 1.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/binscripts/rvm +3 -2
- data/binscripts/rvm-update-head +2 -1
- data/binscripts/rvm-update-latest +2 -1
- data/binscripts/rvmsudo +3 -3
- data/contrib/install-system-wide +2 -1
- data/install +3 -2
- data/lib/VERSION.yml +1 -1
- data/rvm.gemspec +2 -3
- data/scripts/alias +14 -6
- data/scripts/array +1 -1
- data/scripts/cd +3 -2
- data/scripts/cleanup +1 -1
- data/scripts/cli +154 -98
- data/scripts/docs +5 -1
- data/scripts/env +4 -1
- data/scripts/environment-convertor +4 -2
- data/scripts/fetch +2 -0
- data/scripts/gemsets +133 -71
- data/scripts/hash +3 -3
- data/scripts/help +4 -3
- data/scripts/hook +7 -3
- data/scripts/info +18 -12
- data/scripts/install +3 -2
- data/scripts/list +48 -20
- data/scripts/log +15 -14
- data/scripts/maglev +1 -1
- data/scripts/manage +49 -33
- data/scripts/match +2 -2
- data/scripts/md5 +5 -3
- data/scripts/migrate +7 -3
- data/scripts/notes +5 -4
- data/scripts/package +7 -4
- data/scripts/patches +6 -5
- data/scripts/patchsets +8 -3
- data/scripts/repair +7 -4
- data/scripts/rubygems +5 -4
- data/scripts/rvm +11 -13
- data/scripts/rvm-install +3 -2
- data/scripts/selector +181 -106
- data/scripts/set +8 -7
- data/scripts/snapshot +6 -4
- data/scripts/tools +6 -4
- data/scripts/update +3 -2
- data/scripts/upgrade +13 -12
- data/scripts/utility +282 -117
- metadata +4 -5
- data/scripts/man +0 -0
data/scripts/match
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
#!/usr/bin/env bash
|
2
2
|
|
3
|
-
if [[ -z "$1" ]] || [[ -z "$2" ]] ; then exit 1 ; fi
|
3
|
+
if [[ -z "${1:-""}" ]] || [[ -z "${2:-""}" ]] ; then exit 1 ; fi
|
4
4
|
|
5
|
-
if [[ -n "$(echo "$1" | awk "/${2}/")" ]] ; then exit 0 ; else exit 1 ; fi
|
5
|
+
if [[ -n "$(echo "${1}" | awk "/${2}/")" ]] ; then exit 0 ; else exit 1 ; fi
|
6
6
|
|
data/scripts/md5
CHANGED
@@ -1,9 +1,11 @@
|
|
1
1
|
#!/usr/bin/env bash
|
2
2
|
|
3
|
-
if [[ "$rvm_trace_flag" -eq
|
3
|
+
if [[ "$rvm_trace_flag" -eq 2 ]] ; then set -x ; export rvm_trace_flag ; fi
|
4
4
|
|
5
|
-
|
6
|
-
|
5
|
+
args=($*)
|
6
|
+
file="${args[0]}"
|
7
|
+
md5="${args[1]}"
|
8
|
+
args="$(echo ${args[@]:2}) " # Strip trailing / leading / extra spacing.
|
7
9
|
|
8
10
|
if [[ "Linux" = "$(uname)" ]] ; then
|
9
11
|
command="md5sum"
|
data/scripts/migrate
CHANGED
@@ -7,7 +7,6 @@ source "$rvm_scripts_path/base"
|
|
7
7
|
usage() {
|
8
8
|
echo "Usage: rvm migrate from to" >&2
|
9
9
|
echo "Moves all gemsets from one ruby to another." >&2
|
10
|
-
exit 1
|
11
10
|
}
|
12
11
|
|
13
12
|
confirm() {
|
@@ -106,8 +105,13 @@ migrate_rubies() {
|
|
106
105
|
|
107
106
|
}
|
108
107
|
|
109
|
-
|
110
|
-
|
108
|
+
args=($*)
|
109
|
+
source_ruby="${args[0]}"
|
110
|
+
destination_ruby="${args[1]}"
|
111
|
+
args="$(echo ${args[@]:2}) " # Strip trailing / leading / extra spacing.
|
112
|
+
|
113
|
+
if [[ -z "$source_ruby" || -z "$destination_ruby" ]]; then
|
114
|
+
usage ; exit 1
|
111
115
|
fi
|
112
116
|
|
113
117
|
source_ruby="$1"; shift
|
data/scripts/notes
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
#!/usr/bin/env bash
|
2
2
|
|
3
3
|
system="$(uname)"
|
4
|
-
item="
|
4
|
+
item="* "
|
5
5
|
|
6
6
|
if [[ "Linux" = "$system" ]] ; then
|
7
7
|
for file in /etc/*-release ; do
|
8
8
|
release="( $(cat $file) )" ; break
|
9
9
|
done
|
10
|
-
printf "\n\
|
10
|
+
printf "\n\nNotes for ${system} $release\n"
|
11
11
|
|
12
|
-
rvm_aptitude_binary="$(command -v aptitude)"
|
12
|
+
rvm_aptitude_binary="$(command -v aptitude || comand -v apt-get)"
|
13
13
|
rvm_emerge_binary="$(command -v emerge)"
|
14
14
|
rvm_pacman_binary="$(command -v pacman)"
|
15
15
|
rvm_yum_binary="$(command -v yum)"
|
@@ -18,6 +18,7 @@ if [[ "Linux" = "$system" ]] ; then
|
|
18
18
|
printf "\n $item curl is required.\n"
|
19
19
|
printf "\n $item patch is required (for ree, some ruby head's).\n"
|
20
20
|
printf "\n $item If you wish to install rbx and/or any MRI head (eg. 1.9.2-head) then you must install and use rvm 1.8.7 first.\n"
|
21
|
+
printf "\n $item If you wish to have the 'pretty colors' again, set 'export rvm_pretty_print=1' in ~/.rvmrc.\n"
|
21
22
|
|
22
23
|
if [[ ! -z "$rvm_aptitude_binary" ]] ; then
|
23
24
|
printf "\n $item For JRuby (if you wish to use it) you will need:"
|
@@ -62,7 +63,7 @@ if [[ "Linux" = "$system" ]] ; then
|
|
62
63
|
fi
|
63
64
|
elif [[ "Darwin" = "$system" ]] ; then
|
64
65
|
release="( $(sw_vers -productName) )"
|
65
|
-
printf "\
|
66
|
+
printf "\nNotes for ${system} $release\n"
|
66
67
|
printf "\n $item For Snow Leopard be sure to have XCode Tools Version 3.2.1 (1613) or later (there were bugs with the dvd release version)."
|
67
68
|
printf "\n $item You should download the latest XCode tools from developer.apple.com. This is necessary since the dvd install for Snow Leopard has bugs."
|
68
69
|
printf "\n $item If you intend on installing MacRuby you must install LLVM first."
|
data/scripts/package
CHANGED
@@ -1,12 +1,15 @@
|
|
1
1
|
#!/usr/bin/env bash
|
2
|
+
|
3
|
+
if [[ "$rvm_trace_flag" -eq 2 ]] ; then set -x ; export rvm_trace_flag ; fi
|
4
|
+
|
2
5
|
rvm_base_except="selector"
|
3
6
|
source "$rvm_scripts_path/base"
|
4
7
|
|
5
8
|
# Tools to make managing ruby dependencies inside of rvm easier.
|
6
|
-
|
7
|
-
action="$
|
8
|
-
library="$1"
|
9
|
-
args="$(echo
|
9
|
+
args=($*)
|
10
|
+
action="${args[0]}"
|
11
|
+
library="${args[1]}"
|
12
|
+
args="$(echo ${args[@]:2})"
|
10
13
|
|
11
14
|
install_package() {
|
12
15
|
|
data/scripts/patches
CHANGED
@@ -12,12 +12,13 @@ __rvm_patch_lookup_path() {
|
|
12
12
|
}
|
13
13
|
|
14
14
|
__rvm_expand_patch_name() {
|
15
|
-
|
16
|
-
|
15
|
+
local name="$1"
|
16
|
+
[[ -z "$name" ]] && return 0
|
17
|
+
expanded_patch_name="$("$rvm_scripts_path/patchsets" show "$name")"
|
17
18
|
if [[ "$?" == "0" ]]; then
|
18
|
-
echo "$expanded_patch_name"
|
19
|
-
elif [[ "$
|
20
|
-
echo "$
|
19
|
+
echo "${expanded_patch_name}"
|
20
|
+
elif [[ "$name" != "default" ]]; then
|
21
|
+
echo "$name"
|
21
22
|
fi ; unset expanded_patch_name
|
22
23
|
}
|
23
24
|
|
data/scripts/patchsets
CHANGED
@@ -34,13 +34,18 @@ __rvm_lookup_full_patch_path() {
|
|
34
34
|
}
|
35
35
|
|
36
36
|
usage() {
|
37
|
-
echo "Usage: 'rvm patchset {show,lookup}'"
|
37
|
+
echo "Usage: 'rvm patchset {show,lookup} [patchset]'"
|
38
38
|
echo " Tools for manipulating patchsets."
|
39
39
|
return 1
|
40
40
|
}
|
41
41
|
|
42
|
-
|
43
|
-
|
42
|
+
args=($*)
|
43
|
+
action="${args[0]}"
|
44
|
+
patchset="${args[1]}"
|
45
|
+
args="$(echo ${args[@]:2}) " # Strip trailing / leading / extra spacing.
|
46
|
+
|
47
|
+
case "$action" in
|
48
|
+
show|lookup) lookup_patchset "$patchset" ;;
|
44
49
|
*) usage ;;
|
45
50
|
esac
|
46
51
|
|
data/scripts/repair
CHANGED
@@ -50,12 +50,15 @@ repair_all() {
|
|
50
50
|
"$rvm_scripts_path/log" "info" "All items repaired."
|
51
51
|
}
|
52
52
|
|
53
|
-
|
54
|
-
|
55
|
-
|
53
|
+
args=($*)
|
54
|
+
action="${args[0]}"
|
55
|
+
args="$(echo ${args[@]:1}) " # Strip trailing / leading / extra spacing.
|
56
|
+
|
57
|
+
if [[ -z "$action" ]]; then
|
58
|
+
usage ; exit $?
|
56
59
|
fi
|
57
60
|
|
58
|
-
case "$
|
61
|
+
case "$action" in
|
59
62
|
all) repair_all ;;
|
60
63
|
symlinks) repair_symlinks ;;
|
61
64
|
environments) repair_environments ;;
|
data/scripts/rubygems
CHANGED
@@ -87,10 +87,11 @@ fi
|
|
87
87
|
#
|
88
88
|
# rvm rubygems use X
|
89
89
|
#
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
90
|
+
args=($*)
|
91
|
+
version="${args[0]}"
|
92
|
+
args="$(echo ${args[@]:1}) " # Strip trailing / leading / extra spacing.
|
93
|
+
|
94
|
+
if [[ -z "$version" ]] ; then
|
94
95
|
"$rvm_scripts_path/log" "error" "A version must be specified, for example 'rvm rubygems 1.3.7'"
|
95
96
|
exit 1
|
96
97
|
fi
|
data/scripts/rvm
CHANGED
@@ -4,11 +4,10 @@
|
|
4
4
|
# http://rvm.beginrescueend.com
|
5
5
|
# http://github.com/wayneeseguin/rvm
|
6
6
|
|
7
|
-
rvm_reload_flag
|
8
|
-
rvm_loaded_flag
|
9
|
-
|
10
|
-
|
11
|
-
unset rvm_reload_flag
|
7
|
+
rvm_reload_flag=${rvm_reload_flag:-0}
|
8
|
+
rvm_loaded_flag=${rvm_loaded_flag:-0}
|
9
|
+
if [[ $rvm_loaded_flag -eq 0 || $rvm_reload_flag -eq 1 ]] ; then
|
10
|
+
rvm_reload_flag=0
|
12
11
|
|
13
12
|
if [[ -z "$rvm_ignore_rvmrc" ]]; then
|
14
13
|
for rvmrc in /etc/rvmrc $HOME/.rvmrc ; do
|
@@ -54,14 +53,13 @@ if [[ "$rvm_loaded_flag" != "1" ]] || [[ "$rvm_reload_flag" = "1" ]] ; then
|
|
54
53
|
rvm_scripts_path="${rvm_scripts_path:-"$rvm_path/scripts"}"
|
55
54
|
|
56
55
|
if [[ -d "$rvm_path" ]] ; then
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
source "$rvm_scripts_path/override_gem"
|
56
|
+
for script in array utility initialize version selector cli cd override_gem ; do
|
57
|
+
if [[ -f "$rvm_scripts_path/$script" ]] ; then
|
58
|
+
source "$rvm_scripts_path/$script"
|
59
|
+
else
|
60
|
+
"$rvm_scripts_path/log" "error" "RVM: Could not source script '$rvm_scripts_path/$script', file does not exist. RVM will likely not work as expected."
|
61
|
+
fi
|
62
|
+
done
|
65
63
|
|
66
64
|
rvm_loaded_flag=1
|
67
65
|
|
data/scripts/rvm-install
CHANGED
@@ -201,7 +201,7 @@ fi
|
|
201
201
|
spinner
|
202
202
|
if [[ -d gemsets/ ]] ; then
|
203
203
|
\mkdir -p "$rvm_gemsets_path"
|
204
|
-
for gemset_file in $(cd gemsets ; find \. -iname '*.gems' | sed 's/^\.\///') ; do
|
204
|
+
for gemset_file in $(builtin cd gemsets ; find \. -iname '*.gems' | sed 's/^\.\///') ; do
|
205
205
|
destination="$rvm_gemsets_path/$gemset_file"
|
206
206
|
destination_path="$(dirname "$destination")"
|
207
207
|
if [[ ! -s "$destination" ]] ; then
|
@@ -214,7 +214,7 @@ fi
|
|
214
214
|
spinner
|
215
215
|
if [[ -d patchsets/ ]] ; then
|
216
216
|
\mkdir -p "$rvm_patchsets_path"
|
217
|
-
for patchset_file in $(cd patchsets ; find \. -iname '*' | sed 's/^\.\///') ; do
|
217
|
+
for patchset_file in $(builtin cd patchsets ; find \. -iname '*' | sed 's/^\.\///') ; do
|
218
218
|
destination="$rvm_patchsets_path/$patchset_file"
|
219
219
|
destination_path="$(dirname "$destination")"
|
220
220
|
if [[ ! -s "$destination" ]] ; then
|
@@ -318,6 +318,7 @@ if [[ "$upgrade_flag" -eq 1 ]] ; then
|
|
318
318
|
printf "\n * 'rvm notes' tells you OS dependency packages for installing rubies."
|
319
319
|
printf "\n * If you encounter any issues with a ruby your best bet is to 'rvm remove X ; rvm install X' "
|
320
320
|
printf "\n * Gemset separator is '@' and will remain unless any rubies error using it."
|
321
|
+
printf "\n * If you wish to have the 'pretty colors' again, set 'export rvm_pretty_print=1' in ~/.rvmrc.\n"
|
321
322
|
printf "\n$(tput sgr0)\n"
|
322
323
|
check_rubyopt_conditions
|
323
324
|
printf "\nUpgrade of RVM in $rvm_path/ is complete.\n\n"
|
data/scripts/selector
CHANGED
@@ -2,7 +2,17 @@
|
|
2
2
|
|
3
3
|
# __rvm_select implementation version patch_level
|
4
4
|
__rvm_select() {
|
5
|
-
|
5
|
+
rvm_ruby_interpreter=${rvm_ruby_interpreter:-""}
|
6
|
+
rvm_head_flag=${rvm_head_flag:-0}
|
7
|
+
rvm_install_on_use_flag=${rvm_install_on_use_flag:-0}
|
8
|
+
rvm_ruby_version=${rvm_ruby_version:-""}
|
9
|
+
rvm_ruby_patch_level=${rvm_ruby_patch_level:-""}
|
10
|
+
rvm_ruby_revision=${rvm_ruby_revision:-""}
|
11
|
+
rvm_ruby_name=${rvm_ruby_name:-""}
|
12
|
+
rvm_ruby_gem_home=${rvm_ruby_gem_home:-""}
|
13
|
+
export GEM_HOME GEM_PATH BUNDLE_PATH MY_RUBY_HOME RUBY_VERSION
|
14
|
+
|
15
|
+
if [[ -z "${rvm_ruby_string:-""}" ]] ; then
|
6
16
|
rvm_ruby_string="${rvm_ruby_interpreter}"
|
7
17
|
[[ -n "$rvm_ruby_version" ]] && rvm_ruby_string="$rvm_ruby_string-$rvm_ruby_version"
|
8
18
|
[[ -n "$rvm_ruby_patch_level" ]] && rvm_ruby_string="$rvm_ruby_string-$rvm_ruby_patch_level"
|
@@ -18,8 +28,8 @@ __rvm_select() {
|
|
18
28
|
macruby)
|
19
29
|
if [[ "Darwin" = "$(uname)" ]] ; then
|
20
30
|
rvm_ruby_package_name=${rvm_ruby_interpreter}-${rvm_ruby_version}
|
21
|
-
if [[
|
22
|
-
|
31
|
+
if [[ $rvm_head_flag -eq 1 ]] ; then
|
32
|
+
rvm_ruby_version="" ; rvm_ruby_tag=""
|
23
33
|
rvm_ruby_revision="head"
|
24
34
|
__rvm_db "macruby_repo_url" "rvm_ruby_repo_url"
|
25
35
|
rvm_url="$rvm_ruby_repo_url"
|
@@ -34,8 +44,7 @@ __rvm_select() {
|
|
34
44
|
rvm_ruby_package_file="$rvm_ruby_package_name"
|
35
45
|
rvm_url="$rvm_url/$rvm_ruby_package_name"
|
36
46
|
fi
|
37
|
-
|
38
|
-
unset rvm_ruby_patch_level
|
47
|
+
rvm_ruby_patch_level=""
|
39
48
|
else
|
40
49
|
"$rvm_scripts_path/log" "fail" "MacRuby can only be installed on a Darwin OS."
|
41
50
|
fi
|
@@ -46,7 +55,7 @@ __rvm_select() {
|
|
46
55
|
rvm_ruby_interpreter="rbx"
|
47
56
|
rvm_ruby_version=${rvm_ruby_version:-$(__rvm_db "rbx_version")}
|
48
57
|
rvm_ruby_repo_url=${rvm_rbx_repo_url:-$(__rvm_db "rubinius_repo_url")}
|
49
|
-
if [[
|
58
|
+
if [[ $rvm_head_flag -eq 0 ]] ; then
|
50
59
|
rvm_ruby_patch_level=${rvm_ruby_patch_level:-$(__rvm_db "rbx_patch_level")}
|
51
60
|
rvm_ruby_string="${rvm_ruby_string/-prc/-rc}"
|
52
61
|
rvm_ruby_string="$(echo "$rvm_ruby_string" | sed 's#-p*#-#')"
|
@@ -54,13 +63,13 @@ __rvm_select() {
|
|
54
63
|
__rvm_db "rbx_url" "rvm_url"
|
55
64
|
rvm_url="$rvm_url/$rvm_ruby_package_file"
|
56
65
|
else
|
57
|
-
|
66
|
+
rvm_ruby_patch_level="" ; rvm_ruby_version=""
|
58
67
|
fi
|
59
68
|
;;
|
60
69
|
|
61
70
|
jruby)
|
62
|
-
|
63
|
-
if [[
|
71
|
+
rvm_ruby_patch_level=""
|
72
|
+
if [[ $rvm_head_flag -eq 1 ]] ; then
|
64
73
|
rvm_ruby_version="head"
|
65
74
|
rvm_ruby_repo_url="${rvm_ruby_repo_url:-$(__rvm_db "jruby_repo_url")}"
|
66
75
|
rvm_url="${rvm_ruby_repo_url:-$(__rvm_db "jruby_repo_url")}"
|
@@ -71,16 +80,16 @@ __rvm_select() {
|
|
71
80
|
rvm_ruby_package_file="${rvm_ruby_interpreter}-bin-${rvm_ruby_version}"
|
72
81
|
rvm_ruby_package_name="${rvm_ruby_interpreter}-${rvm_ruby_version}"
|
73
82
|
rvm_url="${jruby_url}/${rvm_ruby_version}/${rvm_ruby_package_file}.tar.gz"
|
74
|
-
|
83
|
+
jruby_url=""
|
75
84
|
fi
|
76
85
|
alias jruby_ng="jruby --ng"
|
77
86
|
alias jruby_ng_server="jruby --ng-server"
|
78
87
|
;;
|
79
88
|
|
80
89
|
maglev)
|
81
|
-
|
90
|
+
rvm_ruby_patch_level=""
|
82
91
|
maglev_url="$(__rvm_db "maglev_url")"
|
83
|
-
if [[
|
92
|
+
if [[ $rvm_head_flag -eq 1 ]] ; then
|
84
93
|
rvm_ruby_version="head"
|
85
94
|
rvm_ruby_repo_url="${rvm_ruby_repo_url:-$(__rvm_db "maglev_repo_url")}"
|
86
95
|
rvm_url="${rvm_ruby_repo_url:-$(__rvm_db "maglev_repo_url")}"
|
@@ -98,8 +107,8 @@ __rvm_select() {
|
|
98
107
|
;;
|
99
108
|
|
100
109
|
ironruby)
|
101
|
-
|
102
|
-
if [[
|
110
|
+
rvm_ruby_patch_level=""
|
111
|
+
if [[ ${rvm_head_flag:-0} -eq 1 ]] ; then
|
103
112
|
rvm_ruby_version="head"
|
104
113
|
rvm_ruby_package_name="${rvm_ruby_string}"
|
105
114
|
rvm_ruby_repo_url="${rvm_ruby_repo_url:-$(__rvm_db "ironruby_repo_url")}"
|
@@ -123,7 +132,7 @@ __rvm_select() {
|
|
123
132
|
|
124
133
|
if [[ "$rvm_ruby_version" != "head" ]] ; then
|
125
134
|
if [[ ! -z "$rvm_ruby_revision" ]] ; then
|
126
|
-
|
135
|
+
rvm_ruby_patch_level="" ; rvm_ruby_package_file=""
|
127
136
|
rvm_ruby_package_name="ree-$rvm_ruby_version-$rvm_ruby_revision"
|
128
137
|
else
|
129
138
|
rvm_ruby_package_file="ruby-enterprise-$rvm_ruby_version-$rvm_ruby_patch_level"
|
@@ -140,18 +149,18 @@ __rvm_select() {
|
|
140
149
|
rvm_ruby_interpreter="mput"
|
141
150
|
rvm_ruby_version="head"
|
142
151
|
rvm_ruby_string=$(echo $rvm_ruby_string | sed -e 's/shyouhei/mput/g')
|
143
|
-
|
152
|
+
rvm_ruby_patch_level=""
|
144
153
|
rvm_ruby_repo_url=${rvm_mput_repo_url:-"$(__rvm_db "shyouhei_repo_url")"}
|
145
154
|
rvm_url=$rvm_ruby_repo_url
|
146
|
-
|
155
|
+
rvm_ruby_configure="" ; rvm_ruby_make="" ; rvm_ruby_make_install=""
|
147
156
|
;;
|
148
157
|
|
149
158
|
ruby)
|
150
|
-
if [[ -z "$rvm_ruby_version" &&
|
159
|
+
if [[ -z "${rvm_ruby_version:-""}" && ${rvm_head_flag:-0} -eq 0 ]]; then
|
151
160
|
"$rvm_scripts_path/log" "fail" "Unknown ruby version: $rvm_ruby_version"
|
152
161
|
else
|
153
162
|
rvm_ruby_repo_url="${rvm_ruby_repo_url:-"$(__rvm_db "ruby_repo_url")"}"
|
154
|
-
if [[
|
163
|
+
if [[ ${rvm_head_flag:-0} -eq 0 ]]; then
|
155
164
|
rvm_archive_extension="tar.bz2"
|
156
165
|
fi
|
157
166
|
fi
|
@@ -223,14 +232,28 @@ __rvm_select() {
|
|
223
232
|
|
224
233
|
__rvm_use() {
|
225
234
|
|
226
|
-
|
235
|
+
rvm_ruby_selected_flag=${rvm_ruby_selected_flag:-0}
|
236
|
+
rvm_head_flag=${rvm_head_flag:-0}
|
237
|
+
rvm_default_flag=${rvm_default_flag:-0}
|
238
|
+
rvm_rvmrc_flag=${rvm_rvmrc_flag:-0}
|
239
|
+
rvm_verbose_flag=${rvm_verbose_flag:-0}
|
240
|
+
rvm_sticky_flag=${rvm_sticky_flag:-0}
|
241
|
+
rvm_ruby_interpreter="${rvm_ruby_interpreter:-""}"
|
242
|
+
rvm_gemset_name="${rvm_gemset_name:-""}"
|
243
|
+
rvm_ruby_gem_home="${rvm_ruby_gem_home:-""}"
|
244
|
+
rvm_wrapper_name="${rvm_wrapper_name:-""}"
|
245
|
+
rvm_ruby_alias="${rvm_ruby_alias:-""}"
|
246
|
+
|
247
|
+
local new_path=""
|
248
|
+
|
249
|
+
if [[ $rvm_ruby_selected_flag -eq 0 ]] ; then __rvm_select "$@" ; fi
|
227
250
|
if [[ -z "$rvm_ruby_interpreter" ]] ; then rvm_ruby_interpreter="system" ; fi
|
228
251
|
|
229
252
|
if [[ "system" = "$rvm_ruby_interpreter" ]] ; then
|
230
253
|
|
231
254
|
unset GEM_HOME GEM_PATH BUNDLE_PATH MY_RUBY_HOME RUBY_VERSION IRBRC
|
232
255
|
|
233
|
-
new_path="$rvm_bin_path:$(__rvm_remove_rvm_from_path ; printf $PATH)"
|
256
|
+
new_path="$rvm_bin_path:$(__rvm_remove_rvm_from_path ; printf "$PATH")"
|
234
257
|
if [[ -s $rvm_config_path/system ]] ; then
|
235
258
|
\grep "MY_RUBY_HOME='$rvm_rubies_path" "$rvm_config_path/system" > /dev/null
|
236
259
|
if [[ $? -eq 0 ]] ; then
|
@@ -241,16 +264,15 @@ __rvm_use() {
|
|
241
264
|
fi
|
242
265
|
|
243
266
|
# Check binaries, remove under the condition they're symlinks.
|
267
|
+
local binary full_binary_path
|
244
268
|
if [[ "$rvm_selfcontained" = "0" ]] ; then
|
245
269
|
for binary in ruby gem irb ri rdoc rake erb testrb ; do
|
246
270
|
full_binary_path="$rvm_bin_path/$binary"
|
247
271
|
[[ -L "$full_binary_path" ]] && \rm -f "$full_binary_path"
|
248
|
-
done
|
272
|
+
done
|
249
273
|
fi
|
250
274
|
|
251
|
-
|
252
|
-
"$rvm_scripts_path/log" "info" "Now using system ruby."
|
253
|
-
fi
|
275
|
+
[[ ${rvm_verbose_flag:-0} -eq 1 ]] && "$rvm_scripts_path/log" "info" "Now using system ruby."
|
254
276
|
|
255
277
|
export rvm_ruby_string="system"
|
256
278
|
|
@@ -264,11 +286,11 @@ __rvm_use() {
|
|
264
286
|
|
265
287
|
export GEM_HOME GEM_PATH BUNDLE_PATH MY_RUBY_HOME RUBY_VERSION IRBRC
|
266
288
|
|
267
|
-
if [[ -z "$IRBRC" ]] ; then unset IRBRC ; fi
|
289
|
+
IRBRC=${IRBRC:-""} ; if [[ -z "$IRBRC" ]] ; then unset IRBRC ; fi
|
268
290
|
|
269
|
-
if [[ ! -d $MY_RUBY_HOME ]] ; then
|
291
|
+
if [[ ! -d "$MY_RUBY_HOME" ]] ; then
|
270
292
|
"$rvm_scripts_path/log" "warn" "$rvm_ruby_interpreter $rvm_ruby_string is not installed."
|
271
|
-
if [[
|
293
|
+
if [[ $rvm_install_on_use_flag -eq 1 ]] ; then
|
272
294
|
"$rvm_scripts_path/manage" "install" "$rvm_ruby_string"
|
273
295
|
else
|
274
296
|
"$rvm_scripts_path/log" "info" "To install do: 'rvm install $rvm_ruby_string'"
|
@@ -279,27 +301,27 @@ __rvm_use() {
|
|
279
301
|
# Ensure the environment file for the selected ruby exists.
|
280
302
|
__rvm_ensure_has_environment_files
|
281
303
|
|
282
|
-
|
304
|
+
[[ ${rvm_verbose_flag:-0} -eq 1 ]] && \
|
283
305
|
"$rvm_scripts_path/log" "info" "Using $(basename $GEM_HOME | \tr '-' ' ' | sed 's/'${rvm_gemset_separator}'/ with gemset /')"
|
284
|
-
fi
|
285
306
|
|
286
|
-
new_path="$GEM_HOME/bin:$rvm_ruby_global_gems_path/bin:$MY_RUBY_HOME/bin:$rvm_bin_path:$(__rvm_remove_rvm_from_path ; printf $PATH)"
|
307
|
+
new_path="$GEM_HOME/bin:$rvm_ruby_global_gems_path/bin:$MY_RUBY_HOME/bin:$rvm_bin_path:$(__rvm_remove_rvm_from_path ; printf "$PATH")"
|
287
308
|
fi
|
288
309
|
|
289
310
|
# Export ruby string and gem set me for extrenal scripts to take advantage of them.
|
290
|
-
if [[ -n "$rvm_ruby_string" ]] ; then export rvm_ruby_string ; fi
|
291
|
-
if [[ -n "$rvm_gemset_name" ]] ; then export rvm_gemset_name ; fi
|
311
|
+
if [[ -n "${rvm_ruby_string:-""}" ]] ; then export rvm_ruby_string ; fi
|
312
|
+
if [[ -n "${rvm_gemset_name:-""}" ]] ; then export rvm_gemset_name ; fi
|
292
313
|
if [[ -n "$new_path" ]]; then
|
293
314
|
export PATH="$new_path"
|
294
315
|
unset new_path
|
295
316
|
builtin hash -r
|
296
317
|
fi
|
297
|
-
if [[ -n "$rvm_rvmrc_flag" ]] ; then __rvm_set_rvmrc ; fi
|
298
318
|
|
299
|
-
|
319
|
+
if [[ ${rvm_rvmrc_flag:-0} -eq 1 ]] ; then __rvm_set_rvmrc ; fi
|
300
320
|
|
301
|
-
|
302
|
-
|
321
|
+
local environment_id="$(__rvm_environment_identifier)"
|
322
|
+
|
323
|
+
if [[ ${rvm_default_flag:-0} -eq 1 && "default" != "${rvm_ruby_interpreter:-""}" ]] ; then
|
324
|
+
if [[ "${rvm_selfcontained:-""}" = "0" ]] ; then
|
303
325
|
# Sets up the default wrappers.
|
304
326
|
"$rvm_scripts_path/wrapper" "$rvm_ruby_string" --no-prefix
|
305
327
|
else
|
@@ -316,26 +338,26 @@ __rvm_use() {
|
|
316
338
|
export GEM_HOME GEM_PATH BUNDLE_PATH MY_RUBY_HOME RUBY_VERSION
|
317
339
|
"$rvm_scripts_path/alias" delete default &> /dev/null
|
318
340
|
"$rvm_scripts_path/alias" create default "$environment_id" >& /dev/null
|
319
|
-
ln -nfs "$rvm_environments_path/$environment_id" "$rvm_environments_path/default"
|
320
|
-
ln -nfs "$rvm_wrappers_path/$environment_id" "$rvm_wrappers_path/default"
|
341
|
+
\ln -nfs "$rvm_environments_path/$environment_id" "$rvm_environments_path/default"
|
342
|
+
\ln -nfs "$rvm_wrappers_path/$environment_id" "$rvm_wrappers_path/default"
|
321
343
|
fi
|
322
|
-
fi
|
344
|
+
fi
|
345
|
+
|
346
|
+
rvm_default_flag=0
|
323
347
|
|
324
|
-
if [[ -n "$rvm_wrapper_name" ]] ; then
|
348
|
+
if [[ -n "${rvm_wrapper_name:-""}" ]] ; then
|
325
349
|
"$rvm_scripts_path/wrapper" "$environment_id" "$rvm_wrapper_name" > /dev/null 2>&1
|
326
|
-
|
350
|
+
rvm_wrapper_name=""
|
327
351
|
fi
|
328
352
|
|
329
|
-
if [[ -n "$rvm_ruby_alias" ]]; then
|
353
|
+
if [[ -n "${rvm_ruby_alias:-""}" ]]; then
|
330
354
|
"$rvm_scripts_path/log" "info" "Attempting to alias $environment_id to $rvm_ruby_alias"
|
331
355
|
"$rvm_scripts_path/alias" delete "$rvm_ruby_alias" > /dev/null 2>&1
|
332
356
|
rvm_alias_expanded=1 "$rvm_scripts_path/alias" create "$rvm_ruby_alias" "$environment_id" > /dev/null 2>&1
|
333
|
-
|
357
|
+
ruby_alias="" ; rvm_ruby_alias=""
|
334
358
|
fi
|
335
359
|
|
336
|
-
|
337
|
-
|
338
|
-
if [[ "maglev" = "$rvm_ruby_interpreter" ]] ; then
|
360
|
+
if [[ "maglev" = "${rvm_ruby_interpreter:-""}" ]] ; then
|
339
361
|
export MAGLEV_HOME="$rvm_ruby_home"
|
340
362
|
export GEMSTONE_GLOBAL_DIR=$MAGLEV_HOME
|
341
363
|
if [[ -x "$MAGLEV_HOME/gemstone/bin/gslist" ]] ; then
|
@@ -343,7 +365,10 @@ __rvm_use() {
|
|
343
365
|
if [[ $result -eq 1 ]] ; then "$rvm_ruby_home/bin/maglev" start ; fi
|
344
366
|
fi
|
345
367
|
fi
|
368
|
+
|
346
369
|
rvm_hook="after_use" ; source "$rvm_scripts_path/hook"
|
370
|
+
|
371
|
+
return 0
|
347
372
|
}
|
348
373
|
|
349
374
|
__rvm_ruby_string() {
|
@@ -355,83 +380,113 @@ __rvm_ruby_string() {
|
|
355
380
|
# * rvm_ruby_revision
|
356
381
|
# * rvm_ruby_tag
|
357
382
|
|
358
|
-
|
359
|
-
|
360
|
-
|
361
|
-
|
383
|
+
rvm_expanding_aliases=${rvm_expanding_aliases:-0}
|
384
|
+
|
385
|
+
rvm_ruby_version=${rvm_ruby_version:-""}
|
386
|
+
rvm_gemset_name=${rvm_gemset_name:-""}
|
387
|
+
rvm_ruby_interpreter=${rvm_ruby_interpreter:-""}
|
388
|
+
rvm_ruby_version=${rvm_ruby_version:-""}
|
389
|
+
rvm_ruby_patch_level=${rvm_ruby_patch_level:-""}
|
390
|
+
rvm_ruby_revision=${rvm_ruby_revision:-""}
|
391
|
+
rvm_ruby_tag=${rvm_ruby_tag:-""}
|
392
|
+
|
393
|
+
if echo "$rvm_ruby_string" | \grep -q "$rvm_gemset_separator" ; then
|
394
|
+
rvm_gemset_name="${rvm_ruby_string/*${rvm_gemset_separator}/}"
|
395
|
+
rvm_ruby_string="${rvm_ruby_string/${rvm_gemset_separator}*/}"
|
396
|
+
rvm_sticky_flag=1
|
362
397
|
fi
|
363
|
-
if [[ -n "$set_name" ]] ; then rvm_gemset_name="$set_name" ; fi
|
364
398
|
|
365
399
|
# Alias'd rubies
|
366
|
-
if [[
|
400
|
+
if [[ ${rvm_expanding_aliases:-0} -eq 0 ]]; then
|
367
401
|
rvm_ruby_string="${rvm_ruby_string:-"default"}"
|
368
|
-
|
369
|
-
if [[ -n "$expanded_alias_name" ]]; then
|
402
|
+
|
403
|
+
if expanded_alias_name="$("$rvm_scripts_path/alias" show "$rvm_ruby_string" 2>/dev/null)" && [[ -n "$expanded_alias_name" ]] ; then
|
370
404
|
rvm_ruby_string="$expanded_alias_name"
|
405
|
+
|
371
406
|
elif [[ "$rvm_ruby_string" = default ]]; then
|
372
407
|
# Default is not a known value. Instead, we need to therefore set it to system.
|
373
408
|
rvm_ruby_string="system"
|
374
409
|
fi
|
375
410
|
fi
|
411
|
+
|
376
412
|
ruby_string=${rvm_ruby_string/${rvm_gemset_separator}*/}
|
377
413
|
|
378
414
|
__rvm_unset_ruby_variables
|
379
415
|
|
380
416
|
for string in $(printf "${ruby_string//-/ }") ; do
|
417
|
+
|
381
418
|
if [[ "head" = "$string" ]] ; then
|
382
419
|
rvm_ruby_revision="head"
|
383
|
-
|
420
|
+
rvm_ruby_patch_level="" ; rvm_ruby_revision="" ; rvm_ruby_tag=""
|
384
421
|
export rvm_head_flag=1
|
422
|
+
|
385
423
|
elif [[ "system" = "$string" ]] ; then
|
386
424
|
rvm_ruby_interpreter="system"
|
387
|
-
|
388
|
-
return
|
425
|
+
rvm_ruby_patch_level="" ; rvm_ruby_tag="" ; rvm_head_flag=0 ; rvm_ruby_revision="" ; rvm_ruby_version="" ; rvm_gemset_name=""
|
426
|
+
return 0
|
427
|
+
|
389
428
|
elif [[ "nightly" = "$string" ]] ; then
|
390
429
|
rvm_ruby_version="nightly"
|
391
430
|
rvm_nightly_flag=1
|
392
431
|
break
|
432
|
+
|
393
433
|
elif "$rvm_scripts_path/match" "$string" "^preview" ; then
|
394
434
|
rvm_ruby_patch_level="$string"
|
435
|
+
|
395
436
|
elif "$rvm_scripts_path/match" "$string" "^rc[0-9]" ; then
|
396
437
|
rvm_ruby_patch_level="$string"
|
438
|
+
|
397
439
|
elif "$rvm_scripts_path/match" "$string" "^[0-9]\.[0-9]" ; then
|
398
440
|
rvm_ruby_version="$string"
|
399
|
-
|
441
|
+
rvm_ruby_revision="" ; rvm_ruby_tag=""
|
442
|
+
|
400
443
|
elif "$rvm_scripts_path/match" "$string" "^p[0-9]" ; then
|
401
444
|
rvm_ruby_patch_level="$string"
|
402
|
-
|
403
|
-
|
445
|
+
|
446
|
+
elif [[ -n "${rvm_ruby_version:-""}" ]] && "$rvm_scripts_path/match" "$string" "^[0-9][0-9]" ; then
|
447
|
+
if [[ "ree" = "${rvm_ruby_interpreter:-""}" ]] ; then
|
404
448
|
rvm_ruby_patch_level="$string"
|
405
|
-
|
406
|
-
|
449
|
+
rvm_ruby_revision=""
|
450
|
+
|
451
|
+
elif [[ "rbx" = "${rvm_ruby_interpreter:-""}" ]] ; then
|
407
452
|
rvm_ruby_patch_level="$string"
|
408
|
-
|
409
|
-
|
410
|
-
|
453
|
+
|
454
|
+
elif [[ "maglev" = "${rvm_ruby_interpreter:-""}" ]] ; then
|
455
|
+
rvm_ruby_version="$string" ; rvm_ruby_revision="" ; rvm_ruby_patch_level=""
|
456
|
+
|
411
457
|
else
|
412
458
|
rvm_ruby_revision="r$string"
|
413
459
|
fi
|
460
|
+
|
414
461
|
elif "$rvm_scripts_path/match" "$string" "^r[0-9]" ; then
|
415
|
-
|
462
|
+
rvm_ruby_patch_level=""
|
416
463
|
rvm_ruby_revision="$string"
|
464
|
+
|
417
465
|
elif "$rvm_scripts_path/match" "$string" "^s[0-9]" ; then
|
418
|
-
|
466
|
+
rvm_ruby_revision=""
|
419
467
|
rvm_ruby_sha="$string"
|
468
|
+
|
420
469
|
elif "$rvm_scripts_path/match" "$string" "^t[v0-9]" ; then
|
421
|
-
|
470
|
+
rvm_ruby_patch_level="" ; rvm_ruby_revision=""
|
422
471
|
rvm_ruby_tag="$string"
|
472
|
+
|
423
473
|
elif "$rvm_scripts_path/match" "$string" "^m[0-9]" ; then
|
424
474
|
rvm_ruby_mode="$string"
|
475
|
+
|
425
476
|
elif "$rvm_scripts_path/match" "$string" "^u[a-z0-9]" ; then
|
426
|
-
|
477
|
+
rvm_ruby_patch_level="" ; rvm_ruby_revision="" ; rvm_ruby_tag="" ; rvm_ruby_patch=""
|
427
478
|
rvm_ruby_user_tag="$string"
|
479
|
+
|
428
480
|
elif "$rvm_scripts_path/match" "$string" "^b[0-9][0-9]" ; then
|
429
481
|
rvm_ruby_bits="$string"
|
482
|
+
|
430
483
|
elif "$rvm_scripts_path/match" "$string" "^n" ; then
|
431
484
|
rvm_ruby_name="${string/n/}"
|
485
|
+
|
432
486
|
elif [[ "ruby rbx jruby macruby ree rubinius maglev mput shyouhei ironruby " =~ "$string " ]] ; then
|
433
487
|
# NOTE: The space at the end of each of the above strings is *very* important.
|
434
488
|
rvm_ruby_interpreter="$string"
|
489
|
+
|
435
490
|
else
|
436
491
|
"$rvm_scripts_path/log" "error" "Unknown ruby string component: '$string'"
|
437
492
|
return 1
|
@@ -439,51 +494,62 @@ __rvm_ruby_string() {
|
|
439
494
|
done
|
440
495
|
|
441
496
|
# Unspecified interpreter
|
442
|
-
if [[ -z "$rvm_ruby_interpreter" ]] ; then
|
497
|
+
if [[ -z "${rvm_ruby_interpreter:-""}" ]] ; then
|
498
|
+
|
443
499
|
if "$rvm_scripts_path/match" "$rvm_ruby_version" "^1\.[8-9]" ; then
|
444
500
|
rvm_ruby_interpreter="ruby"
|
501
|
+
|
445
502
|
elif "$rvm_scripts_path/match" "$rvm_ruby_version" "^0.5" ; then
|
446
503
|
rvm_ruby_interpreter="macruby"
|
504
|
+
|
447
505
|
elif "$rvm_scripts_path/match" "$rvm_ruby_version" "^1.[2-4]" ; then
|
448
506
|
rvm_ruby_interpreter="jruby"
|
449
507
|
fi
|
450
508
|
fi
|
451
509
|
|
452
510
|
# Unspecified version
|
453
|
-
|
511
|
+
rvm_ruby_version=${rvm_ruby_version:-""}
|
512
|
+
if [[ -z "${rvm_ruby_version:-""}" || ${rvm_head_flag:-0} -eq 0 ]] ; then
|
454
513
|
rvm_ruby_version=${rvm_ruby_version:-"$(__rvm_db "${rvm_ruby_interpreter}_version")"}
|
455
514
|
fi
|
456
515
|
|
457
|
-
if [[ -z "$rvm_ruby_version" ]] ; then
|
516
|
+
if [[ -z "${rvm_ruby_version:-""}" ]] ; then
|
458
517
|
rvm_ruby_string="${rvm_ruby_interpreter}"
|
459
518
|
else
|
460
519
|
rvm_ruby_string="${rvm_ruby_interpreter}-${rvm_ruby_version}"
|
461
520
|
fi
|
462
521
|
|
463
522
|
# Head
|
464
|
-
if [[
|
523
|
+
if [[ ${rvm_head_flag:-0} -eq 1 ]] ; then
|
465
524
|
rvm_ruby_string="${rvm_ruby_string}-head"
|
466
|
-
|
525
|
+
|
526
|
+
elif [[ -n "${rvm_ruby_revision:-""}" ]] ; then
|
467
527
|
rvm_ruby_string="${rvm_ruby_string}-${rvm_ruby_revision}"
|
468
|
-
|
528
|
+
|
529
|
+
elif [[ -n "${rvm_ruby_tag:-""}" ]] ; then
|
469
530
|
rvm_ruby_string="${rvm_ruby_string}-${rvm_ruby_tag}"
|
470
|
-
|
531
|
+
|
532
|
+
elif [[ -n "${rvm_ruby_patch_level:-""}" ]] ; then
|
471
533
|
rvm_ruby_string="${rvm_ruby_string}-${rvm_ruby_patch_level}"
|
472
|
-
|
534
|
+
|
535
|
+
elif [[ -n "${rvm_ruby_user_tag:-""}" ]] ; then
|
473
536
|
rvm_ruby_string="${rvm_ruby_string}-${rvm_ruby_user_tag}"
|
537
|
+
|
474
538
|
else
|
475
539
|
patch_level="$(__rvm_db "${rvm_ruby_interpreter}_${rvm_ruby_version}_patch_level")"
|
476
|
-
|
540
|
+
|
541
|
+
if [[ -n "${patch_level:-""}" ]] ; then
|
477
542
|
if [[ "ree" = "$rvm_ruby_interpreter" ]] || [[ "rbx" = "$rvm_ruby_interpreter" ]] ; then
|
478
543
|
rvm_ruby_patch_level="${patch_level}"
|
479
544
|
else
|
480
545
|
rvm_ruby_patch_level="p${patch_level}"
|
481
546
|
fi
|
482
547
|
fi
|
483
|
-
|
548
|
+
|
549
|
+
if [[ -n "${rvm_ruby_patch_level:-""}" ]] ; then
|
484
550
|
rvm_ruby_patch_level="$(echo $rvm_ruby_patch_level | sed 's#^pp#p#')"
|
485
551
|
rvm_ruby_string="${rvm_ruby_string}-${rvm_ruby_patch_level}"
|
486
|
-
if [[ "ree" = "$rvm_ruby_interpreter" ]] || [[ "rbx" = "$rvm_ruby_interpreter" ]] ; then
|
552
|
+
if [[ "ree" = "${rvm_ruby_interpreter:-""}" ]] || [[ "rbx" = "${rvm_ruby_interpreter:-""}" ]] ; then
|
487
553
|
rvm_ruby_string="$(echo $rvm_ruby_string | sed 's#-p*#-#')"
|
488
554
|
else
|
489
555
|
rvm_ruby_string="$(echo $rvm_ruby_string | sed 's#-pp#-p#')"
|
@@ -492,7 +558,7 @@ __rvm_ruby_string() {
|
|
492
558
|
fi
|
493
559
|
fi
|
494
560
|
|
495
|
-
if [[ -n "${rvm_ruby_name}" ]] ; then
|
561
|
+
if [[ -n "${rvm_ruby_name:-""}" ]] ; then
|
496
562
|
rvm_ruby_string="${rvm_ruby_string}-n${rvm_ruby_name}"
|
497
563
|
fi
|
498
564
|
}
|
@@ -503,63 +569,68 @@ __rvm_gemset_select() {
|
|
503
569
|
command -v gem > /dev/null
|
504
570
|
if [[ $? -gt 0 ]] ; then return 0 ; fi # Stop if no 'gem' command is available.
|
505
571
|
|
572
|
+
rvm_ruby_gem_home=${rvm_ruby_gem_home:-""}
|
573
|
+
rvm_gemset_name=${rvm_gemset_name:-""}
|
574
|
+
|
506
575
|
rvm_ruby_global_gems_path="$rvm_gems_path/${rvm_ruby_string}${rvm_gemset_separator}global"
|
507
576
|
|
508
|
-
if [[ -z "$rvm_gemset_name" ]] ; then
|
577
|
+
if [[ -z "${rvm_gemset_name:-""}" ]] ; then
|
509
578
|
# No longer defaulting to 'sticky' gem sets.
|
510
579
|
# Set 'rvm_sticky_flag=1' in ~/.rvmrc to enable.
|
511
|
-
if [[
|
512
|
-
if [[ -n "$GEM_HOME" ]] ; then
|
580
|
+
if [[ ${rvm_sticky_flag:-0} -eq 1 ]] ; then
|
581
|
+
if [[ -n "${GEM_HOME:-""}" ]] ; then
|
513
582
|
rvm_gemset_name=$(echo $GEM_HOME | xargs basename | awk -F${rvm_gemset_separator} '{print $2}')
|
514
583
|
fi
|
515
|
-
|
584
|
+
|
585
|
+
if [[ -n "${rvm_ruby_gem_home:-""}" ]] ; then
|
516
586
|
rvm_gemset_name=$(echo $rvm_ruby_gem_home | xargs basename | awk -F${rvm_gemset_separator} '{print $2}')
|
517
587
|
fi
|
518
588
|
fi
|
519
589
|
|
520
|
-
if [[ -n "$rvm_gemset_name" ]] && ! "$rvm_scripts_path/match" "$rvm_gemset_name" "^[0-9]\.[0-9]" ; then
|
590
|
+
if [[ -n "${rvm_gemset_name:-""}" ]] && ! "$rvm_scripts_path/match" "$rvm_gemset_name" "^[0-9]\.[0-9]" ; then
|
521
591
|
rvm_ruby_gem_home="$rvm_gems_path/${rvm_ruby_string}${rvm_gemset_separator}${rvm_gemset_name}"
|
522
592
|
else
|
523
|
-
if [[ -n "$rvm_ruby_string" ]] && [[ "$rvm_ruby_interpreter" != "system" ]] ; then
|
593
|
+
if [[ -n "${rvm_ruby_string:-""}" ]] && [[ "${rvm_ruby_interpreter:-""}" != "system" ]] ; then
|
524
594
|
rvm_ruby_gem_home="$rvm_gems_path/$rvm_ruby_string"
|
525
|
-
elif [[ -z "$GEM_HOME" ]] && [[ -n "$(command -v gem)" ]] ; then
|
595
|
+
elif [[ -z "${GEM_HOME:-""}" ]] && [[ -n "$(command -v gem)" ]] ; then
|
526
596
|
rvm_ruby_gem_home=$(gem env gemdir)
|
527
|
-
elif [[ -n "$GEM_HOME" ]] ; then
|
597
|
+
elif [[ -n "${GEM_HOME:-""}" ]] ; then
|
528
598
|
rvm_ruby_gem_home="$GEM_HOME"
|
529
599
|
else
|
530
|
-
|
600
|
+
rvm_ruby_gem_home=""
|
531
601
|
fi
|
532
602
|
fi
|
533
|
-
if [[ -z "$rvm_gemset_name" ]] ; then unset rvm_gemset_name ; fi
|
534
603
|
else
|
535
|
-
gemset=$(echo "$rvm_ruby_gem_home" | awk -F'@' '{print $NF}')
|
536
|
-
if [[ -z "$rvm_ruby_string"
|
604
|
+
local gemset=$(echo "$rvm_ruby_gem_home" | awk -F'@' '{print $NF}')
|
605
|
+
if [[ -z "${rvm_ruby_string:-""}" && -n "${GEM_HOME:-""}" && -n "${GEM_HOME/@*/}" ]] ; then
|
537
606
|
rvm_ruby_string=$(basename ${GEM_HOME/@*/})
|
538
607
|
fi
|
539
608
|
|
540
|
-
if [[ -n "$rvm_ruby_string" ]] ; then
|
541
|
-
if [[ -z "$rvm_ruby_gem_home"
|
609
|
+
if [[ -n "${rvm_ruby_string:-""}" ]] ; then
|
610
|
+
if [[ -z "${rvm_ruby_gem_home:-""}" || -n "${gemset:-""}" ]] ; then
|
542
611
|
rvm_ruby_gem_home="$rvm_gems_path/${rvm_ruby_string}${rvm_gemset_separator}${rvm_gemset_name}"
|
543
|
-
elif [[ -n "$gemset"
|
612
|
+
elif [[ -n "${gemset:-""}" && "${rvm_gemset_name:-""}" != "${gemset:-""}" ]] ; then
|
544
613
|
rvm_ruby_gem_home="$rvm_gems_path/${rvm_ruby_string}${rvm_gemset_separator}${rvm_gemset_name}"
|
545
|
-
fi
|
614
|
+
fi
|
546
615
|
else
|
547
616
|
"$rvm_scripts_path/log" "error" "Gemsets can not be used with non rvm controlled rubies (currently)."
|
548
617
|
return 1
|
549
618
|
fi
|
550
619
|
fi
|
551
620
|
|
621
|
+
if [[ -z "${GEM_HOME:-""}" ]] ; then unset GEM_HOME ; fi
|
622
|
+
|
552
623
|
# If the gemset does not exist, then notify the user as such and abort the action.
|
553
|
-
if [[ -n "$rvm_gemset_name"
|
554
|
-
if [[
|
624
|
+
if [[ -n "${rvm_gemset_name:-""}" && ! -d "$rvm_ruby_gem_home" ]] ; then
|
625
|
+
if [[ ${rvm_gemset_create_on_use_flag:-0} -ne 1 && ${rvm_create_flag:-0} -ne 1 && ${rvm_delete_flag:-0} -ne 1 ]] ; then
|
555
626
|
"$rvm_scripts_path/log" "error" "Gemset '$rvm_gemset_name' does not exist, rvm gemset create '$rvm_gemset_name' first."
|
556
627
|
return 1
|
557
628
|
fi
|
558
|
-
elif [[
|
629
|
+
elif [[ ${rvm_delete_flag:-0} -eq 1 ]] ; then
|
559
630
|
return 1
|
560
631
|
fi
|
561
632
|
|
562
|
-
if [[ -z "$rvm_ruby_gem_home"
|
633
|
+
if [[ -z "${rvm_ruby_gem_home:-""}" && -n "${rvm_ruby_string:-""}" ]] ; then
|
563
634
|
rvm_ruby_gem_home="$rvm_gems_path/$rvm_ruby_string"
|
564
635
|
rvm_ruby_global_gems_path="$rvm_gems_path/$rvm_ruby_string${rvm_gemset_separator}global"
|
565
636
|
fi
|
@@ -568,11 +639,11 @@ __rvm_gemset_select() {
|
|
568
639
|
|
569
640
|
# Ensure that the ruby gem home exists.
|
570
641
|
\mkdir -p "$rvm_ruby_gem_home"
|
571
|
-
if [[ -n "$rvm_ruby_gem_home" ]] && echo "$rvm_ruby_gem_home" | \grep -q 'rvm'; then
|
642
|
+
if [[ -n "${rvm_ruby_gem_home:-""}" ]] && echo "$rvm_ruby_gem_home" | \grep -q 'rvm'; then
|
572
643
|
if __rvm_using_gemset_globalcache && [[ ! -L "$rvm_ruby_gem_home/cache" ]]; then
|
573
644
|
mv "$rvm_ruby_gem_home/cache/"*.gem "$rvm_gems_cache_path/" 2>/dev/null
|
574
645
|
\rm -rf "$rvm_ruby_gem_home/cache"
|
575
|
-
ln -nfs "$rvm_gems_cache_path" "$rvm_ruby_gem_home/cache"
|
646
|
+
\ln -nfs "$rvm_gems_cache_path" "$rvm_ruby_gem_home/cache"
|
576
647
|
fi
|
577
648
|
fi
|
578
649
|
|
@@ -581,6 +652,9 @@ __rvm_gemset_select() {
|
|
581
652
|
|
582
653
|
# Use a gemset specified by 'rvm_ruby_gem_home'
|
583
654
|
__rvm_gemset_use() {
|
655
|
+
rvm_verbose_flag=${rvm_verbose_flag:-0}
|
656
|
+
rvm_ruby_gem_home=${rvm_ruby_gem_home:-""}
|
657
|
+
|
584
658
|
if [[ -n "$rvm_ruby_gem_home" ]] ; then
|
585
659
|
if [[ ! -d "$rvm_ruby_gem_home" ]] ; then
|
586
660
|
if [[ "$rvm_gemset_create_on_use_flag" -eq 1 ]] || [[ "$rvm_create_flag" -eq 1 ]]; then
|
@@ -591,7 +665,7 @@ __rvm_gemset_use() {
|
|
591
665
|
fi
|
592
666
|
fi
|
593
667
|
|
594
|
-
if [[ "$
|
668
|
+
if [[ "$rvm_interactive_flag" -eq 1 ]] || [[ "$rvm_verbose_flag" -eq 1 ]] ; then
|
595
669
|
"$rvm_scripts_path/log" "info" "Now using gemset '${rvm_gemset_name:-default}'"
|
596
670
|
fi
|
597
671
|
|
@@ -603,11 +677,12 @@ __rvm_gemset_use() {
|
|
603
677
|
|
604
678
|
__rvm_use # Now ensure the selection takes effect for the environment.
|
605
679
|
fi
|
680
|
+
|
606
681
|
return 0
|
607
682
|
}
|
608
683
|
|
609
684
|
__rvm_gemset_clear() {
|
610
|
-
|
685
|
+
rvm_gemset_name="" ; shift
|
611
686
|
rvm_ruby_gem_home="$(echo "$GEM_HOME" | sed "s#${rvm_gemset_separator:-'@'}.*\$##g")"
|
612
687
|
rvm_ruby_global_gems_path="$(echo "$GEM_HOME" | sed 's/'${rvm_gemset_separator}'.*$//')${rvm_gemset_separator}global"
|
613
688
|
GEM_HOME=$rvm_ruby_gem_home
|