rvm 1.0.11 → 1.0.13

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 CHANGED
@@ -1,4 +1,4 @@
1
1
  ---
2
2
  :major: 1
3
3
  :minor: 0
4
- :patch: 11
4
+ :patch: 13
data/rvm.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{rvm}
8
- s.version = "1.0.11"
8
+ s.version = "1.0.13"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Wayne E. Seguin"]
12
- s.date = %q{2010-09-20}
12
+ s.date = %q{2010-10-03}
13
13
  s.default_executable = %q{rvm-install}
14
14
  s.description = %q{Manages Ruby interpreter environments and switching between them.}
15
15
  s.email = %q{wayneeseguin@gmail.com}
data/scripts/array CHANGED
@@ -3,7 +3,8 @@
3
3
  if [[ -n "${ZSH_VERSION:-""}" ]] ; then __array_start=1 ; else __array_start=0 ; fi
4
4
 
5
5
  # Usage: contains "a_string" "${an_array[@]}"
6
- array_contains() {
6
+ array_contains()
7
+ {
7
8
  local pattern="$1" ; shift
8
9
  local index list
9
10
  list=("$@")
@@ -13,14 +14,16 @@ array_contains() {
13
14
  echo -1 ; return 1
14
15
  }
15
16
 
16
- array_length() {
17
+ array_length()
18
+ {
17
19
  array=$1
18
20
  eval "length=\${#${array}[*]}"
19
21
  echo $length
20
22
  return $length
21
23
  }
22
24
 
23
- array_push() {
25
+ array_push()
26
+ {
24
27
  array=$1 ; item=$2
25
28
  # TODO: allow loop over more arguments.
26
29
  eval "index=\$((\${#${array}[*]} + $__array_start))"
data/scripts/cd CHANGED
@@ -9,13 +9,18 @@ if [[ ${rvm_project_rvmrc:-1} -ne 0 ]] ; then
9
9
  autoload is-at-least
10
10
 
11
11
  if is-at-least 4.3.4 >/dev/null 2>&1; then
12
+
12
13
  # On zsh, use chpwd_functions
13
14
  chpwd_functions=( "${chpwd_functions[@]}" __rvm_project_rvmrc )
15
+
14
16
  else
15
17
 
16
- cd() {
18
+ cd()
19
+ {
17
20
  builtin cd "$@"
21
+
18
22
  local result=$?
23
+
19
24
  __rvm_project_rvmrc
20
25
 
21
26
  rvm_hook="after_cd" ; source "$rvm_path/scripts/hook"
@@ -27,9 +32,12 @@ if [[ ${rvm_project_rvmrc:-1} -ne 0 ]] ; then
27
32
 
28
33
  else
29
34
 
30
- cd() {
35
+ cd()
36
+ {
31
37
  builtin cd "$@"
38
+
32
39
  local result=$?
40
+
33
41
  __rvm_project_rvmrc
34
42
 
35
43
  rvm_hook="after_cd" ; source "$rvm_path/scripts/hook"
@@ -39,18 +47,39 @@ if [[ ${rvm_project_rvmrc:-1} -ne 0 ]] ; then
39
47
 
40
48
  _rvm_cd_complete ()
41
49
  {
42
- local cur matches
50
+ local directory current matches item index
51
+
43
52
  COMPREPLY=()
44
- cur="${COMP_WORDS[COMP_CWORD]}"
45
53
 
46
- matches=$(for dir in $(echo $CDPATH | tr -s ':' ' ') ; do
47
- find $dir/* -type d -maxdepth 0 -exec basename {} \;
48
- done | sort | uniq)
54
+ current="${COMP_WORDS[COMP_CWORD]}"
49
55
 
50
- COMPREPLY=( $(compgen -W "${matches}" -- ${cur}) )
51
- }
56
+ if [[ -n "$CDPATH" ]] ; then
57
+
58
+ index=${#COMPREPLY[@]}
59
+
60
+ for directory in $(echo "$CDPATH" | tr -s ':' ' ') ; do
52
61
 
53
- complete -o bashdefault -o default -o dirnames -o filenames -o nospace -o plusdirs -F _rvm_cd_complete cd
62
+ for item in $( compgen -d "$directory/$current" ) ; do
63
+
64
+ item="${item}/"
65
+
66
+ COMPREPLY[index++]=${item#$directory/}
67
+
68
+ done
69
+
70
+ done
71
+
72
+ COMPREPLY=( $(echo ${COMPREPLY} | uniq | sort) )
73
+
74
+ else
75
+
76
+ COMPREPLY=( $(compgen -d ${current}) )
77
+
78
+ fi
79
+
80
+ complete -o filenames -o nospace -F _rvm_cd_complete cd
81
+
82
+ }
54
83
 
55
84
  fi
56
85
 
data/scripts/cleanup CHANGED
@@ -2,7 +2,8 @@
2
2
  rvm_base_except="selector"
3
3
  source "$rvm_path/scripts/base"
4
4
 
5
- usage() {
5
+ usage()
6
+ {
6
7
  printf "
7
8
 
8
9
  Usage:
@@ -16,14 +17,16 @@ usage() {
16
17
  return 0
17
18
  }
18
19
 
19
- cleanup() {
20
+ cleanup()
21
+ {
20
22
  local cleanup_type current_path
21
23
 
22
24
  for cleanup_type in $1; do
23
25
 
24
- eval "current_path=\"\$rvm_${cleanup_type}_path\""
26
+ current_path="${rvm_path}/${cleanup_type}"
25
27
 
26
- if [[ -n "$current_path" && -d "$current_path" && "$current_path" != "/" ]]; then
28
+ if [[ -n "$current_path" && -d "$current_path" \
29
+ && "$current_path" != "/" ]]; then
27
30
 
28
31
  "$rvm_path/scripts/log" "info" \
29
32
  "Cleaning up rvm directory '$current_path'"
@@ -43,9 +46,9 @@ if [[ -z "${1:-""}" ]] ; then
43
46
  fi
44
47
 
45
48
  case "$1" in
46
- all) cleanup "archives repo src log" ;;
49
+ all) cleanup "archives repos src log" ;;
47
50
  archives) cleanup "archives" ;;
48
- repos) cleanup "repo" ;;
51
+ repos) cleanup "repos" ;;
49
52
  sources) cleanup "src" ;;
50
53
  logs) cleanup "log" ;;
51
54
  help) usage ;;
data/scripts/cli CHANGED
@@ -2,7 +2,8 @@
2
2
 
3
3
  __rvm_usage() { ${PAGER:-less} "${rvm_path:-$HOME/.rvm}/README" ; }
4
4
 
5
- __rvm_run_script() {
5
+ __rvm_run_script()
6
+ {
6
7
  local rvm_script_name="${1:-"$rvm_action"}"
7
8
 
8
9
  eval "$rvm_path/scripts/$rvm_script_name $rvm_ruby_args"
@@ -10,8 +11,8 @@ __rvm_run_script() {
10
11
  return $?
11
12
  }
12
13
 
13
- __rvm_parse_args() {
14
-
14
+ __rvm_parse_args()
15
+ {
15
16
  # TODO:
16
17
  # Make this more robust '__rvm_history' so that it stores *unique* rvm commands.
17
18
  # Otherwise this file gets big rather fast.
@@ -594,8 +595,8 @@ __rvm_parse_args() {
594
595
  fi
595
596
  }
596
597
 
597
- rvm() {
598
-
598
+ rvm()
599
+ {
599
600
  local result
600
601
 
601
602
  __rvm_setup
data/scripts/completion CHANGED
@@ -1,3 +1,5 @@
1
+ #!/usr/bin/env bash
2
+
1
3
  # bash completion for Ruby Version Manager (RVM)
2
4
 
3
5
  __rvm_comp()
data/scripts/db CHANGED
@@ -1,6 +1,7 @@
1
1
  #!/usr/bin/env bash
2
2
 
3
- usage() {
3
+ usage()
4
+ {
4
5
  printf "
5
6
 
6
7
  Usage:
data/scripts/default CHANGED
@@ -6,7 +6,8 @@ rvm_ruby_gem_home="${rvm_ruby_gem_home:-$GEM_HOME}"
6
6
 
7
7
  if [[ ! -d "$rvm_ruby_gem_home" ]] && command -v gem > /dev/null 2>&1; then rvm_ruby_gem_home="$(gem env home)" ; fi
8
8
 
9
- usage() {
9
+ usage()
10
+ {
10
11
  printf "
11
12
 
12
13
  Usage:
@@ -32,11 +33,13 @@ usage() {
32
33
  "
33
34
  }
34
35
 
35
- default_list() {
36
+ default_list()
37
+ {
36
38
  :
37
39
  }
38
40
 
39
- default_clear() {
41
+ default_clear()
42
+ {
40
43
  :
41
44
  }
42
45
 
data/scripts/disk-usage CHANGED
@@ -4,26 +4,29 @@
4
4
  rvm_base_except="selector"
5
5
  source "$rvm_path/scripts/base"
6
6
 
7
- usage() {
7
+ usage()
8
+ {
8
9
  printf "Usage: 'rvm disk-usage {all,archives,repos,sources,logs,packages,rubies,gemsets}'\n"
9
10
  printf " Lists the space rvm uses for a given item.\n"
10
11
  exit 1
11
12
  }
12
13
 
13
- disk_usage_for_directory() {
14
+ disk_usage_for_directory()
15
+ {
14
16
  du -hs "$1" | awk '{print $1}'
15
17
  }
16
18
 
17
- disk_usage() {
18
- local current_path
19
- eval "current_path=\"\$rvm_${2}_path\""
19
+ disk_usage()
20
+ {
21
+ local current_path="$rvm_path/$2"
20
22
  if [[ -n "$current_path" && -d "$current_path" && "$current_path" != "/" ]]; then
21
23
  echo "$1 Usage: $(disk_usage_for_directory "$current_path")"
22
24
  fi
23
25
  return 0
24
26
  }
25
27
 
26
- all_disk_usage() {
28
+ all_disk_usage()
29
+ {
27
30
  archives_disk_usage
28
31
  repos_disk_usage
29
32
  sources_disk_usage
@@ -34,12 +37,13 @@ all_disk_usage() {
34
37
  total_disk_usage
35
38
  }
36
39
 
37
- total_disk_usage() {
40
+ total_disk_usage()
41
+ {
38
42
  echo "Total Disk Usage: $(disk_usage_for_directory "$rvm_path")"
39
43
  }
40
44
 
41
45
  archives_disk_usage() { disk_usage "Downloaded Archives" "archives"; }
42
- repos_disk_usage() { disk_usage "Repositories" "repo"; }
46
+ repos_disk_usage() { disk_usage "Repositories" "repos"; }
43
47
  sources_disk_usage() { disk_usage "Extracted Source Code" "src"; }
44
48
  logs_disk_usage() { disk_usage "Log Files" "log"; }
45
49
  packages_disk_usage() { disk_usage "Packages" "usr"; }
data/scripts/docs CHANGED
@@ -22,7 +22,8 @@ if [[ ! -d "${rvm_docs_path:-"$rvm_path/docs"}" ]] ; then
22
22
 
23
23
  fi
24
24
 
25
- usage() {
25
+ usage()
26
+ {
26
27
  printf "
27
28
 
28
29
  Usage:
@@ -33,7 +34,8 @@ usage() {
33
34
  return 0
34
35
  }
35
36
 
36
- open_docs() {
37
+ open_docs()
38
+ {
37
39
  if [[ -s "${rvm_docs_path:-"$rvm_path/docs"}/$rvm_docs_ruby_string/$rvm_docs_type/index.html" ]] ; then
38
40
 
39
41
  if command -v open >/dev/null ; then
@@ -57,7 +59,8 @@ open_docs() {
57
59
  fi
58
60
  }
59
61
 
60
- generate_ri() {
62
+ generate_ri()
63
+ {
61
64
  # Generate ri docs
62
65
  (
63
66
  builtin cd "${rvm_src_path:-"$rvm_path/src"}/$rvm_docs_ruby_string/"
@@ -70,7 +73,8 @@ generate_ri() {
70
73
  )
71
74
  }
72
75
 
73
- generate_rdoc() {
76
+ generate_rdoc()
77
+ {
74
78
  (
75
79
  builtin cd "${rvm_src_path:-"$rvm_path/src"}/$rvm_docs_ruby_string/"
76
80
 
data/scripts/env CHANGED
@@ -4,7 +4,8 @@ unset rvm_default_flag # Recursive loops, oh my!
4
4
 
5
5
  source "$rvm_path/scripts/base"
6
6
 
7
- usage() {
7
+ usage()
8
+ {
8
9
  printf "
9
10
  Usage:
10
11
 
@@ -7,7 +7,8 @@ unset GREP_OPTIONS
7
7
 
8
8
  source "$rvm_path/scripts/base"
9
9
 
10
- convert_path_to_fish() {
10
+ convert_path_to_fish()
11
+ {
11
12
  local parts path_parts
12
13
 
13
14
  path_part="$1"
@@ -23,19 +24,23 @@ end
23
24
  return 0
24
25
  }
25
26
 
26
- convert_unset_to_fish() {
27
+ convert_unset_to_fish()
28
+ {
27
29
  sed 's#^unset #set -e #'
28
30
  }
29
31
 
30
- convert_exports_to_fish() {
32
+ convert_exports_to_fish()
33
+ {
31
34
  sed -e "s#:#' '#g" -e "s#^\\(export \\)\\{0,1\\}\\([^[:space:]]*\\)=#set -x \\2 #"
32
35
  }
33
36
 
34
- contents_of_environment_file() {
37
+ contents_of_environment_file()
38
+ {
35
39
  cat "$rvm_path/environments/$(__rvm_environment_identifier)"
36
40
  }
37
41
 
38
- convert_to_shell() {
42
+ convert_to_shell()
43
+ {
39
44
  convert_path_to_fish "$(contents_of_environment_file | \grep '^export PATH=')"
40
45
  while read -r shell_line; do
41
46
  if echo "$shell_line" | \grep -q '^unset '; then
@@ -47,7 +52,8 @@ convert_to_shell() {
47
52
  unset shell_line
48
53
  }
49
54
 
50
- ensure_has_shell() {
55
+ ensure_has_shell()
56
+ {
51
57
  for item in "path" "unset" "exports"; do
52
58
  command -v "convert_${item}_to_${1}" >/dev/null || return 1
53
59
  done; unset item
data/scripts/fetch CHANGED
@@ -9,14 +9,13 @@ result=0
9
9
  # Set it to cleanup the download on interruption.
10
10
  trap 'cleanup_download' 1 2 3 15
11
11
 
12
- cleanup_download() {
13
-
12
+ cleanup_download()
13
+ {
14
14
  [[ -f "$archive" ]] && rm -f "$archive"
15
-
16
15
  }
17
16
 
18
- record_md5() {
19
-
17
+ record_md5()
18
+ {
20
19
  if [[ "Darwin" = "$(uname)" ]] || [[ "FreeBSD" = "$(uname)" ]]; then
21
20
 
22
21
  archive_md5="$(/sbin/md5 -q "${archive}")"
data/scripts/gemsets CHANGED
@@ -6,7 +6,8 @@ rvm_ruby_gem_home="${rvm_ruby_gem_home:-$GEM_HOME}"
6
6
 
7
7
  if [[ ! -d "$rvm_ruby_gem_home" ]] && command -v gem > /dev/null 2>&1; then rvm_ruby_gem_home="$(gem env home)" ; fi
8
8
 
9
- usage() {
9
+ usage()
10
+ {
10
11
  printf "
11
12
  Usage:
12
13
 
@@ -23,7 +24,8 @@ usage() {
23
24
  "
24
25
  }
25
26
 
26
- gemset_update() {
27
+ gemset_update()
28
+ {
27
29
 
28
30
  if [[ -z "$rvm_ruby_strings" ]]; then
29
31
 
@@ -46,8 +48,8 @@ gemset_update() {
46
48
  return $?
47
49
  }
48
50
 
49
- gemset_globalcache() {
50
-
51
+ gemset_globalcache()
52
+ {
51
53
  local gc_status globalcache_enabled directories directory_name full_directory_path directory_name
52
54
 
53
55
  if [[ "$1" == "enabled" ]]; then
@@ -135,19 +137,26 @@ gemset_globalcache() {
135
137
  fi
136
138
  }
137
139
 
138
- gemset_name() {
140
+ gemset_name()
141
+ {
139
142
  gemset_dir | awk -F${rvm_gemset_separator:-"@"} '{print $2}'
140
143
  return $?
141
144
  }
142
145
 
143
- gemset_dir() {
146
+ gemset_dir()
147
+ {
144
148
  echo "$rvm_ruby_gem_home"
145
149
  return $?
146
150
  }
147
151
 
148
- gemset_create() {
152
+ gemset_create()
153
+ {
149
154
  local gem_home gemset gemsets prefix
150
155
 
156
+ if [[ -n "$rvm_ruby_string" ]] ; then
157
+ __rvm_select
158
+ fi
159
+
151
160
  prefix=$(echo $rvm_ruby_gem_home | sed 's/'${rvm_gemset_separator:-"@"}'.*$//')
152
161
 
153
162
  gemsets=(${args[@]})
@@ -155,7 +164,14 @@ gemset_create() {
155
164
  for gemset in "${gemsets[@]}" ; do
156
165
 
157
166
  if [[ "$gemset" == *"${rvm_gemset_separator:-"@"}"* ]]; then
158
- "$rvm_path/scripts/log" "error" "Can't do that, it contains a \"${rvm_gemset_separator:-"@"}\"."
167
+ "$rvm_path/scripts/log" "error" \
168
+ "Can not create gemset '$gemset', it contains a \"${rvm_gemset_separator:-"@"}\"."
169
+ continue
170
+ fi
171
+
172
+ if [[ -z "$gemset" || "$gemset" = *"${rvm_gemset_separator:-"@"}" ]] ; then
173
+ "$rvm_path/scripts/log" "error" \
174
+ "Can not create gemset '$gemset', Missing name. "
159
175
  continue
160
176
  fi
161
177
 
@@ -184,8 +200,8 @@ gemset_create() {
184
200
  return 0
185
201
  }
186
202
 
187
- gemset_list() {
188
-
203
+ gemset_list()
204
+ {
189
205
  if [[ ${rvm_ruby_selected_flag:-0} -eq 0 ]] ; then __rvm_select ; fi
190
206
 
191
207
  "$rvm_path/scripts/log" "info" \
@@ -213,8 +229,8 @@ gemset_list() {
213
229
  return 0
214
230
  }
215
231
 
216
- gemset_delete() {
217
-
232
+ gemset_delete()
233
+ {
218
234
  gemsets=(${args[@]})
219
235
 
220
236
  if [[ ${rvm_ruby_selected_flag:-0} -eq 0 ]] ; then __rvm_select ; fi
@@ -266,8 +282,8 @@ gemset_delete() {
266
282
  return 0
267
283
  }
268
284
 
269
- gemset_empty() {
270
-
285
+ gemset_empty()
286
+ {
271
287
  local gemdir
272
288
 
273
289
  if [[ -z "${rvm_ruby_gem_home:-""}" ]] ; then __rvm_select ; fi
@@ -305,7 +321,8 @@ gemset_empty() {
305
321
  }
306
322
 
307
323
  # Migrate gemsets from ruby X to ruby Y
308
- gemset_copy() {
324
+ gemset_copy()
325
+ {
309
326
  local source_ruby destination_ruby source_path destination_path
310
327
 
311
328
  source_ruby="${args[__array_start]:-""}"
@@ -330,12 +347,14 @@ gemset_copy() {
330
347
  destination_path="$(rvm_silence_logging=1 rvm "$destination_ruby" gem env gemdir)"
331
348
 
332
349
  if [[ -z "$source_path" || ! -d "$source_path" ]]; then
333
- "$rvm_path/scripts/log" "error" "Unable to expand '$source_ruby' or directory does not exist."
350
+ "$rvm_path/scripts/log" "error" \
351
+ "Unable to expand '$source_ruby' or directory does not exist."
334
352
  return 1
335
353
  fi
336
354
 
337
355
  if [[ -z "$destination_path" ]]; then
338
- "$rvm_path/scripts/log" "error" "Unable to expand '$destination_ruby'"
356
+ "$rvm_path/scripts/log" "error" \
357
+ "Unable to expand '$destination_ruby'"
339
358
  return 1
340
359
  fi
341
360
 
@@ -368,8 +387,8 @@ gemset_copy() {
368
387
  fi
369
388
  }
370
389
 
371
- gemset_unpack() {
372
-
390
+ gemset_unpack()
391
+ {
373
392
  local gems name directory version versions
374
393
 
375
394
  directory="${args[$__array_start]}"
@@ -411,7 +430,8 @@ gemset_unpack() {
411
430
  return 0
412
431
  }
413
432
 
414
- gemset_export() {
433
+ gemset_export()
434
+ {
415
435
  local gems name file_name version versions
416
436
 
417
437
  rvm_file_name="${rvm_file_name:-${gems_args// }}"
@@ -461,8 +481,8 @@ gemset_export() {
461
481
  return 0
462
482
  }
463
483
 
464
- gemset_import() {
465
-
484
+ gemset_import()
485
+ {
466
486
  unset -f gem
467
487
 
468
488
  if [[ -n "${rvm_ruby_gem_home:-""}" ]] ; then
@@ -528,8 +548,8 @@ gemset_import() {
528
548
  fi
529
549
  }
530
550
 
531
- __rvm_parse_gems_args() {
532
-
551
+ __rvm_parse_gems_args()
552
+ {
533
553
  gem="${gems_args/;*}" ; gem_prefix=""
534
554
 
535
555
  if echo "$gems_args" | grep -q ';' ; then
@@ -572,8 +592,8 @@ __rvm_parse_gems_args() {
572
592
  }
573
593
 
574
594
  # Install a gem
575
- gem_install() {
576
-
595
+ gem_install()
596
+ {
577
597
  local gem gem_prefix gem_name gem_version gem_file_name gem_postfix cache_file gem_file_name gem_string gem_action
578
598
 
579
599
  result=0
@@ -676,7 +696,8 @@ gem_install() {
676
696
  }
677
697
 
678
698
  # Output the user's current gem directory.
679
- gemset_info() {
699
+ gemset_info()
700
+ {
680
701
  if [[ ${rvm_user_flag:-0} -eq 1 ]] ; then
681
702
  echo $(rvm system ; gem env | grep "\- $HOME" | awk '{print $NF}')
682
703
 
@@ -696,7 +717,8 @@ gemset_info() {
696
717
  return $?
697
718
  }
698
719
 
699
- gemset_prune() {
720
+ gemset_prune()
721
+ {
700
722
  local temporary_cache_path live_cache_path gemset_name version versions cached_gem_name cached_file_path
701
723
 
702
724
  temporary_cache_path="$GEM_HOME/temporary-cache"
@@ -737,7 +759,8 @@ gemset_prune() {
737
759
  return 0
738
760
  }
739
761
 
740
- gemset_pristine() {
762
+ gemset_pristine()
763
+ {
741
764
  if ( unset -f gem ; command -v gem > /dev/null ) ; then
742
765
 
743
766
  gem pristine --all
@@ -754,8 +777,8 @@ gemset_pristine() {
754
777
  }
755
778
 
756
779
  # Loads the default gemsets for the current interpreter and gemset.
757
- gemset_initial() {
758
-
780
+ gemset_initial()
781
+ {
759
782
  local gemsets gemset path paths
760
783
 
761
784
  rvm_gemsets_path="${rvm_gemsets_path:-"$rvm_path/gemsets"}"
@@ -763,8 +786,8 @@ gemset_initial() {
763
786
  "$rvm_path/scripts/log" "info" \
764
787
  "Importing initial gemsets for $(__rvm_environment_identifier)."
765
788
 
766
- if [[ ! -d "$rvm_gemsets_path/${rvm_ruby_string//-/\/}" ]] ; then
767
- mkdir -p "$rvm_gemsets_path/${rvm_ruby_string//-/\/}" 2>/dev/null
789
+ if [[ ! -d "$rvm_gemsets_path/${rvm_ruby_string//-//}" ]] ; then
790
+ mkdir -p "$rvm_gemsets_path/${rvm_ruby_string//-//}" 2>/dev/null
768
791
  fi
769
792
 
770
793
  paths=($(__rvm_ruby_string_paths_under "$rvm_gemsets_path"))