rvm 1.0.2 → 1.0.3
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 +3 -2
- data/binscripts/rvm-update-head +2 -1
- data/binscripts/rvm-update-latest +2 -1
- data/binscripts/rvmsudo +3 -3
- data/contrib/install-system-wide +2 -1
- data/install +3 -2
- data/lib/VERSION.yml +1 -1
- data/rvm.gemspec +2 -3
- data/scripts/alias +14 -6
- data/scripts/array +1 -1
- data/scripts/cd +3 -2
- data/scripts/cleanup +1 -1
- data/scripts/cli +154 -98
- data/scripts/docs +5 -1
- data/scripts/env +4 -1
- data/scripts/environment-convertor +4 -2
- data/scripts/fetch +2 -0
- data/scripts/gemsets +133 -71
- data/scripts/hash +3 -3
- data/scripts/help +4 -3
- data/scripts/hook +7 -3
- data/scripts/info +18 -12
- data/scripts/install +3 -2
- data/scripts/list +48 -20
- data/scripts/log +15 -14
- data/scripts/maglev +1 -1
- data/scripts/manage +49 -33
- data/scripts/match +2 -2
- data/scripts/md5 +5 -3
- data/scripts/migrate +7 -3
- data/scripts/notes +5 -4
- data/scripts/package +7 -4
- data/scripts/patches +6 -5
- data/scripts/patchsets +8 -3
- data/scripts/repair +7 -4
- data/scripts/rubygems +5 -4
- data/scripts/rvm +11 -13
- data/scripts/rvm-install +3 -2
- data/scripts/selector +181 -106
- data/scripts/set +8 -7
- data/scripts/snapshot +6 -4
- data/scripts/tools +6 -4
- data/scripts/update +3 -2
- data/scripts/upgrade +13 -12
- data/scripts/utility +282 -117
- metadata +4 -5
- data/scripts/man +0 -0
data/scripts/hash
CHANGED
@@ -9,14 +9,15 @@
|
|
9
9
|
# we then provide functionality of a file based hash
|
10
10
|
#
|
11
11
|
|
12
|
-
if [[
|
12
|
+
if [[ "$rvm_trace_flag" -eq 2 ]] ; then set -x ; export rvm_trace_flag ; fi
|
13
13
|
|
14
|
-
if [[
|
14
|
+
if [[ -n "${ZSH_VERSION:-""}" ]] ; then __array_start=1 ; else __array_start=0 ; fi
|
15
15
|
|
16
16
|
hash() {
|
17
17
|
hash_name=$1 ; hash_key=$2 ; hash_value=$3
|
18
18
|
|
19
19
|
eval "_hash_${hash_name}_keys=\${_hash_${hash_name}_keys:-()} ; _hash_${hash_name}_values=\${_hash_${hash_name}_values:-()}"
|
20
|
+
|
20
21
|
if [[ -z "$hash_value" ]] ; then
|
21
22
|
eval "length=\${#_hash_${hash_name}_keys[@]}"
|
22
23
|
for (( index=$__array_start ; index < $length; index++ )) ; do
|
@@ -31,6 +32,5 @@ hash() {
|
|
31
32
|
eval "_hash_${hash_name}_keys[$index]=\"$hash_key\""
|
32
33
|
eval "_hash_${hash_name}_values[$index]=\"$hash_value\""
|
33
34
|
fi
|
34
|
-
set +x
|
35
35
|
}
|
36
36
|
|
data/scripts/help
CHANGED
@@ -4,9 +4,10 @@ source "$rvm_scripts_path/base"
|
|
4
4
|
|
5
5
|
rvm_help_path="${rvm_help_path:-"$rvm_path/help"}"
|
6
6
|
|
7
|
-
|
8
|
-
|
9
|
-
|
7
|
+
args=($*)
|
8
|
+
command="${args[0]}"
|
9
|
+
action="${args[1]}"
|
10
|
+
args="$(echo ${args[@]:2}) " # Strip trailing / leading / extra spacing.
|
10
11
|
|
11
12
|
if [[ ! -z "$command" ]] && [[ -s "${rvm_help_path}/${command}" ]] ; then
|
12
13
|
if [[ ! -z "$action" ]] && [[ -s "${rvm_help_path}/${command}/${action}" ]] ; then
|
data/scripts/hook
CHANGED
@@ -1,10 +1,14 @@
|
|
1
1
|
#!/usr/bin/env bash
|
2
2
|
|
3
|
-
|
3
|
+
declare rvm_verbose_flag=${rvm_verbose_flag:-0}
|
4
|
+
declare rvm_hook=${rvm_hook:-""}
|
5
|
+
|
6
|
+
if [[ -n "$rvm_hook" ]] ; then
|
4
7
|
if [[ -s "$rvm_hooks_path/$rvm_hook" ]] ; then
|
5
|
-
if [[
|
8
|
+
if [[ $rvm_verbose_flag -eq 1 ]] || [[ "$rvm_debug_flag" -eq 1 ]] ; then
|
6
9
|
"$rvm_scripts_path/log" "info" "running hook $rvm_hook"
|
7
10
|
fi
|
8
11
|
source "$rvm_hooks_path/$rvm_hook"
|
9
12
|
fi
|
10
|
-
fi
|
13
|
+
fi
|
14
|
+
unset rvm_hook
|
data/scripts/info
CHANGED
@@ -1,15 +1,20 @@
|
|
1
1
|
#!/usr/bin/env bash
|
2
2
|
|
3
|
+
if [[ "$rvm_trace_flag" -eq 2 ]] ; then set -x ; export rvm_trace_flag ; fi
|
4
|
+
|
3
5
|
source "$rvm_scripts_path/base"
|
4
6
|
source "$rvm_scripts_path/version"
|
5
7
|
|
6
8
|
rvm_ruby_gem_home="${rvm_ruby_gem_home:-$GEM_HOME}"
|
7
9
|
|
8
|
-
if [[ ! -d "$rvm_ruby_gem_home" ]] && command -v gem > /dev/null 2>&1; then
|
10
|
+
if [[ ! -d "$rvm_ruby_gem_home" ]] && command -v gem > /dev/null 2>&1; then
|
11
|
+
rvm_ruby_gem_home="$(gem env home)"
|
12
|
+
fi
|
9
13
|
|
10
14
|
version_for() {
|
11
|
-
|
12
|
-
|
15
|
+
local binary=$1
|
16
|
+
if command -v "$binary" >/dev/null ; then
|
17
|
+
$binary --version | head -n1
|
13
18
|
else
|
14
19
|
echo "not installed"
|
15
20
|
fi
|
@@ -17,8 +22,8 @@ version_for() {
|
|
17
22
|
|
18
23
|
info_system() {
|
19
24
|
rvm_info="$rvm_info\n system:\n uname: \"$(uname -a)\""
|
20
|
-
rvm_info="$rvm_info\n
|
21
|
-
rvm_info="$rvm_info\n
|
25
|
+
rvm_info="$rvm_info\n bash: \"$(command -v bash) => $(version_for bash)\""
|
26
|
+
rvm_info="$rvm_info\n zsh: \"$(command -v zsh) => $(version_for zsh)\""
|
22
27
|
rvm_info="$rvm_info\n"
|
23
28
|
}
|
24
29
|
|
@@ -77,7 +82,7 @@ info_environment() {
|
|
77
82
|
info_debug() {
|
78
83
|
rvm_info=$(__rvm_version)
|
79
84
|
rvm_info="$rvm_info\n$("$rvm_scripts_path/info" "$rvm_ruby_string" "" )"
|
80
|
-
rvm_info="$rvm_info\nPATH:\n$(printf $PATH | awk -F":" '{print $1":"$2":"$3":"$4":"$5}' )"
|
85
|
+
rvm_info="$rvm_info\nPATH:\n$(printf "$PATH" | awk -F":" '{print $1":"$2":"$3":"$4":"$5}' )"
|
81
86
|
rvm_info="$rvm_info\nuname -a: $(uname -a)"
|
82
87
|
rvm_info="$rvm_info\npermissions: $(\ls -la $rvm_path{,/rubies})"
|
83
88
|
|
@@ -118,11 +123,10 @@ info_sections() {
|
|
118
123
|
done
|
119
124
|
}
|
120
125
|
|
121
|
-
args=
|
122
|
-
ruby_strings="${args/
|
123
|
-
|
124
|
-
sections="${
|
125
|
-
sections="${sections%"${sections##*[![:space:]]}"}" # strip trailing whitespace
|
126
|
+
args=($*)
|
127
|
+
ruby_strings="${args[0]// /}"
|
128
|
+
args="$(echo ${args[@]:1}) " # Strip trailing / leading / extra spacing.
|
129
|
+
sections="${args// /}"
|
126
130
|
all_sections="system rvm ruby homes binaries environment"
|
127
131
|
|
128
132
|
if "$rvm_scripts_path/match" "$all_sections debug" "${ruby_strings/,*/}" ; then
|
@@ -130,7 +134,7 @@ if "$rvm_scripts_path/match" "$all_sections debug" "${ruby_strings/,*/}" ; then
|
|
130
134
|
ruby_strings=""
|
131
135
|
fi
|
132
136
|
|
133
|
-
if [[ -z "$sections" ]] ; then sections="$all_sections" ; fi
|
137
|
+
if [[ -z "${sections// /}" ]] ; then sections="$all_sections" ; fi
|
134
138
|
|
135
139
|
if [[ -z "$ruby_strings" ]] ; then
|
136
140
|
printf "$(__rvm_environment_identifier):\n"
|
@@ -142,3 +146,5 @@ else
|
|
142
146
|
info_sections
|
143
147
|
done
|
144
148
|
fi
|
149
|
+
|
150
|
+
exit 0
|
data/scripts/install
CHANGED
@@ -201,7 +201,7 @@ fi
|
|
201
201
|
spinner
|
202
202
|
if [[ -d gemsets/ ]] ; then
|
203
203
|
\mkdir -p "$rvm_gemsets_path"
|
204
|
-
for gemset_file in $(cd gemsets ; find \. -iname '*.gems' | sed 's/^\.\///') ; do
|
204
|
+
for gemset_file in $(builtin cd gemsets ; find \. -iname '*.gems' | sed 's/^\.\///') ; do
|
205
205
|
destination="$rvm_gemsets_path/$gemset_file"
|
206
206
|
destination_path="$(dirname "$destination")"
|
207
207
|
if [[ ! -s "$destination" ]] ; then
|
@@ -214,7 +214,7 @@ fi
|
|
214
214
|
spinner
|
215
215
|
if [[ -d patchsets/ ]] ; then
|
216
216
|
\mkdir -p "$rvm_patchsets_path"
|
217
|
-
for patchset_file in $(cd patchsets ; find \. -iname '*' | sed 's/^\.\///') ; do
|
217
|
+
for patchset_file in $(builtin cd patchsets ; find \. -iname '*' | sed 's/^\.\///') ; do
|
218
218
|
destination="$rvm_patchsets_path/$patchset_file"
|
219
219
|
destination_path="$(dirname "$destination")"
|
220
220
|
if [[ ! -s "$destination" ]] ; then
|
@@ -318,6 +318,7 @@ if [[ "$upgrade_flag" -eq 1 ]] ; then
|
|
318
318
|
printf "\n * 'rvm notes' tells you OS dependency packages for installing rubies."
|
319
319
|
printf "\n * If you encounter any issues with a ruby your best bet is to 'rvm remove X ; rvm install X' "
|
320
320
|
printf "\n * Gemset separator is '@' and will remain unless any rubies error using it."
|
321
|
+
printf "\n * If you wish to have the 'pretty colors' again, set 'export rvm_pretty_print=1' in ~/.rvmrc.\n"
|
321
322
|
printf "\n$(tput sgr0)\n"
|
322
323
|
check_rubyopt_conditions
|
323
324
|
printf "\nUpgrade of RVM in $rvm_path/ is complete.\n\n"
|
data/scripts/list
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
#!/usr/bin/env bash
|
2
2
|
|
3
|
+
rvm_pretty_print=${rvm_pretty_print:-0}
|
4
|
+
|
3
5
|
rvm_base_except="selector"
|
4
6
|
source "$rvm_scripts_path/base"
|
5
7
|
|
@@ -14,17 +16,17 @@ list_gemsets() {
|
|
14
16
|
local all_rubies="$(list_strings)"
|
15
17
|
|
16
18
|
printf "rvm gemsets\n"
|
17
|
-
for version in $(
|
19
|
+
for version in $(ls "$rvm_gems_path/" 2> /dev/null | awk '/[a-z]*-.*/ {print $NF}') ; do
|
18
20
|
ruby_version_name="$(echo "$version" | awk -F"$rvm_gemset_separator" '{print $1}')"
|
19
21
|
|
20
22
|
[[ "$all_rubies" != *"$ruby_version_name"* ]] && continue
|
21
23
|
|
22
|
-
if echo "$version" |
|
24
|
+
if echo "$version" | grep -q '^jruby-' ; then
|
23
25
|
string="[ $("$rvm_rubies_path/$ruby_version_name/bin/ruby" -v | awk '{print $NF}' | sed -e 's/\[//' -e 's/\]//') ]"
|
24
26
|
elif [[ -n "$(echo "$version" | awk '/^maglev-|^macruby-/')" ]] ; then
|
25
27
|
string="[ x86_64 ]"
|
26
28
|
else
|
27
|
-
string="[ $(file "$rvm_rubies_path/$ruby_version_name/bin/ruby" | awk '/x86.64/ {print "x86_64"} /386/ {print "i386"} /ppc/ {print "ppc"}' |
|
29
|
+
string="[ $(file "$rvm_rubies_path/$ruby_version_name/bin/ruby" | awk '/x86.64/ {print "x86_64"} /386/ {print "i386"} /ppc/ {print "ppc"}' | tr "\n" ' ')]"
|
28
30
|
fi ; unset ruby_version_name
|
29
31
|
printf "\n"
|
30
32
|
if [[ "$version" = "$current_ruby" ]]; then
|
@@ -32,15 +34,23 @@ list_gemsets() {
|
|
32
34
|
else
|
33
35
|
printf " "
|
34
36
|
fi
|
35
|
-
|
37
|
+
if [[ $rvm_pretty_print -eq 1 ]] ; then
|
38
|
+
printf "$(tput setaf 2)$version$(tput sgr0) $string"
|
39
|
+
else
|
40
|
+
printf "$version $string"
|
41
|
+
fi
|
36
42
|
done ; unset version
|
37
43
|
|
38
44
|
if [[ -f "$rvm_config_path/default" ]] && [[ -s "$rvm_config_path/default" ]] ; then
|
39
|
-
version=$(
|
45
|
+
version=$(grep 'MY_RUBY_HOME' "$rvm_config_path/default" | head -n1 | awk -F"'" '{print $2}' | xargs basename --)
|
40
46
|
if [[ ! -z "$version" ]] ; then
|
41
47
|
printf "\n\nDefault Ruby (for new shells)\n"
|
42
|
-
string="[ $(file "$rvm_rubies_path/$version/bin/ruby" | awk '/x86.64/ {print "x86_64"} /386/ {print "i386"} /ppc/ {print "ppc"}' |
|
43
|
-
|
48
|
+
string="[ $(file "$rvm_rubies_path/$version/bin/ruby" | awk '/x86.64/ {print "x86_64"} /386/ {print "i386"} /ppc/ {print "ppc"}' | tr "\n" ' ')]"
|
49
|
+
if [[ $rvm_pretty_print -eq 1 ]] ; then
|
50
|
+
printf "\n $(tput setaf 2)$version$(tput sgr0) $string"
|
51
|
+
else
|
52
|
+
printf "\n $version $string"
|
53
|
+
fi
|
44
54
|
fi ; unset version
|
45
55
|
fi ; unset current_ruby version selected system_ruby system_version string binary
|
46
56
|
printf "\n\n"
|
@@ -55,7 +65,11 @@ list_default() {
|
|
55
65
|
if [[ ! -z "$version" ]] ; then
|
56
66
|
printf "\n\nDefault Ruby (for new shells)\n"
|
57
67
|
string="[ $(file "$rvm_rubies_path/$version/bin/ruby" | awk '/x86.64/ {print "x86_64"} /386/ {print "i386"} /ppc/ {print "ppc"}' | \tr "\n" ' ')]"
|
58
|
-
|
68
|
+
if [[ $rvm_pretty_print -eq 1 ]] ; then
|
69
|
+
printf "\n $(tput setaf 2)$version$(tput sgr0) $string\n"
|
70
|
+
else
|
71
|
+
printf "\n $version $string\n"
|
72
|
+
fi
|
59
73
|
fi ; unset version
|
60
74
|
fi
|
61
75
|
fi
|
@@ -73,13 +87,13 @@ list_ruby_svn_tags() {
|
|
73
87
|
# Query for valid rvm ruby strings
|
74
88
|
# This is meant to be used with scripting.
|
75
89
|
list_strings() {
|
76
|
-
|
90
|
+
ls "$rvm_rubies_path"
|
77
91
|
}
|
78
92
|
|
79
93
|
# This is meant to be used with scripting.
|
80
94
|
list_gemset_strings() {
|
81
95
|
local all_rubies="$(list_strings)"
|
82
|
-
for gemset in $(
|
96
|
+
for gemset in $(ls "$rvm_gems_path/" 2>/dev/null | xargs -n1 basename -- | \grep -v '^\(@\|doc$\|cache$\|system$\)' | sort); do
|
83
97
|
local ruby_name="$(echo "$gemset" | awk -F$rvm_gemset_separator '{print $1}')"
|
84
98
|
[[ "$all_rubies" != *"$ruby_name"* ]] && continue
|
85
99
|
echo "$gemset"
|
@@ -97,7 +111,7 @@ list_known() {
|
|
97
111
|
return 0
|
98
112
|
fi
|
99
113
|
|
100
|
-
if [[ "$
|
114
|
+
if [[ "$rvm_interactive_flag" != "1" ]] ; then
|
101
115
|
cat "$rvm_config_path/known"
|
102
116
|
else
|
103
117
|
${PAGER:-less} "$rvm_config_path/known"
|
@@ -116,13 +130,13 @@ list_rubies() {
|
|
116
130
|
current_ruby="$(__rvm_environment_identifier | awk -F"$rvm_gemset_separator" '{print $1}')"
|
117
131
|
|
118
132
|
printf "\nrvm rubies\n"
|
119
|
-
for version in $(
|
120
|
-
if echo "$version" |
|
133
|
+
for version in $(ls "$rvm_rubies_path/" 2> /dev/null | awk '/[a-z]*-.*/ {print $NF}') ; do
|
134
|
+
if echo "$version" | grep -q '^jruby-' ; then
|
121
135
|
string="[ $("$rvm_rubies_path/$version/bin/ruby" -v | awk '{print $NF}' | sed -e 's/\[//' -e 's/\]//') ]"
|
122
136
|
elif [[ ! -z "$(echo "$version" | awk '/^maglev-|^macruby-/')" ]] ; then
|
123
137
|
string="[ x86_64 ]"
|
124
138
|
else
|
125
|
-
string="[ $(file "$rvm_rubies_path/$version/bin/ruby" | awk '/x86.64/ {print "x86_64"} /386/ {print "i386"} /ppc/ {print "ppc"}' |
|
139
|
+
string="[ $(file "$rvm_rubies_path/$version/bin/ruby" | awk '/x86.64/ {print "x86_64"} /386/ {print "i386"} /ppc/ {print "ppc"}' | tr "\n" ' ')]"
|
126
140
|
fi
|
127
141
|
printf "\n"
|
128
142
|
if [[ "$version" = "$current_ruby" ]]; then
|
@@ -131,15 +145,23 @@ list_rubies() {
|
|
131
145
|
printf " "
|
132
146
|
fi
|
133
147
|
# TODO: Only use tput for interactive terminal sessions.
|
134
|
-
|
148
|
+
if [[ $rvm_pretty_print -eq 1 ]] ; then
|
149
|
+
printf "$(tput setaf 2)$version$(tput sgr0) $string"
|
150
|
+
else
|
151
|
+
printf "$version $string"
|
152
|
+
fi
|
135
153
|
done ; unset version
|
136
154
|
|
137
155
|
if [[ -f "$rvm_config_path/default" ]] && [[ -s "$rvm_config_path/default" ]] ; then
|
138
|
-
version=$(
|
156
|
+
version=$(grep 'MY_RUBY_HOME' "$rvm_config_path/default" | head -n 1 | awk -F"'" '{print $2}' | xargs basename --)
|
139
157
|
if [[ ! -z "$version" ]] ; then
|
140
158
|
printf "\n\nDefault Ruby (for new shells)\n"
|
141
159
|
string="[ $(file "$rvm_rubies_path/$version/bin/ruby" | awk '/x86.64/ {print "x86_64"} /386/ {print "i386"} /ppc/ {print "ppc"}' | \tr "\n" ' ')]"
|
142
|
-
|
160
|
+
if [[ $rvm_pretty_print -eq 1 ]] ; then
|
161
|
+
printf "\n $(tput setaf 2)$version$(tput sgr0) $string"
|
162
|
+
else
|
163
|
+
printf "\n $version $string"
|
164
|
+
fi
|
143
165
|
fi ; unset version
|
144
166
|
fi ; unset current_ruby version selected system_ruby system_version string binary
|
145
167
|
printf "\n\n"
|
@@ -148,8 +170,9 @@ list_rubies() {
|
|
148
170
|
# List all rvm installed rubies, default ruby and system ruby.
|
149
171
|
# Display the rubies, indicate their architecture and indicate which is currently used.
|
150
172
|
# This is not meant to be used with scripting. This is for interactive mode usage only.
|
151
|
-
|
152
|
-
[
|
173
|
+
args=($*)
|
174
|
+
action="${args[0]}"
|
175
|
+
args="$(echo ${args[@]:1}) " # Strip trailing / leading / extra spacing.
|
153
176
|
|
154
177
|
if [[ "known" = "$action" ]] ; then
|
155
178
|
list_known
|
@@ -166,7 +189,12 @@ elif [[ "strings" = "$action" ]] ; then
|
|
166
189
|
elif [[ "ruby_svn_tags" = "$action" ]] ; then
|
167
190
|
list_ruby_svn_tags
|
168
191
|
else # help
|
169
|
-
printf "
|
192
|
+
printf "
|
193
|
+
Usage:
|
194
|
+
|
195
|
+
rvm list {known,gemsets,default,rubies,strings,known_strings}
|
196
|
+
|
197
|
+
"
|
170
198
|
false
|
171
199
|
fi
|
172
200
|
|
data/scripts/log
CHANGED
@@ -7,27 +7,28 @@ if [[ "$rvm_trace_flag" -eq 2 ]] ; then set -x ; export rvm_trace_flag ; fi
|
|
7
7
|
|
8
8
|
if [[ ! -z "$2" ]] ; then level=$1 ; shift ; else level="info" ; fi
|
9
9
|
|
10
|
-
message="$
|
10
|
+
message="${1//%/%%}"
|
11
|
+
|
12
|
+
rvm_pretty_print=${rvm_pretty_print:-0}
|
13
|
+
if [[ $rvm_pretty_print -eq 0 ]] ; then
|
14
|
+
if [[ $rvm_verbose_flag -eq 1 ]] && [[ -n "$level" ]] ; then
|
15
|
+
message="$level: $message"
|
16
|
+
fi
|
11
17
|
|
12
|
-
if [[ "$rvm_interactive" != "1" ]] ; then
|
13
18
|
case "$level" in
|
14
|
-
debug)
|
15
|
-
|
16
|
-
warn) shift ; printf "\n$level: $message\n" ;;
|
17
|
-
error) shift ; printf "\n$level: $message\n" >&2 ;;
|
18
|
-
fail) shift ; printf "\n$level: $message\n" >&2 ;;
|
19
|
+
debug|info|warn) printf "$message\n" ;;
|
20
|
+
error|fail) printf "$message\n" >&2 ;;
|
19
21
|
*) printf "$message"
|
20
22
|
esac
|
21
23
|
else
|
22
24
|
case "$level" in
|
23
|
-
debug)
|
24
|
-
info)
|
25
|
-
warn)
|
26
|
-
error)
|
27
|
-
fail)
|
28
|
-
*)
|
25
|
+
debug) printf "$(tput setaf 5)$level$(tput sgr0): $message\n" ;;
|
26
|
+
info) printf "$(tput setaf 2)$level$(tput sgr0): $message\n" ;;
|
27
|
+
warn) printf "$(tput setaf 3)$level$(tput sgr0): $message\n" ;;
|
28
|
+
error) printf "$(tput setaf 1)$level$(tput sgr0): $message\n" >&2 ;;
|
29
|
+
fail) printf "$(tput setaf 1)$level$(tput sgr0): $message\n" >&2 ;;
|
30
|
+
*) printf "$message"
|
29
31
|
esac
|
30
32
|
fi
|
31
|
-
set +x
|
32
33
|
|
33
34
|
exit 0
|
data/scripts/maglev
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
#!/usr/bin/env bash
|
2
2
|
|
3
|
-
if [[
|
3
|
+
if [[ "$rvm_trace_flag" -eq 2 ]] ; then set -x ; export rvm_trace_flag ; fi
|
4
4
|
|
5
5
|
system="$(uname -s)"
|
6
6
|
if [[ $system = "SunOS" ]] && [[ "$(uname -m)" = "i86pc" ]] ; then system="Solaris-x86" ; fi
|
data/scripts/manage
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
#!/usr/bin/env bash
|
2
2
|
|
3
|
+
if [[ "$rvm_trace_flag" -eq 2 ]] ; then set -x ; export rvm_trace_flag ; fi
|
4
|
+
|
3
5
|
original_ruby_version=$rvm_ruby_version
|
4
6
|
original_ruby_string=$rvm_ruby_string
|
5
7
|
|
@@ -23,37 +25,48 @@ __rvm_check_for_bison() {
|
|
23
25
|
fi
|
24
26
|
}
|
25
27
|
|
26
|
-
#
|
28
|
+
# Emits a number of patches to STDOUT, each on a new name
|
27
29
|
# Expands patchsets etc.
|
28
30
|
__rvm_current_patch_names() {
|
29
31
|
# TODO: Lookup default patches on rvm_ruby_string heirarchy.
|
30
|
-
local
|
32
|
+
local separator="%"
|
31
33
|
local patches="$rvm_patch_names default"
|
32
|
-
for patch_name in $(
|
33
|
-
|
34
|
+
for patch_name in $(echo "$patches" | \tr ',' ' ' | __rvm_strip); do
|
35
|
+
local level=1
|
36
|
+
local name="$patch_name"
|
37
|
+
if echo "$name" | \grep -q "$separator"; then
|
38
|
+
level="${name/*${separator}/}"
|
39
|
+
name="${name//${separator}*/}"
|
40
|
+
fi
|
41
|
+
local expanded_name="$(__rvm_expand_patch_name "$name")"
|
42
|
+
echo "${expanded_name}${separator}${level}"
|
34
43
|
done
|
35
44
|
}
|
36
45
|
|
37
46
|
__rvm_apply_patches() {
|
38
47
|
local patch_result=0
|
39
|
-
local
|
48
|
+
local patch_level_separator="%"
|
40
49
|
local patch_fuzziness="25"
|
50
|
+
local patch_level=1
|
41
51
|
source_directory="${1:-"$rvm_ruby_src_path"}"
|
42
52
|
__rvm_pushpop "$source_directory"
|
43
53
|
unset source_directory
|
44
|
-
|
45
|
-
|
54
|
+
patches="$(__rvm_current_patch_names | __rvm_strip)"
|
55
|
+
for patch_name in $(echo $patches); do
|
46
56
|
# If set, extract the patch level from the patch name.
|
47
|
-
|
48
|
-
|
49
|
-
|
57
|
+
patch_level=1
|
58
|
+
if echo "$patch_name" | \grep -q "$patch_level_separator"; then
|
59
|
+
patch_level="${patch_name//*${patch_level_separator}/}"
|
60
|
+
patch_name="${patch_name//${patch_level_separator}*/}"
|
50
61
|
fi
|
51
62
|
full_patch_path="$(__rvm_lookup_full_patch_path "$patch_name")"
|
52
63
|
# Expand paths, and for those we found we then apply the patches.
|
53
64
|
if [[ -n "$full_patch_path" ]]; then
|
54
|
-
|
55
|
-
|
56
|
-
|
65
|
+
if [[ -f "$full_patch_path" ]] ; then
|
66
|
+
__rvm_run "patch.apply.${patch_name/*\/}" "patch -F$patch_fuzziness -p$patch_level -f <\"$full_patch_path\"" "Applying patch '$patch_name' (located at $full_patch_path)"
|
67
|
+
# Detect failed patches
|
68
|
+
[[ "$?" -gt 0 ]] && patch_result=1
|
69
|
+
fi
|
57
70
|
else
|
58
71
|
"$rvm_scripts_path/log" "warn" "Patch '$patch_name' not found."
|
59
72
|
patch_result=1
|
@@ -250,7 +263,7 @@ RubyWrapper
|
|
250
263
|
;;
|
251
264
|
|
252
265
|
ree)
|
253
|
-
if [[ -n "$(echo "$rvm_ruby_version" | awk '/^1\.8/')" ]] && [[
|
266
|
+
if [[ -n "$(echo "$rvm_ruby_version" | awk '/^1\.8/')" ]] && [[ $rvm_head_flag -eq 0 ]] ; then
|
254
267
|
rvm_url="$(__rvm_db "ree_${rvm_ruby_version}_url")/$rvm_ruby_package_file.tar.gz"
|
255
268
|
"$rvm_scripts_path/log" "info" "Installing Ruby Enterprise Edition from source to: $rvm_ruby_home"
|
256
269
|
__rvm_pushpop "$rvm_src_path"
|
@@ -328,7 +341,7 @@ RubyWrapper
|
|
328
341
|
__rvm_conditionally_add_bin_path ; export PATH
|
329
342
|
builtin hash -r
|
330
343
|
|
331
|
-
if [[ -n "$(echo $rvm_ruby_version | awk '/^1\.0/')" ]] && [[
|
344
|
+
if [[ -n "$(echo $rvm_ruby_version | awk '/^1\.0/')" ]] && [[ $rvm_head_flag -eq 0 ]] ; then
|
332
345
|
"$rvm_scripts_path/log" "info" "Downloading $rvm_ruby_package_file, this may take a while depending on your connection..."
|
333
346
|
"$rvm_scripts_path/fetch" "$rvm_url"
|
334
347
|
result=$? ; if [[ "$result" -gt 0 ]] ; then
|
@@ -422,7 +435,7 @@ RubyWrapper
|
|
422
435
|
fi
|
423
436
|
|
424
437
|
builtin cd "$rvm_ruby_src_path"
|
425
|
-
if [[
|
438
|
+
if [[ $rvm_head_flag -eq 1 ]] ; then __rvm_run "ant.dist" "ant dist" "Running 'ant dist' (this could take a few minutes) ..." ; fi
|
426
439
|
|
427
440
|
\mkdir -p "$rvm_ruby_home/bin/"
|
428
441
|
if "$rvm_scripts_path/match" "$rvm_ruby_version" "1\.3" || "$rvm_scripts_path/match" "$rvm_ruby_version" "1\.2" ; then
|
@@ -489,7 +502,7 @@ RubyWrapper
|
|
489
502
|
fi
|
490
503
|
fi
|
491
504
|
|
492
|
-
if [[
|
505
|
+
if [[ $rvm_head_flag -eq 1 ]] ; then
|
493
506
|
builtin cd "$rvm_ruby_src_path"
|
494
507
|
rvm_gemstone_package_file="GemStone-$(\grep ^GEMSTONE version.txt | cut -f2 -d-).$(uname -sm | \tr ' ' '-')"
|
495
508
|
rvm_gemstone_url="${rvm_gemstone_url:-"$maglev_url/${rvm_gemstone_package_file}.${rvm_archive_extension}"}"
|
@@ -534,7 +547,7 @@ RubyWrapper
|
|
534
547
|
done ; unset binary
|
535
548
|
|
536
549
|
builtin cd "$rvm_ruby_home"
|
537
|
-
if [[
|
550
|
+
if [[ $rvm_head_flag -eq 1 ]] ; then
|
538
551
|
git submodule update --init
|
539
552
|
"$rvm_ruby_home/bin/maglev" force-reload
|
540
553
|
ln -sf maglev.demo.key-$(uname -sm | \tr ' ' '-') etc/maglev.demo.key
|
@@ -569,7 +582,7 @@ RubyWrapper
|
|
569
582
|
printf "mono must be installed and in your path in order to install IronRuby." ; return 1
|
570
583
|
fi
|
571
584
|
|
572
|
-
if [[
|
585
|
+
if [[ $rvm_head_flag -eq 1 ]] ; then
|
573
586
|
mono_version="$(mono -V | head -n 1 | cut -d ' ' -f5)"
|
574
587
|
if "$rvm_scripts_path/match" "$mono_version" "([0-9]+)\.([0-9]+)\.?([0-9]+)?" ; then
|
575
588
|
mono_major_ver="$(echo "$mono_version" | cut -d '.' -f1)"
|
@@ -755,7 +768,7 @@ __rvm_fetch_from_github() {
|
|
755
768
|
__rvm_fetch_ruby() {
|
756
769
|
[[ -z "$rvm_ruby_selected_flag" ]] && __rvm_select
|
757
770
|
|
758
|
-
if [[
|
771
|
+
if [[ $rvm_head_flag -eq 0 && -z "$rvm_ruby_tag" && -z "$rvm_ruby_revision" ]] ; then
|
759
772
|
rvm_ruby_package_name="${rvm_ruby_package_name:-"$rvm_ruby_string"}"
|
760
773
|
rvm_ruby_package_file="${rvm_ruby_package_file:-"$rvm_ruby_package_name"}"
|
761
774
|
if [[ "ruby" = "$rvm_ruby_interpreter" ]]; then
|
@@ -805,7 +818,7 @@ __rvm_fetch_ruby() {
|
|
805
818
|
fi
|
806
819
|
fi
|
807
820
|
|
808
|
-
mv "/tmp/rvm_src_$$/$(
|
821
|
+
mv "/tmp/rvm_src_$$/$(builtin cd /tmp/rvm_src_$$ ; \ls)" "$rvm_ruby_src_path" ; \rm -rf "/tmp/rvm_src_$$"
|
809
822
|
|
810
823
|
if [[ -n "$rvm_ruby_name" ]] && [[ -d "$rvm_src_path/$(echo $rvm_ruby_string | sed -e 's/-n.*//')" ]] ; then
|
811
824
|
mv "$rvm_src_path/$(echo "$rvm_ruby_string" | sed -e 's/-n.*//')" "$rvm_ruby_src_path"
|
@@ -854,10 +867,10 @@ __rvm_fetch_ruby() {
|
|
854
867
|
if [[ -n "$rvm_ruby_tag" ]] ; then
|
855
868
|
# TODO: Check if tag v is valid
|
856
869
|
rvm_url="${rvm_url:-"$rvm_ruby_repo_url/tags/$(echo "$rvm_ruby_tag" | sed 's/^t//')"}"
|
857
|
-
elif [[ -z "$rvm_ruby_version"
|
870
|
+
elif [[ -z "$rvm_ruby_version" && $rvm_head_flag -eq 1 ]] ; then
|
858
871
|
rvm_url="${rvm_url:-"$rvm_ruby_repo_url/trunk"}"
|
859
872
|
elif [[ "$rvm_major_version" = "9" ]] ; then
|
860
|
-
if [[ -z "$rvm_minor_version"
|
873
|
+
if [[ -z "$rvm_minor_version" || "$rvm_minor_version" = 3 ]] ; then
|
861
874
|
rvm_url="${rvm_url:-"$rvm_ruby_repo_url/trunk"}"
|
862
875
|
else
|
863
876
|
rvm_url="${rvm_url:-"$rvm_ruby_repo_url/branches/ruby_${rvm_release_version}_${rvm_major_version}_${rvm_minor_version}"}"
|
@@ -1038,7 +1051,7 @@ __rvm_post_install() {
|
|
1038
1051
|
fi
|
1039
1052
|
|
1040
1053
|
# Import the initial gemsets.
|
1041
|
-
__rvm_run_with_env "gemsets.initial" "$rvm_ruby_string" '
|
1054
|
+
__rvm_run_with_env "gemsets.initial" "$rvm_ruby_string" "'$rvm_scripts_path/gemsets' initial" "Importing initial gems..."
|
1042
1055
|
|
1043
1056
|
__rvm_irbrc
|
1044
1057
|
__rvm_generate_default_docs
|
@@ -1210,44 +1223,47 @@ __rvm_manage_rubies() {
|
|
1210
1223
|
if [[ -n "$rubies_string" ]] ;then
|
1211
1224
|
for rvm_ruby_string in $(echo "$rubies_string" | \tr ',' ' ') ; do
|
1212
1225
|
current_manage_ruby_string="$rvm_ruby_string"
|
1213
|
-
eval "__rvm_${
|
1226
|
+
eval "__rvm_${action}_ruby"
|
1214
1227
|
result="$?"
|
1215
1228
|
if [[ "$result" -gt 0 && "$manage_result" = 0 ]]; then
|
1216
1229
|
manage_result="$result"
|
1217
1230
|
fi
|
1218
|
-
[[ "$result" = 0 && "$
|
1231
|
+
[[ "$result" = 0 && "$action" = "install" ]] && __rvm_record_install "$current_manage_ruby_string"
|
1219
1232
|
unset current_manage_ruby_string
|
1220
1233
|
__rvm_unset_ruby_variables
|
1221
1234
|
done
|
1222
1235
|
else # all
|
1223
|
-
if [[ "$
|
1236
|
+
if [[ "$action" != "install" && "$action" != "remove" && "$action" != "uninstall" ]] ; then
|
1224
1237
|
while read -r bin_line
|
1225
1238
|
do # Keep this on second line damnit!
|
1226
1239
|
if [[ -x "$bin_line" ]] ; then
|
1227
1240
|
current_manage_ruby_string="$(dirname "$bin_line" | xargs dirname | xargs basename)"
|
1228
1241
|
rvm_ruby_string="$current_manage_ruby_string"
|
1229
|
-
eval "__rvm_${
|
1242
|
+
eval "__rvm_${action}_ruby"
|
1230
1243
|
result="$?"
|
1231
1244
|
if [[ "$result" -gt 0 && "$manage_result" = 0 ]]; then
|
1232
1245
|
manage_result="$result"
|
1233
1246
|
fi
|
1234
1247
|
# record as current_manage_string to prevent it being overridden.
|
1235
|
-
[[ "$result" = 0 && "$
|
1248
|
+
[[ "$result" = 0 && "$action" = "install" ]] && __rvm_record_install "$current_manage_ruby_string"
|
1236
1249
|
unset current_manage_ruby_string
|
1237
1250
|
__rvm_unset_ruby_variables
|
1238
1251
|
fi
|
1239
1252
|
done < <(\ls "$rvm_rubies_path"/*/bin/ruby 2> /dev/null)
|
1240
1253
|
else
|
1241
|
-
"$rvm_scripts_path/log" "warn" 'Really? '"$
|
1254
|
+
"$rvm_scripts_path/log" "warn" 'Really? '"$action"' all? See "rvm list known" and limit the selection to something more sane please :)'
|
1242
1255
|
fi
|
1243
1256
|
fi
|
1244
1257
|
|
1245
1258
|
# TODO: This should return the exit status of the command that got called.
|
1246
1259
|
return $manage_result
|
1247
|
-
|
1248
1260
|
}
|
1249
1261
|
|
1250
|
-
|
1251
|
-
|
1262
|
+
args=($*)
|
1263
|
+
action="${args[0]}"
|
1264
|
+
rubies_string="${args[1]}"
|
1265
|
+
args="$(echo ${args[@]:2}) " # Strip trailing / leading / extra spacing.
|
1266
|
+
|
1252
1267
|
__rvm_manage_rubies
|
1268
|
+
|
1253
1269
|
exit $?
|