rvm 1.0.5 → 1.0.6
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/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/completion
CHANGED
@@ -11,10 +11,10 @@ __rvm_subcommand()
|
|
11
11
|
{
|
12
12
|
local word subcommand c=1
|
13
13
|
|
14
|
-
while [ $c -lt $COMP_CWORD ]; do
|
14
|
+
while [[ $c -lt $COMP_CWORD ]] ; do
|
15
15
|
word="${COMP_WORDS[c]}"
|
16
16
|
for subcommand in $1; do
|
17
|
-
if [ "$subcommand" = "$word" ]; then
|
17
|
+
if [[ "$subcommand" = "$word" ]]; then
|
18
18
|
echo "$subcommand"
|
19
19
|
return
|
20
20
|
fi
|
@@ -111,10 +111,11 @@ _rvm_use ()
|
|
111
111
|
|
112
112
|
_rvm_gemset ()
|
113
113
|
{
|
114
|
-
local subcommands
|
115
|
-
|
114
|
+
local subcommand subcommands
|
115
|
+
subcommands="use create"
|
116
|
+
subcommand="$(__rvm_subcommand "$subcommands")"
|
116
117
|
|
117
|
-
if [ -z "$subcommand" ]; then
|
118
|
+
if [[ -z "$subcommand" ]]; then
|
118
119
|
__rvm_comp "$subcommands"
|
119
120
|
return
|
120
121
|
fi
|
data/scripts/disk-usage
CHANGED
@@ -15,11 +15,12 @@ disk_usage_for_directory() {
|
|
15
15
|
}
|
16
16
|
|
17
17
|
disk_usage() {
|
18
|
-
|
18
|
+
local current_path
|
19
|
+
eval "current_path=\"\$rvm_${2}_path\""
|
19
20
|
if [[ -n "$current_path" && -d "$current_path" && "$current_path" != "/" ]]; then
|
20
21
|
echo "$1 Usage: $(disk_usage_for_directory "$current_path")"
|
21
22
|
fi
|
22
|
-
|
23
|
+
return 0
|
23
24
|
}
|
24
25
|
|
25
26
|
all_disk_usage() {
|
@@ -8,13 +8,19 @@ unset GREP_OPTIONS
|
|
8
8
|
source "$rvm_scripts_path/base"
|
9
9
|
|
10
10
|
convert_path_to_fish() {
|
11
|
-
local
|
12
|
-
|
13
|
-
|
14
|
-
echo '
|
15
|
-
|
16
|
-
|
17
|
-
|
11
|
+
local parts path_parts
|
12
|
+
|
13
|
+
path_part="$1"
|
14
|
+
parts="$(echo "$path_part" | sed -e 's#:\$PATH##' -e "s#:#\" \"#g" -e "s#^export \\([^[:space:]]*\\)=##")"
|
15
|
+
|
16
|
+
printf "\
|
17
|
+
for path_part in $parts
|
18
|
+
if test -d $path_part
|
19
|
+
set PATH $path_parth $PATH
|
20
|
+
end
|
21
|
+
end
|
22
|
+
"
|
23
|
+
return 0
|
18
24
|
}
|
19
25
|
|
20
26
|
convert_unset_to_fish() {
|
data/scripts/gemsets
CHANGED
@@ -26,7 +26,9 @@ usage() {
|
|
26
26
|
gemset_update() {
|
27
27
|
if [[ -z "$rvm_ruby_strings" ]]; then
|
28
28
|
"$rvm_scripts_path/log" "info" "Running gem update for all rubies and gemsets."
|
29
|
-
|
29
|
+
|
30
|
+
rvm_ruby_strings="$(builtin cd "$rvm_gems_path" ; find * -type d -maxdepth 0 -print 2>/dev/null | grep -v '^\(doc\|cache\|@\|system\)' | \tr '\n' ',')"
|
31
|
+
rvm_ruby_strings="${rvm_ruby_strings/%,}"
|
30
32
|
else
|
31
33
|
"$rvm_scripts_path/log" "info" "Running gem update for the specified rubies."
|
32
34
|
fi
|
@@ -49,7 +51,7 @@ gemset_globalcache() {
|
|
49
51
|
return "$globalcache_enabled"
|
50
52
|
elif [[ "$1" == "disable" ]]; then
|
51
53
|
"$rvm_scripts_path/log" "info" "Removing the global cache (note: this will empty the caches)"
|
52
|
-
for directory_name in $(
|
54
|
+
for directory_name in $(builtin cd "$rvm_gems_path" ; find * -type d -maxdepth 0 -print); do
|
53
55
|
current_cache_path="$rvm_gems_path/$directory_name/cache"
|
54
56
|
if [[ -L "$current_cache_path" && "$(readlink "$current_cache_path")" == "$rvm_gems_cache_path" ]]; then
|
55
57
|
"$rvm_scripts_path/log" "info" "Reverting the gem cache for $directory_name to an empty directory."
|
@@ -61,7 +63,7 @@ gemset_globalcache() {
|
|
61
63
|
elif [[ "$1" == "enable" ]]; then
|
62
64
|
"$rvm_scripts_path/log" "info" "Enabling global cache for gems."
|
63
65
|
mkdir -p "$rvm_gems_cache_path"
|
64
|
-
for directory_name in $(
|
66
|
+
for directory_name in $(builtin cd "$rvm_gems_path" ; find * -type d -maxdepth 0 -print); do
|
65
67
|
current_cache_path="$rvm_gems_path/$directory_name/cache"
|
66
68
|
if [[ -d "$current_cache_path" && ! -L "$current_cache_path" ]]; then
|
67
69
|
"$rvm_scripts_path/log" "info" "Moving the gem cache for $directory_name to the global cache."
|
@@ -306,7 +308,8 @@ gemset_import() {
|
|
306
308
|
|
307
309
|
if [[ -s "$rvm_file_name" ]] ; then
|
308
310
|
echo "Importing $rvm_file_name file..."
|
309
|
-
|
311
|
+
|
312
|
+
rvm_ruby_gem_list=$(builtin cd "$rvm_ruby_gem_home/specifications/" ; find * -type f -maxdepth 0 -print 2> /dev/null | sed -e 's#.gems.*$##' 2> /dev/null)
|
310
313
|
|
311
314
|
while read -r line
|
312
315
|
do # Keep this on 2nd line :(
|
@@ -367,31 +370,43 @@ gem_install() {
|
|
367
370
|
else
|
368
371
|
if [[ -s "$gem" ]] ; then
|
369
372
|
cache_file="$gem"
|
373
|
+
|
370
374
|
elif [[ -s "$(__rvm_current_gemcache_dir)/${gem_file_name}" ]] ; then
|
371
375
|
cache_file="$(__rvm_current_gemcache_dir)/${gem_file_name}"
|
376
|
+
|
372
377
|
else
|
373
|
-
cache_file="${cache_file:-$(
|
378
|
+
cache_file="${cache_file:-$(builtin cd "$(__rvm_current_gemcache_dir)/${gem_file_name}" ; find * -type f -maxdepth 0 -print 2> /dev/null | sort | head -n1)}"
|
374
379
|
fi
|
375
380
|
|
376
381
|
if [[ ! -s "$cache_file" ]] ; then
|
382
|
+
|
377
383
|
if [[ -s "$gem_file_name" ]] ; then
|
378
384
|
gem="$gem_file_name"
|
385
|
+
|
379
386
|
elif [[ -z "${gem_version// /}" ]] ; then
|
380
387
|
gem="${gem_name// /}"
|
388
|
+
|
381
389
|
else
|
382
390
|
gem="${gem_name// /} -v $gem_version"
|
383
391
|
fi
|
384
392
|
else # cached
|
393
|
+
|
385
394
|
gem_file_name="$(basename "$cache_file")"
|
395
|
+
|
386
396
|
gem_string="$(echo "$gem_file_name" | sed 's#\.gem$##')"
|
387
397
|
|
388
398
|
if [[ -z "$rvm_force_flag" ]] && [[ -s "${rvm_ruby_gem_home}/specifications/$(basename $gem_file_name)spec" ]] ; then
|
389
399
|
unset gem # already installed, not forcing reinstall.
|
400
|
+
|
390
401
|
"$rvm_scripts_path/log" "info" "$gem_name $gem_version exists, skipping (--force to re-install)"
|
402
|
+
|
391
403
|
else
|
392
404
|
if [[ -s "$(__rvm_current_gemcache_dir)/$(basename $gem_file_name)" ]] ; then
|
405
|
+
|
393
406
|
mkdir -p "$rvm_tmp_path/$$/"
|
407
|
+
|
394
408
|
mv "$(__rvm_current_gemcache_dir)/$gem_file_name" "$rvm_tmp_path/$$/$gem_file_name"
|
409
|
+
|
395
410
|
gem="$rvm_tmp_path/$$/$gem_file_name -f -l"
|
396
411
|
else
|
397
412
|
gem="$cache_file"
|
data/scripts/help
CHANGED
@@ -11,13 +11,13 @@ args="$(echo ${args[@]:2}) " # Strip trailing / leading / extra spacing.
|
|
11
11
|
|
12
12
|
if [[ ! -z "$command" ]] && [[ -s "${rvm_help_path}/${command}" ]] ; then
|
13
13
|
if [[ ! -z "$action" ]] && [[ -s "${rvm_help_path}/${command}/${action}" ]] ; then
|
14
|
-
|
14
|
+
less "${rvm_help_path}/${command}/${action}"
|
15
15
|
else
|
16
|
-
|
16
|
+
less "${rvm_help_path}/${command}"
|
17
17
|
fi
|
18
18
|
else
|
19
|
-
|
20
|
-
"$rvm_scripts_path/log" "info" "Commands available with 'rvm help':\n\n $(builtin cd "${rvm_help_path}" ;
|
19
|
+
less "${rvm_path:-$HOME/.rvm}/README"
|
20
|
+
"$rvm_scripts_path/log" "info" "Commands available with 'rvm help':\n\n $(builtin cd "${rvm_help_path}" ; find * -type f -maxdepth 0 -print | \tr "\n" ' ')"
|
21
21
|
fi
|
22
22
|
|
23
23
|
"$rvm_scripts_path/log" "info" "For additional information please visit RVM's documentation website:\n\n http://rvm.beginrescueend.com/"
|
data/scripts/info
CHANGED
@@ -14,12 +14,15 @@ fi
|
|
14
14
|
rvm_info=""
|
15
15
|
|
16
16
|
version_for() {
|
17
|
-
local binary=$1
|
17
|
+
local binary=${1:-""}
|
18
|
+
|
18
19
|
if command -v "$binary" >/dev/null ; then
|
19
20
|
$binary --version | head -n1
|
20
21
|
else
|
21
22
|
echo "not installed"
|
22
23
|
fi
|
24
|
+
|
25
|
+
return 0
|
23
26
|
}
|
24
27
|
|
25
28
|
info_system() {
|
data/scripts/install
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/list
CHANGED
@@ -3,61 +3,103 @@
|
|
3
3
|
rvm_pretty_print=${rvm_pretty_print:-0}
|
4
4
|
|
5
5
|
rvm_base_except="selector"
|
6
|
+
|
6
7
|
source "$rvm_scripts_path/base"
|
7
8
|
|
9
|
+
usage() {
|
10
|
+
printf "
|
11
|
+
Usage:
|
12
|
+
|
13
|
+
rvm list [action]
|
14
|
+
|
15
|
+
Actions:
|
16
|
+
|
17
|
+
{help,known,gemsets,default [string],rubies,strings,known_strings}
|
18
|
+
|
19
|
+
"
|
20
|
+
return 0
|
21
|
+
}
|
22
|
+
|
8
23
|
list_gemsets() {
|
24
|
+
local all_rubies version versions ruby_version_name current_ruby selected system_ruby system_version string binary
|
25
|
+
|
9
26
|
if [[ "${1:-""}" = "strings" ]]; then
|
10
27
|
list_gemset_strings
|
11
28
|
return 0
|
12
29
|
fi
|
13
|
-
echo
|
14
30
|
|
15
31
|
current_ruby="$(__rvm_environment_identifier)"
|
16
|
-
local all_rubies="$(list_strings)"
|
17
32
|
|
18
|
-
|
19
|
-
|
33
|
+
all_rubies="$(list_strings)"
|
34
|
+
|
35
|
+
printf "\nrvm gemsets\n"
|
36
|
+
|
37
|
+
versions=($(builtin cd "$rvm_gems_path/" ; find * -type d -maxdepth 0 -print 2> /dev/null | awk '/[a-z]*-.*/ {print $NF}'))
|
38
|
+
for version in "${versions[@]}" ; do
|
39
|
+
|
20
40
|
ruby_version_name="$(echo "$version" | awk -F"$rvm_gemset_separator" '{print $1}')"
|
21
41
|
|
22
42
|
[[ "$all_rubies" != *"$ruby_version_name"* ]] && continue
|
23
43
|
|
24
44
|
if echo "$version" | grep -q '^jruby-' ; then
|
25
45
|
string="[ $("$rvm_rubies_path/$ruby_version_name/bin/ruby" -v | awk '{print $NF}' | sed -e 's/\[//' -e 's/\]//') ]"
|
46
|
+
|
26
47
|
elif [[ -n "$(echo "$version" | awk '/^maglev-|^macruby-/')" ]] ; then
|
27
48
|
string="[ x86_64 ]"
|
49
|
+
|
28
50
|
else
|
29
51
|
string="[ $(file "$rvm_rubies_path/$ruby_version_name/bin/ruby" | awk '/x86.64/ {print "x86_64"} /386/ {print "i386"} /ppc/ {print "ppc"}' | tr "\n" ' ')]"
|
30
|
-
fi
|
52
|
+
fi
|
53
|
+
|
31
54
|
printf "\n"
|
55
|
+
|
32
56
|
if [[ "$version" = "$current_ruby" ]]; then
|
33
57
|
printf "=> "
|
34
58
|
else
|
35
59
|
printf " "
|
36
60
|
fi
|
37
|
-
|
61
|
+
|
62
|
+
if [[ ${rvm_pretty_print:-0} -eq 1 ]] ; then
|
63
|
+
|
38
64
|
printf "$(tput setaf 2)$version$(tput sgr0) $string"
|
39
65
|
else
|
40
66
|
printf "$version $string"
|
41
67
|
fi
|
42
|
-
done ; unset version
|
43
68
|
|
44
|
-
|
69
|
+
done
|
70
|
+
|
71
|
+
if [[ -f "$rvm_config_path/default" && -s "$rvm_config_path/default" ]] ; then
|
72
|
+
|
45
73
|
version=$(grep 'MY_RUBY_HOME' "$rvm_config_path/default" | head -n1 | awk -F"'" '{print $2}' | xargs basename --)
|
46
|
-
|
74
|
+
|
75
|
+
if [[ -n "$version" ]] ; then
|
76
|
+
|
47
77
|
printf "\n\nDefault Ruby (for new shells)\n"
|
78
|
+
|
48
79
|
string="[ $(file "$rvm_rubies_path/$version/bin/ruby" | awk '/x86.64/ {print "x86_64"} /386/ {print "i386"} /ppc/ {print "ppc"}' | tr "\n" ' ')]"
|
49
|
-
|
80
|
+
|
81
|
+
if [[ ${rvm_pretty_print:-0} -eq 1 ]] ; then
|
82
|
+
|
50
83
|
printf "\n $(tput setaf 2)$version$(tput sgr0) $string"
|
51
84
|
else
|
52
85
|
printf "\n $version $string"
|
53
86
|
fi
|
54
|
-
|
55
|
-
|
87
|
+
|
88
|
+
fi
|
89
|
+
|
90
|
+
fi
|
91
|
+
|
56
92
|
printf "\n\n"
|
93
|
+
|
94
|
+
return 0
|
57
95
|
}
|
58
96
|
|
59
97
|
list_default() {
|
98
|
+
|
99
|
+
local version string
|
100
|
+
|
60
101
|
if [[ "${args[0]:-""}" = "string" ]] ; then
|
102
|
+
|
61
103
|
"$rvm_scripts_path/alias" show default 2>/dev/null | awk -F"$rvm_gemset_separator" '{print $1}' | xargs basename --
|
62
104
|
|
63
105
|
else
|
@@ -65,12 +107,14 @@ list_default() {
|
|
65
107
|
|
66
108
|
version=$("$rvm_scripts_path/alias" show default 2>/dev/null | awk -F"$rvm_gemset_separator" '{print $1}' | xargs basename --)
|
67
109
|
|
68
|
-
if [[
|
110
|
+
if [[ -n "$version" ]] ; then
|
111
|
+
|
69
112
|
printf "\n\nDefault Ruby (for new shells)\n"
|
70
113
|
|
71
114
|
string="[ $(file "$rvm_rubies_path/$version/bin/ruby" | awk '/x86.64/ {print "x86_64"} /386/ {print "i386"} /ppc/ {print "ppc"}' | \tr "\n" ' ')]"
|
72
115
|
|
73
|
-
if [[ $rvm_pretty_print -eq 1 ]] ; then
|
116
|
+
if [[ ${rvm_pretty_print:-0} -eq 1 ]] ; then
|
117
|
+
|
74
118
|
printf "\n $(tput setaf 2)$version$(tput sgr0) $string\n"
|
75
119
|
else
|
76
120
|
printf "\n $version $string\n"
|
@@ -78,97 +122,165 @@ list_default() {
|
|
78
122
|
fi ; unset version
|
79
123
|
fi
|
80
124
|
fi
|
125
|
+
|
126
|
+
return 0
|
81
127
|
}
|
82
128
|
|
83
129
|
list_ruby_svn_tags() {
|
130
|
+
local prefix tag
|
131
|
+
|
84
132
|
while read -r tag
|
85
133
|
do
|
86
134
|
prefix="$(echo ${tag/\//} | sed 's#^v1_##' | awk -F'_' '{print "(ruby-)1."$1"."$2}' | sed 's#p$##')"
|
135
|
+
|
87
136
|
echo "${prefix}-t${tag/\//}"
|
88
|
-
|
137
|
+
|
89
138
|
done < <(svn list http://svn.ruby-lang.org/repos/ruby/tags/ | awk '/^v1_[8|9]/')
|
139
|
+
|
140
|
+
return 0
|
90
141
|
}
|
91
142
|
|
92
143
|
# Query for valid rvm ruby strings
|
93
144
|
# This is meant to be used with scripting.
|
94
145
|
list_strings() {
|
95
|
-
|
146
|
+
(
|
147
|
+
cd "$rvm_rubies_path"
|
148
|
+
|
149
|
+
find * -type d -maxdepth 0
|
150
|
+
)
|
151
|
+
|
152
|
+
return $?
|
96
153
|
}
|
97
154
|
|
98
155
|
# This is meant to be used with scripting.
|
99
156
|
list_gemset_strings() {
|
100
|
-
local all_rubies
|
101
|
-
|
102
|
-
|
157
|
+
local all_rubies ruby_name gemset gemsets
|
158
|
+
|
159
|
+
all_rubies="$(list_strings)"
|
160
|
+
|
161
|
+
gemsets=($(builtin cd "$rvm_gems_path" ; find * -type d -maxdepth 0 2>/dev/null | xargs -n1 basename -- | \grep -v '^\(@\|doc$\|cache$\|system$\)' | sort))
|
162
|
+
|
163
|
+
for gemset in "${gemsets[@]}" ; do
|
164
|
+
|
165
|
+
ruby_name="${gemset//${rvm_gemset_separator}*}"
|
166
|
+
|
103
167
|
[[ "$all_rubies" != *"$ruby_name"* ]] && continue
|
168
|
+
|
104
169
|
echo "$gemset"
|
105
170
|
done
|
171
|
+
|
172
|
+
return 0
|
106
173
|
}
|
107
174
|
|
108
175
|
# This is meant to be used with scripting.
|
109
176
|
list_known_strings() {
|
177
|
+
|
110
178
|
sed -e 's/#.*$//g' -e 's/(//g' -e 's/)//g' < "$rvm_config_path/known" | sort -r | uniq
|
179
|
+
|
180
|
+
return $?
|
111
181
|
}
|
112
182
|
|
113
183
|
list_known() {
|
184
|
+
|
114
185
|
if [[ "${1:-""}" = "strings" ]]; then
|
186
|
+
|
115
187
|
list_known_strings
|
188
|
+
|
116
189
|
return 0
|
117
190
|
fi
|
118
191
|
|
119
|
-
if [[
|
192
|
+
if [[ ${rvm_interactive_flag:-0} -eq 0 ]] ; then
|
193
|
+
|
120
194
|
cat "$rvm_config_path/known"
|
195
|
+
|
121
196
|
else
|
122
|
-
|
197
|
+
|
198
|
+
less "$rvm_config_path/known"
|
199
|
+
|
123
200
|
fi
|
201
|
+
|
202
|
+
return $?
|
124
203
|
}
|
125
204
|
|
126
205
|
|
127
206
|
list_rubies_strings() {
|
128
|
-
|
207
|
+
( builtin cd "$rvm_rubies_path" ; find -type d -maxdepth 0 | tail -n+2 | xargs -n1 basename -- | __rvm_strip )
|
208
|
+
return $?
|
129
209
|
}
|
130
210
|
|
131
211
|
list_rubies() {
|
212
|
+
|
213
|
+
local current_ruby rubies version selected system_ruby system_version string binary
|
214
|
+
|
132
215
|
if [[ "${1:-""}" = "strings" ]]; then list_rubies_strings ; return 0 ; fi
|
133
216
|
|
134
217
|
current_ruby="$(__rvm_environment_identifier | awk -F"$rvm_gemset_separator" '{print $1}')"
|
135
218
|
|
136
219
|
printf "\nrvm rubies\n"
|
137
|
-
|
220
|
+
|
221
|
+
rubies=($(builtin cd "$rvm_rubies_path/" ; find * -type d -maxdepth 0 2> /dev/null | awk '/[a-z]*-.*/ {print $NF}'))
|
222
|
+
|
223
|
+
for version in "${rubies[@]}" ; do
|
224
|
+
|
225
|
+
[[ ! -x "$rvm_rubies_path/$version/bin/ruby" ]] && continue
|
226
|
+
|
227
|
+
(
|
138
228
|
if echo "$version" | grep -q '^jruby-' ; then
|
229
|
+
|
139
230
|
string="[ $("$rvm_rubies_path/$version/bin/ruby" -v | awk '{print $NF}' | sed -e 's/\[//' -e 's/\]//') ]"
|
231
|
+
|
140
232
|
elif [[ ! -z "$(echo "$version" | awk '/^maglev-|^macruby-/')" ]] ; then
|
233
|
+
|
141
234
|
string="[ x86_64 ]"
|
235
|
+
|
142
236
|
else
|
237
|
+
|
143
238
|
string="[ $(file "$rvm_rubies_path/$version/bin/ruby" | awk '/x86.64/ {print "x86_64"} /386/ {print "i386"} /ppc/ {print "ppc"}' | tr "\n" ' ')]"
|
144
239
|
fi
|
240
|
+
|
145
241
|
printf "\n"
|
242
|
+
|
146
243
|
if [[ "$version" = "$current_ruby" ]]; then
|
147
244
|
printf "=> "
|
148
245
|
else
|
149
246
|
printf " "
|
150
247
|
fi
|
248
|
+
|
151
249
|
# TODO: Only use tput for interactive terminal sessions.
|
152
|
-
if [[ $rvm_pretty_print -eq 1 ]] ; then
|
250
|
+
if [[ ${rvm_pretty_print:-0} -eq 1 ]] ; then
|
251
|
+
|
153
252
|
printf "$(tput setaf 2)$version$(tput sgr0) $string"
|
154
253
|
else
|
155
254
|
printf "$version $string"
|
156
255
|
fi
|
157
|
-
|
256
|
+
)&
|
257
|
+
|
258
|
+
done ; wait
|
158
259
|
|
159
260
|
if [[ -f "$rvm_config_path/default" ]] && [[ -s "$rvm_config_path/default" ]] ; then
|
261
|
+
|
160
262
|
version=$(grep 'MY_RUBY_HOME' "$rvm_config_path/default" | head -n 1 | awk -F"'" '{print $2}' | xargs basename --)
|
161
|
-
|
263
|
+
|
264
|
+
if [[ -n "$version" ]] ; then
|
265
|
+
|
162
266
|
printf "\n\nDefault Ruby (for new shells)\n"
|
267
|
+
|
163
268
|
string="[ $(file "$rvm_rubies_path/$version/bin/ruby" | awk '/x86.64/ {print "x86_64"} /386/ {print "i386"} /ppc/ {print "ppc"}' | \tr "\n" ' ')]"
|
164
|
-
|
269
|
+
|
270
|
+
if [[ ${rvm_pretty_print:-0} -eq 1 ]] ; then
|
271
|
+
|
165
272
|
printf "\n $(tput setaf 2)$version$(tput sgr0) $string"
|
166
273
|
else
|
167
274
|
printf "\n $version $string"
|
168
275
|
fi
|
169
|
-
|
170
|
-
|
276
|
+
|
277
|
+
fi
|
278
|
+
|
279
|
+
fi
|
280
|
+
|
171
281
|
printf "\n\n"
|
282
|
+
|
283
|
+
return 0
|
172
284
|
}
|
173
285
|
|
174
286
|
# List all rvm installed rubies, default ruby and system ruby.
|
@@ -178,28 +290,18 @@ args=($*)
|
|
178
290
|
action="${args[0]:-""}"
|
179
291
|
args=${args[@]:1} # Strip trailing / leading / extra spacing.
|
180
292
|
|
181
|
-
if [[
|
182
|
-
list_known
|
183
|
-
elif [[ "known_strings" = "$action" ]] ; then
|
184
|
-
list_known_strings
|
185
|
-
elif [[ "gemsets" = "$action" ]] ; then
|
186
|
-
list_gemsets "$@"
|
187
|
-
elif [[ "default" = "$action" ]] ; then
|
188
|
-
list_default
|
189
|
-
elif [[ -z "$action" ]] || [[ "rubies" = "$action" ]] ; then
|
190
|
-
list_rubies "$@"
|
191
|
-
elif [[ "strings" = "$action" ]] ; then
|
192
|
-
list_strings
|
193
|
-
elif [[ "ruby_svn_tags" = "$action" ]] ; then
|
194
|
-
list_ruby_svn_tags
|
195
|
-
else # help
|
196
|
-
printf "
|
197
|
-
Usage:
|
198
|
-
|
199
|
-
rvm list {known,gemsets,default [string],rubies,strings,known_strings}
|
293
|
+
if [[ -z "$action" ]] ; then list_rubies ; exit 0 ; fi
|
200
294
|
|
201
|
-
"
|
202
|
-
|
203
|
-
|
295
|
+
case "$action" in
|
296
|
+
known) list_known ;;
|
297
|
+
known_strings) list_known_strings ;;
|
298
|
+
gemsets) list_gemsets "$@" ;;
|
299
|
+
default) list_default ;;
|
300
|
+
rubies) list_rubies "$@" ;;
|
301
|
+
strings) list_strings ;;
|
302
|
+
ruby_svn_tags) list_ruby_svn_tags ;;
|
303
|
+
help) usage ;;
|
304
|
+
*) usage ; exit 1 ;;
|
305
|
+
esac
|
204
306
|
|
205
307
|
exit $?
|