rvm 1.1.4 → 1.1.5
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/VERSION.yml +1 -1
- data/lib/rvm/environment.rb +1 -1
- data/lib/rvm/shell/shell_wrapper.sh +1 -1
- data/rvm.gemspec +3 -110
- metadata +4 -111
- data/binscripts/rvm +0 -76
- data/binscripts/rvm-auto-ruby +0 -24
- data/binscripts/rvm-prompt +0 -208
- data/binscripts/rvm-shell +0 -35
- data/binscripts/rvm-update-head +0 -58
- data/binscripts/rvm-update-latest +0 -27
- data/binscripts/rvmsudo +0 -20
- data/config/db +0 -71
- data/config/known +0 -54
- data/config/md5 +0 -139
- data/contrib/gemset_snapshot +0 -25
- data/contrib/install-system-wide +0 -221
- data/contrib/r +0 -44
- data/examples/rvmrc +0 -49
- data/gemsets/default.gems +0 -1
- data/gemsets/global.gems +0 -1
- data/help/alias +0 -46
- data/help/benchmark +0 -17
- data/help/cleanup +0 -23
- data/help/debug +0 -8
- data/help/disk-usage +0 -15
- data/help/docs +0 -22
- data/help/exec +0 -33
- data/help/fetch +0 -5
- data/help/gem +0 -0
- data/help/gemdir +0 -0
- data/help/gemset +0 -14
- data/help/implode +0 -0
- data/help/info +0 -62
- data/help/install +0 -0
- data/help/list +0 -0
- data/help/migrate +0 -15
- data/help/monitor +0 -0
- data/help/notes +0 -0
- data/help/package +0 -0
- data/help/rake +0 -14
- data/help/remove +0 -0
- data/help/repair +0 -23
- data/help/reset +0 -0
- data/help/ruby +0 -84
- data/help/rubygems +0 -11
- data/help/rvmrc +0 -34
- data/help/snapshot +0 -15
- data/help/specs +0 -0
- data/help/srcdir +0 -0
- data/help/tests +0 -0
- data/help/tools +0 -22
- data/help/uninstall +0 -0
- data/help/update +0 -0
- data/help/upgrade +0 -18
- data/help/use +0 -0
- data/help/wrapper +0 -41
- data/install +0 -667
- data/man/man1/rvm.1 +0 -380
- data/man/man1/rvm.1.gz +0 -0
- data/scripts/alias +0 -226
- data/scripts/aliases +0 -4
- data/scripts/array +0 -32
- data/scripts/base +0 -57
- data/scripts/cd +0 -94
- data/scripts/cleanup +0 -58
- data/scripts/cli +0 -798
- data/scripts/color +0 -49
- data/scripts/completion +0 -151
- data/scripts/db +0 -87
- data/scripts/default +0 -64
- data/scripts/disk-usage +0 -60
- data/scripts/docs +0 -115
- data/scripts/env +0 -46
- data/scripts/environment-convertor +0 -74
- data/scripts/fetch +0 -231
- data/scripts/gemsets +0 -1045
- data/scripts/get +0 -126
- data/scripts/hash +0 -37
- data/scripts/help +0 -46
- data/scripts/hook +0 -23
- data/scripts/info +0 -213
- data/scripts/initialize +0 -29
- data/scripts/install +0 -667
- data/scripts/irbrc +0 -13
- data/scripts/irbrc.rb +0 -64
- data/scripts/list +0 -315
- data/scripts/log +0 -38
- data/scripts/maglev +0 -193
- data/scripts/manage +0 -2157
- data/scripts/match +0 -6
- data/scripts/md5 +0 -22
- data/scripts/migrate +0 -175
- data/scripts/monitor +0 -105
- data/scripts/notes +0 -140
- data/scripts/override_gem +0 -14
- data/scripts/package +0 -302
- data/scripts/patches +0 -64
- data/scripts/patchsets +0 -87
- data/scripts/repair +0 -199
- data/scripts/rubygems +0 -157
- data/scripts/rvm +0 -128
- data/scripts/rvm-install +0 -667
- data/scripts/selector +0 -904
- data/scripts/set +0 -301
- data/scripts/snapshot +0 -262
- data/scripts/tools +0 -58
- data/scripts/update +0 -667
- data/scripts/upgrade +0 -144
- data/scripts/utility +0 -1499
- data/scripts/version +0 -17
- data/scripts/wrapper +0 -210
data/scripts/selector
DELETED
@@ -1,904 +0,0 @@
|
|
1
|
-
#!/usr/bin/env bash
|
2
|
-
|
3
|
-
# __rvm_select implementation version patch_level
|
4
|
-
__rvm_select()
|
5
|
-
{
|
6
|
-
# Set Variable Defaults
|
7
|
-
export GEM_HOME GEM_PATH MY_RUBY_HOME RUBY_VERSION
|
8
|
-
|
9
|
-
if [[ -z "${rvm_ruby_string:-""}" ]] ; then
|
10
|
-
[[ -n "${rvm_ruby_interpreter:-""}" ]] && rvm_ruby_string="$rvm_ruby_interpreter"
|
11
|
-
[[ -n "${rvm_ruby_version:-""}" ]] && rvm_ruby_string="$rvm_ruby_string-$rvm_ruby_version"
|
12
|
-
[[ -n "${rvm_ruby_patch_level:-""}" ]] && rvm_ruby_string="$rvm_ruby_string-$rvm_ruby_patch_level"
|
13
|
-
[[ -n "${rvm_ruby_revision:-""}" ]] && rvm_ruby_string="$rvm_ruby_string-$rvm_ruby_revision"
|
14
|
-
[[ -n "${rvm_ruby_name:-""}" ]] && rvm_ruby_name="$rvm_ruby_string-n$rvm_ruby_name"
|
15
|
-
fi
|
16
|
-
|
17
|
-
if ! __rvm_ruby_string ; then
|
18
|
-
return $?
|
19
|
-
fi
|
20
|
-
|
21
|
-
rvm_archive_extension="tar.gz"
|
22
|
-
|
23
|
-
if [[ -z "${rvm_ruby_interpreter:-""}" ]] ; then
|
24
|
-
rvm_ruby_interpreter="${rvm_ruby_string//-*/}"
|
25
|
-
fi
|
26
|
-
|
27
|
-
case "$rvm_ruby_interpreter" in
|
28
|
-
macruby)
|
29
|
-
if [[ "Darwin" = "$(uname)" ]] ; then
|
30
|
-
|
31
|
-
rvm_ruby_package_name=${rvm_ruby_interpreter}-${rvm_ruby_version}
|
32
|
-
|
33
|
-
if [[ ${rvm_head_flag:-0} -eq 1 ]] ; then
|
34
|
-
rvm_ruby_version="" ; rvm_ruby_tag=""
|
35
|
-
rvm_ruby_revision="head"
|
36
|
-
__rvm_db "macruby_repo_url" "rvm_ruby_repo_url"
|
37
|
-
rvm_ruby_url="$rvm_ruby_repo_url"
|
38
|
-
|
39
|
-
elif [[ "nightly" = "${rvm_ruby_version:-""}" ]] ; then
|
40
|
-
__rvm_db "macruby_nightly_url" "rvm_ruby_url"
|
41
|
-
rvm_ruby_package_name="${rvm_ruby_interpreter}_nightly-${rvm_ruby_version}"
|
42
|
-
rvm_ruby_package_file="$rvm_ruby_package_name"
|
43
|
-
|
44
|
-
else
|
45
|
-
__rvm_db "macruby_version" "rvm_ruby_version"
|
46
|
-
__rvm_db "macruby_url" "rvm_ruby_url"
|
47
|
-
rvm_ruby_package_name="MacRuby%20${rvm_ruby_version}.zip"
|
48
|
-
rvm_ruby_package_file="$rvm_ruby_package_name"
|
49
|
-
rvm_ruby_url="$rvm_ruby_url/$rvm_ruby_package_name"
|
50
|
-
fi
|
51
|
-
rvm_ruby_patch_level=""
|
52
|
-
else
|
53
|
-
"$rvm_path/scripts/log" "fail" "MacRuby can only be installed on a Darwin OS."
|
54
|
-
fi
|
55
|
-
;;
|
56
|
-
|
57
|
-
rbx|rubinius)
|
58
|
-
rvm_archive_extension="tar.gz"
|
59
|
-
rvm_ruby_interpreter="rbx"
|
60
|
-
rvm_ruby_version=${rvm_ruby_version:-$(__rvm_db "rbx_version")}
|
61
|
-
rvm_ruby_repo_url=${rvm_rbx_repo_url:-$(__rvm_db "rubinius_repo_url")}
|
62
|
-
|
63
|
-
if [[ ${rvm_head_flag:-0} -eq 0 ]] ; then
|
64
|
-
rvm_ruby_patch_level=${rvm_ruby_patch_level:-$(__rvm_db "rbx_patch_level")}
|
65
|
-
rvm_ruby_string="${rvm_ruby_string/-prc/-rc}"
|
66
|
-
rvm_ruby_string="$(echo "$rvm_ruby_string" | sed 's#-p*#-#')"
|
67
|
-
rvm_ruby_package_file="$(echo "rubinius-${rvm_ruby_version}-${rvm_ruby_patch_level}.${rvm_archive_extension}" | sed 's#-p*#-#' )"
|
68
|
-
__rvm_db "rbx_url" "rvm_ruby_url"
|
69
|
-
rvm_ruby_url="$rvm_ruby_url/$rvm_ruby_package_file"
|
70
|
-
|
71
|
-
else
|
72
|
-
rvm_ruby_patch_level="" ; rvm_ruby_version=""
|
73
|
-
fi
|
74
|
-
;;
|
75
|
-
|
76
|
-
jruby)
|
77
|
-
rvm_ruby_patch_level=""
|
78
|
-
|
79
|
-
if [[ ${rvm_head_flag:-0} -eq 1 ]] ; then
|
80
|
-
rvm_ruby_version="head"
|
81
|
-
rvm_ruby_repo_url="${rvm_ruby_repo_url:-$(__rvm_db "jruby_repo_url")}"
|
82
|
-
rvm_ruby_url="${rvm_ruby_repo_url:-$(__rvm_db "jruby_repo_url")}"
|
83
|
-
|
84
|
-
else
|
85
|
-
rvm_archive_extension="tar.gz"
|
86
|
-
rvm_ruby_version="${rvm_ruby_version:-"$(__rvm_db "jruby_version")"}"
|
87
|
-
jruby_url="$(__rvm_db "jruby_url")"
|
88
|
-
rvm_ruby_package_file="${rvm_ruby_interpreter}-bin-${rvm_ruby_version}"
|
89
|
-
rvm_ruby_package_name="${rvm_ruby_interpreter}-${rvm_ruby_version}"
|
90
|
-
rvm_ruby_url="${jruby_url}/${rvm_ruby_version}/${rvm_ruby_package_file}.tar.gz"
|
91
|
-
jruby_url=""
|
92
|
-
fi
|
93
|
-
|
94
|
-
alias jruby_ng="jruby --ng"
|
95
|
-
alias jruby_ng_server="jruby --ng-server"
|
96
|
-
;;
|
97
|
-
|
98
|
-
maglev)
|
99
|
-
rvm_ruby_patch_level=""
|
100
|
-
maglev_url="$(__rvm_db "maglev_url")"
|
101
|
-
|
102
|
-
if [[ ${rvm_head_flag:-0} -eq 1 ]] ; then
|
103
|
-
rvm_ruby_version="head"
|
104
|
-
rvm_ruby_repo_url="${rvm_ruby_repo_url:-$(__rvm_db "maglev_repo_url")}"
|
105
|
-
rvm_ruby_url="${rvm_ruby_repo_url:-$(__rvm_db "maglev_repo_url")}"
|
106
|
-
|
107
|
-
else
|
108
|
-
system="$(uname -s)"
|
109
|
-
arch="$(uname -m)"
|
110
|
-
rvm_ruby_package_file="MagLev-${rvm_ruby_version}.${system}-${arch}"
|
111
|
-
rvm_gemstone_package_file="GemStone-${rvm_ruby_version}.${system}-${arch}"
|
112
|
-
rvm_ruby_version="${rvm_ruby_version:-"$(__rvm_db "maglev_version")"}"
|
113
|
-
rvm_ruby_package_name="${rvm_ruby_interpreter}-${rvm_ruby_version}"
|
114
|
-
rvm_ruby_url="${rvm_ruby_url:-"$maglev_url/${rvm_ruby_package_file}.${rvm_archive_extension}"}"
|
115
|
-
rvm_gemstone_url="${rvm_gemstone_url:-"$maglev_url/${rvm_gemstone_package_file}.${rvm_archive_extension}"}"
|
116
|
-
export MAGLEV_HOME="$rvm_path/rubies/$rvm_ruby_string"
|
117
|
-
fi
|
118
|
-
;;
|
119
|
-
|
120
|
-
ironruby)
|
121
|
-
rvm_ruby_patch_level=""
|
122
|
-
|
123
|
-
if [[ ${rvm_head_flag:-0} -eq 1 ]] ; then
|
124
|
-
rvm_ruby_version="head"
|
125
|
-
rvm_ruby_package_name="${rvm_ruby_string}"
|
126
|
-
rvm_ruby_repo_url="${rvm_ruby_repo_url:-$(__rvm_db "ironruby_repo_url")}"
|
127
|
-
rvm_ruby_url="${rvm_ruby_repo_url:-$(__rvm_db "ironruby_repo_url")}"
|
128
|
-
|
129
|
-
else
|
130
|
-
rvm_archive_extension="zip"
|
131
|
-
rvm_ruby_version=${rvm_ruby_version:-"$(__rvm_db "ironruby_version")"}
|
132
|
-
rvm_ruby_package_name="${rvm_ruby_interpreter}-${rvm_ruby_version}"
|
133
|
-
rvm_ruby_package_file="${rvm_ruby_interpreter}-${rvm_ruby_version}.${rvm_archive_extension}"
|
134
|
-
rvm_ruby_url="$(__rvm_db "ironruby_${rvm_ruby_version}_url")${rvm_ruby_package_file}"
|
135
|
-
fi
|
136
|
-
|
137
|
-
export rvm_ruby_version rvm_ruby_string rvm_ruby_package_name rvm_ruby_repo_url rvm_ruby_url rvm_archive_extension
|
138
|
-
;;
|
139
|
-
|
140
|
-
ree)
|
141
|
-
rvm_ruby_interpreter=ree
|
142
|
-
rvm_ruby_version=${rvm_ruby_version:-"$(__rvm_db "ree_version")"}
|
143
|
-
|
144
|
-
if [[ -n "${rvm_ruby_patch_level:-0}" ]] ; then
|
145
|
-
rvm_ruby_patch_level="$(echo $rvm_ruby_patch_level | sed 's#^p##')"
|
146
|
-
fi
|
147
|
-
|
148
|
-
if [[ ${rvm_head_flag:-0} -eq 0 ]] ; then
|
149
|
-
|
150
|
-
if [[ -n "${rvm_ruby_revision:-""}" ]] ; then
|
151
|
-
rvm_ruby_patch_level="" ; rvm_ruby_package_file=""
|
152
|
-
rvm_ruby_package_name="ree-$rvm_ruby_version-$rvm_ruby_revision"
|
153
|
-
|
154
|
-
else
|
155
|
-
rvm_ruby_package_file="ruby-enterprise-$rvm_ruby_version-$rvm_ruby_patch_level"
|
156
|
-
rvm_ruby_url="$(__rvm_db "${rvm_ruby_interpreter}_${rvm_ruby_version}_url")/$rvm_ruby_package_file.tar.gz"
|
157
|
-
fi
|
158
|
-
fi
|
159
|
-
|
160
|
-
if ! "$rvm_path/scripts/match" "$rvm_ruby_version" "^1\.8" ; then
|
161
|
-
"$rvm_path/scripts/log" "fail" "Unknown Ruby Enterprise Edition version: $rvm_ruby_version"
|
162
|
-
fi
|
163
|
-
;;
|
164
|
-
|
165
|
-
goruby)
|
166
|
-
rvm_ruby_interpreter="goruby"
|
167
|
-
rvm_ruby_version="head"
|
168
|
-
rvm_ruby_string="goruby"
|
169
|
-
rvm_ruby_patch_level=""
|
170
|
-
rvm_ruby_repo_url=${rvm_mput_repo_url:-"$(__rvm_db "goruby_repo_url")"}
|
171
|
-
rvm_ruby_url=$rvm_ruby_repo_url
|
172
|
-
rvm_ruby_configure="" ; rvm_ruby_make="" ; rvm_ruby_make_install=""
|
173
|
-
;;
|
174
|
-
|
175
|
-
ruby)
|
176
|
-
if [[ -z "${rvm_ruby_version:-""}" && ${rvm_head_flag:-0} -eq 0 ]]; then
|
177
|
-
"$rvm_path/scripts/log" "fail" "Ruby version was not specified!"
|
178
|
-
|
179
|
-
else
|
180
|
-
rvm_ruby_repo_url="${rvm_ruby_repo_url:-"$(__rvm_db "ruby_repo_url")"}"
|
181
|
-
|
182
|
-
if [[ ${rvm_head_flag:-0} -eq 0 ]]; then
|
183
|
-
rvm_archive_extension="tar.bz2"
|
184
|
-
fi
|
185
|
-
fi
|
186
|
-
;;
|
187
|
-
|
188
|
-
current)
|
189
|
-
ruby_binary="$(command -v ruby)"
|
190
|
-
|
191
|
-
if [[ $? -eq 0 ]] && "$rvm_path/scripts/match" "$ruby_binary" "rvm" ; then
|
192
|
-
rvm_ruby_string="$(dirname "$ruby_binary" | xargs dirname | xargs basename)"
|
193
|
-
|
194
|
-
else
|
195
|
-
rvm_ruby_interpreter="system"
|
196
|
-
fi
|
197
|
-
;;
|
198
|
-
|
199
|
-
default|system|user)
|
200
|
-
# no-op?
|
201
|
-
;;
|
202
|
-
|
203
|
-
*)
|
204
|
-
if [[ -n "${MY_RUBY_HOME:-""}" ]] ; then
|
205
|
-
rvm_ruby_string=$(basename $MY_RUBY_HOME)
|
206
|
-
__rvm_select
|
207
|
-
|
208
|
-
else
|
209
|
-
if [[ -z "${rvm_ruby_string:-""}" ]] ; then
|
210
|
-
"$rvm_path/scripts/log" "fail" "Ruby implementation '$rvm_ruby_interpreter' is not known."
|
211
|
-
return 1
|
212
|
-
fi
|
213
|
-
fi
|
214
|
-
esac
|
215
|
-
|
216
|
-
__rvm_gemset_select
|
217
|
-
|
218
|
-
if [[ -n "$rvm_ruby_interpreter" && "system" != "$rvm_ruby_interpreter" && "default" != "$rvm_ruby_interpreter" ]] ; then
|
219
|
-
|
220
|
-
if [[ ! -z "$rvm_ruby_version" ]] ; then
|
221
|
-
rvm_ruby_release_version="${rvm_ruby_version/.*/}"
|
222
|
-
rvm_ruby_major_version=${rvm_ruby_version%.*} ; rvm_ruby_major_version=${rvm_ruby_major_version#*.}
|
223
|
-
rvm_ruby_minor_version="${rvm_ruby_version//*.}"
|
224
|
-
fi
|
225
|
-
|
226
|
-
rvm_ruby_package_name="${rvm_ruby_package_name:-${rvm_ruby_string//-n*}}"
|
227
|
-
rvm_ruby_home="$rvm_path/rubies/$rvm_ruby_string"
|
228
|
-
rvm_ruby_binary="$rvm_ruby_home/bin/ruby"
|
229
|
-
rvm_ruby_irbrc="$rvm_ruby_home/.irbrc"
|
230
|
-
|
231
|
-
if [[ "maglev" = "$rvm_ruby_interpreter" ]] ; then
|
232
|
-
export MAGLEV_HOME="$rvm_ruby_home"
|
233
|
-
export GEMSTONE_GLOBAL_DIR=$MAGLEV_HOME
|
234
|
-
fi
|
235
|
-
|
236
|
-
rvm_ruby_gem_home="${rvm_gems_path:-"$rvm_path/gems"}/${rvm_ruby_string}"
|
237
|
-
|
238
|
-
if [[ -n "$rvm_gemset_name" ]] ; then
|
239
|
-
rvm_ruby_gem_home="${rvm_ruby_gem_home}${rvm_gemset_separator:-"@"}${rvm_gemset_name}"
|
240
|
-
rvm_ruby_gem_path="${rvm_ruby_gem_home}:${rvm_gems_path:-"$rvm_path/gems"}/${rvm_ruby_string}${rvm_gemset_separator:-"@"}global"
|
241
|
-
fi
|
242
|
-
|
243
|
-
rvm_ruby_global_gems_path="${rvm_ruby_gem_home%%${rvm_gemset_separator:-"@"}*}${rvm_gemset_separator:-"@"}global"
|
244
|
-
rvm_ruby_gem_path="${rvm_ruby_gem_home}:${rvm_ruby_global_gems_path}"
|
245
|
-
|
246
|
-
rvm_ruby_selected_flag=1
|
247
|
-
|
248
|
-
if [[ ! -d "{rvm_log_path:-"$rvm_path/log"}/$rvm_ruby_string" ]] ; then
|
249
|
-
\mkdir -p "${rvm_log_path:-"$rvm_path/log"}/$rvm_ruby_string"
|
250
|
-
fi
|
251
|
-
|
252
|
-
export rvm_action rvm_alias_expanded rvm_archflags rvm_archive_extension rvm_bin_flag rvm_bin_path rvm_clang_flag rvm_configure_flags rvm_debug_flag rvm_default_flag rvm_delete_flag rvm_docs_type rvm_dump_environment_flag rvm_error_message rvm_expanding_aliases rvm_file_name rvm_gemdir_flag rvm_gemset_name rvm_gemstone_package_file rvm_gemstone_url rvm_head_flag rvm_hook rvm_install_arguments rvm_install_on_use_flag rvm_interactive_flag rvm_llvm_flag rvm_loaded_flag rvm_make_flags rvm_niceness rvm_nightly_flag rvm_only_path_flag rvm_parse_break rvm_patch_names rvm_patch_original_pwd rvm_pretty_print_flag rvm_prior_cc rvm_proxy rvm_quiet_flag rvm_ree_options rvm_reload_flag rvm_remove_flag rvm_ruby_alias rvm_ruby_aliases rvm_ruby_args rvm_ruby_binary rvm_ruby_bits rvm_ruby_configure rvm_ruby_file rvm_ruby_gem_home rvm_ruby_gem_path rvm_ruby_global_gems_path rvm_ruby_home rvm_ruby_interpreter rvm_ruby_irbrc rvm_ruby_load_path rvm_ruby_major_version rvm_ruby_make rvm_ruby_make_install rvm_ruby_minor_version rvm_ruby_mode rvm_ruby_name rvm_ruby_package_file rvm_ruby_package_name rvm_ruby_patch rvm_ruby_patch_level rvm_ruby_release_version rvm_ruby_repo_url rvm_ruby_require rvm_ruby_revision rvm_ruby_selected_flag rvm_ruby_sha rvm_ruby_string rvm_ruby_strings rvm_ruby_tag rvm_ruby_url rvm_ruby_user_tag rvm_ruby_version rvm_script_name rvm_sdk rvm_silent_flag rvm_sticky_flag rvm_system_flag rvm_token rvm_trace_flag rvm_use_flag rvm_user_flag rvm_verbose_flag rvm_wrapper_name
|
253
|
-
|
254
|
-
else
|
255
|
-
rvm_ruby_interpreter="${rvm_ruby_interpreter:-system}"
|
256
|
-
fi
|
257
|
-
}
|
258
|
-
|
259
|
-
__rvm_use_system() {
|
260
|
-
|
261
|
-
unset GEM_HOME GEM_PATH MY_RUBY_HOME RUBY_VERSION IRBRC
|
262
|
-
|
263
|
-
new_path="$(__rvm_remove_rvm_from_path ; printf "$PATH"):${rvm_bin_path:-"$rvm_path/bin"}"
|
264
|
-
|
265
|
-
if [[ -s "$rvm_path/config/system" ]] ; then
|
266
|
-
|
267
|
-
\grep "MY_RUBY_HOME='$rvm_path/rubies" "$rvm_path/config/system" > /dev/null
|
268
|
-
|
269
|
-
if [[ $? -eq 0 ]] ; then
|
270
|
-
# 'system' should *not* point to an rvm ruby.
|
271
|
-
[[ -f "$rvm_path/config/system" ]] && \rm -f "$rvm_path/config/system"
|
272
|
-
else
|
273
|
-
source "$rvm_path/config/system"
|
274
|
-
fi
|
275
|
-
fi
|
276
|
-
|
277
|
-
if [[ ${rvm_default_flag:-0} -eq 1 ]] ; then
|
278
|
-
|
279
|
-
"$rvm_path/scripts/alias" delete default &> /dev/null
|
280
|
-
|
281
|
-
\find "${rvm_bin_path:-"$rvm_path/bin"}" -name 'default_*' -maxdepth 0 -delete
|
282
|
-
\rm -f "$rvm_path/config/default"
|
283
|
-
\rm -f "$rvm_path/environments/default"
|
284
|
-
\rm -rf "$rvm_path/wrappers/default"
|
285
|
-
|
286
|
-
fi
|
287
|
-
|
288
|
-
|
289
|
-
# Check binaries, remove under the condition they're symlinks.
|
290
|
-
if [[ ${rvm_selfcontained:-1} -eq 0 ]] ; then
|
291
|
-
|
292
|
-
for binary in ruby gem irb ri rdoc rake erb testrb ; do
|
293
|
-
|
294
|
-
full_binary_path="${rvm_bin_path:-"$rvm_path/bin"}/$binary"
|
295
|
-
|
296
|
-
[[ -L "$full_binary_path" ]] && \rm -f "$full_binary_path"
|
297
|
-
|
298
|
-
done
|
299
|
-
|
300
|
-
fi
|
301
|
-
|
302
|
-
if [[ ${rvm_verbose_flag:-0} -gt 0 ]] ; then
|
303
|
-
"$rvm_path/scripts/log" "info" "Now using system ruby."
|
304
|
-
fi
|
305
|
-
|
306
|
-
__rvm_remove_rvm_from_path
|
307
|
-
|
308
|
-
new_path="$PATH:${rvm_bin_path:-"$rvm_path/bin"}"
|
309
|
-
|
310
|
-
export rvm_ruby_string="system"
|
311
|
-
|
312
|
-
}
|
313
|
-
|
314
|
-
__rvm_use()
|
315
|
-
{
|
316
|
-
local new_path binary full_binary_path rvm_ruby_gem_home
|
317
|
-
|
318
|
-
#if [[ ${rvm_ruby_selected_flag:-0} -eq 0 ]] ; then __rvm_select "$@" ; fi
|
319
|
-
__rvm_select "$@"
|
320
|
-
|
321
|
-
if [[ -z "${rvm_ruby_interpreter:-""}" ]] ; then rvm_ruby_interpreter="system" ; fi
|
322
|
-
|
323
|
-
if [[ "system" = "$rvm_ruby_interpreter" ]] ; then
|
324
|
-
|
325
|
-
__rvm_use_system
|
326
|
-
|
327
|
-
else
|
328
|
-
unset BUNDLE_PATH # Ensure that BUNDLE_PATH is not set!
|
329
|
-
GEM_HOME="$rvm_ruby_gem_home"
|
330
|
-
GEM_PATH="$rvm_ruby_gem_home:$rvm_ruby_global_gems_path"
|
331
|
-
MY_RUBY_HOME="$rvm_ruby_home"
|
332
|
-
RUBY_VERSION="$rvm_ruby_string"
|
333
|
-
IRBRC="$rvm_ruby_irbrc"
|
334
|
-
|
335
|
-
export GEM_HOME GEM_PATH MY_RUBY_HOME RUBY_VERSION IRBRC
|
336
|
-
|
337
|
-
IRBRC=${IRBRC:-""} ; if [[ -z "$IRBRC" ]] ; then unset IRBRC ; fi
|
338
|
-
|
339
|
-
if [[ ! -d "$MY_RUBY_HOME" ]] ; then
|
340
|
-
"$rvm_path/scripts/log" "warn" \
|
341
|
-
"$rvm_ruby_interpreter $rvm_ruby_string is not installed."
|
342
|
-
|
343
|
-
if [[ ${rvm_install_on_use_flag:-0} -eq 1 ]] ; then
|
344
|
-
"$rvm_path/scripts/manage" "install" "$rvm_ruby_string"
|
345
|
-
else
|
346
|
-
"$rvm_path/scripts/log" "info" \
|
347
|
-
"To install do: 'rvm install $rvm_ruby_string'"
|
348
|
-
return 1
|
349
|
-
fi
|
350
|
-
fi
|
351
|
-
|
352
|
-
# Ensure the environment file for the selected ruby exists.
|
353
|
-
__rvm_ensure_has_environment_files
|
354
|
-
|
355
|
-
[[ ${rvm_verbose_flag:-0} -gt 0 ]] && \
|
356
|
-
"$rvm_path/scripts/log" "info" \
|
357
|
-
"Using ${GEM_HOME/${rvm_gemset_separator:-'@'}/ with gemset }"
|
358
|
-
|
359
|
-
new_path="$GEM_HOME/bin:$rvm_ruby_global_gems_path/bin:$MY_RUBY_HOME/bin:${rvm_bin_path:-"$rvm_path/bin"}:$(__rvm_remove_rvm_from_path ; printf "$PATH")"
|
360
|
-
fi
|
361
|
-
|
362
|
-
# Export ruby string and gem set me for extrenal scripts to take advantage of them.
|
363
|
-
if [[ -n "${rvm_ruby_string:-""}" ]] ; then
|
364
|
-
export rvm_ruby_string
|
365
|
-
fi
|
366
|
-
|
367
|
-
if [[ -n "${rvm_gemset_name:-""}" ]] ; then
|
368
|
-
export rvm_gemset_name
|
369
|
-
fi
|
370
|
-
|
371
|
-
if [[ -n "$new_path" ]]; then
|
372
|
-
export PATH="$new_path"
|
373
|
-
unset new_path
|
374
|
-
builtin hash -r
|
375
|
-
fi
|
376
|
-
|
377
|
-
if [[ "$rvm_ruby_string" != "system" ]] ; then
|
378
|
-
|
379
|
-
if [[ ${rvm_rvmrc_flag:-0} -eq 1 ]] ; then __rvm_set_rvmrc ; fi
|
380
|
-
|
381
|
-
local environment_id="$(__rvm_environment_identifier)"
|
382
|
-
|
383
|
-
if [[ ${rvm_default_flag:-0} -eq 1 && "default" != "${rvm_ruby_interpreter:-""}" ]] ; then
|
384
|
-
|
385
|
-
if [[ ${rvm_selfcontained:-""} -eq 0 ]] ; then
|
386
|
-
# Sets up the default wrappers.
|
387
|
-
"$rvm_path/scripts/wrapper" "$rvm_ruby_string" --no-prefix
|
388
|
-
else
|
389
|
-
"$rvm_path/scripts/wrapper" "$rvm_ruby_string" "default"
|
390
|
-
fi
|
391
|
-
|
392
|
-
if [[ "system" != "$rvm_ruby_interpreter" ]] ; then
|
393
|
-
|
394
|
-
RUBY_VERSION="$("$rvm_ruby_home/bin/ruby" -v | sed 's#^\(.*\) (.*$#\1#')"
|
395
|
-
|
396
|
-
export GEM_HOME GEM_PATH MY_RUBY_HOME RUBY_VERSION
|
397
|
-
|
398
|
-
"$rvm_path/scripts/alias" delete default &> /dev/null
|
399
|
-
|
400
|
-
"$rvm_path/scripts/alias" create default "$environment_id" >& /dev/null
|
401
|
-
|
402
|
-
\ln -nfs "$rvm_path/environments/$environment_id" "$rvm_path/environments/default"
|
403
|
-
|
404
|
-
\ln -nfs "$rvm_path/wrappers/$environment_id" "$rvm_path/wrappers/default"
|
405
|
-
|
406
|
-
fi
|
407
|
-
|
408
|
-
fi
|
409
|
-
|
410
|
-
rvm_default_flag=0
|
411
|
-
|
412
|
-
if [[ -n "${rvm_wrapper_name:-""}" ]] ; then
|
413
|
-
"$rvm_path/scripts/wrapper" "$environment_id" "$rvm_wrapper_name" > /dev/null 2>&1
|
414
|
-
rvm_wrapper_name=""
|
415
|
-
fi
|
416
|
-
|
417
|
-
if [[ -n "${rvm_ruby_alias:-""}" ]]; then
|
418
|
-
"$rvm_path/scripts/log" "info" "Attempting to alias $environment_id to $rvm_ruby_alias"
|
419
|
-
"$rvm_path/scripts/alias" delete "$rvm_ruby_alias" > /dev/null 2>&1
|
420
|
-
rvm_alias_expanded=1 "$rvm_path/scripts/alias" create "$rvm_ruby_alias" "$environment_id" > /dev/null 2>&1
|
421
|
-
ruby_alias="" ; rvm_ruby_alias=""
|
422
|
-
fi
|
423
|
-
|
424
|
-
if [[ "maglev" = "${rvm_ruby_interpreter:-""}" ]] ; then
|
425
|
-
export MAGLEV_HOME="$rvm_ruby_home"
|
426
|
-
export GEMSTONE_GLOBAL_DIR=$MAGLEV_HOME
|
427
|
-
if [[ -x "$MAGLEV_HOME/gemstone/bin/gslist" ]] ; then
|
428
|
-
"$MAGLEV_HOME/gemstone/bin/gslist" -clv > /dev/null 2>&1 ; result=$?
|
429
|
-
if [[ $result -eq 1 ]] ; then "$rvm_ruby_home/bin/maglev" start ; fi
|
430
|
-
fi
|
431
|
-
fi
|
432
|
-
|
433
|
-
else
|
434
|
-
|
435
|
-
if [[ ${rvm_default_flag:-0} -eq 1 ]] ; then
|
436
|
-
|
437
|
-
__rvm_reset
|
438
|
-
|
439
|
-
fi
|
440
|
-
|
441
|
-
fi
|
442
|
-
|
443
|
-
rvm_hook="after_use" ; source "$rvm_path/scripts/hook"
|
444
|
-
|
445
|
-
return 0
|
446
|
-
}
|
447
|
-
|
448
|
-
__rvm_ruby_string()
|
449
|
-
{
|
450
|
-
# rvm_ruby_string may designate any of the following items:
|
451
|
-
# * rvm_gemset_name
|
452
|
-
# * rvm_ruby_interpreter
|
453
|
-
# * rvm_ruby_version
|
454
|
-
# * rvm_ruby_patch_level
|
455
|
-
# * rvm_ruby_revision
|
456
|
-
# * rvm_ruby_tag
|
457
|
-
|
458
|
-
local ruby_string gemset_name
|
459
|
-
|
460
|
-
rvm_expanding_aliases=${rvm_expanding_aliases:-0}
|
461
|
-
|
462
|
-
rvm_ruby_version="${rvm_ruby_version:-""}"
|
463
|
-
rvm_gemset_name="${rvm_gemset_name:-""}"
|
464
|
-
rvm_ruby_interpreter="${rvm_ruby_interpreter:-""}"
|
465
|
-
rvm_ruby_version="${rvm_ruby_version:-""}"
|
466
|
-
rvm_ruby_patch_level="${rvm_ruby_patch_level:-""}"
|
467
|
-
rvm_ruby_revision="${rvm_ruby_revision:-""}"
|
468
|
-
rvm_ruby_tag="${rvm_ruby_tag:-""}"
|
469
|
-
|
470
|
-
if echo "$rvm_ruby_string" | \grep -q "${rvm_gemset_separator:-"@"}" ; then
|
471
|
-
rvm_gemset_name="${rvm_ruby_string/*${rvm_gemset_separator:-"@"}/}"
|
472
|
-
rvm_ruby_string="${rvm_ruby_string/${rvm_gemset_separator:-"@"}*/}"
|
473
|
-
fi
|
474
|
-
|
475
|
-
# Alias'd rubies
|
476
|
-
if [[ ${rvm_expanding_aliases:-0} -eq 0 && -n "${rvm_ruby_string:-""}"
|
477
|
-
&& "$rvm_ruby_string" != "system" ]] ; then
|
478
|
-
if expanded_alias_name="$("$rvm_path/scripts/alias" show "$rvm_ruby_string" 2>/dev/null)" \
|
479
|
-
&& [[ -n "$expanded_alias_name" ]] ; then
|
480
|
-
rvm_ruby_string="$expanded_alias_name"
|
481
|
-
elif [[ "$rvm_ruby_string" = default ]] ; then
|
482
|
-
# Default is not a known value. Instead, we need to therefore set it to system.
|
483
|
-
rvm_ruby_string="system"
|
484
|
-
fi
|
485
|
-
fi
|
486
|
-
|
487
|
-
if echo "$rvm_ruby_string" | \grep -q "${rvm_gemset_separator:-"@"}" ; then
|
488
|
-
rvm_gemset_name="${rvm_ruby_string/*${rvm_gemset_separator:-"@"}/}"
|
489
|
-
rvm_ruby_string="${rvm_ruby_string/${rvm_gemset_separator:-"@"}*/}"
|
490
|
-
fi
|
491
|
-
|
492
|
-
# Stash the ruby string.
|
493
|
-
ruby_string="${rvm_ruby_string:-""}"
|
494
|
-
gemset_name="${rvm_gemset_name:-""}"
|
495
|
-
repo_url="${rvm_ruby_repo_url:-""}"
|
496
|
-
branch_name="${rvm_ruby_repo_branch:-""}"
|
497
|
-
|
498
|
-
__rvm_unset_ruby_variables
|
499
|
-
|
500
|
-
rvm_ruby_repo_url="${repo_url:-""}"
|
501
|
-
rvm_ruby_repo_branch="${branch_name:-""}"
|
502
|
-
|
503
|
-
if [[ ! -z "$gemset_name" ]] ; then
|
504
|
-
rvm_gemset_name="$gemset_name"
|
505
|
-
rvm_sticky_flag=1 # <- not sold on this.
|
506
|
-
fi
|
507
|
-
|
508
|
-
strings=($(echo "${ruby_string//-/ }"))
|
509
|
-
|
510
|
-
if [[ ${#strings[@]} -eq 0 ]] ; then
|
511
|
-
|
512
|
-
if echo "${GEM_HOME:-""}" | grep -q "rvm" ; then
|
513
|
-
# Current Ruby
|
514
|
-
strings="${GEM_HOME##*\/}"
|
515
|
-
strings="${strings/%${rvm_gemset_separator:-"@"}*}"
|
516
|
-
rvm_ruby_string="$strings"
|
517
|
-
strings=(${strings//-/ })
|
518
|
-
else
|
519
|
-
strings=(system)
|
520
|
-
rvm_ruby_string="system"
|
521
|
-
fi
|
522
|
-
fi
|
523
|
-
|
524
|
-
for string in "${strings[@]:-""}" ; do
|
525
|
-
|
526
|
-
# TODO: case...
|
527
|
-
|
528
|
-
case "$string" in
|
529
|
-
head)
|
530
|
-
|
531
|
-
rvm_ruby_revision="head"
|
532
|
-
rvm_ruby_patch_level="" ; rvm_ruby_revision="" ; rvm_ruby_tag=""
|
533
|
-
export rvm_head_flag=1
|
534
|
-
;;
|
535
|
-
|
536
|
-
system)
|
537
|
-
rvm_ruby_interpreter="system"
|
538
|
-
rvm_ruby_patch_level="" ; rvm_ruby_tag="" ; rvm_head_flag=0 ; rvm_ruby_revision="" ; rvm_ruby_version="" ; rvm_gemset_name=""
|
539
|
-
return 0
|
540
|
-
;;
|
541
|
-
|
542
|
-
nightly)
|
543
|
-
rvm_ruby_version="nightly"
|
544
|
-
rvm_nightly_flag=1
|
545
|
-
break
|
546
|
-
;;
|
547
|
-
|
548
|
-
preview*)
|
549
|
-
rvm_ruby_patch_level="$string"
|
550
|
-
;;
|
551
|
-
|
552
|
-
rc[[:digit:]]*)
|
553
|
-
rvm_ruby_patch_level="$string"
|
554
|
-
;;
|
555
|
-
|
556
|
-
[[:digit:]]\.[[:digit:]]*)
|
557
|
-
|
558
|
-
case "$string" in
|
559
|
-
|
560
|
-
0.[[:digit:]]|0.[[:digit:]]\.[[:digit:]]|1.[[:digit:]]\.[[:digit:]])
|
561
|
-
rvm_ruby_version="$string"
|
562
|
-
rvm_ruby_revision=""
|
563
|
-
rvm_ruby_tag=""
|
564
|
-
;;
|
565
|
-
|
566
|
-
*)
|
567
|
-
"$rvm_path/scripts/log" "error" \
|
568
|
-
"Unknown ruby interpreter version: '$string'"
|
569
|
-
return 1
|
570
|
-
;;
|
571
|
-
esac
|
572
|
-
|
573
|
-
;;
|
574
|
-
|
575
|
-
p[[:digit:]]*)
|
576
|
-
rvm_ruby_patch_level="$string"
|
577
|
-
;;
|
578
|
-
|
579
|
-
#elif [[ -n "${rvm_ruby_version:-""}" ]] && "$rvm_path/scripts/match" "$string" "^
|
580
|
-
[[:digit:]][[:digit:]]*)
|
581
|
-
|
582
|
-
case "${rvm_ruby_interpreter:-""}" in
|
583
|
-
ree)
|
584
|
-
rvm_ruby_patch_level="$string"
|
585
|
-
rvm_ruby_revision=""
|
586
|
-
;;
|
587
|
-
|
588
|
-
rbx)
|
589
|
-
rvm_ruby_patch_level="$string"
|
590
|
-
;;
|
591
|
-
|
592
|
-
maglev)
|
593
|
-
rvm_ruby_version="$string"
|
594
|
-
rvm_ruby_revision=""
|
595
|
-
rvm_ruby_patch_level=""
|
596
|
-
;;
|
597
|
-
|
598
|
-
*)
|
599
|
-
rvm_ruby_revision="r$string"
|
600
|
-
;;
|
601
|
-
esac
|
602
|
-
;;
|
603
|
-
|
604
|
-
r[[:digit:]]*)
|
605
|
-
rvm_ruby_patch_level=""
|
606
|
-
rvm_ruby_revision="$string"
|
607
|
-
;;
|
608
|
-
|
609
|
-
s[[:digit:]]*)
|
610
|
-
rvm_ruby_revision=""
|
611
|
-
rvm_ruby_sha="$string"
|
612
|
-
;;
|
613
|
-
|
614
|
-
tv[[:digit:]]* | t[[:digit:]]*)
|
615
|
-
rvm_ruby_patch_level="" ; rvm_ruby_revision=""
|
616
|
-
rvm_ruby_tag="$string"
|
617
|
-
;;
|
618
|
-
|
619
|
-
m[[:digit:]]*)
|
620
|
-
rvm_ruby_mode="$string"
|
621
|
-
;;
|
622
|
-
|
623
|
-
u[[:alnum:]]*)
|
624
|
-
rvm_ruby_patch_level="" ; rvm_ruby_revision="" ; rvm_ruby_tag="" ; rvm_ruby_patch=""
|
625
|
-
rvm_ruby_user_tag="$string"
|
626
|
-
;;
|
627
|
-
|
628
|
-
b[[:digit:]][[:digit:]]*)
|
629
|
-
rvm_ruby_bits="$string"
|
630
|
-
;;
|
631
|
-
|
632
|
-
n*)
|
633
|
-
rvm_ruby_name="${string/n/}"
|
634
|
-
;;
|
635
|
-
|
636
|
-
ruby|rbx|jruby|macruby|ree|rubinius|maglev|ironruby|goruby)
|
637
|
-
rvm_ruby_interpreter="$string"
|
638
|
-
;;
|
639
|
-
|
640
|
-
*)
|
641
|
-
"$rvm_path/scripts/log" "error" \
|
642
|
-
"Unknown ruby interpreter string component: '$string'"
|
643
|
-
return 1
|
644
|
-
;;
|
645
|
-
esac
|
646
|
-
done
|
647
|
-
|
648
|
-
if [[ -z "${rvm_ruby_interpreter:-""}" ]] ; then
|
649
|
-
# Detect interpreter based on version.
|
650
|
-
case "$rvm_ruby_version" in
|
651
|
-
1.[8-9]*) rvm_ruby_interpreter="ruby" ;;
|
652
|
-
0.[5-6]*) rvm_ruby_interpreter="macruby" ;;
|
653
|
-
1.[2-7]*) rvm_ruby_interpreter="jruby" ;;
|
654
|
-
esac
|
655
|
-
fi
|
656
|
-
|
657
|
-
# Unspecified version
|
658
|
-
rvm_ruby_version="${rvm_ruby_version:-""}"
|
659
|
-
if [[ -z "${rvm_ruby_version:-""}" && ${rvm_head_flag:-0} -eq 0 ]] ; then
|
660
|
-
rvm_ruby_version="${rvm_ruby_version:-"$(__rvm_db "${rvm_ruby_interpreter}_version")"}"
|
661
|
-
fi
|
662
|
-
|
663
|
-
if [[ -z "${rvm_ruby_version:-""}" ]] ; then
|
664
|
-
rvm_ruby_string="${rvm_ruby_interpreter}"
|
665
|
-
else
|
666
|
-
rvm_ruby_string="${rvm_ruby_interpreter}-${rvm_ruby_version}"
|
667
|
-
fi
|
668
|
-
|
669
|
-
# Head
|
670
|
-
if [[ ${rvm_head_flag:-0} -eq 1 ]] ; then
|
671
|
-
rvm_ruby_string="${rvm_ruby_string}-head"
|
672
|
-
|
673
|
-
elif [[ -n "${rvm_ruby_revision:-""}" ]] ; then
|
674
|
-
rvm_ruby_string="${rvm_ruby_string}-${rvm_ruby_revision}"
|
675
|
-
|
676
|
-
elif [[ -n "${rvm_ruby_tag:-""}" ]] ; then
|
677
|
-
rvm_ruby_string="${rvm_ruby_string}-${rvm_ruby_tag}"
|
678
|
-
|
679
|
-
elif [[ -n "${rvm_ruby_patch_level:-""}" ]] ; then
|
680
|
-
rvm_ruby_string="${rvm_ruby_string}-${rvm_ruby_patch_level}"
|
681
|
-
|
682
|
-
elif [[ -n "${rvm_ruby_user_tag:-""}" ]] ; then
|
683
|
-
rvm_ruby_string="${rvm_ruby_string}-${rvm_ruby_user_tag}"
|
684
|
-
|
685
|
-
else
|
686
|
-
patch_level="$(__rvm_db "${rvm_ruby_interpreter}_${rvm_ruby_version}_patch_level")"
|
687
|
-
|
688
|
-
if [[ -n "${patch_level:-""}" ]] ; then
|
689
|
-
|
690
|
-
case "$rvm_ruby_interpreter" in
|
691
|
-
ree|rbx)
|
692
|
-
# REE & Rubinius use dates for their patch levels.
|
693
|
-
rvm_ruby_patch_level="${patch_level}"
|
694
|
-
;;
|
695
|
-
*)
|
696
|
-
# MRI uses -pN+ to specify the patch level.
|
697
|
-
rvm_ruby_patch_level="p${patch_level}"
|
698
|
-
;;
|
699
|
-
esac
|
700
|
-
|
701
|
-
fi
|
702
|
-
|
703
|
-
if [[ -n "${rvm_ruby_patch_level:-""}" ]] ; then
|
704
|
-
|
705
|
-
rvm_ruby_patch_level="${rvm_ruby_patch_level/#pp/p}"
|
706
|
-
rvm_ruby_string="${rvm_ruby_string}-${rvm_ruby_patch_level}"
|
707
|
-
|
708
|
-
case "$rvm_ruby_interpreter" in
|
709
|
-
|
710
|
-
ree|rbx)
|
711
|
-
rvm_ruby_string="${rvm_ruby_string//-p*/-}"
|
712
|
-
;;
|
713
|
-
|
714
|
-
*)
|
715
|
-
rvm_ruby_string="${rvm_ruby_string//-pp/-p}"
|
716
|
-
rvm_ruby_string="${rvm_ruby_string//-prc/-rc}"
|
717
|
-
;;
|
718
|
-
|
719
|
-
esac
|
720
|
-
|
721
|
-
fi
|
722
|
-
fi
|
723
|
-
|
724
|
-
if [[ -n "${rvm_ruby_name:-""}" ]] ; then
|
725
|
-
rvm_ruby_string="${rvm_ruby_string}-n${rvm_ruby_name}"
|
726
|
-
fi
|
727
|
-
}
|
728
|
-
|
729
|
-
# Select a gemset based on CLI set options and environment.
|
730
|
-
# This only sets 'rvm_ruby_gem_home'
|
731
|
-
__rvm_gemset_select()
|
732
|
-
{
|
733
|
-
command -v gem > /dev/null
|
734
|
-
if [[ $? -gt 0 ]] ; then return 0 ; fi # Stop if no 'gem' command is available.
|
735
|
-
|
736
|
-
rvm_ruby_gem_home="${rvm_ruby_gem_home:-""}"
|
737
|
-
rvm_gemset_name="${rvm_gemset_name:-""}"
|
738
|
-
|
739
|
-
if [[ -z "${rvm_gemset_name:-""}" ]] ; then
|
740
|
-
|
741
|
-
# No longer defaulting to 'sticky' gem sets.
|
742
|
-
# Set 'rvm_sticky_flag=1' in ~/.rvmrc to enable.
|
743
|
-
if [[ ${rvm_sticky_flag:-0} -eq 1 ]] ; then
|
744
|
-
|
745
|
-
if [[ -n "${GEM_HOME:-""}" ]] ; then
|
746
|
-
rvm_gemset_name="$(echo $GEM_HOME | xargs basename | awk -F${rvm_gemset_separator:-"@"} '{print $2}')"
|
747
|
-
fi
|
748
|
-
|
749
|
-
if [[ -n "${rvm_ruby_gem_home:-""}" ]] ; then
|
750
|
-
rvm_gemset_name="$(echo $rvm_ruby_gem_home | xargs basename | awk -F${rvm_gemset_separator:-"@"} '{print $2}')"
|
751
|
-
fi
|
752
|
-
fi
|
753
|
-
|
754
|
-
if [[ -n "${rvm_gemset_name:-""}" ]] &&
|
755
|
-
! echo "${rvm_gemset_name:-""}" | grep -q "^[[:digit:]]\.[[:digit:]]" ; then
|
756
|
-
|
757
|
-
rvm_ruby_gem_home="${rvm_gems_path:-"$rvm_path/gems"}/${rvm_ruby_string}${rvm_gemset_separator:-"@"}${rvm_gemset_name}"
|
758
|
-
|
759
|
-
else
|
760
|
-
if [[ -n "${rvm_ruby_string:-""}" && "${rvm_ruby_interpreter:-""}" != "system" ]] ; then
|
761
|
-
rvm_ruby_gem_home="${rvm_gems_path:-"$rvm_path/gems"}/$rvm_ruby_string"
|
762
|
-
|
763
|
-
elif [[ -z "${GEM_HOME:-""}" && -n "$(command -v gem)" ]] ; then
|
764
|
-
rvm_ruby_gem_home="$(gem env gemdir)"
|
765
|
-
|
766
|
-
elif [[ -n "${GEM_HOME:-""}" ]] ; then
|
767
|
-
rvm_ruby_gem_home="$GEM_HOME"
|
768
|
-
|
769
|
-
else
|
770
|
-
rvm_ruby_gem_home=""
|
771
|
-
fi
|
772
|
-
fi
|
773
|
-
else
|
774
|
-
local gemset="$(echo "$rvm_ruby_gem_home" | awk -F'@' '{print $NF}')"
|
775
|
-
|
776
|
-
if [[ -z "${rvm_ruby_string:-""}" && -n "${GEM_HOME:-""}" && -n "${GEM_HOME/@*/}" ]] ; then
|
777
|
-
rvm_ruby_string="$(basename ${GEM_HOME/@*/})"
|
778
|
-
fi
|
779
|
-
|
780
|
-
if [[ -n "${rvm_ruby_string:-""}" ]] ; then
|
781
|
-
|
782
|
-
if [[ -z "${rvm_ruby_gem_home:-""}" || -n "${gemset:-""}" ]] ; then
|
783
|
-
|
784
|
-
rvm_ruby_gem_home="${rvm_gems_path:-"$rvm_path/gems"}/${rvm_ruby_string}${rvm_gemset_separator:-"@"}${rvm_gemset_name}"
|
785
|
-
|
786
|
-
elif [[ -n "${gemset:-""}" && "${rvm_gemset_name:-""}" != "${gemset:-""}" ]] ; then
|
787
|
-
|
788
|
-
rvm_ruby_gem_home="${rvm_gems_path:-"$rvm_path/gems"}/${rvm_ruby_string}${rvm_gemset_separator:-"@"}${rvm_gemset_name}"
|
789
|
-
fi
|
790
|
-
else
|
791
|
-
"$rvm_path/scripts/log" "error" \
|
792
|
-
"Gemsets can not be used with non rvm controlled rubies (currently)."
|
793
|
-
return 1
|
794
|
-
fi
|
795
|
-
fi
|
796
|
-
|
797
|
-
if [[ -z "${GEM_HOME:-""}" ]] ; then unset GEM_HOME ; fi
|
798
|
-
|
799
|
-
# If the gemset does not exist, then notify the user as such and abort the action.
|
800
|
-
if [[ -n "${rvm_gemset_name:-""}" && ! -d "$rvm_ruby_gem_home" ]] ; then
|
801
|
-
|
802
|
-
if [[ ${rvm_gemset_create_on_use_flag:-0} -ne 1 && ${rvm_create_flag:-0} -ne 1 && ${rvm_delete_flag:-0} -ne 1 ]] ; then
|
803
|
-
|
804
|
-
"$rvm_path/scripts/log" "error" \
|
805
|
-
"Gemset '$rvm_gemset_name' does not exist, rvm gemset create '$rvm_gemset_name' first."
|
806
|
-
|
807
|
-
unset rvm_gemset_name gemset_name
|
808
|
-
|
809
|
-
return 1
|
810
|
-
fi
|
811
|
-
|
812
|
-
elif [[ ${rvm_delete_flag:-0} -eq 1 ]] ; then
|
813
|
-
return 1
|
814
|
-
fi
|
815
|
-
|
816
|
-
if [[ -z "${rvm_ruby_gem_home:-""}" && -n "${rvm_ruby_string:-""}" ]] ; then
|
817
|
-
rvm_ruby_gem_home="${rvm_gems_path:-"$rvm_path/gems"}/$rvm_ruby_string"
|
818
|
-
fi
|
819
|
-
|
820
|
-
rvm_ruby_global_gems_path="${rvm_ruby_gem_home%%${rvm_gemset_separator:-"@"}*}${rvm_gemset_separator:-"@"}global"
|
821
|
-
rvm_ruby_gem_path="$rvm_ruby_gem_home:$rvm_ruby_global_gems_path"
|
822
|
-
|
823
|
-
# Ensure that the ruby gem home exists.
|
824
|
-
\mkdir -p "$rvm_ruby_gem_home"
|
825
|
-
|
826
|
-
if [[ -n "${rvm_ruby_gem_home:-""}" ]] &&
|
827
|
-
echo "$rvm_ruby_gem_home" | \grep -q 'rvm'; then
|
828
|
-
|
829
|
-
if __rvm_using_gemset_globalcache && [[ ! -L "$rvm_ruby_gem_home/cache" ]]; then
|
830
|
-
|
831
|
-
\mv "$rvm_ruby_gem_home/cache/"*.gem "$rvm_gems_cache_path/" 2>/dev/null
|
832
|
-
\rm -rf "$rvm_ruby_gem_home/cache"
|
833
|
-
\ln -nfs "$rvm_gems_cache_path" "$rvm_ruby_gem_home/cache"
|
834
|
-
|
835
|
-
fi
|
836
|
-
|
837
|
-
fi
|
838
|
-
|
839
|
-
export rvm_ruby_gem_path rvm_ruby_gem_home
|
840
|
-
}
|
841
|
-
|
842
|
-
# Use a gemset specified by 'rvm_ruby_gem_home'
|
843
|
-
__rvm_gemset_use()
|
844
|
-
{
|
845
|
-
if [[ -z "${rvm_gemset_name:-""}" ]] ; then
|
846
|
-
|
847
|
-
"$rvm_path/scripts/log" "error" \
|
848
|
-
"Gemset was not given.\n Usage:\n rvm gemset use <gemsetname>\n"
|
849
|
-
|
850
|
-
return 1
|
851
|
-
|
852
|
-
fi
|
853
|
-
|
854
|
-
if [[ -n "${rvm_ruby_gem_home:-""}" ]] ; then
|
855
|
-
|
856
|
-
if [[ ! -d "$rvm_ruby_gem_home" ]] ; then
|
857
|
-
|
858
|
-
if [[ ${rvm_gemset_create_on_use_flag:-0} -eq 1 \
|
859
|
-
|| ${rvm_create_flag:-0} -eq 1 ]] ; then
|
860
|
-
"$rvm_path/scripts/gemsets" create "$rvm_gemset_name"
|
861
|
-
else
|
862
|
-
"$rvm_path/scripts/log" "error" \
|
863
|
-
"Gemset '$rvm_gemset_name' does not exist, rvm gemset create '$rvm_gemset_name' first."
|
864
|
-
return 1
|
865
|
-
fi
|
866
|
-
fi
|
867
|
-
|
868
|
-
if [[ ${rvm_interactive_flag:-0} -gt 0 && ${rvm_verbose_flag:-1} -ne 0 ]] ; then
|
869
|
-
"$rvm_path/scripts/log" "info" \
|
870
|
-
"Now using gemset '${rvm_gemset_name:-default}'"
|
871
|
-
fi
|
872
|
-
|
873
|
-
rvm_ruby_gem_home="${GEM_HOME//${rvm_gemset_separator:-"@"}*}${rvm_gemset_separator:-"@"}${rvm_gemset_name}"
|
874
|
-
|
875
|
-
rvm_ruby_global_gems_path="${rvm_ruby_gem_home%%${rvm_gemset_separator:-"@"}*}${rvm_gemset_separator:-"@"}global"
|
876
|
-
|
877
|
-
GEM_HOME="$rvm_ruby_gem_home"
|
878
|
-
GEM_PATH="$rvm_ruby_gem_home:$rvm_ruby_global_gems_path"
|
879
|
-
|
880
|
-
export rvm_ruby_gem_home GEM_HOME GEM_PATH
|
881
|
-
|
882
|
-
__rvm_use # Now ensure the selection takes effect for the environment.
|
883
|
-
fi
|
884
|
-
|
885
|
-
return 0
|
886
|
-
}
|
887
|
-
|
888
|
-
__rvm_gemset_clear()
|
889
|
-
{
|
890
|
-
rvm_gemset_name=""
|
891
|
-
|
892
|
-
rvm_ruby_gem_home="${GEM_HOME//${rvm_gemset_separator:-"@"}*}"
|
893
|
-
|
894
|
-
rvm_ruby_global_gems_path="${rvm_ruby_gem_home}${rvm_gemset_separator:-"@"}global"
|
895
|
-
|
896
|
-
GEM_HOME="$rvm_ruby_gem_home"
|
897
|
-
|
898
|
-
GEM_PATH="$rvm_ruby_gem_home:$rvm_ruby_global_gems_path"
|
899
|
-
|
900
|
-
export rvm_ruby_gem_home rvm_ruby_global_gems_path GEM_HOME GEM_PATH
|
901
|
-
|
902
|
-
__rvm_use # Now ensure the selection takes effect for the environment.
|
903
|
-
}
|
904
|
-
|