rvm 1.0.5 → 1.0.6
Sign up to get free protection for your applications and to get access to all the features.
- data/binscripts/rvm +13 -15
- data/binscripts/rvm-prompt +18 -14
- data/binscripts/rvm-shell +2 -1
- data/contrib/gemset_snapshot +16 -5
- data/contrib/install-system-wide +73 -9
- data/install +2 -1
- data/lib/VERSION.yml +1 -1
- data/lib/rvm/environment/tools.rb +1 -1
- data/rvm.gemspec +2 -2
- data/scripts/cli +32 -17
- data/scripts/completion +6 -5
- data/scripts/disk-usage +3 -2
- data/scripts/environment-convertor +13 -7
- data/scripts/gemsets +20 -5
- data/scripts/help +4 -4
- data/scripts/info +4 -1
- data/scripts/install +2 -1
- data/scripts/list +153 -51
- data/scripts/log +2 -2
- data/scripts/manage +679 -224
- data/scripts/migrate +48 -8
- data/scripts/override_gem +8 -5
- data/scripts/package +11 -8
- data/scripts/patches +24 -6
- data/scripts/repair +53 -13
- data/scripts/rvm +2 -1
- data/scripts/rvm-install +2 -1
- data/scripts/selector +106 -73
- data/scripts/set +10 -6
- data/scripts/snapshot +3 -3
- data/scripts/update +2 -1
- data/scripts/upgrade +27 -6
- data/scripts/utility +222 -71
- data/scripts/wrapper +64 -23
- metadata +4 -4
data/scripts/set
CHANGED
@@ -4,11 +4,12 @@ source "$rvm_scripts_path/base"
|
|
4
4
|
|
5
5
|
__rvm_attempt_single_exec() {
|
6
6
|
# Return if we have multiple rubies. or we're not running exec.
|
7
|
-
|
8
|
-
if [[ "$action" = "exec" && -n "$rvm_ruby_strings" && "$ruby_string_lines" = "0" ]]; then
|
7
|
+
if [[ "$action" = "exec" && ${#rvm_ruby_strings[@]} -lt 2 ]]; then
|
9
8
|
__rvm_become "$rvm_ruby_strings"
|
9
|
+
|
10
10
|
eval "exec ${args[@]}"
|
11
11
|
fi
|
12
|
+
|
12
13
|
return 1
|
13
14
|
}
|
14
15
|
|
@@ -16,9 +17,11 @@ __rvm_attempt_single_exec() {
|
|
16
17
|
__rvm_ruby_do() {
|
17
18
|
# Return on invalid rubies.
|
18
19
|
__rvm_become "$current_set_ruby" || return 1
|
20
|
+
|
19
21
|
if [[ "$action" = "exec" ]]; then
|
20
22
|
# Exec is a special case.
|
21
23
|
rvm_command="$args"
|
24
|
+
|
22
25
|
else
|
23
26
|
binary="$(echo $action | sed 's#do$##')"
|
24
27
|
if [[ -x "$rvm_ruby_home/bin/$binary" ]] ; then
|
@@ -46,7 +49,7 @@ __rvm_ruby_do() {
|
|
46
49
|
|
47
50
|
load_path="$(dirname $(command -v $binary) 2>/dev/null):$rvm_ruby_load_path"
|
48
51
|
# TODO: the else case below should be run if $args =~ /\.rb$/
|
49
|
-
if [[ "ruby" = "$(basename $binary)"
|
52
|
+
if [[ "ruby" = "$(basename $binary)" && "$rvm_benchmark_flag" -ne 1 ]] ; then
|
50
53
|
|
51
54
|
if "$rvm_scripts_path/match" "$args" "\.rb$" ; then
|
52
55
|
|
@@ -153,7 +156,7 @@ __rvm_json() {
|
|
153
156
|
done ; unset index array_start
|
154
157
|
json="$json\n }\n}"
|
155
158
|
|
156
|
-
|
159
|
+
mkdir -p log
|
157
160
|
printf "$json" | tee -a log/summary.json
|
158
161
|
|
159
162
|
return ${#errors[*]}
|
@@ -178,12 +181,13 @@ if [[ "$action" == "ruby" ]] && echo "$args" | \grep -q "^'--[^[:space:]]*'$" ;
|
|
178
181
|
"$rvm_scripts_path/log" "warn" "Please note that 'rvm ruby' invokes set operations instead."
|
179
182
|
fi
|
180
183
|
|
181
|
-
rvm_ruby_strings
|
184
|
+
rvm_ruby_strings=$(__rvm_expand_ruby_string "$rvm_ruby_strings")
|
185
|
+
rvm_ruby_strings=(${rvm_ruby_strings//default}) # No quotes here is intentional.
|
182
186
|
|
183
187
|
# Check for a single ruby && exec if present.
|
184
188
|
__rvm_attempt_single_exec
|
185
189
|
|
186
|
-
for current_set_ruby in ${rvm_ruby_strings} ; do
|
190
|
+
for current_set_ruby in ${rvm_ruby_strings[@]} ; do
|
187
191
|
__rvm_ruby_do
|
188
192
|
done
|
189
193
|
|
data/scripts/snapshot
CHANGED
@@ -143,12 +143,12 @@ snapshot_load() {
|
|
143
143
|
"$rvm_scripts_path/log" "info" "Setting up gemsets"
|
144
144
|
(
|
145
145
|
builtin cd "$snapshot_temp_path/gems"
|
146
|
-
for snapshot_gemset in $(
|
146
|
+
for snapshot_gemset in $(find * -iname '*.gems' -type f -maxdepth 0 | sed 's/.gems$//'); do
|
147
147
|
__rvm_become "$snapshot_gemset"
|
148
148
|
result="$?"
|
149
149
|
__error_on_result "$result" "Error becoming '$snapshot_gemset'" && return "$result"
|
150
|
-
|
151
|
-
|
150
|
+
mkdir -p "$GEM_HOME/cache/"
|
151
|
+
cp -Rf "$snapshot_gemset/" "$GEM_HOME/cache/"
|
152
152
|
result="$?"
|
153
153
|
__error_on_result "$result" "Error copying across cache for $snapshot_gemset" && return "$result"
|
154
154
|
"$rvm_scripts_path/gemsets" import "$snapshot_gemset" >/dev/null 2>&1
|
data/scripts/update
CHANGED
@@ -383,7 +383,8 @@ for file in rvm rvmsudo rvm-shell rvm-auto-ruby ; do
|
|
383
383
|
[[ -s "$rvm_bin_path/$file" ]] && chmod +x "$rvm_bin_path/$file"
|
384
384
|
done; unset file
|
385
385
|
printf "\n Copying manpages into place."
|
386
|
-
|
386
|
+
|
387
|
+
for man_file in $(builtin cd "$install_source_path/man" ; find * -type f -maxdepth 0 -print); do
|
387
388
|
rm -rf "$rvm_man_path/$man_file"
|
388
389
|
cp -R "$install_source_path/man/$man_file" "$rvm_man_path/"
|
389
390
|
done
|
data/scripts/upgrade
CHANGED
@@ -10,9 +10,13 @@ usage() {
|
|
10
10
|
}
|
11
11
|
|
12
12
|
confirm() {
|
13
|
-
|
13
|
+
|
14
14
|
local confirmation_response
|
15
|
+
|
16
|
+
printf "$1 (Y/n): "
|
17
|
+
|
15
18
|
read -r confirmation_response
|
19
|
+
|
16
20
|
[[ -z "$confirmation_response" ]] || echo $confirmation_response | \grep -qi '^y\|^Y'
|
17
21
|
}
|
18
22
|
|
@@ -26,33 +30,49 @@ expand_ruby_name() {
|
|
26
30
|
}
|
27
31
|
|
28
32
|
expand_existing_ruby() {
|
29
|
-
local prefix
|
30
|
-
|
33
|
+
local prefix ruby_name
|
34
|
+
|
35
|
+
prefix="$(expand_ruby_name "$1" | awk -F'-' '{print $1"-"$2}')"
|
36
|
+
|
31
37
|
while read -r ruby_name; do
|
38
|
+
|
32
39
|
if [[ "$ruby_name" != "$expanded_destination"* ]]; then
|
33
40
|
echo "$ruby_name" ; return 0
|
34
41
|
fi
|
42
|
+
|
35
43
|
done < <("$rvm_scripts_path/list" strings | tr ' ' '\n' | sort -ur | \grep "^$prefix" | \grep -v '-head$' | head -n1)
|
44
|
+
|
36
45
|
return 1
|
37
46
|
}
|
38
47
|
|
39
48
|
upgrade_ruby() {
|
49
|
+
|
40
50
|
[[ -z "$source_ruby" ]] && die_with_error "Unable to find a source ruby. Please manually provide one."
|
41
51
|
|
42
52
|
expanded_source="$(expand_ruby_name "$source_ruby")"
|
53
|
+
|
43
54
|
[[ -z "$expanded_source" ]] && die_with_error "The source ruby was not a valid ruby string."
|
44
55
|
|
45
56
|
confirm "Are you sure you wish to upgrade from $expanded_source to $expanded_destination?" || die_with_error "Cancelling upgrade."
|
46
57
|
|
47
58
|
if [[ ! -d "$rvm_rubies_path/$expanded_destination" ]]; then
|
48
|
-
|
59
|
+
|
60
|
+
"$rvm_scripts_path/log" "info" \
|
61
|
+
"Installing new ruby $expanded_destination"
|
62
|
+
|
49
63
|
$rvm_bin_path/rvm install "$expanded_destination"
|
64
|
+
|
50
65
|
result="$?" ; [[ "$result" -gt 0 ]] && die_with_error "Unable to install ruby $expanded_destination. Please install it manually to continue." "$result"
|
66
|
+
|
51
67
|
fi
|
52
68
|
|
53
|
-
"$rvm_scripts_path/log" "info"
|
69
|
+
"$rvm_scripts_path/log" "info" \
|
70
|
+
"Migrating gems from $expanded_source to $expanded_destination"
|
71
|
+
|
54
72
|
"$rvm_scripts_path/migrate" "$expanded_source" "$expanded_destination"
|
55
|
-
result="$?"
|
73
|
+
result="$?"
|
74
|
+
|
75
|
+
[[ "$result" -gt 0 ]] && die_with_error "Error migrating gems." "$result"
|
56
76
|
|
57
77
|
"$rvm_scripts_path/log" "info" "Upgrade complete!"
|
58
78
|
}
|
@@ -67,6 +87,7 @@ args="$(echo ${args[@]:2}) " # Strip trailing / leading / extra spacing.
|
|
67
87
|
expanded_destination="$(expand_ruby_name "$destination_ruby")"
|
68
88
|
|
69
89
|
[[ -z "$source_ruby" ]] && die_with_error "The Source ruby was not specified, a valid ruby string, or not found."
|
90
|
+
|
70
91
|
[[ -z "$expanded_destination" ]] && die_with_error "The destination ruby was not a valid ruby string, or not found."
|
71
92
|
|
72
93
|
upgrade_ruby
|
data/scripts/utility
CHANGED
@@ -48,33 +48,48 @@ __rvm_teardown() {
|
|
48
48
|
|
49
49
|
# Dump the current environment to a file.
|
50
50
|
__rvm_dump_environment() {
|
51
|
+
|
51
52
|
# Note: This assumes that there is a ','
|
52
|
-
local dump_environment_file
|
53
|
-
|
53
|
+
local dump_environment_file dump_environment_type rvm_dump_environment_flag
|
54
|
+
|
55
|
+
dump_environment_file="${rvm_dump_environment_flag/,*/}"
|
56
|
+
|
57
|
+
dump_environment_type="${rvm_dump_environment_flag/*,/}"
|
58
|
+
|
54
59
|
if [[ -n "$dump_environment_file" && -n "$dump_environment_type" ]]; then
|
60
|
+
|
55
61
|
if [[ "$dump_environment_type" == "atheis"* ]] && [[ -f "$dump_environment_file" ]] ; then
|
56
62
|
# TODO: Query Darcy about the ln.
|
57
63
|
\rm -f "$dump_environment_file" && ln -s /dev/null "$dump_environment_file" >/dev/null 2>&1
|
64
|
+
|
58
65
|
else
|
59
66
|
"$rvm_scripts_path/environment-convertor" "$dump_environment_type" "$(__rvm_environment_identifier)" > "$dump_environment_file"
|
60
|
-
if [[ "$?" -gt 0
|
67
|
+
if [[ "$?" -gt 0 && -f "$dump_environment_file" ]] ; then
|
61
68
|
\rm -f "$dump_environment_file"
|
62
69
|
fi
|
63
70
|
fi
|
64
|
-
fi
|
71
|
+
fi
|
72
|
+
|
65
73
|
return 0
|
66
74
|
}
|
67
75
|
|
68
76
|
# Return a list of directories under a given base path.
|
69
77
|
# Derived from rvm_ruby_string.
|
70
78
|
__rvm_ruby_string_paths_under() {
|
71
|
-
local path
|
72
|
-
|
79
|
+
local path path_parts
|
80
|
+
|
81
|
+
path="$1"
|
82
|
+
|
83
|
+
path_parts="${rvm_ruby_string//-/ }"
|
73
84
|
|
74
85
|
while true ; do
|
86
|
+
|
75
87
|
echo "$path/$path_parts" | sed -e 's# #/#g' -e 's#/$##g'
|
88
|
+
|
76
89
|
[[ -z "$path_parts" ]] && break
|
90
|
+
|
77
91
|
path_parts="$(echo "$path_parts" | awk '{$NF=""; print}' | __rvm_strip)"
|
92
|
+
|
78
93
|
done
|
79
94
|
|
80
95
|
return 0
|
@@ -83,7 +98,7 @@ __rvm_ruby_string_paths_under() {
|
|
83
98
|
# Query the rvm key-value database for a specific key
|
84
99
|
# Allow overrides from user specifications in $rvm_config_path/user
|
85
100
|
__rvm_db() {
|
86
|
-
local value
|
101
|
+
local value key variable
|
87
102
|
|
88
103
|
key=${1:-""}
|
89
104
|
variable=${2:-""}
|
@@ -111,29 +126,45 @@ is_a_function() { type $1 | head -n 1 | \grep -q "function" ; }
|
|
111
126
|
|
112
127
|
__rvm_quote_args() {
|
113
128
|
local quoted_string=""
|
129
|
+
|
114
130
|
for quoted_argument in "$@"; do
|
131
|
+
|
115
132
|
if printf "%s" "$quoted_argument" | \grep -vq "^[[:alnum:]]$"; then
|
133
|
+
|
116
134
|
quoted_string="$quoted_string '$(printf "%s" "$quoted_argument" | sed "s/'/\'\\\'\'/g")'"
|
135
|
+
|
117
136
|
else
|
118
137
|
quoted_string="$quoted_string $quoted_argument"
|
119
138
|
fi
|
120
139
|
done
|
140
|
+
|
121
141
|
echo "$quoted_string" | sed -e 's/^ *//g' -e 's/ *$//g'
|
142
|
+
|
122
143
|
return 0
|
123
144
|
}
|
124
145
|
|
125
146
|
__rvm_quote_args_with_shift() {
|
147
|
+
|
126
148
|
local shift_value="$1"; shift
|
127
|
-
|
128
|
-
|
149
|
+
|
150
|
+
while [[ "$shift_value" -gt 0 && $# -gt 0 ]]; do
|
151
|
+
|
152
|
+
shift
|
153
|
+
|
154
|
+
((shift_value--))
|
155
|
+
|
129
156
|
done
|
157
|
+
|
130
158
|
__rvm_quote_args "$@"
|
159
|
+
|
131
160
|
return 0
|
132
161
|
}
|
133
162
|
|
134
163
|
__rvm_warn_on_rubyopt() {
|
135
|
-
|
136
|
-
|
164
|
+
|
165
|
+
if [[ -n "${RUBYOPT:-""}" ]]; then
|
166
|
+
"$rvm_scripts_path"/log "warn" \
|
167
|
+
"Please note: You have the RUBYOPT environment variable set and this may interfere with normal rvm operations. We sugges unsetting it."
|
137
168
|
return 1
|
138
169
|
else
|
139
170
|
return 0
|
@@ -141,52 +172,76 @@ __rvm_warn_on_rubyopt() {
|
|
141
172
|
}
|
142
173
|
|
143
174
|
__rvm_strings() {
|
144
|
-
local strings
|
145
|
-
|
175
|
+
local strings ruby_strings
|
176
|
+
|
177
|
+
ruby_strings=($(echo ${rvm_ruby_args:-$rvm_ruby_string}))
|
178
|
+
|
179
|
+
for rvm_ruby_string in "${ruby_strings[@]}" ; do
|
146
180
|
strings="$strings $(__rvm_select ; echo $rvm_ruby_string)"
|
147
181
|
done
|
182
|
+
|
148
183
|
echo $strings
|
184
|
+
|
149
185
|
return 0
|
150
186
|
}
|
151
187
|
|
152
188
|
# Push an item onto a given array.
|
153
189
|
__rvm_push() {
|
190
|
+
|
191
|
+
local array item
|
192
|
+
|
154
193
|
array=$1 ; shift ; item=$2
|
194
|
+
|
155
195
|
# TODO: allow loop over more arguments.
|
156
196
|
eval "index=\$((\${#${array}[*]} + $__shell_array_start))"
|
197
|
+
|
157
198
|
eval "${array}[${index}]=${item}"
|
158
|
-
|
199
|
+
|
200
|
+
return 0
|
159
201
|
}
|
160
202
|
|
161
203
|
__rvm_set_path_variable() {
|
204
|
+
|
162
205
|
if [[ -d "$1" ]] ; then
|
163
206
|
eval "${path_variable}=${1}"
|
207
|
+
|
164
208
|
else
|
165
|
-
"$rvm_scripts_path/log" "error"
|
166
|
-
|
209
|
+
"$rvm_scripts_path/log" "error" \
|
210
|
+
"'$1' is not a valid path."
|
211
|
+
unset path_variable
|
212
|
+
fi
|
213
|
+
|
214
|
+
return 0
|
167
215
|
}
|
168
216
|
|
169
217
|
# Clean all *duplicate* items out of the path. (keep first occurrence of each)
|
170
218
|
__rvm_clean_path() {
|
171
219
|
PATH="$(echo $PATH | \tr -s ':' '\n' | awk '!($0 in a){a[$0];print}' | \tr -s '\n' ':' | sed 's#:$##')"
|
220
|
+
|
172
221
|
export PATH
|
222
|
+
|
173
223
|
builtin hash -r
|
174
224
|
}
|
175
225
|
|
176
226
|
# Clean all rvm items out of the current working path.
|
177
227
|
__rvm_remove_rvm_from_path() {
|
178
|
-
PATH="$
|
228
|
+
PATH="${PATH//${rvm_path}*rvm\/bin:}"
|
229
|
+
|
179
230
|
export PATH
|
231
|
+
|
180
232
|
builtin hash -r
|
181
233
|
}
|
182
234
|
|
183
235
|
# Run a specified command and log it.
|
184
236
|
__rvm_run() {
|
185
|
-
local log_file_name="${1:-""}"
|
186
|
-
local command="${2:-""}"
|
187
|
-
local message="${3:-""}"
|
188
237
|
|
189
|
-
|
238
|
+
local log_file_name command message
|
239
|
+
|
240
|
+
log_file_name="${1:-""}"
|
241
|
+
command="${2:-""}"
|
242
|
+
message="${3:-""}"
|
243
|
+
|
244
|
+
if [[ -z "${rvm_ruby_log_path:-""}" ]] ; then rvm_ruby_log_path="$rvm_log_path" ; fi
|
190
245
|
|
191
246
|
if [[ -n "$message" ]] ; then "$rvm_scripts_path/log" "info" "$message" ; fi
|
192
247
|
|
@@ -207,8 +262,11 @@ __rvm_run() {
|
|
207
262
|
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
263
|
fi
|
209
264
|
)
|
210
|
-
local result=$?
|
211
|
-
|
265
|
+
local result=$?
|
266
|
+
|
267
|
+
if [[ $result -gt 0 ]] ; then
|
268
|
+
"$rvm_scripts_path/log" "error" \
|
269
|
+
"Error running '$command', please check $rvm_ruby_log_path/$log_file_name*.log"
|
212
270
|
fi
|
213
271
|
|
214
272
|
return $result
|
@@ -216,10 +274,13 @@ __rvm_run() {
|
|
216
274
|
|
217
275
|
# Runs a command in a given env.
|
218
276
|
__rvm_run_with_env() {
|
219
|
-
|
220
|
-
local env_name
|
221
|
-
|
222
|
-
|
277
|
+
|
278
|
+
local log_file_name env_name comand message
|
279
|
+
|
280
|
+
log_file_name="${1:-""}"
|
281
|
+
env_name="${2:-""}"
|
282
|
+
command="${3:-""}"
|
283
|
+
message="${4:-""}"
|
223
284
|
|
224
285
|
if [[ -z "$env_name" ]]; then env_name="$(__rvm_environment_identifier)"; fi
|
225
286
|
|
@@ -244,8 +305,11 @@ __rvm_run_with_env() {
|
|
244
305
|
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
306
|
fi
|
246
307
|
)
|
247
|
-
result=$?
|
248
|
-
|
308
|
+
result=$?
|
309
|
+
|
310
|
+
if [[ $result -gt 0 ]] ; then
|
311
|
+
"$rvm_scripts_path/log" "error" \
|
312
|
+
"Error running '$command' under $env_name, please check $rvm_ruby_log_path/$log_file_name*.log"
|
249
313
|
fi
|
250
314
|
|
251
315
|
return $result
|
@@ -257,7 +321,7 @@ __rvm_nuke_rvm_variables() {
|
|
257
321
|
|
258
322
|
# Unset ruby-specific variables
|
259
323
|
__rvm_unset_ruby_variables() {
|
260
|
-
unset
|
324
|
+
unset rvm_ruby_flag $(env | awk -F= '/^rvm_ruby_/{printf $1" "}')
|
261
325
|
}
|
262
326
|
|
263
327
|
# TODO: Should be able to...
|
@@ -268,40 +332,61 @@ __rvm_cleanse_variables() {
|
|
268
332
|
|
269
333
|
if [[ ${rvm_sticky_flag:-0} -eq 1 ]] ; then export rvm_gemset_name ; else unset rvm_gemset_name ; fi
|
270
334
|
|
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
|
335
|
+
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_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
|
272
336
|
}
|
273
337
|
|
274
338
|
# Usage: __rvm_with_env 'env-name' 'command'
|
275
339
|
__rvm_with_env() {
|
276
|
-
local environment_id
|
277
|
-
|
340
|
+
local environment_id command
|
341
|
+
|
342
|
+
environment_id="$1"
|
343
|
+
command="$2"
|
344
|
+
|
345
|
+
(
|
346
|
+
rvm use "$environment_id"
|
347
|
+
eval "$command"
|
348
|
+
)
|
278
349
|
}
|
279
350
|
|
280
351
|
# Returns the first 1.8.7-compatible (partly) ruby for use
|
281
352
|
# with things like rbx etc which require a ruby be installed.
|
282
353
|
__rvm_18_compat_ruby() {
|
283
|
-
local rubies
|
284
|
-
|
285
|
-
|
286
|
-
|
354
|
+
local rubies ruby_name
|
355
|
+
|
356
|
+
rubies=($( cd "$rvm_rubies_path" ; find * -type d -maxdepth 0 ))
|
357
|
+
|
358
|
+
for ruby_name in "${rubies[@]}"; do
|
359
|
+
|
360
|
+
if [[ ! -L "$rvm_rubies_path/$ruby_name" ]] ; then
|
361
|
+
|
362
|
+
case $ruby_name in
|
363
|
+
*1.8.*|rbx-*|ree-*) rubies="$rubies $ruby_name" ;;
|
364
|
+
esac
|
287
365
|
fi
|
288
|
-
done
|
366
|
+
done
|
289
367
|
|
290
|
-
echo
|
368
|
+
echo $rubies | \tr ' ' '\n' | \sort | \tail -n1
|
291
369
|
|
292
370
|
return 0
|
293
371
|
}
|
294
372
|
|
295
373
|
__rvm_ensure_has_18_compat_ruby() {
|
374
|
+
|
296
375
|
if [[ -z "$(__rvm_18_compat_ruby)" ]]; then
|
297
376
|
# TODO: install currently doesn't return the correct status.
|
298
377
|
local compat_result=0
|
378
|
+
|
299
379
|
if ! ( "$rvm_scripts_path/manage" install 1.8.7 ); then
|
300
|
-
|
301
|
-
"$rvm_scripts_path/log" "fail"
|
380
|
+
|
381
|
+
"$rvm_scripts_path/log" "fail" \
|
382
|
+
"To proceed rvm requires a 1.8-compatible ruby is installed. We attempted to install 1.8.7 automatically but it failed.\
|
383
|
+
Please install it manually (or a compatible alternative) to proceed."
|
384
|
+
|
302
385
|
compat_result=1
|
303
|
-
|
304
|
-
|
386
|
+
|
387
|
+
fi
|
388
|
+
# unset original_ruby
|
389
|
+
# Question: Why *were* we unsetting original_ruby here
|
305
390
|
return $compat_result
|
306
391
|
fi
|
307
392
|
|
@@ -311,6 +396,7 @@ __rvm_ensure_has_18_compat_ruby() {
|
|
311
396
|
# Cleans up temp folders for a given prefix,
|
312
397
|
# typically the current process id.
|
313
398
|
__rvm_cleanup_temp_for() {
|
399
|
+
|
314
400
|
local prefix="$1"
|
315
401
|
|
316
402
|
[[ -z "$prefix" ]] && return 1
|
@@ -524,8 +610,10 @@ __rvm_update_rvm() {
|
|
524
610
|
(
|
525
611
|
builtin cd "$rvm_src_path"
|
526
612
|
if [[ ${rvm_head_flag:-0} -eq 1 ]] ; then
|
613
|
+
|
527
614
|
if [[ -d "$rvm_src_path/rvm/.git" ]] ; then
|
528
615
|
builtin cd "$rvm_src_path/rvm/" && git pull origin master && ./scripts/install
|
616
|
+
|
529
617
|
else
|
530
618
|
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
619
|
fi
|
@@ -620,12 +708,12 @@ __rvm_inspect() {
|
|
620
708
|
|
621
709
|
"$rvm_scripts_path/log" "info" "$actual_file:"
|
622
710
|
|
623
|
-
if [[ $rvm_shebang_flag -eq 1 ]] ; then head -n 1 < "$actual_file" ; fi
|
624
|
-
if [[ $rvm_env_flag -eq 1 ]] ; then awk '/ENV/' < "$actual_file" ; fi
|
625
|
-
if [[ $rvm_path_flag -eq 1 ]] ; then awk '/PATH/' < "$actual_file" ; fi
|
626
|
-
if [[ $rvm_head_flag -eq 1 ]] ; then head -n 5 < "$actual_file" ; fi
|
627
|
-
if [[ $rvm_tail_flag -eq 1 ]] ; then tail -n 5 < "$actual_file" ; fi
|
628
|
-
if [[ $rvm_all_flag -eq 1 ]] ; then cat $actual_file ; fi
|
711
|
+
if [[ $rvm_shebang_flag -eq 1 ]] ; then \head -n 1 < "$actual_file" ; fi
|
712
|
+
if [[ $rvm_env_flag -eq 1 ]] ; then \awk '/ENV/' < "$actual_file" ; fi
|
713
|
+
if [[ $rvm_path_flag -eq 1 ]] ; then \awk '/PATH/' < "$actual_file" ; fi
|
714
|
+
if [[ $rvm_head_flag -eq 1 ]] ; then \head -n 5 < "$actual_file" ; fi
|
715
|
+
if [[ $rvm_tail_flag -eq 1 ]] ; then \tail -n 5 < "$actual_file" ; fi
|
716
|
+
if [[ $rvm_all_flag -eq 1 ]] ; then \cat $actual_file ; fi
|
629
717
|
done
|
630
718
|
|
631
719
|
return 0
|
@@ -644,12 +732,12 @@ __rvm_make_flags() {
|
|
644
732
|
elif [[ "$(sysctl -n hw.cpu64bit_capable)" = 1 || "$(sysctl -n hw.optional.x86_64)" = 1 ]] ; then
|
645
733
|
# 64 bit capable
|
646
734
|
if [[ "-arch x86_64" = "${rvm_archflags:-""}" ]] ; then
|
647
|
-
|
735
|
+
rvm_configure_flags="${rvm_configure_flags} --build=x86_64-apple-darwin$(uname -r) --host=x86_64-apple-darwin$(uname -r)"
|
648
736
|
elif [[ "-arch i386" = "${rvm_archflags:-""}" ]] ; then
|
649
|
-
|
737
|
+
rvm_configure_flags="${rvm_configure_flags} --build=i386-apple-darwin$(uname -r) --host=i386-apple-darwin$(uname -r)"
|
650
738
|
else
|
651
739
|
rvm_archflags="-arch x86_64"
|
652
|
-
|
740
|
+
rvm_configure_flags="${rvm_configure_flags} --build=x86_64-apple-darwin$(uname -r) --host=x86_64-apple-darwin$(uname -r)"
|
653
741
|
fi
|
654
742
|
fi
|
655
743
|
|
@@ -657,7 +745,7 @@ __rvm_make_flags() {
|
|
657
745
|
ARCHFLAGS="$rvm_archflags" ; export ARCHFLAGS
|
658
746
|
# Use the latest sdk available.
|
659
747
|
if [[ -z "${rvm_sdk:-""}" ]] ; then
|
660
|
-
rvm_sdk="$(/usr/bin/basename -a /Developer/SDKs/* | awk '/^M/' | sort | tail -n 1)"
|
748
|
+
rvm_sdk="$(/usr/bin/basename -a /Developer/SDKs/* | awk '/^M/' | \sort | \tail -n 1)"
|
661
749
|
fi
|
662
750
|
CFLAGS="${CFLAGS:-"-isysroot /Developer/SDKs/$rvm_sdk $rvm_archflags"}" ; export CFLAGS
|
663
751
|
LDFLAGS="${LDFLAGS:-"-Wl,-syslibroot /Developer/SDKs/$rvm_sdk $rvm_archflags"}" ; export LDFLAGS
|
@@ -883,7 +971,11 @@ __rvm_check_rvmrc_trustworthiness() {
|
|
883
971
|
}
|
884
972
|
|
885
973
|
__rvm_ask_to_trust() {
|
974
|
+
|
975
|
+
local trusted value
|
976
|
+
|
886
977
|
[[ -n "$rvm_promptless" ]] && return 2
|
978
|
+
|
887
979
|
printf "
|
888
980
|
============================================================
|
889
981
|
RVM has encountered a not yet trusted .rvmrc file in the
|
@@ -899,22 +991,30 @@ $(cat $1)
|
|
899
991
|
Do you wish to trust this .rvmrc from now on?
|
900
992
|
============================================================
|
901
993
|
(y for yes, n for no)"
|
902
|
-
|
994
|
+
|
903
995
|
# TODO: Eliminate infinite loop possibility.
|
904
996
|
while [[ -z "$trusted" ]] ; do
|
997
|
+
|
905
998
|
printf " > "
|
999
|
+
|
906
1000
|
read -r response
|
1001
|
+
|
907
1002
|
value="$(echo "$response" | tr '[[:upper:]]' '[[:lower:]]' | __rvm_strip)"
|
1003
|
+
|
908
1004
|
if [[ "$response" = "y"* ]]; then
|
909
1005
|
trusted=1
|
1006
|
+
|
910
1007
|
elif [[ "$response" = "n"* ]]; then
|
911
1008
|
trusted=0
|
912
1009
|
fi
|
913
|
-
done
|
1010
|
+
done
|
1011
|
+
|
1012
|
+
if [[ ${trusted:-0} -gt 0 ]] ; then
|
914
1013
|
|
915
|
-
if [[ "$trusted" == "1" ]] ; then
|
916
1014
|
__rvm_trust_rvmrc "$1"
|
1015
|
+
|
917
1016
|
return 0
|
1017
|
+
|
918
1018
|
else
|
919
1019
|
__rvm_untrust_rvmrc "$1"
|
920
1020
|
return 1
|
@@ -930,17 +1030,27 @@ __rvm_project_rvmrc() {
|
|
930
1030
|
cwd="${1:-"$PWD"}"
|
931
1031
|
|
932
1032
|
while : ; do
|
1033
|
+
|
933
1034
|
if [[ -z "$cwd" || "$HOME" = "$cwd" || "/" = "$cwd" ]] ; then
|
1035
|
+
|
934
1036
|
if [[ -n "${rvm_rvmrc_cwd:-""}" ]] ; then
|
1037
|
+
|
935
1038
|
if [[ ${rvm_project_rvmrc_default:-0} -eq 1 ]]; then
|
1039
|
+
|
936
1040
|
__rvm_load_env_file "default"
|
1041
|
+
|
937
1042
|
elif [[ -n "${rvm_previous_environment:-""}" ]] ; then
|
1043
|
+
|
938
1044
|
__rvm_load_env_file "$rvm_previous_environment"
|
1045
|
+
|
939
1046
|
fi
|
1047
|
+
|
940
1048
|
unset rvm_rvmrc_cwd rvm_previous_environment
|
1049
|
+
|
941
1050
|
fi
|
942
1051
|
break
|
943
1052
|
else
|
1053
|
+
|
944
1054
|
if [[ -f "$cwd/.rvmrc" ]] ; then
|
945
1055
|
|
946
1056
|
if [[ "${rvm_rvmrc_cwd:-""}" != "$cwd" ]] ; then
|
@@ -950,54 +1060,89 @@ __rvm_project_rvmrc() {
|
|
950
1060
|
local rvm_trustworthiness_result="$?"
|
951
1061
|
|
952
1062
|
if [[ "$rvm_trustworthiness_result" = 0 ]]; then
|
1063
|
+
|
953
1064
|
rvm_previous_environment="$(__rvm_environment_identifier)"
|
1065
|
+
|
954
1066
|
rvm_rvmrc_cwd="$cwd"
|
1067
|
+
|
955
1068
|
source "$cwd/.rvmrc"
|
956
|
-
return 0
|
957
1069
|
|
1070
|
+
return 0
|
958
1071
|
else
|
959
1072
|
return "$rvm_trustworthiness_result"
|
960
1073
|
fi
|
961
1074
|
fi
|
962
1075
|
break
|
1076
|
+
|
963
1077
|
else
|
964
1078
|
cwd="$(dirname "$cwd")"
|
965
1079
|
fi
|
966
1080
|
fi
|
967
1081
|
done
|
1082
|
+
|
968
1083
|
return $?
|
969
1084
|
}
|
970
1085
|
|
971
1086
|
__rvm_record_install() {
|
1087
|
+
|
1088
|
+
local recorded_ruby_name rvm_install_record_file rvm_install_command
|
1089
|
+
|
972
1090
|
[[ -z "$1" ]] && return
|
973
|
-
|
974
|
-
|
975
|
-
|
1091
|
+
|
1092
|
+
recorded_ruby_name="$($rvm_scripts_path/tools strings "$1")"
|
1093
|
+
|
1094
|
+
rvm_install_record_file="$rvm_config_path/installs"
|
1095
|
+
|
1096
|
+
rvm_install_command="$(echo "$recorded_ruby_name $rvm_install_arguments" | __rvm_strip)"
|
1097
|
+
|
976
1098
|
\touch "$rvm_install_record_file"
|
1099
|
+
|
977
1100
|
\rm -f "$rvm_install_record_file.tmp"
|
1101
|
+
|
978
1102
|
\grep -v "^$recorded_ruby_name " < "$rvm_install_record_file" > "$rvm_install_record_file.tmp"
|
1103
|
+
|
979
1104
|
echo "$rvm_install_command" >> "$rvm_install_record_file.tmp"
|
1105
|
+
|
980
1106
|
\rm -f "$rvm_install_record_file"
|
1107
|
+
|
981
1108
|
\mv "$rvm_install_record_file.tmp" "$rvm_install_record_file"
|
1109
|
+
|
1110
|
+
return 0
|
982
1111
|
}
|
983
1112
|
|
984
1113
|
__rvm_remove_install_record() {
|
985
|
-
local recorded_ruby_name
|
986
|
-
|
1114
|
+
local recorded_ruby_name rvm_install_record_file
|
1115
|
+
|
1116
|
+
recorded_ruby_name="$($rvm_scripts_path/tools strings "$1")"
|
1117
|
+
|
1118
|
+
rvm_install_record_file="$rvm_config_path/installs"
|
1119
|
+
|
987
1120
|
if [[ -s "$rvm_install_record_file" ]]; then
|
1121
|
+
|
988
1122
|
\mv "$rvm_install_record_file" "$rvm_install_record_file.tmp"
|
1123
|
+
|
989
1124
|
\grep -v "^$recorded_ruby_name " < "$rvm_install_record_file.tmp" > "$rvm_install_record_file"
|
1125
|
+
|
990
1126
|
\rm -f "$rvm_install_record_file.tmp"
|
991
1127
|
fi
|
1128
|
+
|
992
1129
|
return 0
|
993
1130
|
}
|
994
1131
|
|
995
1132
|
__rvm_recorded_install_command() {
|
996
|
-
|
1133
|
+
|
1134
|
+
local recorded_ruby_name recorded_ruby_match
|
1135
|
+
|
1136
|
+
recorded_ruby_name="$($rvm_scripts_path/tools strings "$1" | awk -F"$rvm_gemset_separator" '{print $1}')"
|
1137
|
+
|
997
1138
|
[[ -z "$recorded_ruby_name" ]] && return 1
|
998
|
-
|
1139
|
+
|
1140
|
+
recorded_ruby_match="^$recorded_ruby_name "
|
1141
|
+
|
999
1142
|
if [[ -s "$rvm_config_path/installs" ]] && \grep -q "$recorded_ruby_match" "$rvm_config_path/installs" ; then
|
1143
|
+
|
1000
1144
|
\grep "$recorded_ruby_match" < "$rvm_config_path/installs" | head -n1
|
1145
|
+
|
1001
1146
|
else
|
1002
1147
|
return 1
|
1003
1148
|
fi
|
@@ -1005,41 +1150,47 @@ __rvm_recorded_install_command() {
|
|
1005
1150
|
}
|
1006
1151
|
|
1007
1152
|
__rvm_environment_identifier() {
|
1008
|
-
|
1009
|
-
local string
|
1153
|
+
|
1154
|
+
local path string
|
1155
|
+
|
1010
1156
|
path="${GEM_HOME:-""}"
|
1157
|
+
|
1011
1158
|
string="${path//*gems\//}"
|
1012
1159
|
string="${string//\/*/}"
|
1160
|
+
|
1013
1161
|
echo "${string:-system}"
|
1162
|
+
|
1014
1163
|
return $?
|
1015
1164
|
}
|
1016
1165
|
|
1017
1166
|
__rvm_expand_ruby_string() {
|
1167
|
+
|
1018
1168
|
local string="$1"
|
1019
1169
|
|
1020
1170
|
if [[ -z "$string" || "$string" = "all" ]]; then
|
1021
|
-
"$rvm_scripts_path/list" strings | tr ' ' "\n"
|
1171
|
+
"$rvm_scripts_path/list" strings | tr ' ' "\n"
|
1022
1172
|
|
1023
1173
|
elif [[ "$string" = "all-gemsets" ]]; then
|
1024
|
-
"$rvm_scripts_path/list" gemsets strings
|
1174
|
+
"$rvm_scripts_path/list" gemsets strings
|
1025
1175
|
|
1026
1176
|
elif [[ "$string" = "default-with-rvmrc" || "$string" = "rvmrc" ]]; then
|
1027
1177
|
"$rvm_scripts_path/tools" path-identifier "$PWD"
|
1028
1178
|
|
1029
1179
|
elif [[ "$string" == "all-rubies" || "$string" = "rubies" ]]; then
|
1030
|
-
"$rvm_scripts_path/list" rubies strings
|
1180
|
+
"$rvm_scripts_path/list" rubies strings
|
1031
1181
|
|
1032
1182
|
elif [[ "$string" == "current-ruby" || "$string" = "gemsets" ]]; then
|
1033
1183
|
local current_ruby="$(__rvm_environment_identifier | awk -F"$rvm_gemset_separator" '{print $string}')"
|
1034
|
-
rvm_silence_logging=1 "$rvm_scripts_path/gemsets" list | sed "s/^/$current_ruby$rvm_gemset_separator/"
|
1184
|
+
rvm_silence_logging=1 "$rvm_scripts_path/gemsets" list | sed "s/^/$current_ruby$rvm_gemset_separator/"
|
1035
1185
|
|
1036
1186
|
elif [[ "$string" = "current" ]]; then
|
1037
1187
|
__rvm_environment_identifier
|
1038
1188
|
|
1039
1189
|
elif [[ "$string" = "aliases" ]]; then
|
1040
|
-
awk -F= '{print $string}' < "$rvm_config_path/alias"
|
1190
|
+
awk -F= '{print $string}' < "$rvm_config_path/alias"
|
1041
1191
|
|
1042
1192
|
else
|
1193
|
+
|
1043
1194
|
echo "$string" | tr "," "\n" | __rvm_strip
|
1044
1195
|
fi
|
1045
1196
|
return $?
|