rvm 0.0.55 → 0.0.56
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/config/db +1 -2
- data/examples/rvmrc +3 -0
- data/install +1 -0
- data/lib/VERSION.yml +1 -1
- data/scripts/cli +31 -42
- data/scripts/completion +2 -2
- data/scripts/gems +180 -0
- data/scripts/install +1 -0
- data/scripts/ruby-installer +70 -67
- data/scripts/rvm +1 -0
- data/scripts/rvm-install +1 -0
- data/scripts/selector +57 -55
- data/scripts/update +1 -0
- data/scripts/utility +143 -218
- metadata +3 -3
- data/rvm.gemspec +0 -62
data/scripts/rvm
CHANGED
data/scripts/rvm-install
CHANGED
|
@@ -21,6 +21,7 @@ for dir_name in src scripts bin log archives config gems examples ; do
|
|
|
21
21
|
mkdir -p $rvm_path/$dir_name
|
|
22
22
|
done
|
|
23
23
|
|
|
24
|
+
rm -rf $rvm_path/scripts # Clear the old scripts directory so that the old style rvm- scripts are cleared out.
|
|
24
25
|
for dir_name in config scripts examples lib ; do
|
|
25
26
|
mkdir -p $rvm_path/$dir_name
|
|
26
27
|
/bin/cp -Rf $source_dir/$dir_name $rvm_path
|
data/scripts/selector
CHANGED
|
@@ -28,7 +28,7 @@ function __rvm_select {
|
|
|
28
28
|
macruby)
|
|
29
29
|
if [ "`uname`" = "Darwin" ] ; then
|
|
30
30
|
rvm_ruby_repo_url="${rvm_ruby_repo_url:-`__rvm_db "macruby_repo_url"`}"
|
|
31
|
-
rvm_ruby_version="head"
|
|
31
|
+
rvm_ruby_version="${rvm_ruby_version:-head}"
|
|
32
32
|
rvm_ruby_package_name=${rvm_ruby_interpreter}-${rvm_ruby_version}
|
|
33
33
|
#rvm_ruby_version="${rvm_ruby_version:-`__rvm_db "macruby_version"`}"
|
|
34
34
|
#rvm_ruby_package_name=${rvm_ruby_interpreter}_nightly-${rvm_ruby_version}
|
|
@@ -40,15 +40,15 @@ function __rvm_select {
|
|
|
40
40
|
;;
|
|
41
41
|
|
|
42
42
|
rbx|rubinius)
|
|
43
|
-
|
|
43
|
+
rvm_ruby_interpreter="rbx"
|
|
44
|
+
rvm_ruby_version="${rvm_ruby_version:-head}"
|
|
45
|
+
#rvm_ruby_revision="head"
|
|
44
46
|
unset rvm_ruby_patch_level
|
|
45
|
-
rvm_ruby_interpreter="rubinius"
|
|
46
47
|
rvm_ruby_repo_url=${rvm_rbx_repo_url:-`__rvm_db "rubinius_repo_url"`}
|
|
47
48
|
rvm_url=$rvm_ruby_repo_url
|
|
48
49
|
rvm_ruby_configure=""
|
|
49
50
|
rvm_ruby_make="build"
|
|
50
51
|
rvm_ruby_make_install=""
|
|
51
|
-
#rvm_ruby_rev="head"
|
|
52
52
|
;;
|
|
53
53
|
|
|
54
54
|
jruby)
|
|
@@ -70,11 +70,11 @@ function __rvm_select {
|
|
|
70
70
|
;;
|
|
71
71
|
|
|
72
72
|
ruby-enterprise|ree)
|
|
73
|
-
rvm_ruby_interpreter=
|
|
74
|
-
rvm_ruby_interpreter=`__rvm_db "ree_interpreter"`
|
|
73
|
+
rvm_ruby_interpreter=ree
|
|
75
74
|
rvm_ruby_version=${rvm_ruby_version:-`__rvm_db "ree_version"`}
|
|
76
|
-
rvm_ruby_patch_level="${
|
|
77
|
-
rvm_ruby_package_name="
|
|
75
|
+
rvm_ruby_patch_level="${rvm_ruby_revision:-`__rvm_db "ree_${rvm_ruby_version}_patch_level"`}"
|
|
76
|
+
rvm_ruby_package_name="ree-$rvm_ruby_version-$rvm_ruby_patch_level"
|
|
77
|
+
rvm_ruby_package_file="ruby-enterprise-$rvm_ruby_version-$rvm_ruby_patch_level"
|
|
78
78
|
if [ -z "$(echo $rvm_ruby_version | awk '/^1\.8/')" ] ; then
|
|
79
79
|
__rvm_log "fail" "Unknown Ruby Enterprise Edition version: $rvm_ruby_version"
|
|
80
80
|
fi
|
|
@@ -86,11 +86,10 @@ function __rvm_select {
|
|
|
86
86
|
rvm_ruby_patch_level=$rvm_ruby_tag # $(echo $rvm_ruby_tag | sed 's/^v//' | sed 's/\///' | awk -F'_' '{print $4 }')
|
|
87
87
|
fi
|
|
88
88
|
if [ -z "$rvm_ruby_version" ] ; then
|
|
89
|
-
rvm_ruby_version
|
|
89
|
+
rvm_ruby_version=$(__rvm_db "ruby_version") # Default verison is 1.8.6
|
|
90
90
|
fi
|
|
91
|
-
rvm_ruby_patch_level=${rvm_ruby_patch_level
|
|
91
|
+
rvm_ruby_patch_level=${rvm_ruby_patch_level:-$(__rvm_db "ruby_${rvm_ruby_version}_patch_level")} # Default verison is 1.8.6
|
|
92
92
|
if [ -z "rvm_ruby_patch_level" ] ; then unset rvm_ruby_patch_level ; fi
|
|
93
|
-
|
|
94
93
|
if [ -z "rvm_ruby_version" ] ; then
|
|
95
94
|
__rvm_log "fail" "Unknown ruby version: $rvm_ruby_version"
|
|
96
95
|
fi
|
|
@@ -109,45 +108,27 @@ function __rvm_select {
|
|
|
109
108
|
fi
|
|
110
109
|
esac
|
|
111
110
|
|
|
112
|
-
if [ ! -z "$
|
|
113
|
-
if [ "$
|
|
111
|
+
if [ ! -z "$rvm_ruby_revision" ] ; then
|
|
112
|
+
if [ "$rvm_ruby_revision" = "head" -o "$rvm_ruby_revision" = "trunk" ] ; then
|
|
114
113
|
rvm_ruby_patch_level="head"
|
|
115
114
|
else
|
|
116
|
-
rvm_ruby_patch_level="$
|
|
115
|
+
rvm_ruby_patch_level="$rvm_ruby_revision"
|
|
117
116
|
fi
|
|
118
117
|
fi
|
|
119
118
|
|
|
120
|
-
|
|
121
|
-
gemset=$(gem env gemdir | xargs basename | sed "s/${rvm_ruby_version}-//")
|
|
122
|
-
if [ "$gemset" != "$rvm_ruby_version" -a -z "$(echo $gemset | awk '/^[0-9]/')" ] ; then
|
|
123
|
-
rvm_gem_set_name="$gemset"
|
|
124
|
-
else
|
|
125
|
-
unset rvm_gem_set_name
|
|
126
|
-
fi ; unset gemset
|
|
127
|
-
fi
|
|
119
|
+
__rvm_gems_select
|
|
128
120
|
|
|
129
121
|
if [ ! -z "$rvm_ruby_interpreter" -a ! -z "$rvm_ruby_version" -a "$rvm_ruby_interpreter" != "system" ] ; then
|
|
130
122
|
rvm_major_version=$(echo $rvm_ruby_version | awk -F'.' '{ print $2 }')
|
|
131
123
|
rvm_minor_version=$(echo $rvm_ruby_version | awk -F'.' '{ print $3 }')
|
|
132
124
|
|
|
133
|
-
|
|
134
|
-
rvm_gem_home="$rvm_gem_path/$rvm_ruby_interpreter/$rvm_ruby_version"
|
|
135
|
-
else
|
|
136
|
-
if [ ! -z "$rvm_gem_set_name_rm" -a -d $rvm_gem_path/$rvm_ruby_interpreter/$rvm_ruby_version-$rvm_gem_set_name ] ; then
|
|
137
|
-
rm -rf $rvm_gem_path/$rvm_ruby_interpreter/$rvm_ruby_version-$rvm_gem_set_name/
|
|
138
|
-
if [ "$rvm_gem_set_name_rm" = "$rvm_gem_set_name" ] ; then unset rvm_gem_set_name ; fi
|
|
139
|
-
else
|
|
140
|
-
rvm_gem_home="$rvm_gem_path/$rvm_ruby_interpreter/$rvm_ruby_version-$rvm_gem_set_name"
|
|
141
|
-
fi
|
|
142
|
-
fi
|
|
143
|
-
|
|
144
|
-
mkdir -p $rvm_gem_home
|
|
125
|
+
__rvm_gems_select
|
|
145
126
|
|
|
146
127
|
if [ -z "$rvm_ruby_patch_level" ] ; then
|
|
147
128
|
rvm_ruby_package_name="${rvm_ruby_package_name:-"$rvm_ruby_interpreter-$rvm_ruby_version"}"
|
|
148
129
|
rvm_ruby_home="${rvm_ruby_home:-"$rvm_path/$rvm_ruby_interpreter-$rvm_ruby_version"}"
|
|
149
130
|
else
|
|
150
|
-
if [ "$rvm_ruby_interpreter" != "
|
|
131
|
+
if [ "$rvm_ruby_interpreter" != "ree" ] ; then
|
|
151
132
|
if [ ! -z "`echo $rvm_ruby_patch_level | awk '/^[0-9]/'`" ] ; then
|
|
152
133
|
rvm_ruby_patch_level="p$rvm_ruby_patch_level"
|
|
153
134
|
fi
|
|
@@ -156,21 +137,22 @@ function __rvm_select {
|
|
|
156
137
|
rvm_ruby_package_name="${rvm_ruby_package_name:-"$rvm_ruby_interpreter-$rvm_ruby_version-$rvm_ruby_patch_level"}"
|
|
157
138
|
rvm_ruby_home="${rvm_ruby_home:-"$rvm_path/$rvm_ruby_interpreter-$rvm_ruby_version-$rvm_ruby_patch_level"}"
|
|
158
139
|
fi
|
|
140
|
+
|
|
159
141
|
rvm_ruby_string="$rvm_ruby_package_name"
|
|
160
142
|
rvm_ruby_log_path="$rvm_log_path/$rvm_ruby_package_name"
|
|
161
|
-
rvm_ruby_src_path="$
|
|
143
|
+
rvm_ruby_src_path="$rvm_src_path/$rvm_ruby_string"
|
|
162
144
|
rvm_ruby_binary="$rvm_ruby_home/bin/ruby"
|
|
163
145
|
rvm_ruby_irbrc="$rvm_ruby_home/.irbrc"
|
|
164
|
-
|
|
146
|
+
rvm_selected_flag=1
|
|
165
147
|
|
|
166
|
-
export rvm_ruby_interpreter rvm_ruby_version rvm_ruby_repo_url rvm_ruby_package_name rvm_url rvm_ruby_patch_level rvm_ruby_configure rvm_ruby_make rvm_ruby_make_install
|
|
148
|
+
export rvm_ruby_interpreter rvm_ruby_version rvm_ruby_repo_url rvm_ruby_package_name rvm_url rvm_ruby_patch_level rvm_ruby_configure rvm_ruby_make rvm_ruby_make_install rvm_ruby_revision rvm_ruby_tag rvm_major_version rvm_minor_version rvm_gem_set_name rvm_gem_path rvm_ruby_gem_home rvm_path rvm_src_path rvm_bin_path rvm_ruby_binary rvm_ruby_home rvm_log_path rvm_ruby_log_path rvm_src_path rvm_ruby_src_path rvm_ruby_irbrc rvm_selected_flag rvm_ruby_string
|
|
167
149
|
else
|
|
168
|
-
|
|
150
|
+
rvm_ruby_gem_home=$GEM_HOME
|
|
169
151
|
fi
|
|
170
152
|
}
|
|
171
153
|
|
|
172
154
|
function __rvm_use {
|
|
173
|
-
if [ -z "$
|
|
155
|
+
if [ -z "$rvm_selected_flag" ] ; then __rvm_select $* ; fi
|
|
174
156
|
if [ -z "$rvm_ruby_interpreter" ] ; then rvm_ruby_interpreter="default" ; fi
|
|
175
157
|
|
|
176
158
|
if [ "$rvm_ruby_interpreter" = "default" ] ; then
|
|
@@ -202,8 +184,8 @@ function __rvm_use {
|
|
|
202
184
|
fi
|
|
203
185
|
|
|
204
186
|
else
|
|
205
|
-
GEM_HOME=$
|
|
206
|
-
GEM_PATH=$
|
|
187
|
+
GEM_HOME=$rvm_ruby_gem_home ; export GEM_HOME
|
|
188
|
+
GEM_PATH=$rvm_ruby_gem_home ; export GEM_PATH
|
|
207
189
|
MY_RUBY_HOME=$rvm_ruby_home ; export MY_RUBY_HOME
|
|
208
190
|
RUBY_VERSION=$rvm_ruby_package_name ; export RUBY_VERSION
|
|
209
191
|
IRBRC="$rvm_ruby_irbrc" ; export IRBRC
|
|
@@ -255,34 +237,54 @@ function __rvm_use {
|
|
|
255
237
|
unset rvm_default_flag
|
|
256
238
|
fi
|
|
257
239
|
|
|
258
|
-
if [ ! -z "$rvm_load_flag" ] ; then
|
|
259
|
-
if [ ! -z "$rvm_dump_flag" ] ; then
|
|
240
|
+
if [ ! -z "$rvm_load_flag" ] ; then __rvm_gems_load ; fi
|
|
241
|
+
if [ ! -z "$rvm_dump_flag" ] ; then __rvm_gems_dump ; fi
|
|
260
242
|
}
|
|
261
243
|
|
|
262
244
|
function __rvm_ruby_string {
|
|
263
245
|
if [ "$rvm_ruby_interpreter" = "system" ] ; then
|
|
264
246
|
rvm_ruby_string="system"
|
|
265
247
|
elif [ ! -z "$rvm_ruby_string" ] ; then
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
248
|
+
ruby_string=$(echo "$rvm_ruby_string" | sed 's/ruby-enterprise/ree/g') # dash-antics :
|
|
249
|
+
__rvm_unset_ruby_variables
|
|
250
|
+
|
|
251
|
+
rvm_ruby_interpreter=$(echo $ruby_string | awk -F'-' '{print $1}')
|
|
252
|
+
rvm_ruby_version=$(echo $ruby_string | awk -F'-' '{print $2}')
|
|
253
|
+
if [ ! -z "$(echo $rvm_ruby_interpreter | awk '/^1\.[8-9]/')" ] ; then
|
|
254
|
+
rvm_ruby_patch_level=$rvm_ruby_version
|
|
255
|
+
rvm_ruby_version=$rvm_ruby_interpreter
|
|
256
|
+
rvm_ruby_interpreter="ruby"
|
|
257
|
+
if [ -z "$rvm_ruby_patch_level" ] ; then
|
|
258
|
+
rvm_ruby_patch_level="${rvm_ruby_patch_level:-$(__rvm_db "${rvm_ruby_interpreter}_${rvm_ruby_version}_patch_level")}"
|
|
259
|
+
fi
|
|
260
|
+
elif [ ! -z "$(echo $rvm_ruby_interpreter | awk '/^1\.[3-4]/')" ] ; then
|
|
261
|
+
rvm_ruby_version=$rvm_ruby_interpreter
|
|
262
|
+
rvm_ruby_interpreter=jruby
|
|
263
|
+
unset rvm_ruby_patch_level
|
|
264
|
+
fi
|
|
265
|
+
|
|
266
|
+
if [ "$rvm_ruby_version" = "head" ] ; then
|
|
267
|
+
revision="head"
|
|
268
|
+
if [ "$rvm_ruby_interpreter" = "ree" ] ; then rvm_ruby_version="1.8.7" ; fi
|
|
269
|
+
if [ "$rvm_ruby_interpreter" = "rbx" ] ; then unset revision ; fi
|
|
270
|
+
else
|
|
271
|
+
revision=$(echo $ruby_string | awk -F'-' '{print $3}')
|
|
272
|
+
fi
|
|
270
273
|
|
|
271
274
|
if [ "$revision" = "head" -o "$revision" = "preview" ] ; then
|
|
272
275
|
rvm_ruby_revision="$revision"
|
|
273
276
|
else
|
|
274
|
-
echo $revision |
|
|
275
|
-
|
|
276
|
-
rvm_ruby_patch_level=`echo $revision | awk -F'p' '{print $2}'`
|
|
277
|
+
if [ ! -z "$(echo $revision | awk '/^p[0-9]\+/')" ] ; then
|
|
278
|
+
rvm_ruby_patch_level=${rvm_ruby_patch_level:-$(echo $revision | awk -F'p' '{print $2}')}
|
|
277
279
|
else
|
|
278
|
-
echo $revision |
|
|
279
|
-
|
|
280
|
-
rvm_ruby_rev="$revision"
|
|
280
|
+
if [ ! -z "$(echo $revision | awk '/^[0-9]\+/')" ] ; then
|
|
281
|
+
rvm_ruby_revision="$revision"
|
|
281
282
|
else
|
|
282
|
-
unset
|
|
283
|
+
unset rvm_ruby_revision
|
|
283
284
|
fi
|
|
284
285
|
fi
|
|
285
286
|
fi
|
|
287
|
+
unset ruby_string
|
|
286
288
|
fi
|
|
287
289
|
return 0
|
|
288
290
|
}
|
data/scripts/update
CHANGED
|
@@ -21,6 +21,7 @@ for dir_name in src scripts bin log archives config gems examples ; do
|
|
|
21
21
|
mkdir -p $rvm_path/$dir_name
|
|
22
22
|
done
|
|
23
23
|
|
|
24
|
+
rm -rf $rvm_path/scripts # Clear the old scripts directory so that the old style rvm- scripts are cleared out.
|
|
24
25
|
for dir_name in config scripts examples lib ; do
|
|
25
26
|
mkdir -p $rvm_path/$dir_name
|
|
26
27
|
/bin/cp -Rf $source_dir/$dir_name $rvm_path
|
data/scripts/utility
CHANGED
|
@@ -1,18 +1,19 @@
|
|
|
1
1
|
#!/bin/bash
|
|
2
2
|
|
|
3
3
|
function __rvm_info {
|
|
4
|
-
|
|
4
|
+
full_version=$(ruby -v)
|
|
5
|
+
cat <<Info
|
|
5
6
|
|
|
6
7
|
system:
|
|
7
8
|
uname: "$(uname -a)"
|
|
8
9
|
|
|
9
10
|
ruby:
|
|
10
|
-
interpreter: "`
|
|
11
|
-
version: "`
|
|
12
|
-
date: "`
|
|
13
|
-
platform: "`
|
|
14
|
-
patchlevel: "`
|
|
15
|
-
full_version: "
|
|
11
|
+
interpreter: "`echo $full_version | awk '{print $1}'`"
|
|
12
|
+
version: "`echo $full_version | awk '{print $2}'`"
|
|
13
|
+
date: "`echo $full_version | sed 's/^.*(\([0-9]\{4\}\(-[0-9][0-9]\)\{2\}\).*$/\1/'`"
|
|
14
|
+
platform: "`echo $full_version | sed 's/^.*\[//' | sed 's/\].*$//'`"
|
|
15
|
+
patchlevel: "`echo $full_version | sed 's/^.*(//' | sed 's/).*$//'`"
|
|
16
|
+
full_version: "$full_version"
|
|
16
17
|
|
|
17
18
|
homes:
|
|
18
19
|
gem: "${GEM_HOME:-'not set'}"
|
|
@@ -29,6 +30,7 @@ environment:
|
|
|
29
30
|
MY_RUBY_HOME: "$MY_RUBY_HOME"
|
|
30
31
|
IRBRC: "$IRBRC"
|
|
31
32
|
Info
|
|
33
|
+
unset full_version
|
|
32
34
|
}
|
|
33
35
|
|
|
34
36
|
function __rvm_debug {
|
|
@@ -55,28 +57,40 @@ function __rvm_debug {
|
|
|
55
57
|
}
|
|
56
58
|
|
|
57
59
|
# Logging functions based on level
|
|
60
|
+
# TODO: Allow specification of a base file name to output to.
|
|
58
61
|
function __rvm_log {
|
|
59
|
-
|
|
62
|
+
if [ ! -z "$2" ] ; then level=$1 ; shift ; else level="info" ; fi
|
|
63
|
+
message=$1
|
|
64
|
+
case "$level" in
|
|
60
65
|
debug) shift ;
|
|
61
66
|
if [ ! -z "$rvm_debug_flag" ] ; then
|
|
62
|
-
echo -e "\033[0;35m<d>\033[0m
|
|
67
|
+
echo -e "\033[0;35m<d>\033[0m $message \033[0;35m</d> \033[0m "
|
|
63
68
|
fi
|
|
64
69
|
;;
|
|
65
|
-
info) shift ; echo -e "\033[0;32m<i>\033[0m
|
|
66
|
-
warn) shift ; echo -e "\033[0;33m<w>\033[0m
|
|
67
|
-
error) shift ; echo -e "\033[0;31m<e>\033[0m
|
|
68
|
-
fail) shift ; echo -e "\033[0;31m<f>\033[0m
|
|
69
|
-
*) echo -e "
|
|
70
|
+
info) shift ; echo -e "\033[0;32m<i>\033[0m $message \033[0;32m</i> \033[0m " ;;
|
|
71
|
+
warn) shift ; echo -e "\033[0;33m<w>\033[0m $message \033[0;33m</w> \033[0m " ;;
|
|
72
|
+
error) shift ; echo -e "\033[0;31m<e>\033[0m $message \033[0;31m</e> \033[0m " ;;
|
|
73
|
+
fail) shift ; echo -e "\033[0;31m<f>\033[0m $message \033[0;31m</f> \033[0m " ; __rvm_pushpop ; return 1 ;;
|
|
74
|
+
*) echo -e "$message"
|
|
70
75
|
esac
|
|
71
76
|
}
|
|
72
77
|
|
|
78
|
+
if [ ! -z "$ZSH_VERSION" ] ; then __shell_array_start=1 ; else __shell_array_start=0 ; fi
|
|
79
|
+
__rvm_push() {
|
|
80
|
+
array=$1 ; shift ; item=$2
|
|
81
|
+
# TODO: allow loop over more arguments.
|
|
82
|
+
eval "index=\$((\${#${array}[*]} + $__shell_array_start))"
|
|
83
|
+
eval "${array}[${index}]=${item}"
|
|
84
|
+
unset array item
|
|
85
|
+
}
|
|
86
|
+
|
|
73
87
|
function __rvm_clean-path {
|
|
74
|
-
PATH
|
|
88
|
+
PATH=$(echo $PATH | tr -s ':' '\n' | awk '!($0 in a){a[$0];print}' | tr -s '\n' ':' | sed 's/:$//')
|
|
75
89
|
export PATH
|
|
76
90
|
}
|
|
77
91
|
|
|
78
92
|
function __rvm_remove-rvm-from-path {
|
|
79
|
-
PATH
|
|
93
|
+
PATH=$(echo $PATH | tr -s ':' '\n' | grep -v "\.rvm" | tr -s '\n' ':' | sed 's/:$//')
|
|
80
94
|
export PATH
|
|
81
95
|
}
|
|
82
96
|
|
|
@@ -84,15 +98,15 @@ function __rvm_gi { gem install -q --no-rdoc --no-ri $* ; }
|
|
|
84
98
|
|
|
85
99
|
function __rvm_run {
|
|
86
100
|
log_file_name="$1" ; command="$2" ; message="$3"
|
|
87
|
-
rvm_ruby_log_path
|
|
88
|
-
mkdir -p
|
|
101
|
+
rvm_ruby_log_path="${rvm_ruby_log_path:-$rvm_path/log}"
|
|
102
|
+
mkdir -p $(dirname "$rvm_ruby_log_path/$log_file_name.log")
|
|
89
103
|
|
|
90
104
|
if [ ! -z "$message" ] ; then __rvm_log "info" "$message" ; fi
|
|
91
105
|
__rvm_log "debug" "Executing: $command"
|
|
92
|
-
touch $rvm_ruby_log_path/$log_file_name.log $rvm_ruby_log_path/$log_file_name.error.log # for zsh :(
|
|
93
|
-
echo "[$(date +'%Y-%m-%d %H:%M:%S')] $command" | tee $rvm_ruby_log_path/$log_file_name.log > $rvm_ruby_log_path/$log_file_name.error.log
|
|
106
|
+
touch "$rvm_ruby_log_path/$log_file_name.log" "$rvm_ruby_log_path/$log_file_name.error.log" # for zsh :(
|
|
107
|
+
echo "[$(date +'%Y-%m-%d %H:%M:%S')] $command" | tee "$rvm_ruby_log_path/$log_file_name.log" > "$rvm_ruby_log_path/$log_file_name.error.log"
|
|
94
108
|
if [ -z "$rvm_niceness" -o "$rvm_niceness" = "0" ] ; then
|
|
95
|
-
eval "$command" >> $rvm_ruby_log_path/$log_file_name.log 2>> $rvm_ruby_log_path/$log_file_name.error.log
|
|
109
|
+
eval "$command" >> "$rvm_ruby_log_path/$log_file_name.log" 2>> "$rvm_ruby_log_path/$log_file_name.error.log"
|
|
96
110
|
else
|
|
97
111
|
eval "nice -n $rvm_niceness \`$command\`" >> $rvm_ruby_log_path/$log_file_name.log 2>> $rvm_ruby_log_path/$log_file_name.error.log
|
|
98
112
|
fi
|
|
@@ -101,11 +115,12 @@ function __rvm_run {
|
|
|
101
115
|
}
|
|
102
116
|
|
|
103
117
|
function __rvm_cleanup_variables {
|
|
104
|
-
|
|
118
|
+
__rvm_unset_ruby_variables
|
|
119
|
+
unset rvm_selected_flag rvm_action rvm_irbrc_file rvm_src_path rvm_path rvm_prefix_path rvm_gem_path rvm_command rvm_error_message rvm_gem_set_name rvm_url rvm_config_path rvm_bin_path rvm_force_flag rvm_all_flag rvm_reconfigure_flag rvm_make_flags rvm_bin_flag rvm_load_flag rvm_dump_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_head_flag rvm_tail_flag rvm_use_flag rvm_dir_flag rvm_list_flag rvm_empty_flag rvm_log_path rvm_file_name
|
|
105
120
|
}
|
|
106
121
|
|
|
107
122
|
function __rvm_unset_ruby_variables {
|
|
108
|
-
unset rvm_ruby_interpreter rvm_ruby_version rvm_ruby_repo_url rvm_ruby_package_name rvm_ruby_patch_level rvm_ruby_configure rvm_ruby_make rvm_ruby_make_install
|
|
123
|
+
unset rvm_ruby_interpreter rvm_ruby_version rvm_ruby_repo_url rvm_ruby_package_name rvm_ruby_patch_level rvm_ruby_configure rvm_ruby_make rvm_ruby_make_install rvm_ruby_revision rvm_ruby_tag rvm_major_version rvm_minor_version rvm_ruby_gem_home rvm_ruby_binary rvm_ruby_home rvm_ruby_log_path rvm_ruby_src_path rvm_ruby_irbrc rvm_selected_flag rvm_ruby_selector rvm_ruby_string rvm_ruby_src_path rvm_ruby_repo_url rvm_major_version rvm_minor_version rvm_ruby_gem_home
|
|
109
124
|
}
|
|
110
125
|
|
|
111
126
|
# TODO: root user loadng of /etc/rvmrc
|
|
@@ -114,9 +129,9 @@ function __rvm_load-rvmrc {
|
|
|
114
129
|
}
|
|
115
130
|
|
|
116
131
|
function __rvm_bin_scripts {
|
|
117
|
-
for rvm_ruby_binary in
|
|
132
|
+
for rvm_ruby_binary in $(/bin/ls $rvm_path/*/bin/ruby 2> /dev/null) ; do
|
|
118
133
|
if [ -x $rvm_ruby_binary ] ; then
|
|
119
|
-
rvm_ruby_string
|
|
134
|
+
rvm_ruby_string=$(dirname $rvm_ruby_binary | xargs dirname | xargs basename)
|
|
120
135
|
__rvm_select
|
|
121
136
|
__rvm_bin_script
|
|
122
137
|
fi
|
|
@@ -124,14 +139,14 @@ function __rvm_bin_scripts {
|
|
|
124
139
|
}
|
|
125
140
|
|
|
126
141
|
function __rvm_bin_script {
|
|
127
|
-
if [ -z "$
|
|
142
|
+
if [ -z "$rvm_selected_flag" ] ; then __rvm_select $* ; fi
|
|
128
143
|
ruby_wrapper=$(cat <<RubyWrapper
|
|
129
144
|
#!/bin/bash
|
|
130
145
|
|
|
131
|
-
GEM_HOME=$
|
|
132
|
-
GEM_PATH=$
|
|
146
|
+
GEM_HOME=$rvm_ruby_gem_home ; export GEM_HOME
|
|
147
|
+
GEM_PATH=$rvm_ruby_gem_home ; export GEM_PATH
|
|
133
148
|
MY_RUBY_HOME=$rvm_ruby_home ; export MY_RUBY_HOME
|
|
134
|
-
PATH=$rvm_ruby_home/bin:$
|
|
149
|
+
PATH=$rvm_ruby_home/bin:$rvm_ruby_gem_home/bin:\$PATH ; export PATH
|
|
135
150
|
|
|
136
151
|
exec "$rvm_ruby_binary" "\$@"
|
|
137
152
|
RubyWrapper
|
|
@@ -144,12 +159,12 @@ RubyWrapper
|
|
|
144
159
|
|
|
145
160
|
function __rvm_fetch {
|
|
146
161
|
__rvm_pushpop $rvm_archives_path
|
|
147
|
-
archive
|
|
162
|
+
archive=$(basename "$1")
|
|
148
163
|
__rvm_log "debug" "Fetching $archive"
|
|
149
164
|
# Check first if we have the correct archive
|
|
150
|
-
if [ -e $archive ] && [ -e $archive.md5 ] ; then
|
|
165
|
+
if [ -e "$archive" ] && [ -e "$archive.md5" ] ; then
|
|
151
166
|
__rvm_log "debug" "Found archive and its md5, testing correctness"
|
|
152
|
-
if [
|
|
167
|
+
if [ $(md5sum --status -c "$archive.md5") -gt 0 ] ; then
|
|
153
168
|
__rvm_log "debug" "Archive is bad, downloading"
|
|
154
169
|
download=1
|
|
155
170
|
else
|
|
@@ -166,19 +181,29 @@ function __rvm_fetch {
|
|
|
166
181
|
eval $rvm_fetch "$1"
|
|
167
182
|
result=$?
|
|
168
183
|
if [ $result -gt 0 ] ; then
|
|
184
|
+
unset retry
|
|
169
185
|
if [ $result -eq 78 ] ; then
|
|
170
186
|
__rvm_log "error" "The requested url does not exist: '$1'"
|
|
187
|
+
elif [ $result -eq 18 ] ; then
|
|
188
|
+
__rvm_log "error" "Partial file. Only a part of the file was transferred. Removing partial and re-trying."
|
|
189
|
+
rm -f "$archive"
|
|
190
|
+
retry=1
|
|
171
191
|
elif [ $result -eq 33 ] ; then
|
|
172
192
|
__rvm_log "debug" "Server does not support 'range' command, removing '$archive'"
|
|
173
|
-
rm -f $archive
|
|
193
|
+
rm -f "$archive"
|
|
194
|
+
retry=1
|
|
195
|
+
else
|
|
196
|
+
__rvm_log "error" "There was an error, please check $rvm_ruby_log_path/*.error.log"
|
|
197
|
+
fi
|
|
198
|
+
|
|
199
|
+
if [ $retry -eq 1 ] ; then
|
|
174
200
|
eval $rvm_fetch "$1"
|
|
175
201
|
result=$?
|
|
176
202
|
if [ $result -gt 0 ] ; then
|
|
177
203
|
__rvm_log "error" "There was an error, please check $rvm_ruby_log_path/*.error.log"
|
|
178
204
|
fi
|
|
179
|
-
else
|
|
180
|
-
__rvm_log "error" "There was an error, please check $rvm_ruby_log_path/*.error.log"
|
|
181
205
|
fi
|
|
206
|
+
|
|
182
207
|
fi
|
|
183
208
|
__rvm_pushpop
|
|
184
209
|
fi
|
|
@@ -202,27 +227,21 @@ function __rvm_load_defaults {
|
|
|
202
227
|
done
|
|
203
228
|
fi
|
|
204
229
|
|
|
205
|
-
|
|
206
|
-
if [ -z "$rvm_system_ps1" ] ; then
|
|
207
|
-
rvm_system_ps1=$PS1
|
|
208
|
-
__rvm_db "system_ps1" "$rvm_system_ps1"
|
|
209
|
-
fi
|
|
210
|
-
|
|
211
|
-
rvm_system_ruby=`__rvm_db "system_ruby"`
|
|
230
|
+
rvm_system_ruby=$(__rvm_db "system_ruby")
|
|
212
231
|
if [ ! -z "$rvm_system_ruby" ] ; then
|
|
213
|
-
rvm_system_ruby
|
|
232
|
+
rvm_system_ruby=$(which ruby)
|
|
214
233
|
if [ $? -ne 0 ] ; then
|
|
215
234
|
__rvm_log "info" "System ruby not found, no db will be stored."
|
|
216
235
|
else
|
|
217
236
|
__rvm_db "system_ruby" "$rvm_system_ruby"
|
|
218
237
|
|
|
219
238
|
# Now store system system & user gem paths
|
|
220
|
-
rvm_system_user_gem_path
|
|
239
|
+
rvm_system_user_gem_path=$(__rvm_db "system_user_gem_path")
|
|
221
240
|
if [ -z "$rvm_system_user_gem_path" ] ; then
|
|
222
241
|
rvm_system_user_gem_path=$( rvm system ; gem env gemdir user; )
|
|
223
242
|
__rvm_db "system_user_gem_path" "$rvm_system_user_gem_path"
|
|
224
243
|
fi
|
|
225
|
-
rvm_system_gem_path
|
|
244
|
+
rvm_system_gem_path=$(__rvm_db "system_gem_path")
|
|
226
245
|
if [ -z "$rvm_system_gem_path" ] ; then
|
|
227
246
|
rvm_system_gem_path=$( rvm system ; gem env gemdir; )
|
|
228
247
|
__rvm_db "system_gem_path" "$rvm_system_gem_path"
|
|
@@ -243,7 +262,7 @@ function __rvm_reset {
|
|
|
243
262
|
rvm_ruby_interpreter="system"
|
|
244
263
|
__rvm_select
|
|
245
264
|
|
|
246
|
-
for system_config in
|
|
265
|
+
for system_config in system_ruby system_gem_path system_user_gem_path ; do
|
|
247
266
|
__rvm_db "$system_config" "delete"
|
|
248
267
|
done ; unset system_config variable
|
|
249
268
|
|
|
@@ -275,13 +294,13 @@ function __rvm_implode {
|
|
|
275
294
|
}
|
|
276
295
|
|
|
277
296
|
function __rvm_gemdir {
|
|
278
|
-
if [ -z "$
|
|
279
|
-
mkdir -p $
|
|
280
|
-
echo $
|
|
297
|
+
if [ -z "$rvm_selected_flag" ] ; then __rvm_select $* ; fi
|
|
298
|
+
mkdir -p $rvm_ruby_gem_home
|
|
299
|
+
echo $rvm_ruby_gem_home
|
|
281
300
|
}
|
|
282
301
|
|
|
283
302
|
function __rvm_source_dir {
|
|
284
|
-
if [ -z "$
|
|
303
|
+
if [ -z "$rvm_selected_flag" ] ; then __rvm_select $* ; fi
|
|
285
304
|
if [ -z "$rvm_ruby_src_path" ] ; then
|
|
286
305
|
__rvm_log "fail" "No source directory exists for the default implementation."
|
|
287
306
|
else
|
|
@@ -292,7 +311,7 @@ function __rvm_source_dir {
|
|
|
292
311
|
# clones from source implementation/version to default
|
|
293
312
|
# TODO: Merge this into 'rvm sync'
|
|
294
313
|
function __rvm_gemdup {
|
|
295
|
-
if [ -z "$
|
|
314
|
+
if [ -z "$rvm_selected_flag" ] ; then __rvm_select $* ; fi
|
|
296
315
|
__rvm_log "debug" "$rvm_ruby_interpreter"
|
|
297
316
|
if [ "$rvm_ruby_interpreter" = "default" ] ; then
|
|
298
317
|
# TODO: ~/.rvm/default first, then system user
|
|
@@ -303,20 +322,20 @@ function __rvm_gemdup {
|
|
|
303
322
|
rvm_source_gem_path="$rvm_system_gem_path"
|
|
304
323
|
else
|
|
305
324
|
# TODO: use selector for this?
|
|
306
|
-
rvm_source_gem_path=${
|
|
325
|
+
rvm_source_gem_path=${rvm_ruby_gem_home/$rvm_ruby_interpreter/$rvm_ruby_version}
|
|
307
326
|
fi
|
|
308
327
|
__rvm_gem_sync
|
|
309
328
|
}
|
|
310
329
|
|
|
311
330
|
function __rvm_gem_sync {
|
|
312
331
|
if [ ! -z "$rvm_source_gem_path" ] ; then
|
|
313
|
-
for rvm_gem_name_version in
|
|
314
|
-
rvm_gem_name
|
|
315
|
-
rvm_gem_version
|
|
332
|
+
for rvm_gem_name_version in $rvm_source_gem_path/gems/* ; do
|
|
333
|
+
rvm_gem_name="${rvm_gem_name_version%-*}"
|
|
334
|
+
rvm_gem_version="${rvm_gem_name_version##*-}"
|
|
316
335
|
if [ -d $GEM_HOME/gems/$rvm_gem_name_version ] ; then
|
|
317
336
|
echo "$rvm_gem_name_version already installed."
|
|
318
337
|
else
|
|
319
|
-
__rvm_gi $rvm_source_gem_path/cache/$rvm_gem_name-$rvm_gem_version.gem
|
|
338
|
+
__rvm_gi "$rvm_source_gem_path/cache/$rvm_gem_name-$rvm_gem_version.gem"
|
|
320
339
|
fi
|
|
321
340
|
done
|
|
322
341
|
unset rvm_gem_name_version rvm_gem_name rvm_gem_version
|
|
@@ -358,10 +377,10 @@ function __rvm_list {
|
|
|
358
377
|
echo -e "rbx head (rubinius head, the default)\nrbx head --jit"
|
|
359
378
|
echo -e "ree 1.8.6 --head\nree (1.8.7, the default)"
|
|
360
379
|
else
|
|
361
|
-
current_ruby
|
|
380
|
+
current_ruby=$(which ruby | xargs dirname | xargs dirname | xargs basename 2> /dev/null)
|
|
362
381
|
echo -e "\nruby:\n"
|
|
363
|
-
for version in
|
|
364
|
-
string
|
|
382
|
+
for version in $(/bin/ls -l $rvm_path/ 2> /dev/null | awk '/ ruby-[1-2].*/ { print $NF }') ; do
|
|
383
|
+
string=$($rvm_path/$version/bin/ruby -v)
|
|
365
384
|
if [ "$current_ruby" = "$version" ] ; then
|
|
366
385
|
echo -e "=> $version : $string"
|
|
367
386
|
selected="1"
|
|
@@ -371,8 +390,8 @@ function __rvm_list {
|
|
|
371
390
|
done ; unset version
|
|
372
391
|
|
|
373
392
|
echo -e "\njruby:\n"
|
|
374
|
-
for version in
|
|
375
|
-
string
|
|
393
|
+
for version in $(/bin/ls -l $rvm_path/ 2> /dev/null | awk '/jruby-.*/ { print $NF }') ; do
|
|
394
|
+
string=$($rvm_path/$version/bin/ruby -v)
|
|
376
395
|
if [ "$current_ruby" = "$version" ] ; then
|
|
377
396
|
echo -e "=> $version : $string"
|
|
378
397
|
selected="1"
|
|
@@ -382,8 +401,8 @@ function __rvm_list {
|
|
|
382
401
|
done ; unset version
|
|
383
402
|
|
|
384
403
|
echo -e "\nree:\n"
|
|
385
|
-
for version in
|
|
386
|
-
string
|
|
404
|
+
for version in $(/bin/ls $rvm_path/ 2> /dev/null | awk '/ree-.*/ { print $NF }') ; do
|
|
405
|
+
string="$($rvm_path/$version/bin/ruby -v | tr "\n" ' ' )"
|
|
387
406
|
if [ "$current_ruby" = "$version" ] ; then
|
|
388
407
|
echo -e "=> $version : $string"
|
|
389
408
|
selected="1"
|
|
@@ -393,10 +412,10 @@ function __rvm_list {
|
|
|
393
412
|
done ; unset version
|
|
394
413
|
|
|
395
414
|
if [ -f $rvm_path/default -a -s $rvm_path/default ] ; then
|
|
396
|
-
version
|
|
415
|
+
version=$(grep '^MY_RUBY_HOME' ~/.rvm/default | awk -F"'" '{print $2}' | xargs basename)
|
|
397
416
|
if [ ! -z "$version" ] ; then
|
|
398
417
|
echo -e "\ndefault:\n"
|
|
399
|
-
string
|
|
418
|
+
string=$($rvm_path/$version/bin/ruby -v)
|
|
400
419
|
if [ "$current_ruby" = "$version" ] ; then
|
|
401
420
|
echo -e "=> $version : $string"
|
|
402
421
|
selected="1"
|
|
@@ -407,9 +426,9 @@ function __rvm_list {
|
|
|
407
426
|
fi
|
|
408
427
|
|
|
409
428
|
echo -e "\nsystem:\n"
|
|
410
|
-
system_version
|
|
429
|
+
system_version=$(rvm system ; ruby -v 2> /dev/null)
|
|
411
430
|
if [ ! -z "$system_version" ] ; then
|
|
412
|
-
if [ "$(
|
|
431
|
+
if [ "$($(which ruby) -v)" = "$system_version" ] ; then
|
|
413
432
|
echo -e "=> $system_version\n"
|
|
414
433
|
else
|
|
415
434
|
echo -e " $system_version\n"
|
|
@@ -419,24 +438,19 @@ function __rvm_list {
|
|
|
419
438
|
}
|
|
420
439
|
|
|
421
440
|
function __rvm_initialize {
|
|
422
|
-
rvm_fetch
|
|
441
|
+
rvm_fetch=$(which curl)
|
|
423
442
|
if [ $? -ne 0 ] ; then
|
|
424
|
-
|
|
425
|
-
if [ $? -ne 0 ] ; then
|
|
426
|
-
__rvm_log "fail" "rvm expects either curl or wget, neither seem to be in your path :("
|
|
427
|
-
else
|
|
428
|
-
rvm_fetch="wget -c " # -q for quiet
|
|
429
|
-
fi
|
|
443
|
+
__rvm_log "fail" "rvm requires curl, which does not seem to exist in your path :("
|
|
430
444
|
else
|
|
431
445
|
rvm_fetch="$rvm_fetch -O -L --create-dirs -C - " # -s for silent
|
|
432
446
|
fi
|
|
433
447
|
|
|
434
448
|
# TODO: Sanitize user input, ensure that there is a / a the end...
|
|
435
|
-
if [ "
|
|
449
|
+
if [ "$(whoami)" = "root" ] ; then
|
|
436
450
|
__rvm_log "fail" "root user support is not yet implemented."
|
|
437
|
-
|
|
451
|
+
rvm_prefix_path="${rvm_prefix_path:-/usr/local/}"
|
|
438
452
|
else
|
|
439
|
-
rvm_prefix_path
|
|
453
|
+
rvm_prefix_path="${rvm_prefix_path:-"$HOME/."}"
|
|
440
454
|
fi
|
|
441
455
|
if [ "${rvm_prefix_path#${rvm_prefix_path%?}}" = '.' -o "${rvm_prefix_path#${rvm_prefix_path%?}}" = '/' ] ; then
|
|
442
456
|
rvm_path="${rvm_prefix_path}rvm"
|
|
@@ -444,12 +458,12 @@ function __rvm_initialize {
|
|
|
444
458
|
rvm_path="${rvm_prefix_path}/rvm"
|
|
445
459
|
fi
|
|
446
460
|
rvm_archives_path="${rvm_archives_path:-"$rvm_path/archives"}"
|
|
447
|
-
|
|
448
|
-
rvm_log_path
|
|
449
|
-
rvm_bin_path
|
|
450
|
-
rvm_gem_path
|
|
451
|
-
rvm_config_path
|
|
452
|
-
rvm_temp_path
|
|
461
|
+
rvm_src_path="${rvm_src_path:-"$rvm_path/src"}"
|
|
462
|
+
rvm_log_path="${rvm_log_path:-"$rvm_path/log"}"
|
|
463
|
+
rvm_bin_path="${rvm_bin_path:-"$rvm_path/bin"}"
|
|
464
|
+
rvm_gem_path="${rvm_gem_path:-"$rvm_path/gems"}"
|
|
465
|
+
rvm_config_path="${rvm_config_path:-"$rvm_path/config"}"
|
|
466
|
+
rvm_temp_path="${rvm_temp_path:-"$rvm_path/tmp"}"
|
|
453
467
|
|
|
454
468
|
rvm_ruby_repo_url="${rvm_ruby_repo_url:-"http://svn.ruby-lang.org/repos/ruby"}"
|
|
455
469
|
# Rubinius sha1's will be available after RC1.
|
|
@@ -458,17 +472,19 @@ function __rvm_initialize {
|
|
|
458
472
|
rvm_ruby_load_path="."
|
|
459
473
|
rvm_ruby_require=""
|
|
460
474
|
|
|
475
|
+
if [ "$(uname)" = "Darwin" ] ; then rvm_archflags="${rvm_archflags:-'-arch i386 -arch x86_64'}" ; fi
|
|
476
|
+
|
|
461
477
|
__rvm_clean-path
|
|
462
478
|
rvm_result=$(echo $PATH | grep 'rvm\/bin:')
|
|
463
479
|
if [ -z $rvm_result ] ; then
|
|
464
480
|
PATH=$rvm_bin_path:$PATH ; export PATH
|
|
465
481
|
fi
|
|
466
482
|
|
|
467
|
-
mkdir -p $
|
|
483
|
+
mkdir -p $rvm_src_path $rvm_bin_path $rvm_archives_path $rvm_gem_path $rvm_temp_path
|
|
468
484
|
}
|
|
469
485
|
|
|
470
486
|
function __rvm_update {
|
|
471
|
-
if [ "$
|
|
487
|
+
if [ "$rvm_ruby_revision" = "head" -o ! -z "$rvm_self_flag" -o ! -z "$rvm_update_flag" ] ; then
|
|
472
488
|
__rvm_version
|
|
473
489
|
__rvm_update_rvm
|
|
474
490
|
__rvm_version
|
|
@@ -480,12 +496,12 @@ function __rvm_update {
|
|
|
480
496
|
}
|
|
481
497
|
|
|
482
498
|
function __rvm_update_rvm {
|
|
483
|
-
mkdir -p $
|
|
484
|
-
if [ "$
|
|
485
|
-
if [ -d $
|
|
486
|
-
cd $
|
|
499
|
+
mkdir -p $rvm_src_path
|
|
500
|
+
if [ "$rvm_ruby_revision" = "head" ] ; then
|
|
501
|
+
if [ -d $rvm_src_path/rvm/.git ] ; then
|
|
502
|
+
cd $rvm_src_path/rvm/ && git pull origin master && ./scripts/install
|
|
487
503
|
else
|
|
488
|
-
cd $
|
|
504
|
+
cd $rvm_src_path && git clone git://github.com/wayneeseguin/rvm.git && cd rvm/ && ./install
|
|
489
505
|
fi
|
|
490
506
|
else
|
|
491
507
|
# TODO: rvm_install_path:
|
|
@@ -521,8 +537,7 @@ function __rvm_reboot {
|
|
|
521
537
|
source ~/.rvm/scripts/rvm
|
|
522
538
|
else
|
|
523
539
|
__rvm_log "info" "Carry on then..."
|
|
524
|
-
fi
|
|
525
|
-
unset response
|
|
540
|
+
fi ; unset response
|
|
526
541
|
}
|
|
527
542
|
|
|
528
543
|
function __rvm_reload {
|
|
@@ -563,7 +578,7 @@ function __rvm_ruby_do {
|
|
|
563
578
|
else
|
|
564
579
|
__rvm_log "warn" "'$rvm_ruby_home/bin/$binary' either does not exist or is not executable? :("
|
|
565
580
|
fi
|
|
566
|
-
|
|
581
|
+
__rvm_unset_ruby_variables
|
|
567
582
|
}
|
|
568
583
|
|
|
569
584
|
function __rvm_do {
|
|
@@ -619,13 +634,9 @@ function __rvm_summary {
|
|
|
619
634
|
function __rvm_yaml {
|
|
620
635
|
export successes errors statuses
|
|
621
636
|
yaml="totals:\n rubies: ${#rubies[*]}\n successes: ${#successes[*]}\n errors: ${#errors[*]}\nsuccesses:"
|
|
622
|
-
for var in ${successes[*]} ; do
|
|
623
|
-
yaml="$yaml\n - $var"
|
|
624
|
-
done
|
|
637
|
+
for var in ${successes[*]} ; do yaml="$yaml\n - $var" ; done
|
|
625
638
|
yaml="$yaml\nerrors:"
|
|
626
|
-
for var in ${errors[*]} ; do
|
|
627
|
-
yaml="$yaml\n - $var"
|
|
628
|
-
done
|
|
639
|
+
for var in ${errors[*]} ; do yaml="$yaml\n - $var" ; done
|
|
629
640
|
yaml="$yaml\nrubies:"
|
|
630
641
|
total=${#rubies[*]}
|
|
631
642
|
if [ ! -z "$ZSH_VERSION" ] ; then array_start=1 ; else array_start=0 ; fi
|
|
@@ -662,120 +673,17 @@ function __rvm_json {
|
|
|
662
673
|
}
|
|
663
674
|
|
|
664
675
|
function __rvm_benchmark {
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
)"
|
|
671
|
-
echo -e "$rvm_code" > $rvm_temp_path/$$.rb
|
|
672
|
-
cat $rvm_ruby_file >> $rvm_temp_path/$$.rb
|
|
673
|
-
echo -e "\n end \nend\n" >> $rvm_temp_path/$$.rb
|
|
674
|
-
unset rvm_code
|
|
676
|
+
code="require \"benchmark\" \n Benchmark.bmbm do |benchmark| \n benchmark.report(\"${rvm_ruby_file}\") do \n"
|
|
677
|
+
echo -e "$code" > "$rvm_temp_path/$$.rb"
|
|
678
|
+
unset code
|
|
679
|
+
cat $rvm_ruby_file >> "$rvm_temp_path/$$.rb"
|
|
680
|
+
echo -e "\n end \nend\n" >> "$rvm_temp_path/$$.rb"
|
|
675
681
|
rvm_ruby_args="$rvm_temp_path/$$.rb"
|
|
676
682
|
rvm_action="ruby"
|
|
677
683
|
if [ ! -z "$rvm_debug_flag" ] ; then echo -e "$rvm_temp_path/$$.rb:\n$(cat $rvm_temp_path/$$.rb)" ; fi
|
|
678
684
|
__rvm_do
|
|
679
685
|
}
|
|
680
686
|
|
|
681
|
-
__rvm_gemset_delete () {
|
|
682
|
-
if [ -z "$rvm_selected" ] ; then __rvm_select $* ; fi
|
|
683
|
-
|
|
684
|
-
if [ ! -z $rvm_gem_set_name ] ; then
|
|
685
|
-
gemdir="$rvm_gem_path/$rvm_ruby_interpreter/$rvm_ruby_version-$rvm_gem_set_name"
|
|
686
|
-
if [ -d $gemdir ] ; then
|
|
687
|
-
__rvm_log "warn" "Are you SURE you wish to remove the installed gemset '$rvm_gem_set_name ' ($gemdir)?"
|
|
688
|
-
echo -n "(anything other than 'yes' will cancel) > "
|
|
689
|
-
read response
|
|
690
|
-
if [ "$response" = "yes" ] ; then
|
|
691
|
-
rm -rf $gemdir
|
|
692
|
-
else
|
|
693
|
-
__rvm_log "info" "Not doing anything, phew... close call that one eh?"
|
|
694
|
-
fi
|
|
695
|
-
else
|
|
696
|
-
__rvm_log "info" "$gemdir does not exist, dirtywork alredy done."
|
|
697
|
-
fi
|
|
698
|
-
unset gemdir
|
|
699
|
-
else
|
|
700
|
-
__rvm_log "error" "A gemset name must be specified in order to delete a gemset."
|
|
701
|
-
fi
|
|
702
|
-
}
|
|
703
|
-
|
|
704
|
-
function __rvm_gemset_dump {
|
|
705
|
-
rvm_gem_set_name=${rvm_gem_set_name:-"default"}
|
|
706
|
-
rvm_file_name=${rvm_file_name:-$rvm_gem_set_name}
|
|
707
|
-
|
|
708
|
-
echo "# $rvm_gem_set_name.gemset generated gem dump file. Note that any env variable settings will be missing. Append these after using a ';' field separator" > $rvm_gem_set_name.gemset
|
|
709
|
-
|
|
710
|
-
for gem in $(gem list | sed 's/[\(|\)]//g' | sed 's/, /,/g' | tr ' ' ';') ; do
|
|
711
|
-
name=`echo $gem | awk -F';' '{print $1}'`
|
|
712
|
-
if [ -z "$rvm_latest_flag" ] ; then
|
|
713
|
-
versions=`echo $gem | awk -F';' '{print $2}' | sed 's/,/ /g'`
|
|
714
|
-
for version in $versions ; do
|
|
715
|
-
echo "$name -v$version" >> $rvm_file_name
|
|
716
|
-
done ; unset version versions
|
|
717
|
-
else
|
|
718
|
-
echo "$name" >> $rvm_file_name
|
|
719
|
-
fi ; unset name
|
|
720
|
-
done ; unset file_name
|
|
721
|
-
}
|
|
722
|
-
|
|
723
|
-
function __rvm_gemset_load {
|
|
724
|
-
rvm_gem_set_name=${rvm_gem_set_name:-"default"}
|
|
725
|
-
rvm_file_name=${rvm_file_name:-$rvm_gem_set_name}
|
|
726
|
-
|
|
727
|
-
echo "Loading $rvm_file_name file..."
|
|
728
|
-
rvm_ruby_gem_list=`/bin/ls $rvm_gem_home/specifications/ 2> /dev/null | sed 's/\.gemspec$//' 2> /dev/null`
|
|
729
|
-
while read line
|
|
730
|
-
do # Keep this on 2nd line :( bash fail.
|
|
731
|
-
# TODO: Switch to a different field separator than ; to allow for evals
|
|
732
|
-
gem=`echo $line | awk -F';' '{print $1}'`
|
|
733
|
-
gem_prefix=`echo $line | awk -F';' '{print $2}'`
|
|
734
|
-
gem_name=`echo $gem | awk '{print $1}'`
|
|
735
|
-
gem_version=`echo $gem | sed 's/^.*-v[=]*[ ]*//' | awk '{print $1}'`
|
|
736
|
-
gem_postfix=`echo $gem | sed "s/$gem_name//" | sed "s/-v[=]*[ ]*$gem_version//"`
|
|
737
|
-
|
|
738
|
-
if [ -z "$gem_version" ] ; then # no version
|
|
739
|
-
gem_file_name="${gem_name}*.gem"
|
|
740
|
-
else # version
|
|
741
|
-
gem_file_name="$gem_name-$gem_version.gem"
|
|
742
|
-
fi
|
|
743
|
-
|
|
744
|
-
cache_file=`/bin/ls -t $rvm_gem_path/*/*/cache/${gem_file_name}* 2> /dev/null | head -n1`
|
|
745
|
-
if [ -z "$cache_file" ] ; then
|
|
746
|
-
if [ -z "$gem_version" ] ; then
|
|
747
|
-
gem="$gem_name"
|
|
748
|
-
else
|
|
749
|
-
gem="$gem_name -v $gem_version"
|
|
750
|
-
fi
|
|
751
|
-
else # cached
|
|
752
|
-
gem_file_name=`basename $cache_file`
|
|
753
|
-
gem_string=`echo "$gem_file_name" | sed 's/\.gem$//'`
|
|
754
|
-
if [ ! -z "`echo "$rvm_ruby_gem_list" | awk "/$gem_string/{print}"`" ] ; then
|
|
755
|
-
if [ ! -z "$rvm_force_flag" ] ; then
|
|
756
|
-
cp $cache_file $rvm_temp_path/$gem_file_name
|
|
757
|
-
gem="$rvm_temp_path/$gem_file_name" # install as a named local gem
|
|
758
|
-
else
|
|
759
|
-
unset gem
|
|
760
|
-
__rvm_log "info" "$gem_name $gem_version is already installed, skipping. (use --force to force these to install regardless)"
|
|
761
|
-
fi
|
|
762
|
-
else
|
|
763
|
-
gem="$cache_file"
|
|
764
|
-
fi
|
|
765
|
-
fi
|
|
766
|
-
|
|
767
|
-
if [ ! -z "$gem" ] ; then
|
|
768
|
-
# TODO: Set vars if fourth field is non-empty (means that there are conditional statements to execute in the gem install line.
|
|
769
|
-
if [ -z "$vars" ] ; then
|
|
770
|
-
GEM_HOME="$rvm_gem_home" GEM_PATH="$rvm_gem_home" $gem_prefix $rvm_ruby_home/bin/gem install --no-rdoc --no-ri -q $gem $gem_postfix
|
|
771
|
-
else
|
|
772
|
-
eval "GEM_HOME='$rvm_gem_home' GEM_PATH='$rvm_gem_home' $gem_prefix $rvm_ruby_home/bin/gem install --no-rdoc --no-ri -q $gem $gem_postfix"
|
|
773
|
-
fi
|
|
774
|
-
fi
|
|
775
|
-
unset gem gem_prefix gem_name gem_version gem_file_name gem_postfix cache_file gem_file_name gem_string
|
|
776
|
-
done < <(awk '/^[a-zA-Z]/{print}' "$rvm_file_name")
|
|
777
|
-
}
|
|
778
|
-
|
|
779
687
|
function __rvm_irbrc {
|
|
780
688
|
if [ -d $rvm_ruby_home -a ! -s $rvm_ruby_irbrc ] ; then
|
|
781
689
|
rvm_ruby_irbrc_file=$(cat <<-Config
|
|
@@ -829,7 +737,7 @@ function __rvm_state {
|
|
|
829
737
|
|
|
830
738
|
function __rvm_inspect {
|
|
831
739
|
for binary in $rvm_ruby_args ; do
|
|
832
|
-
actual_file
|
|
740
|
+
actual_file=$(which $binary)
|
|
833
741
|
__rvm_log "info" "$actual_file:"
|
|
834
742
|
if [ ! -z "$rvm_shebang_flag" ] ; then cat $actual_file | head -n 1 ; fi
|
|
835
743
|
if [ ! -z "$rvm_env_flag" ] ; then cat $actual_file | awk '/ENV/' ; fi
|
|
@@ -844,15 +752,15 @@ function __rvm_inspect {
|
|
|
844
752
|
# ruby supporting libraries:
|
|
845
753
|
#
|
|
846
754
|
function __rvm_readline_install {
|
|
847
|
-
__rvm_pushpop $
|
|
755
|
+
__rvm_pushpop $rvm_src_path
|
|
848
756
|
package="readline" ; version="5.2" ; archive_format="tar.gz"
|
|
849
757
|
# TODO: Figure out how to list, grab and apply the patches
|
|
850
758
|
__rvm_log "info" "Retrieving $package-$version.$archive_format"
|
|
851
|
-
__rvm_fetch ftp://ftp.gnu.org/gnu/readline/$package-$version.$archive_format"
|
|
852
|
-
__rvm_run "$package/extract" "tar zxf $rvm_archives_path/$package-$version.$archive_format -C $
|
|
853
|
-
cd $
|
|
854
|
-
if [ "
|
|
855
|
-
sdk
|
|
759
|
+
__rvm_fetch "ftp://ftp.gnu.org/gnu/readline/$package-$version.$archive_format"
|
|
760
|
+
__rvm_run "$package/extract" "tar zxf $rvm_archives_path/$package-$version.$archive_format -C $rvm_src_path" "Extracting $package-$version.$archive_format"
|
|
761
|
+
cd "$rvm_src_path/$package-$version"
|
|
762
|
+
if [ "$(uname)" = "Darwin" ] ; then
|
|
763
|
+
sdk=$(ls -t /Developer/SDKs/ | head -n 1)
|
|
856
764
|
CFLAGS="-isysroot /Developer/SDKs/$sdk -arch i386 -arch x86_64"
|
|
857
765
|
LDFLAGS="-Wl,-syslibroot,/Developer/SDKs/$sdk -arch i386 -arch x86_64"
|
|
858
766
|
export CFLAGS LDFLAGS
|
|
@@ -866,15 +774,32 @@ function __rvm_readline_install {
|
|
|
866
774
|
}
|
|
867
775
|
|
|
868
776
|
function __rvm_iconv_install {
|
|
869
|
-
__rvm_pushpop $
|
|
777
|
+
__rvm_pushpop $rvm_src_path
|
|
870
778
|
package="libiconv" ; version=1.13.1 ; archive_format="tar.gz"
|
|
871
779
|
__rvm_log "info" "Retrieving $package-$version.$archive_format"
|
|
872
|
-
__rvm_fetch http://ftp.gnu.org/pub/gnu/libiconv/$package-$version.$archive_format"
|
|
873
|
-
__rvm_run "$package/extract" "tar zxf $rvm_archives_path/$package-$version.$archive_format -C $
|
|
874
|
-
cd $
|
|
780
|
+
__rvm_fetch "http://ftp.gnu.org/pub/gnu/libiconv/$package-$version.$archive_format"
|
|
781
|
+
__rvm_run "$package/extract" "tar zxf $rvm_archives_path/$package-$version.$archive_format -C $rvm_src_path" "Extracting $package-$version.$archive_format"
|
|
782
|
+
cd "$rvm_src_path/$package-$version"
|
|
875
783
|
__rvm_run "$package/configure" "./configure --prefix=$rvm_path/usr --disable-static --enable-shared" "Configuring $package."
|
|
876
784
|
__rvm_run "$package/make" "/usr/bin/make $rvm_make_flags" "Compiling $package"
|
|
877
785
|
__rvm_run "$package/make.install" "/usr/bin/make install" "Installing $package to $rvm_path/usr"
|
|
878
786
|
__rvm_pushpop
|
|
879
787
|
}
|
|
880
788
|
|
|
789
|
+
__rvm_monitor() {
|
|
790
|
+
if [ -d test/ ] ; then
|
|
791
|
+
:
|
|
792
|
+
elif [ -d spec/ ] ; then
|
|
793
|
+
:
|
|
794
|
+
fi
|
|
795
|
+
#
|
|
796
|
+
# timestamp() {
|
|
797
|
+
# if [ "$(uname)" = "Darwin" ] ; then
|
|
798
|
+
# $(stat -c "%Y" $1)
|
|
799
|
+
# else
|
|
800
|
+
# echo $(stat -f "%m" $1)
|
|
801
|
+
# fi
|
|
802
|
+
# }
|
|
803
|
+
#
|
|
804
|
+
}
|
|
805
|
+
|