rvm 1.0.1 → 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/binscripts/rvm-prompt +15 -16
- data/contrib/gemset_snapshot +1 -1
- data/install +19 -20
- data/lib/VERSION.yml +1 -1
- data/rvm.gemspec +2 -3
- data/scripts/alias +28 -20
- data/scripts/base +1 -1
- data/scripts/cleanup +1 -1
- data/scripts/cli +83 -104
- data/scripts/completion +28 -1
- data/scripts/docs +11 -11
- data/scripts/fetch +15 -15
- data/scripts/gemsets +72 -75
- data/scripts/help +9 -10
- data/scripts/hook +3 -1
- data/scripts/info +8 -6
- data/scripts/install +19 -20
- data/scripts/list +31 -40
- data/scripts/maglev +18 -18
- data/scripts/manage +190 -193
- data/scripts/match +1 -0
- data/scripts/migrate +10 -11
- data/scripts/monitor +4 -4
- data/scripts/package +14 -14
- data/scripts/patches +3 -4
- data/scripts/repair +5 -5
- data/scripts/rubygems +11 -11
- data/scripts/rvm +3 -3
- data/scripts/rvm-install +19 -20
- data/scripts/selector +68 -64
- data/scripts/set +10 -10
- data/scripts/snapshot +29 -28
- data/scripts/tools +7 -9
- data/scripts/update +19 -20
- data/scripts/upgrade +7 -7
- data/scripts/utility +96 -93
- data/scripts/wrapper +13 -18
- metadata +4 -5
- data/scripts/manpages +0 -8
data/scripts/tools
CHANGED
@@ -17,15 +17,13 @@ tools_path_identifier() {
|
|
17
17
|
echo "Usage: rvm tools path-identifier 'path-to-heck'"
|
18
18
|
return 1
|
19
19
|
fi
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
exit $rvmrc_result
|
28
|
-
)
|
20
|
+
|
21
|
+
source "$rvm_scripts_path/rvm"
|
22
|
+
builtin cd "$1"
|
23
|
+
rvm_promptless=1 __rvm_project_rvmrc
|
24
|
+
rvmrc_result="$?"
|
25
|
+
__rvm_environment_identifier
|
26
|
+
exit $rvmrc_result
|
29
27
|
}
|
30
28
|
|
31
29
|
tools_strings() {
|
data/scripts/update
CHANGED
@@ -76,7 +76,7 @@ if [[ -z "$rvm_path" ]] ; then rvm_path="${rvm_prefix}rvm" ; fi
|
|
76
76
|
|
77
77
|
source scripts/initialize
|
78
78
|
|
79
|
-
if \grep -q 'scripts/rvm' $HOME/.bash* 2>/dev/null || \grep -q 'scripts/rvm' $HOME/.zsh* 2>/dev/null; then
|
79
|
+
if \grep -q 'scripts/rvm' "$HOME"/.bash* 2>/dev/null || \grep -q 'scripts/rvm' "$HOME"/.zsh* 2>/dev/null; then
|
80
80
|
if [[ -d "$rvm_path" ]] && [[ -s "${rvm_path}/scripts/rvm" ]] ; then
|
81
81
|
export upgrade_flag=1
|
82
82
|
else
|
@@ -93,7 +93,7 @@ __rvm_initialize
|
|
93
93
|
#
|
94
94
|
item="$(tput setaf 2)* $(tput sgr0)"
|
95
95
|
question="\n$(tput setaf 2)<?>$(tput sgr0)"
|
96
|
-
cwd
|
96
|
+
cwd="$PWD"
|
97
97
|
source_path="${source_path:-$cwd}"
|
98
98
|
rvm_archives_path="${rvm_archives_path:-"$rvm_path/archives"}"
|
99
99
|
rvm_src_path="${rvm_src_path:-"$rvm_path/src"}"
|
@@ -151,7 +151,7 @@ done ; unset dir_name
|
|
151
151
|
spinner
|
152
152
|
if [[ ! -s "$rvm_config_path/user" ]] ; then
|
153
153
|
\mkdir -p "$rvm_config_path/"
|
154
|
-
echo '# Users settings file, overrides db file settings and persists across installs.' >> $rvm_config_path/user
|
154
|
+
echo '# Users settings file, overrides db file settings and persists across installs.' >> "$rvm_config_path/user"
|
155
155
|
fi
|
156
156
|
|
157
157
|
scripts=("monitor" "match" "log" "install" "color" "db" "fetch" "log" "set" "package")
|
@@ -170,7 +170,7 @@ for file in rvm-prompt rvm rvmsudo rvm-shell rvm-auto-ruby ; do
|
|
170
170
|
\cp -f "$source_path/binscripts/$file" $rvm_bin_path/
|
171
171
|
done
|
172
172
|
spinner
|
173
|
-
chmod +x $rvm_bin_path/*
|
173
|
+
chmod +x "$rvm_bin_path"/*
|
174
174
|
|
175
175
|
#
|
176
176
|
# RC Files
|
@@ -179,17 +179,17 @@ spinner
|
|
179
179
|
if [[ -n "$rvm_auto_flag" ]] ; then
|
180
180
|
printf "Checking rc files... ($rvm_rc_files)"
|
181
181
|
if [[ "$rvm_loaded_flag" != "1" ]] ; then
|
182
|
-
for rcfile in $(
|
182
|
+
for rcfile in $(printf $rvm_rc_files) ; do
|
183
183
|
if [[ ! -f $rcfile ]] ; then \touch $rcfile ; fi
|
184
184
|
if [[ -s "$HOME/.profile" ]] ; then
|
185
185
|
if ! \grep -q '.profile' "$rcfile" ; then
|
186
186
|
echo " Adding 'if [[ -s \$HOME/.profile ]] ; then source \$HOME ; fi' to $rcfile."
|
187
|
-
printf "\n# rvm-install added line:\nif [[ -s \$HOME/.profile ]] ; then source \$HOME/.profile ; fi\n" >> $rcfile
|
187
|
+
printf "\n# rvm-install added line:\nif [[ -s \$HOME/.profile ]] ; then source \$HOME/.profile ; fi\n" >> "$rcfile"
|
188
188
|
fi
|
189
189
|
fi
|
190
190
|
if ! \grep -q "scripts\/rvm" "$rcfile" ; then
|
191
191
|
echo " Adding 'if [[ -s $rvm_scripts_path/rvm ]] ; then source $rvm_scripts_path/rvm ; fi' to $rcfile."
|
192
|
-
printf "\n# rvm-install added:\nif [[ -s $rvm_scripts_path/rvm ]] ; then source $rvm_scripts_path/rvm ; fi\n" >> $rcfile
|
192
|
+
printf "\n# rvm-install added:\nif [[ -s $rvm_scripts_path/rvm ]] ; then source $rvm_scripts_path/rvm ; fi\n" >> "$rcfile"
|
193
193
|
fi
|
194
194
|
done
|
195
195
|
fi
|
@@ -254,26 +254,27 @@ done
|
|
254
254
|
spinner
|
255
255
|
printf "\r*" # Stop spinner.
|
256
256
|
|
257
|
-
for gemset in $rvm_path/gems/*\%* ; do
|
257
|
+
for gemset in "$rvm_path"/gems/*\%* ; do
|
258
258
|
new_path=${gemset/\%/${rvm_gemset_separator}}
|
259
259
|
if [[ -d "$gemset" ]] && [[ ! -d "$new_path" ]] ; then
|
260
|
-
printf "\n Renaming $(basename $gemset) to $(basename $new_path) for new gemset separator."
|
261
|
-
mv $gemset $new_path
|
260
|
+
printf "\n Renaming $(basename "$gemset") to $(basename "$new_path") for new gemset separator."
|
261
|
+
mv "$gemset" "$new_path"
|
262
262
|
fi
|
263
263
|
done
|
264
264
|
|
265
|
-
for gemset in $rvm_path/gems/*\+* ; do
|
265
|
+
for gemset in "$rvm_path"/gems/*\+* ; do
|
266
266
|
new_path=${gemset/\+/${rvm_gemset_separator}}
|
267
267
|
if [[ -d "$gemset" ]] && [[ ! -d "$new_path" ]] ; then
|
268
|
-
printf "\n Renaming $(basename $gemset) to $(basename $new_path) for new gemset separator."
|
268
|
+
printf "\n Renaming $(basename "$gemset") to $(basename "$new_path") for new gemset separator."
|
269
269
|
mv $gemset $new_path
|
270
270
|
fi
|
271
271
|
done
|
272
|
-
|
272
|
+
|
273
|
+
for gemset in "$rvm_path"/gems/*\@ ; do
|
273
274
|
new_path=$(echo $gemset | sed -e 's#\@$##')
|
274
275
|
if [[ -d "$gemset" ]] && [[ ! -d "$new_path" ]] ; then
|
275
|
-
printf "\n Fixing: $(basename $gemset) to $(basename $new_path) for new gemset separator."
|
276
|
-
mv $gemset $new_path
|
276
|
+
printf "\n Fixing: $(basename "$gemset") to $(basename "$new_path") for new gemset separator."
|
277
|
+
mv "$gemset" "$new_path"
|
277
278
|
fi
|
278
279
|
done
|
279
280
|
|
@@ -281,18 +282,16 @@ done
|
|
281
282
|
if [[ -s "$rvm_config_path/default" ]]; then
|
282
283
|
original_version="$(basename "$(\grep GEM_HOME "$rvm_config_path/default" | awk -F"'" '{print $2}' | sed "s#\%#${rvm_gemset_separator}#")")"
|
283
284
|
if [[ -n "$original_version" ]]; then
|
284
|
-
$rvm_scripts_path/alias create default "$original_version" &> /dev/null
|
285
|
-
fi
|
286
|
-
unset original_version
|
285
|
+
"$rvm_scripts_path/alias" create default "$original_version" &> /dev/null
|
286
|
+
fi ; unset original_version
|
287
287
|
\rm -rf "$rvm_config_path/default"
|
288
288
|
fi
|
289
289
|
|
290
290
|
#
|
291
291
|
# End of gemset migration.
|
292
292
|
#
|
293
|
-
|
294
293
|
printf "\n Correct permissions for base binaries in $rvm_bin_path..."
|
295
|
-
\mkdir -p $rvm_bin_path
|
294
|
+
\mkdir -p "$rvm_bin_path"
|
296
295
|
for file in rvm rvmsudo rvm-shell rvm-auto-ruby; do
|
297
296
|
[[ -s "$rvm_bin_path/$file" ]] && chmod +x "$rvm_bin_path/$file"
|
298
297
|
done; unset file
|
data/scripts/upgrade
CHANGED
@@ -17,12 +17,12 @@ confirm() {
|
|
17
17
|
}
|
18
18
|
|
19
19
|
die_with_error() {
|
20
|
-
$rvm_scripts_path/log "fail" "$1"
|
20
|
+
"$rvm_scripts_path/log" "fail" "$1"
|
21
21
|
exit "${2:-1}"
|
22
22
|
}
|
23
23
|
|
24
24
|
expand_ruby_name() {
|
25
|
-
$rvm_scripts_path/tools strings "$1" | awk -F"$rvm_gemset_separator" '{print $1}'
|
25
|
+
"$rvm_scripts_path/tools" strings "$1" | awk -F"$rvm_gemset_separator" '{print $1}'
|
26
26
|
}
|
27
27
|
|
28
28
|
expand_existing_ruby() {
|
@@ -33,7 +33,7 @@ expand_existing_ruby() {
|
|
33
33
|
echo "$ruby_name"
|
34
34
|
return 0
|
35
35
|
fi
|
36
|
-
done < <($rvm_scripts_path/list strings | tr ' ' '\n' | sort -ur | \grep "^$prefix" | \grep -v '-head$' | head -n1)
|
36
|
+
done < <("$rvm_scripts_path/list" strings | tr ' ' '\n' | sort -ur | \grep "^$prefix" | \grep -v '-head$' | head -n1)
|
37
37
|
return 1
|
38
38
|
}
|
39
39
|
|
@@ -46,18 +46,18 @@ upgrade_ruby() {
|
|
46
46
|
confirm "Are you sure you wish to upgrade from $expanded_source to $expanded_destination?" || die_with_error "Cancelling upgrade."
|
47
47
|
|
48
48
|
if [[ ! -d "$rvm_rubies_path/$expanded_destination" ]]; then
|
49
|
-
$rvm_scripts_path/log "info" "Installing new ruby $expanded_destination"
|
49
|
+
"$rvm_scripts_path/log" "info" "Installing new ruby $expanded_destination"
|
50
50
|
$rvm_bin_path/rvm install "$expanded_destination"
|
51
51
|
result="$?"
|
52
52
|
[[ "$result" -gt 0 ]] && die_with_error "Unable to install ruby $expanded_destination. Please install it manually to continue." "$result"
|
53
53
|
fi
|
54
54
|
|
55
|
-
$rvm_scripts_path/log "info" "Migrating gems from $expanded_source to $expanded_destination"
|
56
|
-
$rvm_scripts_path/migrate "$expanded_source" "$expanded_destination"
|
55
|
+
"$rvm_scripts_path/log" "info" "Migrating gems from $expanded_source to $expanded_destination"
|
56
|
+
"$rvm_scripts_path/migrate" "$expanded_source" "$expanded_destination"
|
57
57
|
result="$?"
|
58
58
|
[[ "$result" -gt 0 ]] && die_with_error "Error migrating gems." "$result"
|
59
59
|
|
60
|
-
$rvm_scripts_path/log "info" "Upgrade complete!"
|
60
|
+
"$rvm_scripts_path/log" "info" "Upgrade complete!"
|
61
61
|
}
|
62
62
|
|
63
63
|
[[ -z "$1" ]] && usage
|
data/scripts/utility
CHANGED
@@ -42,17 +42,17 @@ __rvm_teardown() {
|
|
42
42
|
}
|
43
43
|
|
44
44
|
__rvm_dump_environment() {
|
45
|
-
|
46
|
-
local
|
45
|
+
# Note: This assumes that there is a ','
|
46
|
+
local dump_environment_file="${rvm_dump_environment_flag/,*/}"
|
47
|
+
local dump_environment_type="${rvm_dump_environment_flag/*,/}"
|
47
48
|
if [[ -n "$dump_environment_file" && -n "$dump_environment_type" ]]; then
|
48
49
|
if [[ "$dump_environment_type" == "atheis"* ]]; then
|
49
50
|
\rm -rf "$dump_environment_file" && ln -s /dev/null "$dump_environment_file" >/dev/null 2>&1
|
50
51
|
else
|
51
|
-
$rvm_scripts_path/environment-convertor "$dump_environment_type" "$(__rvm_environment_identifier)" > "$dump_environment_file"
|
52
|
+
"$rvm_scripts_path/environment-convertor" "$dump_environment_type" "$(__rvm_environment_identifier)" > "$dump_environment_file"
|
52
53
|
[[ "$?" -gt 0 ]] && \rm -rf "$dump_environment_file"
|
53
54
|
fi
|
54
|
-
fi
|
55
|
-
unset rvm_dump_environment_flag
|
55
|
+
fi ; unset rvm_dump_environment_flag
|
56
56
|
}
|
57
57
|
|
58
58
|
# Return a list of directories under a given base path.
|
@@ -113,7 +113,7 @@ __rvm_quote_args_with_shift() {
|
|
113
113
|
|
114
114
|
__rvm_warn_on_rubyopt() {
|
115
115
|
if [[ -n "$RUBYOPT" ]]; then
|
116
|
-
$rvm_scripts_path/log "warn" "Please note: You have the RUBYOPT environment variable set and this may interfere with normal rvm operations. We sugges unsetting it."
|
116
|
+
"$rvm_scripts_path"/log "warn" "Please note: You have the RUBYOPT environment variable set and this may interfere with normal rvm operations. We sugges unsetting it."
|
117
117
|
return 1
|
118
118
|
else
|
119
119
|
return 0
|
@@ -148,20 +148,20 @@ __rvm_set_path_variable() {
|
|
148
148
|
if [[ -d "$1" ]] ; then
|
149
149
|
eval "${path_variable}=${1}"
|
150
150
|
else
|
151
|
-
$rvm_scripts_path/log "error" "'$1' is not a valid path."
|
151
|
+
"$rvm_scripts_path/log" "error" "'$1' is not a valid path."
|
152
152
|
fi ; unset path_variable
|
153
153
|
}
|
154
154
|
|
155
155
|
# Clean all *duplicate* items out of the path. (keep first occurrence of each)
|
156
156
|
__rvm_clean_path() {
|
157
|
-
PATH
|
157
|
+
PATH="$(echo $PATH | \tr -s ':' '\n' | awk '!($0 in a){a[$0];print}' | \tr -s '\n' ':' | sed 's#:$##')"
|
158
158
|
export PATH
|
159
159
|
builtin hash -r
|
160
160
|
}
|
161
161
|
|
162
162
|
# Clean all rvm items out of the current working path.
|
163
163
|
__rvm_remove_rvm_from_path() {
|
164
|
-
PATH
|
164
|
+
PATH="$(echo $PATH | \tr -s ':' '\n' | \grep -v "$rvm_path" | \tr -s '\n' ':' | sed 's#:$##')"
|
165
165
|
export PATH
|
166
166
|
builtin hash -r
|
167
167
|
}
|
@@ -170,9 +170,9 @@ __rvm_remove_rvm_from_path() {
|
|
170
170
|
__rvm_run() {
|
171
171
|
log_file_name="$1" ; command="$2" ; message="$3"
|
172
172
|
if [[ -z "$rvm_ruby_log_path" ]] ; then rvm_ruby_log_path="$rvm_log_path" ; fi
|
173
|
-
if [[ -n "$message" ]] ; then $rvm_scripts_path/log "info" "$message" ; fi
|
173
|
+
if [[ -n "$message" ]] ; then "$rvm_scripts_path/log" "info" "$message" ; fi
|
174
174
|
if [[ -n "$rvm_debug_flag" ]] ; then
|
175
|
-
$rvm_scripts_path/log "debug" "Executing: $command"
|
175
|
+
"$rvm_scripts_path/log" "debug" "Executing: $command"
|
176
176
|
fi
|
177
177
|
|
178
178
|
\mkdir -p "$(dirname "$rvm_ruby_log_path/$log_file_name.log")"
|
@@ -183,7 +183,7 @@ __rvm_run() {
|
|
183
183
|
else
|
184
184
|
eval "nice -n $rvm_niceness $command" >> $rvm_ruby_log_path/$log_file_name.log 2>> $rvm_ruby_log_path/$log_file_name.error.log
|
185
185
|
fi
|
186
|
-
if [[ $? -gt 0 ]] ; then $rvm_scripts_path/log "error" "Error running '$command', please check $rvm_ruby_log_path/$log_file_name*.log" ; __rvm_pushpop ; return 1 ; fi
|
186
|
+
if [[ $? -gt 0 ]] ; then "$rvm_scripts_path/log" "error" "Error running '$command', please check $rvm_ruby_log_path/$log_file_name*.log" ; __rvm_pushpop ; return 1 ; fi
|
187
187
|
unset log_file command
|
188
188
|
}
|
189
189
|
|
@@ -192,9 +192,9 @@ __rvm_run_with_env() {
|
|
192
192
|
log_file_name="$1" ; env_name="$2" ; command="$3" ; message="$4"
|
193
193
|
if [[ -z "$env_name" ]]; then env_name="$(__rvm_environment_identifier)"; fi
|
194
194
|
if [[ -z "$rvm_ruby_log_path" ]] ; then rvm_ruby_log_path="$rvm_log_path" ; fi
|
195
|
-
if [[ -n "$message" ]] ; then $rvm_scripts_path/log "info" "$message" ; fi
|
195
|
+
if [[ -n "$message" ]] ; then "$rvm_scripts_path/log" "info" "$message" ; fi
|
196
196
|
if [[ -n "$rvm_debug_flag" ]] ; then
|
197
|
-
$rvm_scripts_path/log "debug" "Executing: $command in environment "$env_name""
|
197
|
+
"$rvm_scripts_path/log" "debug" "Executing: $command in environment "$env_name""
|
198
198
|
fi
|
199
199
|
|
200
200
|
\mkdir -p "$(dirname "$rvm_ruby_log_path/$log_file_name.log")"
|
@@ -205,13 +205,13 @@ __rvm_run_with_env() {
|
|
205
205
|
else
|
206
206
|
eval "nice -n $rvm_niceness __rvm_with_env '$env_name' '$command'" >> $rvm_ruby_log_path/$log_file_name.log 2>> $rvm_ruby_log_path/$log_file_name.error.log
|
207
207
|
fi
|
208
|
-
if [[ $? -gt 0 ]] ; then $rvm_scripts_path/log "error" "Error running '$command' under $env_name, please check $rvm_ruby_log_path/$log_file_name*.log" ; __rvm_pushpop ; return 1 ; fi
|
208
|
+
if [[ $? -gt 0 ]] ; then "$rvm_scripts_path/log" "error" "Error running '$command' under $env_name, please check $rvm_ruby_log_path/$log_file_name*.log" ; __rvm_pushpop ; return 1 ; fi
|
209
209
|
unset log_file command env_name
|
210
210
|
}
|
211
211
|
|
212
212
|
# Unset both rvm variables as well as ruby-specific variables
|
213
213
|
# Preserve gemset if 'rvm_sticky' is set (persist gemset unless clear is explicitely called).
|
214
|
-
|
214
|
+
__rvm_cleanse_variables() {
|
215
215
|
__rvm_unset_ruby_variables
|
216
216
|
|
217
217
|
if [[ "$rvm_sticky_flag" = "1" ]] ; then export rvm_gemset_name ; else unset rvm_gemset_name ; fi
|
@@ -230,8 +230,8 @@ __rvm_with_env() {
|
|
230
230
|
rvm_env_command="$(echo "$2" | sed "s/rvm /rvm $rvm_env_args /")"
|
231
231
|
# Subshells!
|
232
232
|
(
|
233
|
-
source $rvm_scripts_path/rvm
|
234
|
-
rvm $rvm_env_args use $1 && eval "$rvm_env_command"
|
233
|
+
source "$rvm_scripts_path/rvm"
|
234
|
+
rvm "$rvm_env_args" use $1 && eval "$rvm_env_command"
|
235
235
|
)
|
236
236
|
unset rvm_env_args rvm_env_command
|
237
237
|
}
|
@@ -240,8 +240,8 @@ __rvm_with_env() {
|
|
240
240
|
# with things like rbx etc which require a ruby be installed.
|
241
241
|
__rvm_18_compat_ruby() {
|
242
242
|
rubies=""
|
243
|
-
for ruby_name in $(\ls $rvm_rubies_path); do
|
244
|
-
if [[ ! -L "$rvm_rubies_path/$ruby_name" ]] &&
|
243
|
+
for ruby_name in $(\ls "$rvm_rubies_path"); do
|
244
|
+
if [[ ! -L "$rvm_rubies_path/$ruby_name" ]] && [[ "$ruby_name" =~ 1.8. || "$ruby_name" =~ rbx- || "$ruby_name" =~ ree- ]] ; then
|
245
245
|
rubies="$rubies $ruby_name"
|
246
246
|
fi
|
247
247
|
done; unset ruby_name
|
@@ -253,20 +253,18 @@ __rvm_ensure_has_18_compat_ruby() {
|
|
253
253
|
if [[ -z "$(__rvm_18_compat_ruby)" ]]; then
|
254
254
|
# TODO: install currently doesn't return the correct status.
|
255
255
|
local compat_result=0
|
256
|
-
if ! ( $rvm_scripts_path/manage install 1.8.7 ); then
|
257
|
-
$rvm_scripts_path/log "fail" "To proceed rvm requires a 1.8-compatible ruby is installed. We attempted to install 1.8.7 automatically but it failed."
|
258
|
-
$rvm_scripts_path/log "fail" "Please install it manually (or a compatible alternative) to proceed."
|
256
|
+
if ! ( "$rvm_scripts_path/manage" install 1.8.7 ); then
|
257
|
+
"$rvm_scripts_path/log" "fail" "To proceed rvm requires a 1.8-compatible ruby is installed. We attempted to install 1.8.7 automatically but it failed."
|
258
|
+
"$rvm_scripts_path/log" "fail" "Please install it manually (or a compatible alternative) to proceed."
|
259
259
|
compat_result=1
|
260
|
-
fi
|
261
|
-
unset original_ruby
|
260
|
+
fi ; unset original_ruby
|
262
261
|
return $compat_result
|
263
262
|
fi
|
264
263
|
}
|
265
264
|
|
266
265
|
__rvm_inherit_trace_flag() {
|
267
266
|
if [[ -n "$rvm_trace_flag" ]]; then
|
268
|
-
set -x
|
269
|
-
export rvm_trace_flag
|
267
|
+
set -x ; export rvm_trace_flag
|
270
268
|
fi
|
271
269
|
}
|
272
270
|
|
@@ -276,8 +274,7 @@ __rvm_cleanup_temp_for() {
|
|
276
274
|
[[ -z "$1" ]] && return 1
|
277
275
|
if [[ -d "$rvm_tmp_path/" ]]; then
|
278
276
|
\rm -rf "$rvm_tmp_path/$1"* >/dev/null 2>&1
|
279
|
-
fi
|
280
|
-
exit
|
277
|
+
fi ; exit
|
281
278
|
}
|
282
279
|
|
283
280
|
__rvm_cleanup_temp_on_exit() {
|
@@ -290,7 +287,7 @@ __rvm_set_rvmrc() {
|
|
290
287
|
|
291
288
|
if [[ -s .rvmrc ]] ; then
|
292
289
|
mv .rvmrc .rvmrc.$(date +%m.%d.%Y-%H:%M:%S)
|
293
|
-
$rvm_scripts_path/log "warning" ".rvmrc is not empty, moving aside to preserve."
|
290
|
+
"$rvm_scripts_path/log" "warning" ".rvmrc is not empty, moving aside to preserve."
|
294
291
|
fi
|
295
292
|
|
296
293
|
local identifier=$(__rvm_environment_identifier)
|
@@ -299,16 +296,15 @@ __rvm_set_rvmrc() {
|
|
299
296
|
|
300
297
|
unset flags
|
301
298
|
else
|
302
|
-
$rvm_scripts_path/log "error" ".rvmrc cannot be set in your home directory. \n The home .rvmrc is for global rvm settings only."
|
299
|
+
"$rvm_scripts_path/log" "error" ".rvmrc cannot be set in your home directory. \n The home .rvmrc is for global rvm settings only."
|
303
300
|
fi
|
304
|
-
|
305
301
|
}
|
306
302
|
__rvm_load_rvmrc() {
|
307
303
|
[[ -z "$rvm_ignore_rvmrc" ]] && return
|
308
304
|
for rvmrc in /etc/rvmrc $HOME/.rvmrc ; do
|
309
305
|
if [[ -f "$rvmrc" ]] ; then
|
310
306
|
if \grep -q '^\s*rvm .*$' $rvmrc ; then
|
311
|
-
$rvm_scripts_path/log "error" "$rvmrc is for rvm settings only.\nrvm CLI may NOT be called from within $rvmrc. \nSkipping the loading of $rvmrc"
|
307
|
+
"$rvm_scripts_path/log" "error" "$rvmrc is for rvm settings only.\nrvm CLI may NOT be called from within $rvmrc. \nSkipping the loading of $rvmrc"
|
312
308
|
return 1
|
313
309
|
else
|
314
310
|
source "$rvmrc"
|
@@ -332,7 +328,7 @@ __rvm_benchmark() {
|
|
332
328
|
old_rvm_ruby_string=$rvm_ruby_string
|
333
329
|
unset rvm_ruby_string
|
334
330
|
export rvm_ruby_strings
|
335
|
-
$rvm_scripts_path/set $rvm_action $rvm_ruby_args
|
331
|
+
"$rvm_scripts_path/set" "$rvm_action" $rvm_ruby_args
|
336
332
|
result=$?
|
337
333
|
# Restore the state pre-sets.
|
338
334
|
[[ -n "$old_rvm_ruby_string" ]] && rvm_ruby_string=$old_rvm_ruby_string
|
@@ -341,25 +337,25 @@ __rvm_benchmark() {
|
|
341
337
|
|
342
338
|
# Loop over the currently installed rubies and refresh their binscripts.
|
343
339
|
__rvm_bin_scripts() {
|
344
|
-
for rvm_ruby_binary in $rvm_rubies_path/*/bin/ruby ; do
|
345
|
-
|
346
|
-
|
347
|
-
|
348
|
-
|
349
|
-
|
340
|
+
for rvm_ruby_binary in "$rvm_rubies_path"/*/bin/ruby ; do
|
341
|
+
if [[ -x "$rvm_ruby_binary" ]] ; then
|
342
|
+
rvm_ruby_string=$(dirname "$rvm_ruby_binary" | xargs dirname | xargs basename)
|
343
|
+
__rvm_select
|
344
|
+
__rvm_bin_script
|
345
|
+
fi
|
350
346
|
done
|
351
347
|
}
|
352
348
|
|
353
349
|
# Write the bin/ wrapper script for currently selected ruby.
|
354
350
|
# TODO: Adjust binscript to be able to handle all rubies not just the standard interpreteres.
|
355
351
|
__rvm_bin_script() {
|
356
|
-
$rvm_scripts_path/wrapper "$rvm_ruby_string"
|
352
|
+
"$rvm_scripts_path/wrapper" "$rvm_ruby_string"
|
357
353
|
}
|
358
354
|
|
359
355
|
# Add bin path if not present
|
360
356
|
__rvm_conditionally_add_bin_path() {
|
361
|
-
if echo "$PATH" | \
|
362
|
-
PATH="$rvm_bin_path:$PATH"
|
357
|
+
if echo "${PATH//:/ }" | \grep -vqF "$rvm_bin_path " ; then
|
358
|
+
PATH="${rvm_bin_path}:$PATH"
|
363
359
|
builtin hash -r
|
364
360
|
fi
|
365
361
|
}
|
@@ -386,7 +382,7 @@ __rvm_reset() {
|
|
386
382
|
__rvm_unset_ruby_variables
|
387
383
|
|
388
384
|
for system_config in system_ruby system_gem_path system_user_gem_path ; do
|
389
|
-
$rvm_scripts_path/db "$rvm_config_path/user" "$system_config" "delete"
|
385
|
+
"$rvm_scripts_path/db" "$rvm_config_path/user" "$system_config" "delete"
|
390
386
|
done ; unset system_config variable
|
391
387
|
|
392
388
|
\rm -f $rvm_bin_path/ruby $rvm_bin_path/gem $rvm_bin_path/rake $rvm_bin_path/irb $rvm_bin_path/default*
|
@@ -395,23 +391,23 @@ __rvm_reset() {
|
|
395
391
|
# Implode removes the entire rvm installation under $rvm_path.
|
396
392
|
__rvm_implode() {
|
397
393
|
while : ; do
|
398
|
-
$rvm_scripts_path/log "warn" "Are you SURE you wish for rvm to implode? This will remove $rvm_path ? (type 'yes' or 'no')"
|
394
|
+
"$rvm_scripts_path/log" "warn" "Are you SURE you wish for rvm to implode? This will remove $rvm_path ? (type 'yes' or 'no')"
|
399
395
|
read response
|
400
396
|
if [[ "yes" = "$response" ]] ; then
|
401
397
|
if [[ "/" = "$rvm_path" ]] ; then
|
402
|
-
$rvm_scripts_path/log "error" "remove '/' ?!...
|
398
|
+
"$rvm_scripts_path/log" "error" "remove '/' ?!... Ni!"
|
403
399
|
else
|
404
400
|
if [[ -d "$rvm_path" ]] ; then
|
405
|
-
$rvm_scripts_path/log "info" "Hai! Removing $rvm_path"
|
406
|
-
\rm -rf $rvm_path/
|
401
|
+
"$rvm_scripts_path/log" "info" "Hai! Removing $rvm_path"
|
402
|
+
\rm -rf "$rvm_path/"
|
407
403
|
echo "$rvm_path has been removed."
|
408
404
|
else
|
409
|
-
$rvm_scripts_path/log "info" "It appears that $rvm_path is already non existant."
|
405
|
+
"$rvm_scripts_path/log" "info" "It appears that $rvm_path is already non existant."
|
410
406
|
fi
|
411
407
|
fi
|
412
408
|
break
|
413
409
|
elif [[ "no" = "$response" ]] ; then
|
414
|
-
$rvm_scripts_path/log "info" "Cancelling implosion, no harm done :)"
|
410
|
+
"$rvm_scripts_path/log" "info" "Cancelling implosion, no harm done :)"
|
415
411
|
break
|
416
412
|
fi
|
417
413
|
done
|
@@ -421,7 +417,7 @@ __rvm_implode() {
|
|
421
417
|
__rvm_source_dir() {
|
422
418
|
if [[ -z "$rvm_ruby_selected_flag" ]] ; then __rvm_select ; fi
|
423
419
|
if [[ -z "$rvm_ruby_src_path" ]] ; then
|
424
|
-
$rvm_scripts_path/log "fail" "No source directory exists for the default implementation."
|
420
|
+
"$rvm_scripts_path/log" "fail" "No source directory exists for the default implementation."
|
425
421
|
else
|
426
422
|
echo "$rvm_ruby_src_path"
|
427
423
|
fi
|
@@ -449,7 +445,7 @@ __rvm_update() {
|
|
449
445
|
fi
|
450
446
|
[[ -n "$rvm_bin_flag" ]] && __rvm_bin_scripts
|
451
447
|
# Update to the latest rubygems.
|
452
|
-
[[ -n "$rvm_rubygems_flag" ]] && $rvm_scripts_path/rubygems current
|
448
|
+
[[ -n "$rvm_rubygems_flag" ]] && "$rvm_scripts_path/rubygems" current
|
453
449
|
|
454
450
|
unset rvm_update_flag rvm_action rvm_self_flag rvm_ruby_revision rvm_bin_flag rvm_rubygems_flag
|
455
451
|
__rvm_pushpop
|
@@ -472,7 +468,7 @@ __rvm_update_rvm() {
|
|
472
468
|
|
473
469
|
__rvm_run "fetch" "$rvm_scripts_path/fetch 'http://rvm.beginrescueend.com/releases/rvm-${stable_version}.tar.gz'" "fetching rvm-${stable_version}.tar.gz"
|
474
470
|
|
475
|
-
__rvm_run "extract" "gunzip \"$rvm_archives_path/rvm-${stable_version}.tar.gz\" | tar xf - -C $rvm_src_path" "Extracting rvm-${stable_version}.tar.gz ..."
|
471
|
+
__rvm_run "extract" "gunzip < \"$rvm_archives_path/rvm-${stable_version}.tar.gz\" | tar xf - -C $rvm_src_path" "Extracting rvm-${stable_version}.tar.gz ..."
|
476
472
|
|
477
473
|
__rvm_run "install" "builtin cd $rvm_src_path/rvm-${stable_version}/ ; ./install" "Installing rvm-${stable_version}..."
|
478
474
|
fi
|
@@ -482,14 +478,14 @@ __rvm_update_rvm() {
|
|
482
478
|
}
|
483
479
|
|
484
480
|
__rvm_reboot() {
|
485
|
-
$rvm_scripts_path/log "warn" "Do you wish to reboot rvm? ('yes', or 'no')"
|
481
|
+
"$rvm_scripts_path/log" "warn" "Do you wish to reboot rvm? ('yes', or 'no')"
|
486
482
|
read response
|
487
483
|
if [[ "yes" = "$response" ]] ; then
|
488
484
|
builtin cd $rvm_path
|
489
485
|
__rvm_reset
|
490
|
-
mv $rvm_path/archives
|
486
|
+
mv "$rvm_path/archives" "$HOME/.archives"
|
491
487
|
if [[ "/" = "$rvm_path" ]] ; then
|
492
|
-
$rvm_scripts_path/log "error" "remove '/' ?!... NO!"
|
488
|
+
"$rvm_scripts_path/log" "error" "remove '/' ?!... NO!"
|
493
489
|
else
|
494
490
|
if [[ -d "$rvm_path" ]] ; then \rm -rf "$rvm_path/" ; fi
|
495
491
|
fi
|
@@ -497,14 +493,14 @@ __rvm_reboot() {
|
|
497
493
|
__rvm_update_rvm
|
498
494
|
source $rvm_path/scripts/rvm
|
499
495
|
else
|
500
|
-
$rvm_scripts_path/log "info" "Carry on then..."
|
496
|
+
"$rvm_scripts_path/log" "info" "Carry on then..."
|
501
497
|
fi ; unset response
|
502
498
|
}
|
503
499
|
|
504
500
|
# Create the irbrc for the currently selected ruby installation.
|
505
501
|
__rvm_irbrc() {
|
506
502
|
if [[ -d "$rvm_ruby_home" ]] && [[ ! -s "$rvm_ruby_irbrc" ]] ; then
|
507
|
-
\cp $rvm_scripts_path/irbrc $rvm_ruby_irbrc
|
503
|
+
\cp "$rvm_scripts_path/irbrc" "$rvm_ruby_irbrc"
|
508
504
|
fi
|
509
505
|
}
|
510
506
|
|
@@ -540,7 +536,7 @@ __rvm_state() {
|
|
540
536
|
__rvm_inspect() {
|
541
537
|
for binary in $rvm_ruby_args ; do
|
542
538
|
actual_file="$(command -v $binary)"
|
543
|
-
$rvm_scripts_path/log "info" "$actual_file:"
|
539
|
+
"$rvm_scripts_path/log" "info" "$actual_file:"
|
544
540
|
if [[ -n "$rvm_shebang_flag" ]] ; then head -n 1 < "$actual_file" ; fi
|
545
541
|
if [[ -n "$rvm_env_flag" ]] ; then awk '/ENV/' < "$actual_file" ; fi
|
546
542
|
if [[ -n "$rvm_path_flag" ]] ; then awk '/PATH/' < "$actual_file" ; fi
|
@@ -600,18 +596,18 @@ __rvm_become() {
|
|
600
596
|
|
601
597
|
__rvm_ensure_has_environment_files() {
|
602
598
|
local environment_identifier="$(__rvm_environment_identifier)"
|
603
|
-
file_name="${rvm_environments_path}/$environment_identifier"
|
599
|
+
local file_name="${rvm_environments_path}/$environment_identifier"
|
604
600
|
|
605
601
|
if [[ ! -s "$file_name" ]] ; then
|
606
602
|
\mkdir -p "${rvm_environments_path}"
|
607
|
-
echo "export PATH=\"${rvm_ruby_gem_home}/bin:${rvm_ruby_global_gems_path}/bin:${rvm_ruby_home}/bin:${rvm_bin_path}:\$PATH\"" > $file_name
|
603
|
+
echo "export PATH=\"${rvm_ruby_gem_home}/bin:${rvm_ruby_global_gems_path}/bin:${rvm_ruby_home}/bin:${rvm_bin_path}:\$PATH\"" > "$file_name"
|
608
604
|
for variable in RUBY_VERSION GEM_HOME GEM_PATH BUNDLE_PATH MY_RUBY_HOME IRBRC rvm_ruby_string rvm_gemset_name MAGLEV_HOME ; do
|
609
605
|
eval "export $variable"
|
610
|
-
eval value=\$${variable}
|
606
|
+
eval "value=\$${variable}"
|
611
607
|
if [[ -n "$value" ]] ; then
|
612
|
-
printf "${variable}='$value'\nexport ${variable}\n" >> $file_name
|
608
|
+
printf "${variable}='$value'\nexport ${variable}\n" >> "$file_name"
|
613
609
|
else
|
614
|
-
printf "unset ${variable}\n" >> $file_name
|
610
|
+
printf "unset ${variable}\n" >> "$file_name"
|
615
611
|
fi
|
616
612
|
done ; unset variable value
|
617
613
|
fi ; unset file_name
|
@@ -624,7 +620,7 @@ __rvm_ensure_has_environment_files() {
|
|
624
620
|
directory_name="$rvm_wrappers_path/$wrapper_identifier"
|
625
621
|
if [[ ! -L "$directory_name" && ! -d "$directory_name" ]]; then
|
626
622
|
\mkdir -p "$directory_name"
|
627
|
-
$rvm_scripts_path/wrapper "$wrapper_identifier" &> /dev/null
|
623
|
+
"$rvm_scripts_path/wrapper" "$wrapper_identifier" &> /dev/null
|
628
624
|
fi
|
629
625
|
unset rvm_creating_default_wrappers directory_name
|
630
626
|
done; unset wrapper_identifier
|
@@ -637,7 +633,7 @@ __rvm_strip() {
|
|
637
633
|
}
|
638
634
|
|
639
635
|
__rvm_using_gemset_globalcache() {
|
640
|
-
$rvm_scripts_path/db "$rvm_config_path/user" "use_gemset_globalcache" | \grep -q '^true$'
|
636
|
+
"$rvm_scripts_path/db" "$rvm_config_path/user" "use_gemset_globalcache" | \grep -q '^true$'
|
641
637
|
}
|
642
638
|
|
643
639
|
__rvm_current_gemcache_dir() {
|
@@ -656,7 +652,7 @@ __rvm_ultimate_question() {
|
|
656
652
|
printf "\nI do not know the Ultimate Question, "
|
657
653
|
printf "\nhowever I can help you build a more "
|
658
654
|
printf "\npowerful Ruby which can compute the "
|
659
|
-
printf "\nUltimate Question
|
655
|
+
printf "\nUltimate Question.\n"
|
660
656
|
}
|
661
657
|
|
662
658
|
__rvm_load_env_file() {
|
@@ -684,24 +680,24 @@ __rvm_rvmrc_key() {
|
|
684
680
|
|
685
681
|
__rvm_reset_rvmrc_trust() {
|
686
682
|
touch "$rvm_config_path/rvmrcs"
|
687
|
-
$rvm_scripts_path/db "$rvm_config_path/rvmrcs" "$(__rvm_rvmrc_key "$1")" "delete" >/dev/null 2>&1
|
683
|
+
"$rvm_scripts_path/db" "$rvm_config_path/rvmrcs" "$(__rvm_rvmrc_key "$1")" "delete" >/dev/null 2>&1
|
688
684
|
}
|
689
685
|
|
690
686
|
__rvm_trust_rvmrc() {
|
691
687
|
touch "$rvm_config_path/rvmrcs"
|
692
688
|
__rvm_reset_rvmrc_trust "$1"
|
693
|
-
$rvm_scripts_path/db "$rvm_config_path/rvmrcs" "$(__rvm_rvmrc_key "$1")" "1" >/dev/null 2>&1
|
689
|
+
"$rvm_scripts_path/db" "$rvm_config_path/rvmrcs" "$(__rvm_rvmrc_key "$1")" "1" >/dev/null 2>&1
|
694
690
|
}
|
695
691
|
|
696
692
|
__rvm_untrust_rvmrc() {
|
697
693
|
touch "$rvm_config_path/rvmrcs"
|
698
694
|
__rvm_reset_rvmrc_trust "$1"
|
699
|
-
$rvm_scripts_path/db "$rvm_config_path/rvmrcs" "$(__rvm_rvmrc_key "$1")" "0" >/dev/null 2>&1
|
695
|
+
"$rvm_scripts_path/db" "$rvm_config_path/rvmrcs" "$(__rvm_rvmrc_key "$1")" "0" >/dev/null 2>&1
|
700
696
|
}
|
701
697
|
|
702
698
|
__rvm_rvmrc_stored_trust() {
|
703
699
|
touch "$rvm_config_path/rvmrcs"
|
704
|
-
$rvm_scripts_path/db "$rvm_config_path/rvmrcs" "$(__rvm_rvmrc_key "$1")"
|
700
|
+
"$rvm_scripts_path/db" "$rvm_config_path/rvmrcs" "$(__rvm_rvmrc_key "$1")"
|
705
701
|
}
|
706
702
|
|
707
703
|
__rvm_rvmrc_tools() {
|
@@ -754,26 +750,33 @@ __rvm_check_rvmrc_trustworthiness() {
|
|
754
750
|
|
755
751
|
__rvm_ask_to_trust() {
|
756
752
|
[[ -n "$rvm_promptless" ]] && return 2
|
757
|
-
|
758
|
-
|
759
|
-
|
760
|
-
|
761
|
-
|
762
|
-
|
763
|
-
|
764
|
-
|
753
|
+
printf "
|
754
|
+
============================================================
|
755
|
+
RVM has encountered a new untrusted .rvmrc file containing:
|
756
|
+
============================================================
|
757
|
+
|
758
|
+
$(cat $1)
|
759
|
+
|
760
|
+
============================================================
|
761
|
+
Trusting an .rvmrc file means that whenever you cd into the
|
762
|
+
directory RVM will excecute this .rvmrc script in your shell
|
763
|
+
|
764
|
+
Do you wish to trust this .rvmrc from now on?
|
765
|
+
============================================================
|
766
|
+
(y for yes, n for no)"
|
765
767
|
local trusted=""
|
768
|
+
# TODO: Eliminate infinite loop possibility.
|
766
769
|
while [[ -z "$trusted" ]] ; do
|
767
|
-
printf "
|
768
|
-
read -r
|
769
|
-
value="$(echo "$
|
770
|
-
if [[ "$
|
770
|
+
printf " > "
|
771
|
+
read -r response
|
772
|
+
value="$(echo "$response" | tr '[[:upper:]]' '[[:lower:]]' | __rvm_strip)"
|
773
|
+
if [[ "$response" = "y"* ]]; then
|
771
774
|
trusted=1
|
772
|
-
elif [[ "$
|
775
|
+
elif [[ "$response" = "n"* ]]; then
|
773
776
|
trusted=0
|
774
777
|
fi
|
775
|
-
done
|
776
|
-
|
778
|
+
done ; unset value
|
779
|
+
|
777
780
|
if [[ "$trusted" == "1" ]] ; then
|
778
781
|
__rvm_trust_rvmrc "$1"
|
779
782
|
return 0
|
@@ -857,26 +860,26 @@ __rvm_recorded_install_command() {
|
|
857
860
|
|
858
861
|
__rvm_environment_identifier() {
|
859
862
|
ruby_string="$(command -v ruby)"
|
863
|
+
|
860
864
|
if [ -n "$ruby_string" ] && echo "$ruby_string" | \grep -q -F "$rvm_rubies_path"; then
|
861
865
|
echo "$GEM_HOME" | xargs basename
|
862
866
|
else
|
863
867
|
echo "system"
|
864
|
-
fi
|
865
|
-
unset ruby_string
|
868
|
+
fi ; unset ruby_string
|
866
869
|
}
|
867
870
|
|
868
871
|
__rvm_expand_ruby_string() {
|
869
872
|
if [[ -z "$1" || "$1" = "all" ]]; then
|
870
|
-
$rvm_scripts_path/list strings | tr ' ' "\n" | __rvm_strip
|
873
|
+
"$rvm_scripts_path/list" strings | tr ' ' "\n" | __rvm_strip
|
871
874
|
elif [[ "$1" = "all-gemsets" ]]; then
|
872
|
-
$rvm_scripts_path/list gemsets strings | __rvm_strip
|
875
|
+
"$rvm_scripts_path/list" gemsets strings | __rvm_strip
|
873
876
|
elif [[ "$1" = "default-with-rvmrc" || "$1" = "rvmrc" ]]; then
|
874
|
-
$rvm_scripts_path/tools path-identifier "$PWD"
|
877
|
+
"$rvm_scripts_path/tools" path-identifier "$PWD"
|
875
878
|
elif [[ "$1" == "all-rubies" || "$1" = "rubies" ]]; then
|
876
|
-
$rvm_scripts_path/list rubies strings | __rvm_strip
|
879
|
+
"$rvm_scripts_path/list" rubies strings | __rvm_strip
|
877
880
|
elif [[ "$1" == "current-ruby" || "$1" = "gemsets" ]]; then
|
878
881
|
local current_ruby="$(__rvm_environment_identifier | awk -F"$rvm_gemset_separator" '{print $1}')"
|
879
|
-
rvm_silence_logging=1 $rvm_scripts_path/gemsets list | sed "s/^/$current_ruby$rvm_gemset_separator/" | __rvm_strip
|
882
|
+
rvm_silence_logging=1 "$rvm_scripts_path/gemsets" list | sed "s/^/$current_ruby$rvm_gemset_separator/" | __rvm_strip
|
880
883
|
elif [[ "$1" = "current" ]]; then
|
881
884
|
__rvm_environment_identifier
|
882
885
|
elif [[ "$1" = "aliases" ]]; then
|