rvm 0.1.32 → 0.1.33

Sign up to get free protection for your applications and to get access to all the features.
data/scripts/alias ADDED
@@ -0,0 +1,103 @@
1
+ #!/usr/bin/env bash
2
+
3
+ if [[ ! -z "$rvm_trace_flag" ]] ; then set -x ; export rvm_trace_flag ; fi
4
+
5
+ trap "if [[ -d $rvm_tmp_path/ ]] && [[ -f $rvm_tmp_path/$$ ]] ; then rm -f $rvm_tmp_path/$$ > /dev/null 2>&1 ; fi ; exit" 0 1 2 3 15
6
+
7
+ source $rvm_scripts_path/initialize
8
+ source $rvm_scripts_path/utility
9
+ source $rvm_scripts_path/selector
10
+
11
+ show_alias() {
12
+ if [[ -z "$alias_name" ]]; then
13
+ $rvm_scripts_path/log "error" "usage: 'rvm alias show [alias_name]'"
14
+ result=1
15
+ return
16
+ fi
17
+ expanded_alias_name="$($rvm_scripts_path/db "$rvm_config_path/alias" "$alias_name")"
18
+ if [[ -z "$expanded_alias_name" ]]; then
19
+ $rvm_scripts_path/log "error" "Unknown alias name: '$alias_name'"
20
+ result=1
21
+ else
22
+ result=0
23
+ echo "$expanded_alias_name"
24
+ fi
25
+ unset expanded_alias_name
26
+ }
27
+
28
+ delete_alias() {
29
+ echo "Deleting alias: $alias_name"
30
+ for link in "$rvm_rubies_path/$alias_name" ; do
31
+ if [[ -L "$link" ]] ; then rm -f $link ; fi
32
+ done
33
+ $rvm_scripts_path/db "$rvm_config_path/alias" "$alias_name" "delete"
34
+ }
35
+
36
+ create_alias() {
37
+ if [[ -z "$rvm_environment_identifier" ]] || [[ -z "$alias_name" ]] ; then
38
+ $rvm_scripts_path/log "error" "usage: 'rvm alias [alias_name] [ruby_string]'"
39
+ result=1
40
+ else
41
+ if [[ -z "$rvm_alias" ]] ; then
42
+ rvm_ruby_string="$rvm_environment_identifier"
43
+ rvm_expanding_aliases=1
44
+ __rvm_ruby_string >& /dev/null
45
+ unset rvm_expanding_aliases
46
+ if [[ -z "$rvm_ruby_string" ]]; then
47
+ $rvm_scripts_path/log "error" "unknown ruby string specified"
48
+ result=1
49
+ return
50
+ fi
51
+ final_environment_identifier="$(__rvm_environment_identifier)"
52
+ $rvm_scripts_path/log "info" "Creating alias $alias_name for $final_environment_identifier."
53
+ ln -nfs "$rvm_rubies_path/$rvm_ruby_string" "$rvm_rubies_path/$alias_name"
54
+ $rvm_scripts_path/log "info" "Recording alias $alias_name for $final_environment_identifier."
55
+ $rvm_scripts_path/db "$rvm_config_path/alias" "$alias_name" "$final_environment_identifier"
56
+ else
57
+ if [[ -d "$rvm_rubies_path/$alias_name" ]] ; then
58
+ $rvm_scripts_path/log "error" "$rvm_rubies_path/$alias_name is taken and is *not* able to be an alias name."
59
+ result=1
60
+ else
61
+ $rvm_scripts_path/log "error" "$rvm_rubies_path/$alias_name is already aliased."
62
+ result=1
63
+ fi
64
+ fi
65
+ fi
66
+ }
67
+
68
+ alias_list() {
69
+ for item in $rvm_rubies_path/* ; do
70
+ if [[ -L "$item" ]] ; then
71
+ echo "$(basename $item) => $($rvm_scripts_path/db "$rvm_config_path/alias" "$(basename "$item")")"
72
+ fi
73
+ done
74
+ }
75
+
76
+ action="$1"
77
+ alias_name="$2"
78
+ rvm_environment_identifier="$3"
79
+ if [[ ! -f "$rvm_config_path/alias" ]] ; then touch "$rvm_config_path/alias" ; fi
80
+ if [[ ! -z "$alias_name" ]] ; then
81
+ rvm_alias="$($rvm_scripts_path/db "$rvm_config_path/alias" "$alias_name")"
82
+ fi
83
+
84
+ # CLI API:
85
+ # rvm alias create [alias_name] [ruby]
86
+ # rvm alias delete [alias_name]
87
+ # rvm alias show [alias_name]
88
+ # rvm alias list
89
+ if [[ "$action" = "delete" ]] ; then
90
+ delete_alias
91
+ elif [[ "$action" = "create" ]] ; then
92
+ create_alias
93
+ elif [[ "$action" = "list" ]] ; then
94
+ alias_list
95
+ elif [[ "$action" = "show" ]]; then
96
+ show_alias
97
+ else
98
+ $rvm_scripts_path/log "error" "usage: 'rvm alias [action] [arguments]"
99
+ fi
100
+
101
+ unset action alias_name rvm_ruby_string rvm_environment_identifier final_environment_identifier
102
+
103
+ exit $result
data/scripts/cli CHANGED
@@ -14,6 +14,9 @@ __rvm_parse_args() {
14
14
 
15
15
  package)
16
16
  rvm_action="$rvm_token"
17
+ if [[ "$1" = "--only-path" ]]; then
18
+ shift; rvm_only_path_flag=1
19
+ fi
17
20
  rvm_ruby_args="$@"
18
21
  rvm_parse_break=1
19
22
  ;;
@@ -24,6 +27,10 @@ __rvm_parse_args() {
24
27
  if [[ "ruby" = "$1" ]] ; then shift ; fi
25
28
  ;;
26
29
 
30
+ env)
31
+ rvm_action=$rvm_token
32
+ ;;
33
+
27
34
  inspect)
28
35
  rvm_action=$rvm_token
29
36
  rvm_ruby_args="$@"
@@ -82,27 +89,23 @@ __rvm_parse_args() {
82
89
  rvm_ruby_gem_home="$rvm_ruby_gem_home${rvm_gemset_separator}$rvm_gemset_name"
83
90
  fi
84
91
  else
85
- if [[ -z "$1" ]] ; then
86
- rvm_action="error"
87
- rvm_error_message="'gemset' must be followed by a gemset action, see http://rvm.beginrescueend.com/gemsets/ for details."
88
- else
89
- if [[ "$rvm_ruby_string" != "$rvm_gemset_name" ]] ; then __rvm_ruby_string ; fi
90
- rvm_ruby_args="$@"
91
- fi
92
+ if [[ "$rvm_ruby_string" != "$rvm_gemset_name" ]] ; then __rvm_ruby_string ; fi
93
+ rvm_ruby_args="$@"
92
94
  fi
93
95
  rvm_parse_break=1
94
96
  ;;
95
97
 
96
- gemdir)
98
+ gemdir|gempath|gemhome)
97
99
  rvm_action=$rvm_token
98
100
  rvm_gemdir_flag=1
99
101
  if [[ "system" = "$1" ]] ; then rvm_system_flag=1 ; shift ; fi
100
102
  if [[ "user" = "$1" ]] ; then rvm_user_flag=1 ; shift ; fi
101
103
  ;;
102
104
 
103
- list|info|docs|alias)
105
+ list|info|alias|docs)
104
106
  rvm_action="$rvm_token"
105
107
  rvm_ruby_args="$@"
108
+ if [[ "$rvm_token" = "info" ]] && [[ -z "$rvm_ruby_args" ]] ; then rvm_ruby_args="$rvm_ruby_string" ; fi
106
109
  rvm_parse_break=1
107
110
  ;;
108
111
 
@@ -198,7 +201,7 @@ __rvm_parse_args() {
198
201
 
199
202
  # For use with --patch
200
203
  --patch-name) rvm_ruby_patch_name="$1" ; shift ;;
201
- -h|--patch)
204
+ --patch)
202
205
  if [[ -z "$rvm_ruby_patch" ]] ; then
203
206
  rvm_ruby_patch="$1"
204
207
  else
@@ -279,6 +282,24 @@ __rvm_parse_args() {
279
282
  rvm_ruby_args="$@"
280
283
  rvm_parse_break=1
281
284
  ;;
285
+
286
+ --passenger|--editor)
287
+ rvm_wrapper_name="${rvm_token/--/}"
288
+ ;;
289
+
290
+ --symlink)
291
+ $rvm_scripts_path/log "warn" "--symlink has been removed, please see 'rvm wrapper'."
292
+ shift
293
+ ;;
294
+
295
+ wrapper)
296
+ rvm_action="$rvm_token"
297
+ rvm_ruby_string="$1" ; shift
298
+ rvm_wrapper_name="$1" ; shift
299
+ rvm_ruby_args="$@" # list of binaries, or none
300
+ rvm_parse_break=1
301
+ ;;
302
+
282
303
  -h|--help|usage) rvm_action=help ;;
283
304
  -G|--gems) rvm_gems_path="$1" ; shift ;;
284
305
  --source) rvm_src_path="$1" ; shift ;;
@@ -290,7 +311,6 @@ __rvm_parse_args() {
290
311
  # TODO: handle this below better (if $1 is null)
291
312
  --sdk) rvm_sdk="$1" ; shift ;;
292
313
  --archflags) rvm_archflags="$1" ; shift ;;
293
- --symlink) rvm_symlink_name="$1" ; shift ;;
294
314
  --install) rvm_install_on_use_flag=1 ;;
295
315
  --trace) rvm_trace_flag=1 ; set -x ;;
296
316
  --proxy) rvm_proxy="$1" ; shift ;;
@@ -304,7 +324,7 @@ __rvm_parse_args() {
304
324
 
305
325
  reboot|damnit|wtf|argh|BOOM|boom|wth) $rvm_action="reboot" ;;
306
326
 
307
- --self|--gem|--rubygems|--reconfigure|--default|--debug|--force|--export|--summary|--latest|--yaml|--json|--archive|--shebang|--env|--path|--tail|--delete|--verbose|--import|--rvmrc|--passenger|--editor|--sticky|--create|--rvmrc|--gems)
327
+ --self|--gem|--rubygems|--reconfigure|--default|--debug|--force|--export|--summary|--latest|--yaml|--json|--archive|--shebang|--env|--path|--tail|--delete|--verbose|--import|--rvmrc|--sticky|--create|--rvmrc|--gems)
308
328
  export rvm_$(echo $rvm_token | sed 's#-##g')_flag=1
309
329
  if [[ "--debug" = "$rvm_token" ]] ; then rvm_debug_flag ; fi
310
330
  ;;
@@ -325,6 +345,7 @@ __rvm_parse_args() {
325
345
  fi
326
346
  elif [[ ! -z "$(echo "$rvm_token" | awk '/,/')" ]] ; then
327
347
  rvm_ruby_version="$rvm_token"
348
+ rvm_ruby_strings="$rvm_token" # Migrating to this from rvm_ruby_version
328
349
  if [[ -z "$rvm_action" ]] ; then
329
350
  rvm_action="ruby" # Not sure if we really want to do this but we'll try it out.
330
351
  fi
@@ -382,27 +403,23 @@ rvm() {
382
403
  # Check that this is the current version.
383
404
  disk_version=$(cat "${rvm_path:-$HOME/.rvm}/lib/VERSION.yml" | tail -n 3 | sed 's/^.*: //g' | tr "\n" '.' | sed 's/\.$//')
384
405
  if [[ "${rvm_version}" != "${disk_version}" ]] && [[ "reload" != "$1" ]]; then
385
- echo -e "A newer version of rvm has been installed ($disk_version) than is loaded ($rvm_version), please do one of the following:\n * 'rvm reload'\n * open a new shell\n * source your shell init scripts"
406
+ printf "\nA newer version of rvm has been installed ($disk_version) than is loaded ($rvm_version), please do one of the following:\n * 'rvm reload'\n * open a new shell\n * source your shell init scripts"
386
407
  return 1
387
408
  fi
388
409
 
389
410
  __rvm_cleanup_variables
390
411
  __rvm_load_rvmrc
391
412
  __rvm_initialize
392
- __rvm_load_defaults
393
413
  __rvm_parse_args "$@"
394
414
 
395
- export BUNDLE_PATH GEM_HOME GEM_PATH rvm_action rvm_bin_flag rvm_debug_flag rvm_delete_flag rvm_docs_type rvm_file_name rvm_gemset_name rvm_head_flag rvm_install_on_use_flag rvm_interactive rvm_llvm_flag rvm_make_flags rvm_proxy rvm_remove_flag rvm_ruby_args rvm_ruby_configure_flags rvm_ruby_file rvm_ruby_gem_home rvm_ruby_interpreter rvm_ruby_name rvm_ruby_patch rvm_ruby_patch_name rvm_ruby_string rvm_ruby_version rvm_system_flag rvm_trace_flag rvm_use_flag rvm_user_flag rvm_verbose_flag
396
- export rvm_path rvm_rubies_path rvm_scripts_path rvm_archives_path rvm_src_path rvm_log_path rvm_bin_path rvm_gems_path rvm_config_path rvm_tmp_path rvm_hooks_path rvm_gems_cache_path rvm_gemset_separator rvm_symlink_path
415
+ export BUNDLE_PATH GEM_HOME GEM_PATH rvm_ruby_string rvm_action rvm_bin_flag rvm_debug_flag rvm_delete_flag rvm_docs_type rvm_file_name rvm_gemset_name rvm_head_flag rvm_install_on_use_flag rvm_interactive rvm_llvm_flag rvm_make_flags rvm_proxy rvm_remove_flag rvm_ruby_args rvm_ruby_configure_flags rvm_ruby_file rvm_ruby_gem_home rvm_ruby_interpreter rvm_ruby_name rvm_ruby_patch rvm_ruby_patch_name rvm_ruby_version rvm_system_flag rvm_trace_flag rvm_use_flag rvm_user_flag rvm_verbose_flag
416
+ export rvm_path rvm_rubies_path rvm_scripts_path rvm_archives_path rvm_src_path rvm_log_path rvm_bin_path rvm_gems_path rvm_config_path rvm_tmp_path rvm_hooks_path rvm_gems_cache_path rvm_gemset_separator
397
417
 
398
418
  result=0
399
419
  case "$rvm_action" in
400
420
  use) __rvm_use ; result=$? ;;
401
421
  srcdir) __rvm_source_dir ; result=$? ;;
402
- list) __rvm_list ; result=$? ;;
403
422
  strings) __rvm_strings ; result=$? ;;
404
- info) __rvm_info ; result=$? ;;
405
- debug) __rvm_debug ; result=$? ;;
406
423
  version) __rvm_version ; result=$? ;;
407
424
  reset) __rvm_reset ; result=$? ;;
408
425
  update) __rvm_update ; result=$? ;;
@@ -411,19 +428,43 @@ rvm() {
411
428
  benchmark) __rvm_benchmark ; result=$? ;;
412
429
  inspect) __rvm_inspect ; result=$? ;;
413
430
  implode|seppuku) __rvm_implode ; result=$? ;;
431
+
432
+ list) $rvm_scripts_path/list $rvm_ruby_args ; result=$? ;;
433
+ # TODO: Make debug run in the current environment.
434
+ debug) $rvm_scripts_path/info '' debug ; result=$? ;;
435
+ info)
436
+ if [[ -z "$rvm_ruby_args" ]] ; then
437
+ . $rvm_scripts_path/info
438
+ else
439
+ $rvm_scripts_path/info $rvm_ruby_args
440
+ fi
441
+ result=$?
442
+ ;;
414
443
  docs) $rvm_scripts_path/docs ; result=$? ;;
415
- alias) $rvm_scripts_path/alias ; result=$? ;;
416
- help) $rvm_scripts_path/help $rvm_ruby_args ; result=$? ;;
444
+ alias) $rvm_scripts_path/alias $rvm_ruby_args ; result=$? ;;
445
+ help) $rvm_scripts_path/help $rvm_ruby_args ; result=$? ;;
417
446
 
418
447
  answer) __rvm_Answer_to_the_Ultimate_Question_of_Life_the_Universe_and_Everything ; result=42 ;;
419
448
  question) __rvm_ultimate_question ; result=42 ;;
420
449
 
421
- gemdir)
422
- $rvm_scripts_path/gemsets gemdir
450
+ env)
451
+ $rvm_scripts_path/env "$rvm_ruby_string"
452
+ result=$?
453
+ ;;
454
+
455
+ wrapper)
456
+ $rvm_scripts_path/wrapper "$rvm_ruby_string" "$rvm_wrapper_name" $rvm_ruby_args
457
+ result=$?
458
+ unset rvm_wrapper_name
459
+ ;;
460
+
461
+ gemdir|gemhome|gempath)
462
+ $rvm_scripts_path/gemsets $rvm_action
423
463
  result=$?
424
464
  ;;
425
465
 
426
466
  ruby|gem|rake)
467
+ unset rvm_ruby_string
427
468
  $rvm_scripts_path/set $rvm_action $rvm_ruby_args
428
469
  result=$?
429
470
  ;;
data/scripts/db CHANGED
@@ -1,5 +1,12 @@
1
1
  #!/usr/bin/env bash
2
2
 
3
+ usage() {
4
+ printf "\nUsage:\n" >&2
5
+ printf "\n $rvm_scripts_path/db database_file {{key}} {{value}} # set" >&2
6
+ printf "\n $rvm_scripts_path/db database_file {{key}} # get" >&2
7
+ printf "\n $rvm_scripts_path/db database_file {{key}} unset # unset\n\n" >&2
8
+ }
9
+
3
10
  if [[ -f "$1" ]] ; then
4
11
  database_file="$1" ; shift
5
12
  if [[ ! -f "$database_file" ]] ; then
@@ -7,13 +14,13 @@ if [[ -f "$1" ]] ; then
7
14
  touch $database_file
8
15
  fi
9
16
  else
10
- echo "Database file $1 does not exist." >&2
17
+ printf "\n\nDatabase file $1 does not exist.\n\n" >&2
11
18
  exit 1
12
19
  fi
13
20
 
14
21
  key="$1" ; shift
15
22
  if [[ -z "$key" ]] ; then
16
- echo "usage: $0 database key [value]" >&2
23
+ usage
17
24
  exit 1
18
25
  else
19
26
  value="$*"
data/scripts/docs ADDED
@@ -0,0 +1,57 @@
1
+ #!/usr/bin/env bash
2
+
3
+ if [[ ! -z "$rvm_trace_flag" ]] ; then set -x ; export rvm_trace_flag ; fi
4
+
5
+ trap "if [[ -d $rvm_tmp_path/ ]] && [[ -f $rvm_tmp_path/$$ ]] ; then rm -f $rvm_tmp_path/$$ > /dev/null 2>&1 ; fi ; exit" 0 1 2 3 15
6
+
7
+ source $rvm_scripts_path/initialize
8
+
9
+ rvm_ruby_string="$(basename $GEM_HOME 2>/dev/null | awk -F'@' '{print $1}')"
10
+ if [[ -z "$rvm_ruby_string" ]] && echo $GEM_HOME | grep -v 'rvm/' > /dev/null 2>&1 ; then
11
+ $rvm_scripts_path/log "error" "Currently 'rvm docs ...' does not work with non-rvm rubies."
12
+ exit 1
13
+ fi
14
+
15
+ rvm_docs_type="${rvm_docs_type:-rdoc}"
16
+ action="$(echo $rvm_ruby_args | awk '{print $1}')"
17
+
18
+ if [[ ! -d "$rvm_docs_path" ]] ; then mkdir -p "$rvm_docs_path/rdoc" "$rvm_docs_path/yard" ; fi
19
+
20
+ open_docs() {
21
+ if [[ -s "$rvm_docs_path/$rvm_ruby_string/$rvm_docs_type/index.html" ]] ; then
22
+ if command -v open >/dev/null ; then
23
+ open $rvm_docs_path/$rvm_ruby_string/$rvm_docs_type/index.html
24
+ elif command -v xdg-open >/dev/null ; then
25
+ xdg-open $rvm_docs_path/$rvm_ruby_string/$rvm_docs_type/index.html
26
+ else
27
+ $rvm_scripts_path/log "error" "Neither open nor xdg-open were found, in order to open the docs one of these two are required. \n(OR you can let me know how else to open the html in your browser from comand line on your OS :) )"
28
+ fi
29
+ else
30
+ $rvm_scripts_path/log "error" "$rvm_docs_type docs are missing, perhaps run 'rvm docs generate' first?"
31
+ fi
32
+ }
33
+
34
+ generate_docs() {
35
+ builtin cd "$rvm_src_path/$rvm_ruby_string/"
36
+ rm -rf $rvm_docs_path/$rvm_ruby_string/$rvm_docs_type/
37
+ $rvm_scripts_path/log "info" "Generating documentation, be aware that this could take a *long* time, and depends heavily on your system resources..."
38
+ $rvm_scripts_path/log "info" "( Errors will be logged to $rvm_log_path/$rvm_ruby_string/docs.error.log )"
39
+ if gem list | grep ^hanna >/dev/null 2>&1 ; then
40
+ hanna -o $rvm_docs_path/$rvm_ruby_string/$rvm_docs_type --inline-source --line-numbers --fmt=html 2>> $rvm_log_path/$rvm_ruby_string/docs.error.log
41
+ hanna --ri --ri-site -o $rvm_docs_path/$rvm_ruby_string/$rvm_docs_type --inline-source --line-numbers --fmt=html 2>> $rvm_log_path/$rvm_ruby_string/docs.error.log
42
+ else
43
+ rdoc -a -o $rvm_docs_path/$rvm_ruby_string/$rvm_docs_type 2>> $rvm_log_path/$rvm_ruby_string/docs.error.log
44
+ rdoc -a --ri --ri-site -o $rvm_docs_path/$rvm_ruby_string/$rvm_docs_type 2>> $rvm_log_path/$rvm_ruby_string/docs.error.log
45
+ fi
46
+ }
47
+
48
+ if [[ "open" = "$action" ]] ; then
49
+ open_docs
50
+ elif [[ "generate" = "$action" ]] ; then
51
+ generate_docs
52
+ else
53
+ $rvm_scripts_path/log "error" ""
54
+ exit 1
55
+ fi
56
+
57
+ exit $result
data/scripts/env ADDED
@@ -0,0 +1,48 @@
1
+ #!/usr/bin/env bash
2
+
3
+ # Recursive loops, oh my!
4
+ unset rvm_default_flag
5
+
6
+ source $rvm_scripts_path/initialize
7
+ source $rvm_scripts_path/utility
8
+ source $rvm_scripts_path/selector
9
+
10
+ if [[ ! -z "$rvm_trace_flag" ]] ; then set -x ; export rvm_trace_flag ; fi
11
+
12
+ trap "if [[ -d $rvm_tmp_path/ ]] && [[ -s $rvm_tmp_path/$$ ]] ; then rm -f $rvm_tmp_path/$$ > /dev/null 2>&1 ; fi ; exit" 0 1 2 3 15
13
+
14
+ usage() {
15
+ printf "Usage: rvm env [ruby_string] [--path]\n"
16
+ }
17
+
18
+ environment_name="$1"
19
+
20
+ if [[ -z "$environment_name" ]]; then
21
+ usage ; exit 1
22
+ fi
23
+
24
+ rvm_ruby_string="${environment_name}" ;
25
+
26
+ # Ensure the string is valid before printing an env.
27
+ { __rvm_ruby_string && __rvm_select && __rvm_use; }> /dev/null 2>&1
28
+
29
+ if [[ "$?" = 0 ]]; then
30
+ __rvm_use
31
+ environment_file_path="$rvm_environments_path/$(__rvm_environment_identifier)"
32
+ # Echo the path or environment file.
33
+ if [[ -n "$rvm_path_flag" ]]; then
34
+ echo "$environment_file_path"
35
+ else
36
+ cat "$environment_file_path"
37
+ fi
38
+ unset environment_file_path
39
+ result=0
40
+ else
41
+ result=1
42
+ fi
43
+
44
+ unset rvm_ruby_string environment_name
45
+ __rvm_unset_ruby_variables
46
+
47
+ exit $result
48
+
data/scripts/fetch CHANGED
@@ -42,7 +42,7 @@ if [[ ! -z "$rvm_debug_flag" ]] ; then $rvm_scripts_path/log "debug" "Fetching $
42
42
  archive_md5="$($rvm_scripts_path/db "$rvm_config_path/md5" "$archive")"
43
43
  if [[ -e "$archive" ]] && [[ ! -z "$archive_md5" ]] ; then
44
44
  if [[ ! -z "$rvm_debug_flag" ]] ; then $rvm_scripts_path/log "debug" "Found archive and its md5, testing correctness" ; fi
45
- if [[ $($rvm_scripts_path/md5 $archive $archive_md5) -gt 0 ]] ; then
45
+ if ! $rvm_scripts_path/md5 "${rvm_archives_path}/${archive}" "$archive_md5" ; then
46
46
  if [[ ! -z "$rvm_debug_flag" ]] ; then $rvm_scripts_path/log "debug" "Archive is bad, downloading" ; fi
47
47
  download=1
48
48
  else
data/scripts/gemsets CHANGED
@@ -11,7 +11,7 @@ if [[ ! -d "$rvm_ruby_gem_home" ]] && command -v gem > /dev/null 2>&1; then rvm_
11
11
  trap "if [[ -d $rvm_tmp_path/ ]] && [[ -s $rvm_tmp_path/$$ ]] ; then rm -f $rvm_tmp_path/$$ > /dev/null 2>&1 ; fi ; exit" 0 1 2 3 15
12
12
 
13
13
  __rvm_gemset_name() {
14
- __rvm_gemset_gemdir | awk -F${rvm_gemset_separator} '{print $2}'
14
+ __rvm_gemset_dir | awk -F${rvm_gemset_separator} '{print $2}'
15
15
  }
16
16
 
17
17
  __rvm_gemset_dir() {
@@ -35,9 +35,7 @@ __rvm_gemset_list() {
35
35
 
36
36
  if [[ ! -z "$rvm_gems_path" ]] ; then
37
37
  if [[ ! -z $rvm_ruby_string ]] ; then
38
- for gemdir in $rvm_gems_path/${rvm_ruby_string}${rvm_gemset_separator}* ; do
39
- echo "$gemdir" | awk -F${rvm_gemset_separator} '{print $2}'
40
- done
38
+ \ls ${rvm_gems_path}/ | awk -F"${rvm_gemset_separator}" "/${rvm_ruby_string}${rvm_gemset_separator}/{print \$2}" 2>/dev/null
41
39
  else
42
40
  $rvm_scripts_path/log "error" "\$rvm_ruby_string is not set!"
43
41
  fi
@@ -73,13 +71,13 @@ __rvm_gemset_empty() {
73
71
  if [[ -z "$rvm_ruby_gem_home" ]] ; then __rvm_select ; fi
74
72
  gemdir="$rvm_ruby_gem_home"
75
73
  if [[ -d "$gemdir" ]] && [[ "$gemdir" != '/' ]] && [[ ! -z "$rvm_force_flag" ]] ; then
76
- cd $gemdir && rm -rf ./bin/* ./doc/* ./gems/* ./specifications/*
74
+ builtin cd $gemdir && rm -rf ./bin/* ./doc/* ./gems/* ./specifications/*
77
75
  elif [[ -d "$gemdir" ]] ; then
78
76
  $rvm_scripts_path/log "warn" "Are you SURE you wish to remove the installed gemset for gemset '$(basename $gemdir)' ($gemdir)?"
79
77
  echo -n "(anything other than 'yes' will cancel) > "
80
78
  read response
81
79
  if [[ "yes" = "$response" ]] ; then
82
- cd $gemdir && rm -rf ./bin/* ./doc/* ./gems/* ./specifications/*
80
+ builtin cd $gemdir && rm -rf ./bin/* ./doc/* ./gems/* ./specifications/*
83
81
  else
84
82
  $rvm_scripts_path/log "info" "Not doing anything, phew... close call that one eh?"
85
83
  fi
@@ -102,11 +100,13 @@ __rvm_gemset_copy() {
102
100
  destination_path="$(rvm $destination_ruby gem env gemdir | tail -n 1)"
103
101
  if [[ -d "$source_path" ]] ; then
104
102
  if [[ ! -d "$destination_path" ]] ; then mkdir -p $destination_path ; fi
105
- $rvm_scripts_path/log "info" "Copying gemset from $source_ruby to $destination_ruby" ;
103
+ $rvm_scripts_path/log "info" "Copying gemset from $source_ruby to $destination_ruby"
106
104
  for dir in bin doc gems specifications ; do
107
105
  mkdir -p "$destination_path/$dir"
108
106
  cp -Rf "$source_path/$dir" "$destination_path/"
109
107
  done
108
+ $rvm_scripts_path/log "info" "Making gemset for $destination_ruby pristine."
109
+ $(rvm $destination_ruby ; gem pristine --all)
110
110
  else
111
111
  $rvm_scripts_path/log "error" "Gems directory does not exist for $source_path ($source_path)"
112
112
  return 1
@@ -295,17 +295,17 @@ __rvm_gem_install() {
295
295
  }
296
296
 
297
297
  # Output the user's current gem directory.
298
- __rvm_gemset_gemdir() {
298
+ __rvm_gemset_info() {
299
299
  if [[ "$rvm_user_flag" -eq 1 ]] ; then
300
300
  echo $(rvm system ; gem env | grep "\- $HOME" | awk '{print $NF}')
301
301
  elif [[ "$rvm_system_flag" -eq 1 ]] ; then
302
- echo $(rvm system ; gem env gemdir system)
302
+ echo $(rvm system ; gem env $action system)
303
303
  elif [[ ! -z "$rvm_ruby_string" ]] ; then
304
- echo $(rvm "$rvm_ruby_string" ; gem env gemdir)
304
+ echo $(rvm "$rvm_ruby_string" ; gem env $action)
305
305
  elif [[ ! -z "$GEM_HOME" ]] ; then
306
306
  echo "$GEM_HOME"
307
307
  else
308
- gem env gemdir
308
+ gem env $action
309
309
  fi
310
310
  }
311
311
 
@@ -342,8 +342,8 @@ elif [[ "dir" = "$action" ]] ; then
342
342
  __rvm_gemset_dir
343
343
  elif [[ "list" = "$action" ]] ; then
344
344
  __rvm_gemset_list
345
- elif [[ "gemdir" = "$action" ]] ; then
346
- __rvm_gemset_gemdir
345
+ elif [[ "gemdir" = "$action" ]] || [[ "gempath" = "$action" ]] || [[ "gemhome" = "$action" ]] || [[ "home" = "$action" ]] || [[ "path" = "$action" ]] || [[ "version" = "$action" ]] ; then
346
+ __rvm_gemset_info
347
347
  elif [[ "install" = "$action" ]] ; then
348
348
  __rvm_gem_install $*
349
349
  elif [[ "pristine" = "$action" ]] ; then
@@ -352,7 +352,7 @@ elif [[ "clear" = "$action" ]] ; then
352
352
  $rvm_scripts_path/log "info" "gemset cleared."
353
353
  exit 0
354
354
  else
355
- $rvm_scripts_path/log "error" "Unrecognized gemset action '$action'.\n\nValid gems actions are: {create,use,import,export,copy,delete,empty,name,list,gemdir,install}"
355
+ $rvm_scripts_path/log "error" "Unrecognized gemset action '$action'.\n\nValid gems actions are: {import,export,create,copy,empty,delete,name,dir,list,gemdir,install,pristine,clear}"
356
356
  fi
357
357
 
358
358
  exit $?