rvm 1.0.4 → 1.0.5
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/lib/VERSION.yml +1 -1
- data/rvm.gemspec +3 -2
- data/scripts/alias +49 -27
- data/scripts/base +21 -6
- data/scripts/cli +159 -84
- data/scripts/default +61 -0
- data/scripts/docs +17 -15
- data/scripts/env +7 -5
- data/scripts/fetch +10 -10
- data/scripts/gemsets +17 -8
- data/scripts/hook +1 -1
- data/scripts/info +73 -54
- data/scripts/initialize +2 -4
- data/scripts/list +12 -8
- data/scripts/log +1 -1
- data/scripts/manage +317 -264
- data/scripts/notes +84 -38
- data/scripts/package +50 -39
- data/scripts/patches +1 -1
- data/scripts/repair +10 -9
- data/scripts/rubygems +3 -3
- data/scripts/selector +45 -58
- data/scripts/set +28 -18
- data/scripts/snapshot +42 -37
- data/scripts/tools +2 -2
- data/scripts/utility +91 -99
- data/scripts/wrapper +11 -8
- metadata +5 -4
data/scripts/set
CHANGED
@@ -2,17 +2,12 @@
|
|
2
2
|
|
3
3
|
source "$rvm_scripts_path/base"
|
4
4
|
|
5
|
-
if [[ -z "$1" ]] ; then
|
6
|
-
"$rvm_scripts_path/log" "error" "Action must be specified."
|
7
|
-
exit 1
|
8
|
-
fi
|
9
|
-
|
10
5
|
__rvm_attempt_single_exec() {
|
11
6
|
# Return if we have multiple rubies. or we're not running exec.
|
12
7
|
local ruby_string_lines="$(printf "$rvm_ruby_strings" | wc -l | __rvm_strip)"
|
13
8
|
if [[ "$action" = "exec" && -n "$rvm_ruby_strings" && "$ruby_string_lines" = "0" ]]; then
|
14
9
|
__rvm_become "$rvm_ruby_strings"
|
15
|
-
eval "exec $args"
|
10
|
+
eval "exec ${args[@]}"
|
16
11
|
fi
|
17
12
|
return 1
|
18
13
|
}
|
@@ -28,12 +23,16 @@ __rvm_ruby_do() {
|
|
28
23
|
binary="$(echo $action | sed 's#do$##')"
|
29
24
|
if [[ -x "$rvm_ruby_home/bin/$binary" ]] ; then
|
30
25
|
binary="$rvm_ruby_home/bin/$binary"
|
26
|
+
|
31
27
|
elif [[ -x "$rvm_ruby_global_gems_path/bin/$binary" ]] ; then
|
32
28
|
binary="$rvm_ruby_global_gems_path/bin/$binary"
|
29
|
+
|
33
30
|
elif [[ -x "$rvm_ruby_gem_home/bin/$binary" ]] ; then
|
34
31
|
binary="$rvm_ruby_gem_home/bin/$binary"
|
32
|
+
|
35
33
|
elif [[ "system" = "$rvm_ruby_string" ]] && [[ -x "$(command -v $binary)" ]] ; then
|
36
34
|
binary="$(basename $(command -v $binary) 2>/dev/null)"
|
35
|
+
|
37
36
|
else
|
38
37
|
"$rvm_scripts_path/log" "warn" "'$binary not found for $rvm_ruby_string' either does not exist or is not executable? :("
|
39
38
|
__rvm_unset_ruby_variables
|
@@ -48,15 +47,18 @@ __rvm_ruby_do() {
|
|
48
47
|
load_path="$(dirname $(command -v $binary) 2>/dev/null):$rvm_ruby_load_path"
|
49
48
|
# TODO: the else case below should be run if $args =~ /\.rb$/
|
50
49
|
if [[ "ruby" = "$(basename $binary)" ]] && [[ "$rvm_benchmark_flag" -ne 1 ]] ; then
|
50
|
+
|
51
51
|
if "$rvm_scripts_path/match" "$args" "\.rb$" ; then
|
52
|
+
|
52
53
|
if [[ -z "$prefix" ]] ; then prefix="-S" ; fi
|
54
|
+
|
53
55
|
if ! "$rvm_scripts_path/match" "$args" "$prefix" ; then
|
54
56
|
args="$prefix $args"
|
55
57
|
fi
|
56
58
|
fi
|
57
|
-
rvm_command="$binary $rvm_ruby_mode $rvm_ruby_require -I$load_path $args"
|
59
|
+
rvm_command="$(echo "$binary $rvm_ruby_mode $rvm_ruby_require -I$load_path $args")"
|
58
60
|
else
|
59
|
-
rvm_command="$binary $rvm_ruby_mode $args"
|
61
|
+
rvm_command="$(echo "$binary $rvm_ruby_mode $args")"
|
60
62
|
fi
|
61
63
|
fi
|
62
64
|
|
@@ -64,8 +66,9 @@ __rvm_ruby_do() {
|
|
64
66
|
\mkdir -p ./log/$rvm_ruby_string/
|
65
67
|
\touch ./log/$rvm_ruby_string/$action.log ./log/$rvm_ruby_string/$action.error.log
|
66
68
|
eval "$rvm_command" >> ./log/$rvm_ruby_string/$action.log 2>> ./log/$rvm_ruby_string/$action.error.log
|
69
|
+
|
67
70
|
else
|
68
|
-
if [[
|
71
|
+
if [[ ${rvm_verbose_flag:-0} -gt 0 ]] ; then
|
69
72
|
current_env="$(__rvm_environment_identifier)"
|
70
73
|
if [[ "$current_env" != "$current_set_ruby" ]]; then
|
71
74
|
current_env="$current_set_ruby ($current_env)"
|
@@ -83,8 +86,10 @@ __rvm_ruby_do() {
|
|
83
86
|
else
|
84
87
|
eval "errors=(${errors[*]} $string)"
|
85
88
|
fi
|
89
|
+
|
86
90
|
eval "rubies=(${rubies[*]} $string)"
|
87
91
|
eval "statuses=(${statuses[*]} $result)"
|
92
|
+
|
88
93
|
unset string
|
89
94
|
__rvm_unset_ruby_variables
|
90
95
|
}
|
@@ -117,7 +122,7 @@ __rvm_yaml() {
|
|
117
122
|
total=${#rubies[*]}
|
118
123
|
if [[ -n "${ZSH_VERSION:-""}" ]] ; then array_start=1 ; else array_start=0 ; fi
|
119
124
|
for (( index = $array_start ; index < $total + $array_start ; index++ )) ; do
|
120
|
-
if [[
|
125
|
+
if [[ ${rvm_debug_flag:-0} -gt 0 ]] ; then
|
121
126
|
"$rvm_scripts_path/log" "debug" "${rubies[$index]}: ${statuses[$index]}"
|
122
127
|
fi
|
123
128
|
yaml="$yaml\n \"${rubies[$index]}\": ${statuses[$index]}"
|
@@ -130,17 +135,17 @@ __rvm_yaml() {
|
|
130
135
|
|
131
136
|
# Output the summary in a json format.
|
132
137
|
__rvm_json() {
|
133
|
-
json="{
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
+
json="{
|
139
|
+
\"totals\": { \"rubies\": ${#rubies[*]}, \"successes\": ${#successes[*]}, \"errors\": ${#errors[*]} },
|
140
|
+
\"successful\": [$(echo \"${successes[*]}\" | sed 's# #", "#g' | sed 's#\"\"##')],
|
141
|
+
\"errors\": [$(echo \"${errors[*]}\" | sed 's# #", "#g' | sed 's#\"\"##')],
|
142
|
+
\"rubies\": { "
|
138
143
|
|
139
144
|
total=${#rubies[*]}
|
140
145
|
if [[ -n "${ZSH_VERSION:-""}" ]] ; then array_start=1 ; else array_start=0 ; fi
|
141
146
|
|
142
147
|
for (( index = $array_start ; index < $total + $array_start ; index++ )) ; do
|
143
|
-
if [[
|
148
|
+
if [[ ${rvm_debug_flag:-0} -gt 0 ]] ; then
|
144
149
|
"$rvm_scripts_path/log" "debug" "${rubies[$index]}: ${statuses[$index]}"
|
145
150
|
fi
|
146
151
|
json="$json\n {\"${rubies[$index]}\": ${statuses[$index]}}"
|
@@ -161,7 +166,12 @@ rubies=() ; successes=() ; errors=() ; statuses=()
|
|
161
166
|
|
162
167
|
args=($*)
|
163
168
|
action="${args[0]}"
|
164
|
-
args
|
169
|
+
args=${args[@]:1}
|
170
|
+
|
171
|
+
if [[ -z "$action" ]] ; then
|
172
|
+
"$rvm_scripts_path/log" "error" "Action must be specified."
|
173
|
+
exit 1
|
174
|
+
fi
|
165
175
|
|
166
176
|
if [[ "$action" == "ruby" ]] && echo "$args" | \grep -q "^'--[^[:space:]]*'$" ; then
|
167
177
|
"$rvm_scripts_path/log" "warn" "You called rvm ruby with the arguments $args which look like use options."
|
@@ -175,7 +185,7 @@ __rvm_attempt_single_exec
|
|
175
185
|
|
176
186
|
for current_set_ruby in ${rvm_ruby_strings} ; do
|
177
187
|
__rvm_ruby_do
|
178
|
-
done
|
188
|
+
done
|
179
189
|
|
180
190
|
if [[ ! -z "$rvm_summary_flag" ]] ; then __rvm_summary ; fi
|
181
191
|
if [[ ! -z "$rvm_yaml_flag" ]] ; then __rvm_yaml ; fi
|
data/scripts/snapshot
CHANGED
@@ -38,18 +38,20 @@ snapshot_save() {
|
|
38
38
|
|
39
39
|
"$rvm_scripts_path/log" "info" "Backing up all of your gemsets"
|
40
40
|
\mkdir -p "$snapshot_temp_path/gems"
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
41
|
+
|
42
|
+
(
|
43
|
+
builtin cd "$snapshot_temp_path/gems"
|
44
|
+
for snapshot_gemset in $("$rvm_scripts_path/list" gemsets strings) ; do
|
45
|
+
__rvm_become "$snapshot_gemset"
|
46
|
+
result="$?"
|
47
|
+
__error_on_result "$result" "Error becoming ruby $snapshot_gemset" && return "$result"
|
48
|
+
"$rvm_scripts_path/gemsets" export "${snapshot_gemset}.gems" >/dev/null
|
49
|
+
result="$?"
|
50
|
+
__error_on_result "$result" "Error exporting gemset contents for $snapshot_gemset" && return "$result"
|
51
|
+
\mkdir -p "./$snapshot_gemset/"
|
52
|
+
[[ -d "$GEM_HOME/cache/" ]] && \cp -R "$GEM_HOME/cache/" "./$snapshot_gemset/"
|
53
|
+
done; unset snapshot_gemset
|
54
|
+
)
|
53
55
|
|
54
56
|
"$rvm_scripts_path/log" "info" "Backing up all of your installed rubies"
|
55
57
|
echo '#!/usr/bin/env bash -e' > "$snapshot_temp_path/install-rubies.sh"
|
@@ -80,12 +82,13 @@ snapshot_save() {
|
|
80
82
|
|
81
83
|
"$rvm_scripts_path/log" "info" "Compressing snapshotting"
|
82
84
|
local destination_path="$PWD"
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
85
|
+
(
|
86
|
+
builtin cd "$snapshot_temp_path"
|
87
|
+
\rm -rf "$destination_path/$1.tar.gz"
|
88
|
+
tar czf "$destination_path/$1.tar.gz" .
|
89
|
+
result="$?"
|
90
|
+
__error_on_result "$result" "Error creating archive $destination_path/$1.tar.gz" && return "$result"
|
91
|
+
)
|
89
92
|
|
90
93
|
"$rvm_scripts_path/log" "info" "Cleaning up"
|
91
94
|
\rm -rf "$snapshot_temp_path"
|
@@ -113,11 +116,12 @@ snapshot_load() {
|
|
113
116
|
\mkdir -p "$snapshot_temp_path"
|
114
117
|
|
115
118
|
"$rvm_scripts_path/log" "info" "Extracting snapshot"
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
119
|
+
(
|
120
|
+
builtin cd "$snapshot_temp_path"
|
121
|
+
tar xzf "$snapshot_archive"
|
122
|
+
result="$?"
|
123
|
+
__error_on_result "$result" "Error extracting the archive '$snapshot_archive'" && return "$result"
|
124
|
+
)
|
121
125
|
|
122
126
|
"$rvm_scripts_path/log" "info" "Restoring user settings"
|
123
127
|
\cp -f "$snapshot_temp_path/user" "$rvm_config_path/user"
|
@@ -137,20 +141,21 @@ snapshot_load() {
|
|
137
141
|
|
138
142
|
export rvm_create_flag=1
|
139
143
|
"$rvm_scripts_path/log" "info" "Setting up gemsets"
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
144
|
+
(
|
145
|
+
builtin cd "$snapshot_temp_path/gems"
|
146
|
+
for snapshot_gemset in $(\ls | \grep '\.gems$' | sed 's/.gems$//'); do
|
147
|
+
__rvm_become "$snapshot_gemset"
|
148
|
+
result="$?"
|
149
|
+
__error_on_result "$result" "Error becoming '$snapshot_gemset'" && return "$result"
|
150
|
+
\mkdir -p "$GEM_HOME/cache/"
|
151
|
+
\cp -Rf "$snapshot_gemset/" "$GEM_HOME/cache/"
|
152
|
+
result="$?"
|
153
|
+
__error_on_result "$result" "Error copying across cache for $snapshot_gemset" && return "$result"
|
154
|
+
"$rvm_scripts_path/gemsets" import "$snapshot_gemset" >/dev/null 2>&1
|
155
|
+
result="$?"
|
156
|
+
__error_on_result "$result" "Error importing gemset for $snapshot_gemset" && return "$result"
|
157
|
+
done
|
158
|
+
)
|
154
159
|
|
155
160
|
"$rvm_scripts_path/log" "info" "Restoring aliases"
|
156
161
|
while read -r package_info; do
|
data/scripts/tools
CHANGED
@@ -14,7 +14,7 @@ tools_identifier() {
|
|
14
14
|
|
15
15
|
tools_path_identifier() {
|
16
16
|
if [[ -z "$1" || ! -d "$1" ]]; then
|
17
|
-
echo "Usage: rvm tools path-identifier 'path-to-
|
17
|
+
echo "Usage: rvm tools path-identifier 'path-to-check'"
|
18
18
|
return 1
|
19
19
|
fi
|
20
20
|
|
@@ -40,7 +40,7 @@ tools_strings() {
|
|
40
40
|
|
41
41
|
args=($*)
|
42
42
|
action="${args[0]}"
|
43
|
-
args="$(echo ${args[@]:1})
|
43
|
+
args="$(echo ${args[@]:1})" # Strip trailing / leading / extra spacing.
|
44
44
|
|
45
45
|
[[ -z "$action" ]] && usage
|
46
46
|
|
data/scripts/utility
CHANGED
@@ -182,15 +182,15 @@ __rvm_remove_rvm_from_path() {
|
|
182
182
|
|
183
183
|
# Run a specified command and log it.
|
184
184
|
__rvm_run() {
|
185
|
-
local log_file_name="$1"
|
186
|
-
local command="$2"
|
187
|
-
local message="$3"
|
185
|
+
local log_file_name="${1:-""}"
|
186
|
+
local command="${2:-""}"
|
187
|
+
local message="${3:-""}"
|
188
188
|
|
189
189
|
if [[ -z "$rvm_ruby_log_path" ]] ; then rvm_ruby_log_path="$rvm_log_path" ; fi
|
190
190
|
|
191
191
|
if [[ -n "$message" ]] ; then "$rvm_scripts_path/log" "info" "$message" ; fi
|
192
192
|
|
193
|
-
if [[
|
193
|
+
if [[ ${rvm_debug_flag:-0} -gt 0 ]] ; then
|
194
194
|
"$rvm_scripts_path/log" "debug" "Executing: $command"
|
195
195
|
fi
|
196
196
|
|
@@ -200,14 +200,15 @@ __rvm_run() {
|
|
200
200
|
|
201
201
|
echo "[$(date +'%Y-%m-%d %H:%M:%S')] $command" | \tee "$rvm_ruby_log_path/$log_file_name.log" >> "$rvm_ruby_log_path/$log_file_name.error.log"
|
202
202
|
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
203
|
+
(
|
204
|
+
if [[ -z "${rvm_niceness:-""}" || "0" = "${rvm_niceness:-""}" ]] ; then
|
205
|
+
eval "$command" >> "$rvm_ruby_log_path/$log_file_name.log" 2>> "$rvm_ruby_log_path/$log_file_name.error.log"
|
206
|
+
else
|
207
|
+
eval "nice -n $rvm_niceness $command" >> $rvm_ruby_log_path/$log_file_name.log 2>> $rvm_ruby_log_path/$log_file_name.error.log
|
208
|
+
fi
|
209
|
+
)
|
210
|
+
local result=$? ; if [[ $result -gt 0 ]] ; then
|
211
|
+
"$rvm_scripts_path/log" "error" "Error running '$command', please check $rvm_ruby_log_path/$log_file_name*.log"
|
211
212
|
fi
|
212
213
|
|
213
214
|
return $result
|
@@ -226,7 +227,7 @@ __rvm_run_with_env() {
|
|
226
227
|
|
227
228
|
if [[ -n "$message" ]] ; then "$rvm_scripts_path/log" "info" "$message" ; fi
|
228
229
|
|
229
|
-
if [[
|
230
|
+
if [[ ${rvm_debug_flag:-0} -gt 0 ]] ; then
|
230
231
|
"$rvm_scripts_path/log" "debug" "Executing: $command in environment "$env_name""
|
231
232
|
fi
|
232
233
|
|
@@ -236,32 +237,38 @@ __rvm_run_with_env() {
|
|
236
237
|
|
237
238
|
echo "[$(date +'%Y-%m-%d %H:%M:%S')] $command # under $env_name" | tee "$rvm_ruby_log_path/$log_file_name.log" >> "$rvm_ruby_log_path/$log_file_name.error.log"
|
238
239
|
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
240
|
+
(
|
241
|
+
if [[ -z "${rvm_niceness:-""}" || $rvm_niceness -eq 0 ]] ; then
|
242
|
+
eval "__rvm_with_env '$env_name' '$command'" >> "$rvm_ruby_log_path/$log_file_name.log" 2>> "$rvm_ruby_log_path/$log_file_name.error.log"
|
243
|
+
else
|
244
|
+
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
|
245
|
+
fi
|
246
|
+
)
|
247
|
+
result=$? ; if [[ $result -gt 0 ]] ; then
|
248
|
+
"$rvm_scripts_path/log" "error" "Error running '$command' under $env_name, please check $rvm_ruby_log_path/$log_file_name*.log"
|
247
249
|
fi
|
248
250
|
|
249
251
|
return $result
|
250
252
|
}
|
251
253
|
|
252
|
-
|
254
|
+
__rvm_nuke_rvm_variables() {
|
255
|
+
unset rvm_head_flag $(env | awk -F= '/^rvm_/{print $1" "}')
|
256
|
+
}
|
257
|
+
|
258
|
+
# Unset ruby-specific variables
|
259
|
+
__rvm_unset_ruby_variables() {
|
260
|
+
unset rvm_head_flag $(env | awk -F= '/^rvm_ruby_/{printf $1" "}')
|
261
|
+
}
|
262
|
+
|
263
|
+
# TODO: Should be able to...
|
264
|
+
# Unset both rvm variables as well as ruby-specific variables
|
253
265
|
# Preserve gemset if 'rvm_sticky' is set (persist gemset unless clear is explicitely called).
|
254
266
|
__rvm_cleanse_variables() {
|
255
267
|
__rvm_unset_ruby_variables
|
256
268
|
|
257
269
|
if [[ ${rvm_sticky_flag:-0} -eq 1 ]] ; then export rvm_gemset_name ; else unset rvm_gemset_name ; fi
|
258
270
|
|
259
|
-
unset rvm_action rvm_irbrc_file rvm_command rvm_error_message
|
260
|
-
}
|
261
|
-
|
262
|
-
# Unset ruby-specific variables
|
263
|
-
__rvm_unset_ruby_variables() {
|
264
|
-
unset rvm_ruby_interpreter rvm_ruby_version rvm_url rvm_ruby_repo_url rvm_ruby_package_name rvm_ruby_patch_level rvm_ruby_make rvm_ruby_make_install rvm_ruby_revision rvm_ruby_tag rvm_release_version rvm_major_version rvm_minor_version rvm_ruby_gem_home rvm_ruby_binary rvm_ruby_home rvm_ruby_log_path rvm_ruby_src_path rvm_ruby_irbrc rvm_ruby_selected_flag rvm_ruby_src_path rvm_ruby_repo_url rvm_major_version rvm_minor_version rvm_ruby_gem_home rvm_head_flag rvm_ruby_configure rvm_ruby_mode rvm_ruby_package_file rvm_ruby_package_name rvm_ruby_gem_path rvm_ruby_name rvm_ruby_strings rvm_ruby_repo_path
|
271
|
+
unset rvm_action rvm_irbrc_file rvm_command rvm_error_message rvm_force_flag rvm_all_flag rvm_reconfigure_flag rvm_make_flags rvm_bin_flag rvm_import_flag rvm_export_flag rvm_self_flag rvm_gem_flag rvm_rubygems_flag rvm_debug_flag rvm_delete_flag rvm_summary_flag rvm_test_flag _rvm_spec_flag rvm_json_flag rvm_yaml_flag rvm_shebang_flag rvm_env_flag rvm_tail_flag rvm_use_flag rvm_dir_flag rvm_list_flag rvm_empty_flag rvm_file_name rvm_benchmark_flag rvm_clear_flag rvm_name_flag rvm_verbose_flag rvm_user_flag rvm_system_flag rvm_ruby_configure_flags rvm_uninstall_flag rvm_install_flag rvm_llvm_flag rvm_ruby_bits rvm_sticky_flag rvm_rvmrc_flag rvm_gems_flag rvm_only_path_flag rvm_docs_flag rvm_ruby_aliases rvm_patch_names rvm_clang_flag rvm_install_arguments rvm_dump_environment_flag rvm_ruby_alias
|
265
272
|
}
|
266
273
|
|
267
274
|
# Usage: __rvm_with_env 'env-name' 'command'
|
@@ -301,13 +308,6 @@ __rvm_ensure_has_18_compat_ruby() {
|
|
301
308
|
return 0
|
302
309
|
}
|
303
310
|
|
304
|
-
__rvm_inherit_trace_flag() {
|
305
|
-
if [[ -n "$rvm_trace_flag" ]]; then
|
306
|
-
set -x ; export rvm_trace_flag
|
307
|
-
fi
|
308
|
-
return 0
|
309
|
-
}
|
310
|
-
|
311
311
|
# Cleans up temp folders for a given prefix,
|
312
312
|
# typically the current process id.
|
313
313
|
__rvm_cleanup_temp_for() {
|
@@ -322,13 +322,10 @@ __rvm_cleanup_temp_for() {
|
|
322
322
|
exit
|
323
323
|
}
|
324
324
|
|
325
|
-
__rvm_cleanup_temp_on_exit() {
|
326
|
-
trap "__rvm_cleanup_temp_for '$$'" 0 1 2 3 15
|
327
|
-
}
|
328
|
-
|
329
325
|
__rvm_set_rvmrc() {
|
330
326
|
if [[ "$HOME" != "$PWD" ]] ; then
|
331
|
-
|
327
|
+
|
328
|
+
if [[ ${rvm_verbose_flag:-0} -gt 0 ]] ; then flags="use " ; fi
|
332
329
|
|
333
330
|
if [[ -s .rvmrc ]] ; then
|
334
331
|
mv .rvmrc .rvmrc.$(date +%m.%d.%Y-%H:%M:%S)
|
@@ -373,7 +370,7 @@ __rvm_benchmark() {
|
|
373
370
|
rvm_ruby_args="$rvm_tmp_path/$$.rb"
|
374
371
|
rvm_benchmark_flag=1
|
375
372
|
rvm_action="ruby"
|
376
|
-
if [[
|
373
|
+
if [[ ${rvm_debug_flag:0} -gt 0 ]] ; then printf "\n$rvm_tmp_path/$$.rb:\n$(cat $rvm_tmp_path/$$.rb)" ; fi
|
377
374
|
# Override ruby string stuff, pass through.
|
378
375
|
local old_rvm_ruby_string=$rvm_ruby_string
|
379
376
|
# TODO: We can likely do this in a subshell in order to preserve the original environment?
|
@@ -502,50 +499,46 @@ __rvm_initialize() {
|
|
502
499
|
|
503
500
|
# Update rubygems or binscripts based on CLI selection.
|
504
501
|
__rvm_update() {
|
505
|
-
|
502
|
+
(
|
503
|
+
builtin cd "$rvm_path"
|
506
504
|
|
507
|
-
|
508
|
-
|
509
|
-
|
510
|
-
|
505
|
+
if [[ ${rvm_head_flag:-0} -eq 1 || ${rvm_self_flag:-0} -eq 1 || "update" = "${rvm_action:-""}" || ${rvm_update_flag:-0} -eq 1 ]] ; then
|
506
|
+
__rvm_version
|
507
|
+
__rvm_update_rvm
|
508
|
+
fi
|
511
509
|
|
512
|
-
|
510
|
+
[[ ${rvm_bin_flag:-0} -eq 1 ]] && __rvm_bin_scripts
|
513
511
|
|
514
|
-
|
515
|
-
|
512
|
+
# Update to the latest rubygems.
|
513
|
+
[[ ${rvm_rubygems_flag:-0} -eq 1 ]] && "$rvm_scripts_path/rubygems" current
|
516
514
|
|
515
|
+
)
|
517
516
|
unset rvm_update_flag rvm_action rvm_self_flag rvm_ruby_revision rvm_bin_flag rvm_rubygems_flag
|
518
|
-
|
519
|
-
__rvm_pushpop
|
520
|
-
|
521
517
|
return 0
|
522
518
|
}
|
523
519
|
|
524
520
|
# Update rvm using rubygems
|
525
521
|
# If --head was specified, update from git repository master branch.
|
526
522
|
__rvm_update_rvm() {
|
527
|
-
|
528
523
|
\mkdir -p "$rvm_src_path"
|
529
|
-
|
530
|
-
|
531
|
-
|
532
|
-
|
533
|
-
|
534
|
-
|
524
|
+
(
|
525
|
+
builtin cd "$rvm_src_path"
|
526
|
+
if [[ ${rvm_head_flag:-0} -eq 1 ]] ; then
|
527
|
+
if [[ -d "$rvm_src_path/rvm/.git" ]] ; then
|
528
|
+
builtin cd "$rvm_src_path/rvm/" && git pull origin master && ./scripts/install
|
529
|
+
else
|
530
|
+
builtin cd "$rvm_src_path" && ( git clone --depth 1 git://github.com/wayneeseguin/rvm.git || git clone http://github.com/wayneeseguin/rvm.git ) && builtin cd rvm/ && ./scripts/install
|
531
|
+
fi
|
535
532
|
else
|
536
|
-
|
537
|
-
fi
|
538
|
-
else
|
539
|
-
stable_version="$(curl -s http://rvm.beginrescueend.com/releases/stable-version.txt)"
|
533
|
+
stable_version="$(curl -s http://rvm.beginrescueend.com/releases/stable-version.txt)"
|
540
534
|
|
541
|
-
|
535
|
+
__rvm_run "fetch" "$rvm_scripts_path/fetch 'http://rvm.beginrescueend.com/releases/rvm-${stable_version}.tar.gz'" "fetching rvm-${stable_version}.tar.gz"
|
542
536
|
|
543
|
-
|
537
|
+
__rvm_run "extract" "gunzip < \"$rvm_archives_path/rvm-${stable_version}.tar.gz\" | tar xf - -C $rvm_src_path" "Extracting rvm-${stable_version}.tar.gz ..."
|
544
538
|
|
545
|
-
|
546
|
-
|
547
|
-
|
548
|
-
__rvm_pushpop
|
539
|
+
__rvm_run "install" "builtin cd $rvm_src_path/rvm-${stable_version}/ ; ./install" "Installing rvm-${stable_version}..."
|
540
|
+
fi
|
541
|
+
)
|
549
542
|
|
550
543
|
rvm_hook="after_update" ; source "$rvm_scripts_path/hook"
|
551
544
|
|
@@ -592,17 +585,6 @@ __rvm_irbrc() {
|
|
592
585
|
return $?
|
593
586
|
}
|
594
587
|
|
595
|
-
# Push or Pop a directory based on zero or one directory argument provided.
|
596
|
-
__rvm_pushpop() {
|
597
|
-
if [[ -z "$1" ]] ; then
|
598
|
-
popd > /dev/null 2>&1
|
599
|
-
else
|
600
|
-
pushd "$1" > /dev/null 2>&1
|
601
|
-
fi
|
602
|
-
|
603
|
-
return $?
|
604
|
-
}
|
605
|
-
|
606
588
|
# Save or restore the rvm's state. This is a toggle action.
|
607
589
|
# Meant for use before and after an operation that might reset the currently selected ruby.
|
608
590
|
__rvm_state() {
|
@@ -661,9 +643,9 @@ __rvm_make_flags() {
|
|
661
643
|
: # Do nothing ?
|
662
644
|
elif [[ "$(sysctl -n hw.cpu64bit_capable)" = 1 || "$(sysctl -n hw.optional.x86_64)" = 1 ]] ; then
|
663
645
|
# 64 bit capable
|
664
|
-
if [[ "-arch x86_64" = "$rvm_archflags" ]] ; then
|
646
|
+
if [[ "-arch x86_64" = "${rvm_archflags:-""}" ]] ; then
|
665
647
|
rvm_ruby_configure_flags="${rvm_ruby_configure_flags} --build=x86_64-apple-darwin$(uname -r) --host=x86_64-apple-darwin$(uname -r)"
|
666
|
-
elif [[ "-arch i386" = "$rvm_archflags" ]] ; then
|
648
|
+
elif [[ "-arch i386" = "${rvm_archflags:-""}" ]] ; then
|
667
649
|
rvm_ruby_configure_flags="${rvm_ruby_configure_flags} --build=i386-apple-darwin$(uname -r) --host=i386-apple-darwin$(uname -r)"
|
668
650
|
else
|
669
651
|
rvm_archflags="-arch x86_64"
|
@@ -671,10 +653,12 @@ __rvm_make_flags() {
|
|
671
653
|
fi
|
672
654
|
fi
|
673
655
|
|
674
|
-
if [[ -n "$rvm_archflags" ]] ; then
|
656
|
+
if [[ -n "${rvm_archflags:-""}" ]] ; then
|
675
657
|
ARCHFLAGS="$rvm_archflags" ; export ARCHFLAGS
|
676
658
|
# Use the latest sdk available.
|
677
|
-
if [[ -z "$rvm_sdk" ]] ; then
|
659
|
+
if [[ -z "${rvm_sdk:-""}" ]] ; then
|
660
|
+
rvm_sdk="$(/usr/bin/basename -a /Developer/SDKs/* | awk '/^M/' | sort | tail -n 1)"
|
661
|
+
fi
|
678
662
|
CFLAGS="${CFLAGS:-"-isysroot /Developer/SDKs/$rvm_sdk $rvm_archflags"}" ; export CFLAGS
|
679
663
|
LDFLAGS="${LDFLAGS:-"-Wl,-syslibroot /Developer/SDKs/$rvm_sdk $rvm_archflags"}" ; export LDFLAGS
|
680
664
|
# CXXFLAGS="-mmacosx-version-min="$(sw_vers -productVersion | awk -F'.' '{print $1"."$2}')" -isysroot /Developer/SDKs/$rvm_sdk " ; export CXXFLAGS
|
@@ -708,7 +692,6 @@ __rvm_become() {
|
|
708
692
|
|
709
693
|
__rvm_ensure_has_environment_files() {
|
710
694
|
local environment_identifier="$(__rvm_environment_identifier)"
|
711
|
-
|
712
695
|
local file_name="${rvm_environments_path}/$environment_identifier"
|
713
696
|
|
714
697
|
if [[ ! -s "$file_name" ]] ; then
|
@@ -717,9 +700,9 @@ __rvm_ensure_has_environment_files() {
|
|
717
700
|
echo "export PATH=\"${rvm_ruby_gem_home}/bin:${rvm_ruby_global_gems_path}/bin:${rvm_ruby_home}/bin:${rvm_bin_path}:\$PATH\"" > "$file_name"
|
718
701
|
|
719
702
|
for variable in RUBY_VERSION GEM_HOME GEM_PATH BUNDLE_PATH MY_RUBY_HOME IRBRC rvm_ruby_string rvm_gemset_name MAGLEV_HOME ; do
|
720
|
-
eval "export $variable"
|
721
703
|
|
722
|
-
eval "
|
704
|
+
eval "export $variable"
|
705
|
+
eval "value=\${${variable}:-""}"
|
723
706
|
|
724
707
|
if [[ -n "$value" ]] ; then
|
725
708
|
printf "${variable}='$value'\nexport ${variable}\n" >> "$file_name"
|
@@ -941,36 +924,37 @@ $(cat $1)
|
|
941
924
|
# Checks the rvmrc for the given directory. Note that if
|
942
925
|
# argument is passed, it will be used instead of pwd.
|
943
926
|
__rvm_project_rvmrc() {
|
944
|
-
declare -i rvm_project_rvmrc_default=${rvm_project_rvmrc_default:-0}
|
945
|
-
declare rvm_rvmrc_cwd="${rvm_rvmrc_cwd:-""}"
|
946
|
-
declare rvm_previous_environment="${rvm_previous_environment:-""}"
|
947
|
-
|
948
927
|
local cwd
|
949
928
|
|
950
929
|
# Get the first argument or the pwd.
|
951
930
|
cwd="${1:-"$PWD"}"
|
931
|
+
|
952
932
|
while : ; do
|
953
933
|
if [[ -z "$cwd" || "$HOME" = "$cwd" || "/" = "$cwd" ]] ; then
|
954
|
-
if [[ -n "$rvm_rvmrc_cwd" ]] ; then
|
955
|
-
if [[ $rvm_project_rvmrc_default -eq 1 ]]; then
|
934
|
+
if [[ -n "${rvm_rvmrc_cwd:-""}" ]] ; then
|
935
|
+
if [[ ${rvm_project_rvmrc_default:-0} -eq 1 ]]; then
|
956
936
|
__rvm_load_env_file "default"
|
957
|
-
elif [[ -n "$rvm_previous_environment" ]] ; then
|
937
|
+
elif [[ -n "${rvm_previous_environment:-""}" ]] ; then
|
958
938
|
__rvm_load_env_file "$rvm_previous_environment"
|
959
939
|
fi
|
960
|
-
rvm_rvmrc_cwd
|
961
|
-
rvm_previous_environment=""
|
940
|
+
unset rvm_rvmrc_cwd rvm_previous_environment
|
962
941
|
fi
|
963
942
|
break
|
964
943
|
else
|
965
944
|
if [[ -f "$cwd/.rvmrc" ]] ; then
|
966
|
-
|
945
|
+
|
946
|
+
if [[ "${rvm_rvmrc_cwd:-""}" != "$cwd" ]] ; then
|
947
|
+
|
967
948
|
__rvm_check_rvmrc_trustworthiness "$cwd/.rvmrc"
|
949
|
+
|
968
950
|
local rvm_trustworthiness_result="$?"
|
951
|
+
|
969
952
|
if [[ "$rvm_trustworthiness_result" = 0 ]]; then
|
970
953
|
rvm_previous_environment="$(__rvm_environment_identifier)"
|
971
954
|
rvm_rvmrc_cwd="$cwd"
|
972
955
|
source "$cwd/.rvmrc"
|
973
956
|
return 0
|
957
|
+
|
974
958
|
else
|
975
959
|
return "$rvm_trustworthiness_result"
|
976
960
|
fi
|
@@ -1023,8 +1007,8 @@ __rvm_recorded_install_command() {
|
|
1023
1007
|
__rvm_environment_identifier() {
|
1024
1008
|
local path
|
1025
1009
|
local string
|
1026
|
-
path="$
|
1027
|
-
string="${path//*
|
1010
|
+
path="${GEM_HOME:-""}"
|
1011
|
+
string="${path//*gems\//}"
|
1028
1012
|
string="${string//\/*/}"
|
1029
1013
|
echo "${string:-system}"
|
1030
1014
|
return $?
|
@@ -1032,21 +1016,29 @@ __rvm_environment_identifier() {
|
|
1032
1016
|
|
1033
1017
|
__rvm_expand_ruby_string() {
|
1034
1018
|
local string="$1"
|
1019
|
+
|
1035
1020
|
if [[ -z "$string" || "$string" = "all" ]]; then
|
1036
1021
|
"$rvm_scripts_path/list" strings | tr ' ' "\n" | __rvm_strip
|
1022
|
+
|
1037
1023
|
elif [[ "$string" = "all-gemsets" ]]; then
|
1038
1024
|
"$rvm_scripts_path/list" gemsets strings | __rvm_strip
|
1025
|
+
|
1039
1026
|
elif [[ "$string" = "default-with-rvmrc" || "$string" = "rvmrc" ]]; then
|
1040
1027
|
"$rvm_scripts_path/tools" path-identifier "$PWD"
|
1028
|
+
|
1041
1029
|
elif [[ "$string" == "all-rubies" || "$string" = "rubies" ]]; then
|
1042
1030
|
"$rvm_scripts_path/list" rubies strings | __rvm_strip
|
1031
|
+
|
1043
1032
|
elif [[ "$string" == "current-ruby" || "$string" = "gemsets" ]]; then
|
1044
1033
|
local current_ruby="$(__rvm_environment_identifier | awk -F"$rvm_gemset_separator" '{print $string}')"
|
1045
1034
|
rvm_silence_logging=1 "$rvm_scripts_path/gemsets" list | sed "s/^/$current_ruby$rvm_gemset_separator/" | __rvm_strip
|
1035
|
+
|
1046
1036
|
elif [[ "$string" = "current" ]]; then
|
1047
1037
|
__rvm_environment_identifier
|
1038
|
+
|
1048
1039
|
elif [[ "$string" = "aliases" ]]; then
|
1049
1040
|
awk -F= '{print $string}' < "$rvm_config_path/alias" | __rvm_strip
|
1041
|
+
|
1050
1042
|
else
|
1051
1043
|
echo "$string" | tr "," "\n" | __rvm_strip
|
1052
1044
|
fi
|