rvm 1.0.8 → 1.0.9

Sign up to get free protection for your applications and to get access to all the features.
@@ -44,7 +44,7 @@ __rvm_teardown() {
44
44
 
45
45
  fi
46
46
 
47
- unset rvm_ruby_strings rvm_head_flag rvm_prior_cc next_token result rvm_bin_path rvm_error_message rvm_gems_cache_path rvm_gems_path rvm_gemset_name rvm_interactive_flag rvm_man_path rvm_parse_break rvm_rc_files rvm_ruby_binary rvm_ruby_gem_home rvm_ruby_gem_path rvm_ruby_home rvm_ruby_interpreter rvm_ruby_irbrc rvm_ruby_log_path rvm_ruby_major_version rvm_ruby_minor_version rvm_ruby_package_name rvm_ruby_patch_level rvm_ruby_release_version rvm_ruby_repo_url rvm_ruby_revision rvm_ruby_selected_flag rvm_ruby_string rvm_ruby_tag rvm_ruby_version rvm_selfcontained rvm_token
47
+ unset rvm_ruby_strings rvm_head_flag rvm_prior_cc next_token rvm_bin_path rvm_error_message rvm_gems_cache_path rvm_gems_path rvm_gemset_name rvm_interactive_flag rvm_man_path rvm_parse_break rvm_rc_files rvm_ruby_binary rvm_ruby_gem_home rvm_ruby_gem_path rvm_ruby_home rvm_ruby_interpreter rvm_ruby_irbrc rvm_ruby_log_path rvm_ruby_major_version rvm_ruby_minor_version rvm_ruby_package_name rvm_ruby_patch_level rvm_ruby_release_version rvm_ruby_repo_url rvm_ruby_revision rvm_ruby_selected_flag rvm_ruby_string rvm_ruby_tag rvm_ruby_version rvm_selfcontained rvm_token
48
48
 
49
49
 
50
50
  [[ ${rvm_dump_environment_flag:-0} -eq 1 ]] && __rvm_dump_environment
@@ -82,19 +82,19 @@ __rvm_dump_environment() {
82
82
  # Return a list of directories under a given base path.
83
83
  # Derived from rvm_ruby_string.
84
84
  __rvm_ruby_string_paths_under() {
85
- local path path_parts
85
+ local path part parts
86
86
 
87
- path="$1"
87
+ path="${1%/}" # Strip off any trailing slash
88
88
 
89
- path_parts="${rvm_ruby_string//-/ }"
89
+ parts=(${rvm_ruby_string//-/ }) # Strip white space.
90
90
 
91
- while true ; do
91
+ echo "$path"
92
92
 
93
- echo "$path/$path_parts" | sed -e 's# #/#g' -e 's#/$##g'
93
+ for part in "${parts[@]}" ; do
94
94
 
95
- [[ -z "$path_parts" ]] && break
95
+ path="$path/$part"
96
96
 
97
- path_parts="$(echo "$path_parts" | awk '{$NF=""; print}' | __rvm_strip)"
97
+ echo "$path"
98
98
 
99
99
  done
100
100
 
@@ -208,7 +208,8 @@ __rvm_push() {
208
208
 
209
209
  # Clean all *duplicate* items out of the path. (keep first occurrence of each)
210
210
  __rvm_clean_path() {
211
- PATH="$(echo $PATH | \tr -s ':' '\n' | awk '!($0 in a){a[$0];print}' | \tr -s '\n' ':' | sed 's#:$##')"
211
+
212
+ PATH="$(printf "$PATH" | \tr -s ':' '\n' | awk '!($0 in a){a[$0];print}' | \tr -s '\n' ':' | sed 's#:$##')"
212
213
 
213
214
  export PATH
214
215
 
@@ -217,7 +218,8 @@ __rvm_clean_path() {
217
218
 
218
219
  # Clean all rvm items out of the current working path.
219
220
  __rvm_remove_rvm_from_path() {
220
- PATH="$(echo ${PATH} | awk -v RS=: -v ORS=: "/${rvm_path//\//\/}/ {next} {print}")"
221
+
222
+ PATH="$(printf "$PATH" | awk -v RS=: -v ORS=: "/${rvm_path//\//\/}/ {next} {print}" | sed -e 's#:$##')"
221
223
 
222
224
  export PATH
223
225
 
@@ -227,95 +229,111 @@ __rvm_remove_rvm_from_path() {
227
229
  # Run a specified command and log it.
228
230
  __rvm_run() {
229
231
 
230
- local result log_file_name command message
232
+ local name log path command message
231
233
 
232
- log_file_name="${1:-""}"
234
+ name="${1:-""}"
233
235
  command="${2:-""}"
234
236
  message="${3:-""}"
235
237
 
236
- if [[ -n "$message" ]] ; then "$rvm_path/scripts/log" "info" "$message" ; fi
238
+ if [[ -n "$message" ]] ; then
239
+ "$rvm_path/scripts/log" "info" "$message"
240
+ fi
237
241
 
238
242
  if [[ ${rvm_debug_flag:-0} -gt 0 ]] ; then
239
- "$rvm_path/scripts/log" "debug" "Executing: $command"
243
+ "$rvm_path/scripts/log" "debug" \
244
+ "Executing: $command"
240
245
  fi
241
246
 
242
- \mkdir -p "$(dirname "${rvm_log_path:-"$rvm_path/log"}/$rvm_ruby_string/$log_file_name.log")"
247
+ path="${rvm_log_path:-"$rvm_path/log"}/$rvm_ruby_string"
243
248
 
244
- \touch "${rvm_log_path:-"$rvm_path/log"}/$rvm_ruby_string/$log_file_name.log" \
245
- "${rvm_log_path:-"$rvm_path/log"}/$rvm_ruby_string/$log_file_name.error.log" # for zsh :(
249
+ log="$path/$name.log"
246
250
 
247
- echo "[$(date +'%Y-%m-%d %H:%M:%S')] $command" | \
248
- \tee "${rvm_log_path:-"$rvm_path/log"}/$rvm_ruby_string/$log_file_name.log" >> \
249
- "${rvm_log_path:-"$rvm_path/log"}/$rvm_ruby_string/$log_file_name.error.log"
251
+ if [[ ! -d "$path" ]] ; then
252
+ \mkdir -p "$path"
253
+ fi
250
254
 
251
- (
252
- if [[ -z "${rvm_niceness:-""}" || "0" = "${rvm_niceness:-""}" ]] ; then
253
- eval "$command" >> \
254
- "${rvm_log_path:-"$rvm_path/log"}/$rvm_ruby_string/$log_file_name.log" 2>> \
255
- "${rvm_log_path:-"$rvm_path/log"}/$rvm_ruby_string/$log_file_name.error.log"
256
- else
257
- eval "nice -n $rvm_niceness $command" >> \
258
- ${rvm_log_path:-"$rvm_path/log"}/$rvm_ruby_string/$log_file_name.log 2>> \
259
- ${rvm_log_path:-"$rvm_path/log"}/$rvm_ruby_string/$log_file_name.error.log
260
- fi
261
- )
262
- local result=$?
255
+ \touch "$log" "${log/%.log/.error.log}" # for zsh :(
256
+
257
+ printf "[$(date +'%Y-%m-%d %H:%M:%S')] $command" | \
258
+ \tee "$log" \
259
+ >> "${log/%log/error.log}"
260
+
261
+ if [[ ${rvm_niceness:-0} -gt 0 ]] ; then
262
+ command="nice -n $rvm_niceness $command"
263
+ fi
264
+
265
+ eval "$command" \
266
+ >> "$log" \
267
+ 2>> "${log/%log/error.log}"
268
+
269
+ result=$?
263
270
 
264
271
  if [[ $result -gt 0 ]] ; then
265
272
  "$rvm_path/scripts/log" "error" \
266
- "Error running '$command', please check ${rvm_log_path:-"$rvm_path/log"}/$rvm_ruby_string/$log_file_name*.log"
273
+ "Error running '$command', please check ${log/%log/error.log}"
267
274
  fi
268
275
 
269
- return $result
276
+ return ${result:-0}
270
277
  }
271
278
 
272
279
  # Runs a command in a given env.
273
280
  __rvm_run_with_env() {
274
281
 
275
- local result log_file_name env_name comand message
282
+ local name environment command message log path
276
283
 
277
- log_file_name="${1:-""}"
278
- env_name="${2:-""}"
284
+ name="${1:-""}"
285
+ environment="${2:-""}"
279
286
  command="${3:-""}"
280
287
  message="${4:-""}"
281
288
 
282
- if [[ -z "$env_name" ]]; then env_name="$(__rvm_environment_identifier)"; fi
289
+ if [[ -z "$environment" ]] ; then
290
+ environment="$(__rvm_environment_identifier)"
291
+ fi
283
292
 
284
- if [[ -n "$message" ]] ; then "$rvm_path/scripts/log" "info" "$message" ; fi
293
+ if [[ -n "$message" ]] ; then
294
+ "$rvm_path/scripts/log" "info" "$message"
295
+ fi
285
296
 
286
297
  if [[ ${rvm_debug_flag:-0} -gt 0 ]] ; then
287
- "$rvm_path/scripts/log" "debug" "Executing: $command in environment "$env_name""
298
+ "$rvm_path/scripts/log" "debug" "Executing: $command in environment "$environment""
288
299
  fi
289
300
 
290
- \mkdir -p "$(dirname "${rvm_log_path:-"$rvm_path/log"}/$rvm_ruby_string/$log_file_name.log")"
301
+ path="${rvm_log_path:-"$rvm_path/log"}/$rvm_ruby_string"
291
302
 
292
- \touch \
293
- "${rvm_log_path:-"$rvm_path/log"}/$rvm_ruby_string/$log_file_name.log" \
294
- "${rvm_log_path:-"$rvm_path/log"}/$rvm_ruby_string/$log_file_name.error.log" # for zsh :(
303
+ log="$path/$name.log"
304
+
305
+ if [[ ! -d "$path" ]] ; then
306
+ \mkdir -p "$path"
307
+ fi
295
308
 
296
- echo "[$(date +'%Y-%m-%d %H:%M:%S')] $command # under $env_name" | \
297
- tee "${rvm_log_path:-"$rvm_path/log"}/$rvm_ruby_string/$log_file_name.log" >> \
298
- "${rvm_log_path:-"$rvm_path/log"}/$rvm_ruby_string/$log_file_name.error.log"
309
+ \touch "$log" "${log/%.log/.error.log}" # for zsh :(
310
+
311
+ printf "[$(date +'%Y-%m-%d %H:%M:%S')] $command # under $environment\n" \
312
+ | tee "${log}" \
313
+ >> "${log/%log/error.log}"
314
+
315
+ if [[ ${rvm_niceness:-0} -gt 0 ]] ; then
316
+ command="nice -n $rvm_niceness $command"
317
+ fi
299
318
 
300
319
  (
301
- if [[ -z "${rvm_niceness:-""}" || $rvm_niceness -eq 0 ]] ; then
302
- eval "__rvm_with_env '$env_name' '$command'" >> \
303
- "${rvm_log_path:-"$rvm_path/log"}/$rvm_ruby_string/$log_file_name.log" 2>> \
304
- "${rvm_log_path:-"$rvm_path/log"}/$rvm_ruby_string/$log_file_name.error.log"
305
- else
306
- eval "nice -n $rvm_niceness __rvm_with_env '$env_name' '$command'" >> \
307
- ${rvm_log_path:-"$rvm_path/log"}/$rvm_ruby_string/$log_file_name.log 2>> \
308
- ${rvm_log_path:-"$rvm_path/log"}/$rvm_ruby_string/$log_file_name.error.log
309
- fi
320
+ rvm_ruby_string="$environment"
321
+
322
+ __rvm_use
323
+
324
+ eval "$command" \
325
+ >> "${log}" \
326
+ 2>> "${log/%log/error.log}"
310
327
  )
328
+
311
329
  result=$?
312
330
 
313
331
  if [[ $result -gt 0 ]] ; then
314
332
  "$rvm_path/scripts/log" "error" \
315
- "Error running '$command' under $env_name, please check ${rvm_log_path:-"$rvm_path/log"}/$rvm_ruby_string/$log_file_name*.log"
333
+ "Error running '$command' under $env_name, please check ${log/%log/error.log}"
316
334
  fi
317
335
 
318
- return $result
336
+ return ${result:-0}
319
337
  }
320
338
 
321
339
  __rvm_nuke_rvm_variables() {
@@ -339,20 +357,6 @@ __rvm_cleanse_variables() {
339
357
  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
340
358
  }
341
359
 
342
- # Usage: __rvm_with_env 'env-name' 'command'
343
- __rvm_with_env() {
344
- local environment_id command
345
-
346
- environment_id="$1"
347
- command="$2"
348
-
349
- (
350
- rvm use "$environment_id"
351
-
352
- eval "$command"
353
- )
354
- }
355
-
356
360
  # Returns the first 1.8.7-compatible (partly) ruby for use
357
361
  # with things like rbx etc which require a ruby be installed.
358
362
  __rvm_18_compat_ruby() {
@@ -470,7 +474,7 @@ __rvm_load_rvmrc() {
470
474
  # Wrap the specified ruby code file in a Benchmark.bmbm block and execute it.
471
475
  __rvm_benchmark() {
472
476
 
473
- local result old_rvm_ruby_string
477
+ local old_rvm_ruby_string
474
478
 
475
479
  code="require \"benchmark\" \n Benchmark.bmbm do |benchmark| \n benchmark.report(\"${rvm_ruby_file}\") do \n"
476
480
 
@@ -509,7 +513,7 @@ __rvm_benchmark() {
509
513
  # Restore the state pre-sets.
510
514
  [[ -n "$old_rvm_ruby_string" ]] && rvm_ruby_string=$old_rvm_ruby_string
511
515
 
512
- return $result
516
+ return ${result:-0}
513
517
  }
514
518
 
515
519
  # Loop over the currently installed rubies and refresh their binscripts.
@@ -665,7 +669,7 @@ __rvm_implode() {
665
669
  # Output the current ruby's rvm source path.
666
670
  __rvm_source_dir() {
667
671
 
668
- if [[ -z "$rvm_ruby_selected_flag" ]] ; then __rvm_select ; fi
672
+ if [[ ${rvm_ruby_selected_flag:-0} -eq 0 ]] ; then __rvm_select ; fi
669
673
 
670
674
  if [[ -z "$rvm_ruby_src_path" ]] ; then
671
675
 
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rvm
3
3
  version: !ruby/object:Gem::Version
4
- hash: 7
4
+ hash: 5
5
5
  prerelease: false
6
6
  segments:
7
7
  - 1
8
8
  - 0
9
- - 8
10
- version: 1.0.8
9
+ - 9
10
+ version: 1.0.9
11
11
  platform: ruby
12
12
  authors:
13
13
  - Wayne E. Seguin
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-09-14 00:00:00 -04:00
18
+ date: 2010-09-15 00:00:00 -04:00
19
19
  default_executable: rvm-install
20
20
  dependencies: []
21
21