wayneeseguin-rvm 0.0.31 → 0.0.35
Sign up to get free protection for your applications and to get access to all the features.
- data/config/db +20 -0
- data/rvm.gemspec +8 -4
- data/scripts/rvm +10 -1207
- data/scripts/rvm-cli +230 -0
- data/scripts/rvm-install +2 -7
- data/scripts/rvm-ruby-installer +346 -0
- data/scripts/rvm-selector +188 -0
- data/scripts/rvm-update +12 -13
- data/scripts/rvm-utility +459 -0
- metadata +8 -5
- data/config/cache +0 -23
data/config/db
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
niceness=0
|
2
|
+
ruby_repo_url=http://svn.ruby-lang.org/repos/ruby
|
3
|
+
rubinius_repo_url=git://github.com/evanphx/rubinius.git
|
4
|
+
macruby_repo_url=http://svn.macosforge.org/repository/ruby/MacRuby
|
5
|
+
jruby_repo_url=git://kenai.com/jruby~main
|
6
|
+
ruby_configure=--enable-shared
|
7
|
+
interpreter=ruby
|
8
|
+
ruby_version=1.8.6
|
9
|
+
ruby_patchlevel=383
|
10
|
+
jruby_version=1.3.1
|
11
|
+
ree_interpreter=ruby-enterprise
|
12
|
+
ree_version=1.8.6
|
13
|
+
ree_patch_level=20090610
|
14
|
+
macruby_version=2009-09-04
|
15
|
+
ruby_version=1.8.6
|
16
|
+
ruby_1.9.1_patch_level=p243
|
17
|
+
ruby_1.9.2_patch_level=preview1
|
18
|
+
ruby_1.8.5_patch_level=p115
|
19
|
+
ruby_1.8.6_patch_level=p383
|
20
|
+
ruby_1.8.7_patch_level=p174
|
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 = "0.0.
|
8
|
+
s.version = "0.0.35"
|
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{2009-09-
|
12
|
+
s.date = %q{2009-09-05}
|
13
13
|
s.description = %q{Manages Ruby interpreter installations and switching between them.}
|
14
14
|
s.email = %q{wayneeseguin@gmail.com}
|
15
15
|
s.executables = ["rvm-install", "rvm-update"]
|
@@ -20,13 +20,17 @@ Gem::Specification.new do |s|
|
|
20
20
|
"INSTALL",
|
21
21
|
"LICENCE",
|
22
22
|
"README",
|
23
|
-
"config/
|
23
|
+
"config/db",
|
24
24
|
"examples/rvmrc",
|
25
25
|
"lib/rvm.rb",
|
26
26
|
"rvm.gemspec",
|
27
27
|
"scripts/rvm",
|
28
|
+
"scripts/rvm-cli",
|
28
29
|
"scripts/rvm-install",
|
29
|
-
"scripts/rvm-
|
30
|
+
"scripts/rvm-ruby-installer",
|
31
|
+
"scripts/rvm-selector",
|
32
|
+
"scripts/rvm-update",
|
33
|
+
"scripts/rvm-utility"
|
30
34
|
]
|
31
35
|
s.homepage = %q{http://github.com/wayneeseguin/rvm}
|
32
36
|
s.rdoc_options = ["--inline-source", "--charset=UTF-8"]
|
data/scripts/rvm
CHANGED
@@ -1,1214 +1,17 @@
|
|
1
1
|
#!/bin/bash
|
2
2
|
|
3
3
|
#
|
4
|
-
#
|
4
|
+
# rvm : Ruby Version Manager
|
5
|
+
# http://rvm.beginrescueend.com
|
6
|
+
# http://gitub.com/wayneeseguin/rvm
|
5
7
|
#
|
6
8
|
|
7
|
-
|
8
|
-
|
9
|
-
#
|
10
|
-
function __rvm_meta {
|
11
|
-
rvm_meta_author="Wayne E. Seguin"
|
12
|
-
rvm_meta_author_email="wayneeseguin@gmail.com"
|
13
|
-
rvm_meta_website="http://rvm.beginrescueend.com/"
|
14
|
-
rvm_meta_version="0.0.31"
|
15
|
-
rvm_meta_updated="2009.09.03"
|
16
|
-
}
|
17
|
-
|
18
|
-
function __rvm_version { __rvm_meta ; echo "rvm $rvm_meta_version ($rvm_meta_updated) [$rvm_meta_website]" ; }
|
19
|
-
|
20
|
-
function __rvm_usage {
|
21
|
-
|
22
|
-
__rvm_meta
|
23
|
-
|
24
|
-
cat <<-Usage
|
25
|
-
|
26
|
-
rvm ${rvm_meta_version} ${rvm_meta_website} by ${rvm_meta_author} (${rvm_meta_author_email})
|
27
|
-
|
28
|
-
Usage:
|
29
|
-
|
30
|
-
rvm Action [Implementation] [Options]
|
31
|
-
|
32
|
-
Action:
|
33
|
-
|
34
|
-
* usage - Show this usage information
|
35
|
-
use - Switch to using a specific ruby version (new login shell)
|
36
|
-
info - Show information for current ruby
|
37
|
-
list - Show currently installed versions
|
38
|
-
gemdir - Switch to gem directory for installation (new login shell)
|
39
|
-
srcdir - Switch to src directory for the current ruby installation
|
40
|
-
gemdup - Clone source version gems to current version
|
41
|
-
(highly expiramental) Example: rvm gemdup ~/.gem/ruby/1.8/
|
42
|
-
install - Install a ruby version, default is from source
|
43
|
-
uninstall - Uninstall a ruby version
|
44
|
-
reset - Remove default and current settings, exit the shell.
|
45
|
-
(If you experience odd behavior try this first)
|
46
|
-
rubydo - Used with -f to run a ruby file against specified or all rubies
|
47
|
-
debug - Emit environment & configuration information for *current* ruby
|
48
|
-
|
49
|
-
reload - Reload rvm source itself (useful after changing rvm source)
|
50
|
-
implode - Removes all ruby installations it manages, everything in ~/.rvm
|
51
|
-
update - Upgrades rvm to the latest version.
|
52
|
-
|
53
|
-
Implementation:
|
54
|
-
|
55
|
-
* ruby - MRI/YARV Ruby (The Standard), defaults to 1.8.6
|
56
|
-
jruby - jRuby
|
57
|
-
rubinius - Rubinius
|
58
|
-
ree - Ruby Enterprise Edition
|
59
|
-
system - Use the system ruby (eg. pre-rvm state)
|
60
|
-
default - Use rvm set default ruby and system if it hasn't been set.
|
61
|
-
|
62
|
-
Options:
|
63
|
-
|
64
|
-
-v|--version - Ruby Package Version, defaults to 'latest'
|
65
|
-
-l|--level - Patch level for the specified Ruby version
|
66
|
-
-p|--prefix - Package and source directory prefix, with trailing slash!
|
67
|
-
Default is a users home directory and /usr/local/ for root
|
68
|
-
-c|--configure - Options for source compile (default: --enable-shared=true)
|
69
|
-
-a|--archives - Directory to place downladed files into (~/.rvm/archives/)
|
70
|
-
-n|--nice - Niceness level (default: 0)
|
71
|
-
-m|--gem-set - Named gem set for switching between different gem sets
|
72
|
-
--rm-gem-set - Removes a named gemset.
|
73
|
-
|
74
|
-
-l|--level - Specify a patch level to use
|
75
|
-
-t|--tag -
|
76
|
-
-r|--rev - Specify the repository revision # to use or 'head' for
|
77
|
-
|
78
|
-
-P|--prefix - Sets the prefix path for installs to be installed to
|
79
|
-
-B|--bin - Specify path for binaries to be placed
|
80
|
-
-S|--source - Specify src directory to use
|
81
|
-
-A|--archive - Specify archive directory to use (tabralls / zips)
|
82
|
-
-G|--gems - Specify root gem path to use
|
83
|
-
-C|--configure - Specify custom configure options, comma separated
|
84
|
-
-M|--make - Specify a custom make command
|
85
|
-
-I|--make-install - " a custom make install command
|
86
|
-
|
87
|
-
-n|--nice - Specify a process niceness (for slow computers)
|
88
|
-
-f|--file - Specify a ruby file to run with 'rubydo' command
|
89
|
-
-h|--help - Emit this output and exit
|
90
|
-
-d|--default - Set the default Ruby to a specified version
|
91
|
-
-m|--gem-set - Use a named gem set instead of the default set.
|
92
|
-
--all - Used with 'rvm list' to list "most" installable versions.
|
93
|
-
--rm-gem-set - Remove a named gem set
|
94
|
-
--jit - Enable JIT for the Rubinius build
|
95
|
-
--force - Force install, removes old install & source directories.
|
96
|
-
--set-prompt - Set prompt to have the selected ruby prepended.
|
97
|
-
--debug|--trace - Toggle debug mode on for very verbose output.
|
98
|
-
|
99
|
-
Resources:
|
100
|
-
|
101
|
-
http://rvm.beginrescueend.com/
|
102
|
-
https://www.pivotaltracker.com/projects/26822
|
103
|
-
|
104
|
-
Usage
|
105
|
-
|
106
|
-
}
|
107
|
-
|
108
|
-
# Logging functions based on level
|
109
|
-
function __rvm_log {
|
110
|
-
|
111
|
-
case "$1" in
|
112
|
-
debug) shift ; echo -e "\n\033[0;35m <d> $* \033[0m" ;;
|
113
|
-
info) shift ; echo -e "\n\033[0;32m <i> $* \033[0m" ;;
|
114
|
-
warn) shift ; echo -e "\n\033[0;33m <w> $* \033[0m" ;;
|
115
|
-
fail) shift ; echo -e "\n\033[0;31m <e> $* \033[0m" ; popd 2> /dev/null ; return 1 ;;
|
116
|
-
*) echo -e "$*"
|
117
|
-
esac
|
118
|
-
}
|
119
|
-
|
120
|
-
function __rvm_clean-path {
|
121
|
-
PATH=`echo $PATH | tr -s ':' '\n' | awk '!($0 in a){a[$0];print}' | tr -s '\n' ':' | sed 's/:$//'`
|
122
|
-
export PATH
|
123
|
-
}
|
124
|
-
|
125
|
-
function __rvm_remove-from-path {
|
126
|
-
PATH=`echo $PATH | tr -s ':' '\n' | grep -v "\.rvm" | tr -s '\n' ':' | sed 's/:$//'`
|
127
|
-
export PATH
|
128
|
-
}
|
129
|
-
|
130
|
-
function __rvm_gi { gem install -q --no-rdoc --no-ri $* ; }
|
131
|
-
function __rvm_gems-install { for gem in $* ; do __rvm_gi $gem ; done }
|
132
|
-
|
133
|
-
function __rvm_set-defaults {
|
134
|
-
|
135
|
-
# TODO: Store defaults in "defaults/" dir.
|
136
|
-
if [ ! -s $rvm_install_path/default ] ; then
|
137
|
-
for variable in rvm_prompt RUBY_VERSION GEM_HOME MY_RUBY_HOME PATH ; do
|
138
|
-
eval value=\$${variable}
|
139
|
-
if [ -z "$value" ] ; then
|
140
|
-
echo "unset ${variable}" >> $rvm_install_path/default
|
141
|
-
else
|
142
|
-
eval "export $variable"
|
143
|
-
eval value=\$${variable}
|
144
|
-
echo "${variable}='$value' ; export ${variable}" >> $rvm_install_path/default
|
145
|
-
fi
|
146
|
-
done
|
147
|
-
fi
|
148
|
-
|
149
|
-
if [ -s $rvm_install_path/default_path ] ; then
|
150
|
-
rvm_default_path=`cat $rvm_install_path/default_path`
|
151
|
-
else
|
152
|
-
__rvm_clean-path # Clean the path the first time we compute default path.
|
153
|
-
__rvm_remove-from-path
|
154
|
-
echo $PATH > $rvm_install_path/default_path
|
155
|
-
rvm_default_path=$PATH
|
156
|
-
fi
|
157
|
-
|
158
|
-
rvm_default_ps1=`__rvm_cache rvm_default_ps1`
|
159
|
-
if [ -z "$rvm_default_ps1" ] ; then
|
160
|
-
rvm_default_ps1=$PS1
|
161
|
-
__rvm_cache "rvm_default_ps1" "$rvm_default_ps1"
|
162
|
-
fi
|
163
|
-
|
164
|
-
if [ -s $rvm_install_path/default_user_gem_path ] ; then
|
165
|
-
rvm_default_user_gem_path=`cat $rvm_install_path/default_user_gem_path`
|
166
|
-
else
|
167
|
-
ruby -r rubygems -e "puts Gem::default_path.compact.first" > $rvm_install_path/default_user_gem_path
|
168
|
-
fi
|
169
|
-
|
170
|
-
if [ -s $rvm_install_path/default_system_gem_path ] ; then
|
171
|
-
rvm_default_system_gem_path=`cat $rvm_install_path/default_system_gem_path`
|
172
|
-
else
|
173
|
-
ruby -r rubygems -e "puts Gem::default_path.compact[1] || Gem::default_path.compact.first" > $rvm_install_path/default_system_gem_path
|
174
|
-
fi
|
175
|
-
|
176
|
-
if [ -s $rvm_install_path/default_system_ruby ] ; then
|
177
|
-
default_system_ruby=`cat $rvm_install_path/default_system_ruby`
|
178
|
-
else
|
179
|
-
default_system_ruby=`which ruby`
|
180
|
-
echo $default_system_ruby > $rvm_install_path/default_system_ruby
|
181
|
-
fi
|
182
|
-
|
183
|
-
}
|
184
|
-
|
185
|
-
function __rvm_initialize {
|
186
|
-
|
187
|
-
rvm_fetch=`which curl`
|
188
|
-
if [ $? -ne 0 ] ; then
|
189
|
-
rvm_fetch=`which wget`
|
190
|
-
if [ $? -ne 0 ] ; then
|
191
|
-
rvm_fetch="wget -q -c "
|
192
|
-
else
|
193
|
-
__rvm_log "fail" "rvm expects either curl or wget, neither seem to be in your path :("
|
194
|
-
fi
|
195
|
-
else
|
196
|
-
rvm_fetch="$rvm_fetch -O -L -s -C - "
|
197
|
-
fi
|
198
|
-
|
199
|
-
rvm_niceness=${rvm_niceness:-0}
|
200
|
-
|
201
|
-
# TODO: Sanitize user input, ensure that there is a / a the end...
|
202
|
-
if [ "`whoami`" = "root" ] ; then
|
203
|
-
__rvm_log "fail" "root user support is not yet implemented."
|
204
|
-
#rvm_prefix_path=${rvm_prefix_path:-/usr/local/}
|
205
|
-
else
|
206
|
-
rvm_prefix_path=${rvm_prefix_path:-"$HOME/."}
|
207
|
-
fi
|
208
|
-
if [ "${rvm_prefix_path#${rvm_prefix_path%?}}" = '.' -o "${rvm_prefix_path#${rvm_prefix_path%?}}" = '/' ] ; then
|
209
|
-
rvm_install_path="${rvm_prefix_path}rvm"
|
210
|
-
else
|
211
|
-
rvm_install_path="${rvm_prefix_path}/rvm"
|
212
|
-
fi
|
213
|
-
rvm_archives_path="${rvm_archives_path:-"${rvm_install_path}/archives"}"
|
214
|
-
rvm_source_path="${rvm_source_path:-"${rvm_install_path}/src"}"
|
215
|
-
rvm_log_path=${rvm_log_path:-"${rvm_install_path}/log"}
|
216
|
-
rvm_bin_path=${rvm_bin_path:-"${rvm_install_path}/bin"}
|
217
|
-
rvm_gem_path=${rvm_gem_path:-"${rvm_install_path}/gems"}
|
218
|
-
rvm_config_path=${rvm_config_path:-"${rvm_install_path}/config"}
|
219
|
-
|
220
|
-
rvm_ruby_repo_url="${rvm_ruby_repo_url:-"http://svn.ruby-lang.org/repos/ruby"}"
|
221
|
-
# Rubinius sha1's will be available after RC1.
|
222
|
-
rvm_rubinius_repo_url="${rvm_rubinius_repo_url:-"git://github.com/evanphx/rubinius.git"}"
|
223
|
-
#rvm_macruby_repo_url="${rvm_macruby_repo_url:-"http://svn.macosforge.org/repository/ruby/MacRuby"}"
|
224
|
-
rvm_macruby_repo_url="${rvm_macruby_repo_url:-"git://github.com/masterkain/macruby.git"}"
|
225
|
-
rvm_jruby_repo_url="${rvm_jruby_repo_url:-"git://kenai.com/jruby~main"}"
|
226
|
-
|
227
|
-
__rvm_clean-path
|
228
|
-
rvm_result=$(echo $PATH | grep 'rvm\/bin:')
|
229
|
-
if [ -z $rvm_result ] ; then
|
230
|
-
PATH=$rvm_bin_path:$PATH ; export PATH
|
231
|
-
fi
|
232
|
-
|
233
|
-
mkdir -p $rvm_source_path $rvm_bin_path $rvm_archives_path
|
234
|
-
}
|
235
|
-
|
236
|
-
function __rvm_fetch {
|
237
|
-
|
238
|
-
pushd $rvm_archives_path > /dev/null
|
239
|
-
eval $rvm_fetch "$1"
|
240
|
-
popd 2> /dev/null
|
241
|
-
|
242
|
-
}
|
243
|
-
|
244
|
-
function __rvm_install-source {
|
245
|
-
|
246
|
-
if [ -z "$rvm_selected" ] ; then __rvm_select $* ; fi
|
247
|
-
|
248
|
-
__rvm_log "info" "Installing Ruby from source to: $rvm_ruby_home"
|
249
|
-
mkdir -p $rvm_ruby_log_path
|
250
|
-
|
251
|
-
pushd $rvm_source_path > /dev/null
|
252
|
-
|
253
|
-
if [ ! -z "$rvm_force" ] ; then
|
254
|
-
rm -rf $rvm_ruby_home
|
255
|
-
rm -rf $rvm_ruby_src_path
|
256
|
-
fi
|
257
|
-
|
258
|
-
if [ -z "$rvm_ruby_tag" -a -z "$rvm_ruby_rev" ] ; then
|
259
|
-
if [ ! -d $rvm_ruby_src_path ] ; then
|
260
|
-
rvm_url="${rvm_url:-"ftp://ftp.ruby-lang.org/pub/ruby/1.$rvm_major_version/$rvm_ruby_package_name.tar.gz"}"
|
261
|
-
__rvm_log "info" "\tDownloading $rvm_ruby_package_name, this may take a while depending on your connection..."
|
262
|
-
__rvm_fetch $rvm_url
|
263
|
-
if [ $? -gt 0 ] ; then __rvm_log "error" "There was an error, please check $rvm_ruby_log_path/*.error.log" ; popd 2> /dev/null ; return 1 ; fi
|
264
|
-
|
265
|
-
__rvm_log "info" "\tExtracting $rvm_ruby_package_name ..."
|
266
|
-
mkdir -p $rvm_ruby_src_path
|
267
|
-
nice -n $rvm_niceness tar xzf $rvm_archives_path/$rvm_ruby_package_name.tar.gz -C $rvm_source_path
|
268
|
-
fi
|
269
|
-
else
|
270
|
-
__rvm_log "info" "\tRetrieving Ruby from $rvm_url"
|
271
|
-
if [ ! -z "`echo $rvm_url | grep '^git'`" ] ; then
|
272
|
-
if [ -d "$rvm_ruby_src_path/.git" ] ; then
|
273
|
-
cd $rvm_ruby_src_path
|
274
|
-
if [ -z "$rvm_ruby_rev" ] ; then
|
275
|
-
git pull origin master
|
276
|
-
else
|
277
|
-
git checkout ${rvm_ruby_rev:-HEAD}
|
278
|
-
fi
|
279
|
-
else
|
280
|
-
git clone --depth 1 $rvm_ruby_repo_url $rvm_ruby_src_path
|
281
|
-
fi
|
282
|
-
else
|
283
|
-
if [ -z "$rvm_ruby_rev" ] ; then
|
284
|
-
# TODO: Check if tag v is valid
|
285
|
-
rvm_url=$rvm_ruby_repo_url/tags/$rvm_ruby_tag
|
286
|
-
rvm_rev=""
|
287
|
-
else
|
288
|
-
if [ "$rvm_ruby_rev" = "head" -o "$rvm_ruby_rev" = "trunk" ] ; then
|
289
|
-
rvm_url=$rvm_ruby_repo_url/branches/ruby_1_${rvm_major_version}_${rvm_minor_version}
|
290
|
-
rvm_rev=""
|
291
|
-
else
|
292
|
-
rvm_url=$rvm_ruby_repo_url/branches/ruby_1_${rvm_major_version}_${rvm_minor_version}
|
293
|
-
rvm_rev="-r $rvm_ruby_rev"
|
294
|
-
fi
|
295
|
-
fi
|
296
|
-
|
297
|
-
if [ -d "$rvm_ruby_src_path/.svn" ] ; then
|
298
|
-
cd $rvm_ruby_src_path
|
299
|
-
svn checkout -q $rvm_rev
|
300
|
-
else
|
301
|
-
svn checkout -q $rvm_rev --force $rvm_url $rvm_ruby_src_path
|
302
|
-
fi
|
303
|
-
fi
|
304
|
-
fi
|
305
|
-
cd $rvm_ruby_src_path
|
306
|
-
if [ $? -gt 0 ] ; then __rvm_log "error" "There was an error, please check $rvm_ruby_log_path/*.error.log" ; popd 2> /dev/null ; return 1 ; fi
|
307
|
-
if [ ! -s $rvm_ruby_src_path/Makefile -a "$rvm_ruby_interpreter" = "ruby" ] ; then autoconf ; fi
|
308
|
-
if [ $? -gt 0 ] ; then __rvm_log "error" "There was an error, please check $rvm_ruby_log_path/*.error.log" ; popd 2> /dev/null ; return 1 ; fi
|
309
|
-
if [ -s ./configure ] ; then
|
310
|
-
__rvm_log "info" "\tConfiguring $rvm_ruby_package_name using $rvm_ruby_configure, this may take a while depending on your cpu(s)..."
|
311
|
-
# command="nice -n $rvm_niceness ./configure --prefix=$rvm_ruby_home $rvm_ruby_configure"
|
312
|
-
# eval $command > $rvm_ruby_log_path/configure.log 2> $rvm_ruby_log_path/configure.error.log
|
313
|
-
__rvm_run "configure" ./configure --prefix=$rvm_ruby_home $rvm_ruby_configure
|
314
|
-
if [ $? -gt 0 ] ; then __rvm_log "error" "There was an error, please check $rvm_ruby_log_path/*.error.log" ; popd 2> /dev/null ; return 1 ; fi
|
315
|
-
else
|
316
|
-
__rvm_log "warn" "\tSkipping configure step, ./configure file does not exist."
|
317
|
-
fi
|
318
|
-
|
319
|
-
__rvm_log "info" "\tCompiling $rvm_ruby_package_name, this may take a while, depending on your cpu(s)..."
|
320
|
-
if [ -z "$rvm_ruby_make" ] ; then
|
321
|
-
nice -n $rvm_niceness make > $rvm_ruby_log_path/make.log 2> $rvm_ruby_log_path/make.error.log
|
322
|
-
else
|
323
|
-
nice -n $rvm_niceness $rvm_ruby_make > $rvm_ruby_log_path/install.log 2> $rvm_ruby_log_path/install.error.log
|
324
|
-
fi
|
325
|
-
if [ $? -gt 0 ] ; then __rvm_log "error" "There was an error, please check $rvm_ruby_log_path/*.error.log" ; popd 2> /dev/null ; return 1 ; fi
|
326
|
-
if [ -z "$rvm_ruby_make" ] ; then
|
327
|
-
__rvm_log "info" "\tInstalling $rvm_ruby_package_name"
|
328
|
-
nice -n $rvm_niceness make install > $rvm_ruby_log_path/install.log 2> $rvm_ruby_log_path/install.error.log
|
329
|
-
else
|
330
|
-
nice -n $rvm_niceness $rvm_ruby_make_install > $rvm_ruby_log_path/install.log 2> $rvm_ruby_log_path/install.error.log
|
331
|
-
fi
|
332
|
-
if [ $? -gt 0 ] ; then __rvm_log "error" "There was an error, please check $rvm_ruby_log_path/*.error.log" ; popd 2> /dev/null ; return 1 ; fi
|
333
|
-
|
334
|
-
chmod +x $rvm_ruby_home/bin/*
|
335
|
-
|
336
|
-
ruby_wrapper=$(cat <<-RubyWrapper
|
337
|
-
#!/bin/bash
|
338
|
-
GEM_HOME=$rvm_gem_home ; export GEM_HOME
|
339
|
-
MY_RUBY_HOME=$rvm_ruby_home ; export MY_RUBY_HOME
|
340
|
-
PATH=$rvm_ruby_home/bin:$rvm_gem_home/bin:$rvm_default_path ; export PATH
|
341
|
-
|
342
|
-
exec "$rvm_ruby_binary" "\$@"
|
343
|
-
RubyWrapper
|
344
|
-
)
|
345
|
-
echo "$ruby_wrapper" > $rvm_bin_path/$rvm_ruby_package_name
|
346
|
-
unset ruby_wrapper
|
347
|
-
chmod +x $rvm_bin_path/$rvm_ruby_package_name
|
348
|
-
__rvm_log "info" "Installation of $rvm_ruby_package_name is complete."
|
349
|
-
|
350
|
-
__rvm_log "info" "\tInstalling rubygems dedicated to $rvm_ruby_package_name..."
|
351
|
-
rvm_gem_package_name="rubygems-1.3.5"
|
352
|
-
rvm_gem_url="http://rubyforge.org/frs/download.php/60718/$rvm_gem_package_name.tgz"
|
353
|
-
if [ -d $rvm_source_path/$rvm_gem_package_name ] ; then
|
354
|
-
cd $rvm_source_path/$rvm_gem_package_name
|
355
|
-
else
|
356
|
-
__rvm_fetch $rvm_gem_url
|
357
|
-
if [ $? -gt 0 ] ; then __rvm_log "error" "There was an error, please check $rvm_ruby_log_path/*.error.log" ; popd 2> /dev/null ; return 1 ; fi
|
358
|
-
mkdir -p $rvm_source_path/$rvm_gem_package_name
|
359
|
-
nice -n $rvm_niceness tar zxf $rvm_archives_path/$rvm_gem_package_name.tgz -C $rvm_source_path
|
360
|
-
fi
|
361
|
-
# Well this is fun... fix nil error on require_paths:
|
362
|
-
sed -i.orig "s/require_paths\.join/require_paths.to_a.join/" $rvm_source_path/$rvm_gem_package_name/lib/rubygems/gem_path_searcher.rb
|
363
|
-
|
364
|
-
nice -n $rvm_niceness $rvm_ruby_home/bin/ruby $rvm_source_path/$rvm_gem_package_name/setup.rb > $rvm_ruby_log_path/rubygems.install.log 2> $rvm_ruby_log_path/rubygems.install.error.log
|
365
|
-
popd 2> /dev/null
|
366
|
-
|
367
|
-
|
368
|
-
for rvm_gem_name in rake ; do
|
369
|
-
__rvm_log "info" "Installing $rvm_gem_name"
|
370
|
-
nice -n $rvm_niceness $rvm_ruby_home/bin/gem install $rvm_gem_name --no-rdoc --no-ri -q >> $rvm_ruby_log_path/gems.install.log 2> $rvm_ruby_log_path/gems.error.log
|
371
|
-
done
|
372
|
-
|
373
|
-
for binary in gem irb erb ri rdoc testrb rake ; do
|
374
|
-
if [ -x $rvm_ruby_home/bin/$binary ] ; then
|
375
|
-
string="ENV['GEM_HOME']='$rvm_gem_home'\nENV['PATH']='$rvm_ruby_home/bin:$rvm_gem_home/bin'"
|
376
|
-
awk "NR==2 {print \"$string\"} {print}" $rvm_ruby_home/bin/$binary > $rvm_ruby_home/bin/$binary.new
|
377
|
-
mv $rvm_ruby_home/bin/$binary.new $rvm_ruby_home/bin/$binary
|
378
|
-
chmod +x $rvm_ruby_home/bin/$binary
|
379
|
-
else
|
380
|
-
__rvm_log "warn" "$rvm_ruby_home/bin/$binary is missing"
|
381
|
-
fi
|
382
|
-
done
|
383
|
-
|
384
|
-
__rvm_log "info" "Installation of rubygems for $rvm_ruby_package_name is complete."
|
385
|
-
if [ -x $rvm_gem_home/bin/$binary ] ; then
|
386
|
-
string="ENV['GEM_HOME']='$rvm_gem_home'\nENV['PATH']='$rvm_ruby_home/bin:$rvm_gem_home/bin'"
|
387
|
-
mv $rvm_gem_home/bin/$binary $rvm_gem_home/bin/$binary.orig
|
388
|
-
awk "NR==2 {print \"$string\"} {print}" $rvm_gem_home/bin/$binary.orig > $rvm_gem_home/bin/$binary
|
389
|
-
chmod +x $rvm_gem_home/bin/$binary
|
390
|
-
else
|
391
|
-
__rvm_log "warn" "$rvm_gem_home/bin/$binary is missing"
|
392
|
-
fi
|
393
|
-
|
394
|
-
binary=rake
|
395
|
-
mv $rvm_gem_home/bin/$binary $rvm_gem_home/bin/$binary.orig
|
396
|
-
awk "NR==2 {print \"$string\"} {print}" $rvm_gem_home/bin/$binary.orig > $rvm_gem_home/bin/$binary
|
397
|
-
unset binary
|
398
|
-
}
|
399
|
-
|
400
|
-
function __rvm_install-ruby {
|
401
|
-
|
402
|
-
if [ -z "$rvm_selected" ] ; then __rvm_select $* ; fi
|
403
|
-
|
404
|
-
if [ -z "$RUBYOPT" ] ; then ruby_options=$RUBYOPT ; unset RUBYOPT ; fi
|
405
|
-
|
406
|
-
case "$rvm_ruby_interpreter" in
|
407
|
-
|
408
|
-
macruby)
|
409
|
-
if [ "`uname`" = "Darwin" ] ; then
|
410
|
-
rvm_ruby_repo_url=$rvm_macruby_repo_url
|
411
|
-
rvm_ruby_configure=""
|
412
|
-
rvm_ruby_make="rake macruby:build framework_instdir=$rvm_install_path/macruby-head framework_name=/macruby-head --trace"
|
413
|
-
rvm_ruby_make_install="rake framework:install framework_instdir=$rvm_install_path/macruby-head framework_name=/macruby-head --trace"
|
414
|
-
rvm_ruby_rev="${rvm_ruby_rev:-head}" # Hard coding this for now
|
415
|
-
|
416
|
-
DESTDIR="$rvm_ruby_home" ; export DESTDIR
|
417
|
-
if [ -z "$rvm_ruby_rev" ] ; then
|
418
|
-
# TODO: Check if tag v is valid
|
419
|
-
#rvm_ruby_repo_url=$rvm_ruby_repo_url/tags/$rvm_ruby_tag
|
420
|
-
rvm_ruby_rev="head" # For now, until nightly release are available.
|
421
|
-
else
|
422
|
-
if [ "$rvm_ruby_rev" = "head" -o "$rvm_ruby_rev" = "trunk" ] ; then
|
423
|
-
#rvm_ruby_repo_url=$rvm_ruby_repo_url/trunk
|
424
|
-
rvm_ruby_rev="head"
|
425
|
-
else
|
426
|
-
#rvm_ruby_repo_url=$rvm_ruby_repo_url/trunk
|
427
|
-
rvm_ruby_rev="-r $rvm_ruby_rev"
|
428
|
-
fi
|
429
|
-
fi
|
430
|
-
__rvm_install-source
|
431
|
-
unset DESTDIR
|
432
|
-
else
|
433
|
-
__rvm_log "fail" "MacRuby can only be installed on a Darwin OS."
|
434
|
-
fi
|
435
|
-
;;
|
436
|
-
|
437
|
-
ruby-enterprise|ree)
|
438
|
-
rvm_url="http://rubyforge.org/frs/download.php/58677/$rvm_ruby_package_name.tar.gz"
|
439
|
-
__rvm_log "info" "Installing Ruby Enterprise Edition from source to: $rvm_ruby_home"
|
440
|
-
pushd $rvm_source_path > /dev/null
|
441
|
-
if [ -d $rvm_ruby_src_path ] ; then
|
442
|
-
cd $rvm_ruby_src_path
|
443
|
-
else
|
444
|
-
__rvm_log "info" "\tDownloading $rvm_ruby_package_name, this may take a while depending on your connection..."
|
445
|
-
__rvm_fetch $rvm_url
|
446
|
-
if [ $? -gt 0 ] ; then __rvm_log "error" "There was an error, please check $rvm_ruby_log_path/*.error.log" ; popd 2> /dev/null ; return 1 ; fi
|
447
|
-
__rvm_log "info" "\tExtracting $rvm_ruby_package_name..."
|
448
|
-
mkdir -p $rvm_ruby_src_path
|
449
|
-
nice -n $rvm_niceness tar xzf $rvm_archives_path/$rvm_ruby_package_name.tar.gz -C $rvm_source_path
|
450
|
-
fi
|
451
|
-
if [ $? -gt 0 ] ; then __rvm_log "error" "There was an error, please check $rvm_ruby_log_path/*.error.log" ; popd 2> /dev/null ; return 1 ; fi
|
452
|
-
|
453
|
-
__rvm_log "info" "\tInstalling $rvm_ruby_package_name, this may take a while, depending on your cpu(s)..."
|
454
|
-
mkdir -p $rvm_ruby_log_path
|
455
|
-
|
456
|
-
cd $rvm_ruby_src_path
|
457
|
-
nice -n $rvm_niceness ./installer -a $rvm_install_path/ruby-enterprise-$rvm_ruby_version-$rvm_ruby_patch_level --dont-install-useful-gems --no-tcmalloc > $rvm_ruby_log_path/install.log 2> $rvm_ruby_log_path/install.error.log
|
458
|
-
if [ $? -gt 0 ] ; then __rvm_log "error" "There was an error, please check $rvm_ruby_log_path/*.error.log" ; popd 2> /dev/null ; return 1 ; fi
|
459
|
-
chmod +x $rvm_ruby_home/bin/*
|
460
|
-
|
461
|
-
ln -fs $rvm_ruby_home/bin/ruby $rvm_install_path/bin/$rvm_ruby_package_name
|
462
|
-
|
463
|
-
__rvm_log "info" "\tInstalling rubygems dedicated to $rvm_ruby_package_name..."
|
464
|
-
rvm_gem_package_name="rubygems-1.3.5"
|
465
|
-
rvm_gem_url="http://rubyforge.org/frs/download.php/60718/$rvm_gem_package_name.tgz"
|
466
|
-
if [ -d $rvm_source_path/$rvm_gem_package_name ] ; then
|
467
|
-
cd $rvm_source_path/$rvm_gem_package_name
|
468
|
-
else
|
469
|
-
__rvm_fetch $rvm_gem_url
|
470
|
-
if [ $? -gt 0 ] ; then __rvm_log "error" "There was an error, please check $rvm_ruby_log_path/*.error.log" ; popd 2> /dev/null ; return 1 ; fi
|
471
|
-
mkdir -p $rvm_source_path/$rvm_gem_package_name
|
472
|
-
nice -n $rvm_niceness tar zxf $rvm_archives_path/$rvm_gem_package_name.tgz -C $rvm_source_path
|
473
|
-
fi
|
474
|
-
if [ $? -gt 0 ] ; then __rvm_log "error" "There was an error, please check $rvm_ruby_log_path/*.error.log" ; popd 2> /dev/null ; return 1 ; fi
|
475
|
-
# Well this is fun... fix nil error on require_paths:
|
476
|
-
sed -i.orig "s/require_paths\.join/require_paths.to_a.join/" $rvm_source_path/$rvm_gem_package_name/lib/rubygems/gem_path_searcher.rb > $rvm_ruby_log_path/rubygems.install.log 2> $rvm_ruby_log_path/rubygems.install.error.log
|
477
|
-
|
478
|
-
nice -n $rvm_niceness $rvm_ruby_home/bin/ruby $rvm_source_path/$rvm_gem_package_name/setup.rb > $rvm_ruby_log_path/rubygems.install.log 2> $rvm_ruby_log_path/rubygems.install.error.log
|
479
|
-
__rvm_log "info" "Installation of $rvm_ruby_package_name complete."
|
480
|
-
popd 2> /dev/null
|
481
|
-
|
482
|
-
for rvm_gem_name in rake ; do
|
483
|
-
__rvm_log "info" "Installing $rvm_gem_name"
|
484
|
-
nice -n $rvm_niceness $rvm_ruby_home/bin/gem install $rvm_gem_name --no-rdoc --no-ri -q >> $rvm_ruby_log_path/gems.install.log 2> $rvm_ruby_log_path/gems.error.log
|
485
|
-
done
|
486
|
-
;;
|
487
|
-
|
488
|
-
rbx|rubinius)
|
489
|
-
__rvm_reset # Requires 1.8 to install due to parsetree. TOOD: Check for 1.8 + parse-tree
|
490
|
-
rvm_ruby_repo_url=$rvm_rubinius_repo_url
|
491
|
-
rvm_ruby_configure=""
|
492
|
-
rvm_ruby_make="rake"
|
493
|
-
rvm_ruby_make_install="rake install"
|
494
|
-
#rvm_ruby_rev="head"
|
495
|
-
# TODO: Check if already git repo, then git pull origin master && build
|
496
|
-
if [ ! -d $rvm_install_path/$rvm_ruby_interpreter-$rvm_ruby_version -o ! -d $rvm_install_path/$rvm_ruby_interpreter-$rvm_ruby_version/.git ] ; then
|
497
|
-
rm -rf $rvm_install_path/$rvm_ruby_interpreter-$rvm_ruby_version
|
498
|
-
git clone --depth 1 $rvm_ruby_repo_url $rvm_install_path/$rvm_ruby_interpreter-$rvm_ruby_version
|
499
|
-
fi
|
500
|
-
cd $rvm_install_path/$rvm_ruby_interpreter-$rvm_ruby_version && $rvm_rubinius_jit rake build
|
501
|
-
if [ $? -gt 0 ] ; then __rvm_log "error" "There was an error, please check $rvm_ruby_log_path/*.error.log" ; popd 2> /dev/null ; return 1 ; fi
|
502
|
-
for binary in ruby irb ; do
|
503
|
-
ln -fs $rvm_install_path/$rvm_ruby_interpreter-$rvm_ruby_version/bin/rbx $rvm_install_path/$rvm_ruby_interpreter-$rvm_ruby_version/bin/$binary
|
504
|
-
done
|
505
|
-
;;
|
506
|
-
|
507
|
-
jruby)
|
508
|
-
rvm_package_file="$rvm_ruby_interpreter-bin-$rvm_ruby_version"
|
509
|
-
rvm_url="http://dist.codehaus.org/$rvm_ruby_interpreter/$rvm_ruby_version/$rvm_package_file.zip"
|
510
|
-
rvm_jruby_repo_url="${rvm_jruby_repo_url:-"git://kenai.com/jruby~main"}"
|
511
|
-
|
512
|
-
__rvm_log "info" "Installing jRuby to: $rvm_ruby_home"
|
513
|
-
mkdir -p $rvm_ruby_log_path
|
514
|
-
pushd $rvm_source_path > /dev/null
|
515
|
-
|
516
|
-
|
517
|
-
if [ ! -z "$rvm_ruby_rev" ] ; then
|
518
|
-
if [ ! -d $rvm_install_path/$rvm_ruby_interpreter-$rvm_ruby_version -o ! -d $rvm_install_path/$rvm_ruby_interpreter-$rvm_ruby_version/.git ] ; then
|
519
|
-
git clone --depth 1 $rvm_jruby_repo_url $rvm_ruby_src_path
|
520
|
-
cd $rvm_ruby_src_path && ant
|
521
|
-
fi
|
522
|
-
else
|
523
|
-
if [ -d $rvm_ruby_src_path ] ; then
|
524
|
-
cd $rvm_ruby_src_path
|
525
|
-
else
|
526
|
-
__rvm_log "info" "\tDownloading $rvm_package_file, this may take a while depending on your connection..."
|
527
|
-
__rvm_fetch $rvm_url
|
528
|
-
__rvm_log "info" "\tExtracting $rvm_package_file..."
|
529
|
-
nice -n $rvm_niceness unzip -q $rvm_archives_path/$rvm_package_file.zip -d $rvm_source_path
|
530
|
-
cd $rvm_ruby_src_path
|
531
|
-
fi
|
532
|
-
fi
|
533
|
-
if [ $? -gt 0 ] ; then __rvm_log "error" "There was an error, please check $rvm_ruby_log_path/*.error.log" ; popd 2> /dev/null ; return 1 ; fi
|
534
|
-
|
535
|
-
__rvm_log "info" "\tInstalling $rvm_ruby_package_name..."
|
536
|
-
mkdir -p $rvm_ruby_home/bin/
|
537
|
-
rsync -ag $rvm_ruby_src_path/ $rvm_ruby_home/
|
538
|
-
if [ $? -gt 0 ] ; then __rvm_log "error" "There was an error, please check $rvm_ruby_log_path/*.error.log" ; popd 2> /dev/null ; return 1 ; fi
|
539
|
-
cd $rvm_ruby_src_path/tool/nailgun && make > $rvm_ruby_log_path/install.nailgun.log 2> $rvm_ruby_log_path/install.error.nailgun.log
|
540
|
-
popd 2> /dev/null
|
541
|
-
chmod +x $rvm_ruby_home/bin/*
|
542
|
-
for binary in jruby jgem jirb ; do
|
543
|
-
ln -fs $rvm_ruby_home/bin/$binary $rvm_ruby_home/bin/${binary#j}
|
544
|
-
done
|
545
|
-
|
546
|
-
ln -fs $rvm_ruby_home/bin/ruby $rvm_install_path/bin/$rvm_ruby_package_name
|
547
|
-
|
548
|
-
for rvm_gem_name in rake jruby-openssl ; do
|
549
|
-
__rvm_log "info" "Installing $rvm_gem_name"
|
550
|
-
nice -n $rvm_niceness $rvm_ruby_home/bin/jgem install $rvm_gem_name --no-rdoc --no-ri -q >> $rvm_ruby_log_path/gems.install.log 2> $rvm_ruby_log_path/gems.error.log
|
551
|
-
done
|
552
|
-
;;
|
553
|
-
|
554
|
-
ruby)
|
555
|
-
if [ -z "rvm_ruby_configure" ] ; then rvm_ruby_configure="--enable-shared=true" ; fi
|
556
|
-
__rvm_install-source $*
|
557
|
-
;;
|
558
|
-
|
559
|
-
default)
|
560
|
-
__rvm_log "fail" "please specify a ruby implementation to install."
|
561
|
-
;;
|
562
|
-
|
563
|
-
*) __rvm_log "fail" "Ruby implementation '$rvm_ruby_interpreter' is not known."
|
564
|
-
|
565
|
-
esac
|
566
|
-
|
567
|
-
if [ ! -z "$ruby_options" ] ; then
|
568
|
-
RUBYOPT=$ruby_options ; export RUBYOPT
|
569
|
-
fi
|
570
|
-
|
571
|
-
}
|
572
|
-
|
573
|
-
function __rvm_uninstall {
|
574
|
-
|
575
|
-
if [ -z "$rvm_selected" ] ; then __rvm_select $* ; fi
|
576
|
-
|
577
|
-
if [ ! -z "$rvm_ruby_package_name" ] ; then
|
578
|
-
for dir in $rvm_source_path $rvm_install_path ; do
|
579
|
-
if [ -d $dir/$rvm_ruby_package_name ] ; then
|
580
|
-
__rvm_log "info" "Removing $dir/$rvm_ruby_package_name..."
|
581
|
-
rm -rf $dir/$rvm_ruby_package_name
|
582
|
-
else
|
583
|
-
__rvm_log "info" "it seems that $dir/$rvm_ruby_package_name is already non existent."
|
584
|
-
fi
|
585
|
-
if [ -e $rvm_bin_path/$rvm_ruby_package_name ] ; then
|
586
|
-
rm -f $rvm_bin_path/$rvm_ruby_package_name
|
587
|
-
fi
|
588
|
-
done ; unset dir
|
589
|
-
rm -rf $rvm_gem_path/$rvm_ruby_interpreter/$rvm_ruby_version*/
|
590
|
-
else
|
591
|
-
__rvm_log "fail" "Cannot uninstall unknown package '$rvm_ruby_package_name'"
|
592
|
-
fi
|
593
|
-
|
594
|
-
}
|
595
|
-
|
596
|
-
# __rvm_select implementation version patch_level
|
597
|
-
function __rvm_select {
|
598
|
-
|
599
|
-
rvm_ruby_interpreter="${1:-$rvm_ruby_interpreter}"
|
600
|
-
rvm_ruby_interpreter="${rvm_ruby_interpreter:-ruby}" # Default is standard ruby
|
601
|
-
|
602
|
-
if [ "$rvm_ruby_version" = "1.8" ] ; then rvm_ruby_version="1.8.6" ; fi
|
603
|
-
if [ "$rvm_ruby_version" = "1.9" ] ; then rvm_ruby_version="1.9.1" ; fi
|
604
|
-
|
605
|
-
case "$rvm_ruby_interpreter" in
|
606
|
-
macruby)
|
607
|
-
if [ "`uname`" = "Darwin" ] ; then
|
608
|
-
rvm_ruby_repo_url=$rvm_macruby_repo_url
|
609
|
-
rvm_ruby_version="head" # For now we are only supporting latest
|
610
|
-
unset rvm_ruby_patch_level
|
611
|
-
else
|
612
|
-
__rvm_log "fail" "MacRuby can only be installed on a Darwin OS."
|
613
|
-
fi
|
614
|
-
;;
|
615
|
-
|
616
|
-
rbx|rubinius)
|
617
|
-
rvm_ruby_version="head"
|
618
|
-
rvm_ruby_version="head"
|
619
|
-
unset rvm_ruby_patch_level
|
620
|
-
rvm_ruby_repo_url=$rvm_rubinius_repo_url
|
621
|
-
rvm_ruby_configure=""
|
622
|
-
rvm_ruby_make="build"
|
623
|
-
rvm_ruby_make_install=""
|
624
|
-
#rvm_ruby_rev="head"
|
625
|
-
;;
|
626
|
-
|
627
|
-
jruby)
|
628
|
-
rvm_ruby_version="${rvm_ruby_version:-1.3.1}"
|
629
|
-
unset rvm_ruby_patch_level
|
630
|
-
if [ "$rvm_ruby_version" != "1.2.0" -a "$rvm_ruby_version" != "1.3.1" ] ; then
|
631
|
-
__rvm_log "fail" "Unknown jRuby version: $rvm_ruby_version"
|
632
|
-
fi
|
633
|
-
alias jruby_ng="jruby --ng"
|
634
|
-
alias jruby_ng_server="jruby --ng-server"
|
635
|
-
;;
|
636
|
-
|
637
|
-
ruby-enterprise|ree)
|
638
|
-
rvm_ruby_interpreter="ruby-enterprise"
|
639
|
-
rvm_ruby_version=${rvm_ruby_version:-1.8.6}
|
640
|
-
rvm_ruby_patch_level="${3:-20090610}"
|
641
|
-
|
642
|
-
if [ "$rvm_ruby_version" != "1.8.6" ] ; then
|
643
|
-
__rvm_log "fail" "Unknown Ruby Enterprise Edition version: $rvm_ruby_version"
|
644
|
-
fi
|
645
|
-
;;
|
646
|
-
|
647
|
-
ruby)
|
648
|
-
if [ ! -z "$rvm_ruby_tag" ] ; then
|
649
|
-
rvm_ruby_version=$(echo $rvm_ruby_tag | sed 's/^v//' | sed 's/\///' | awk -F'_' '{print 1 "." $2 "." $3 }')
|
650
|
-
rvm_ruby_patch_level=$rvm_ruby_tag # $(echo $rvm_ruby_tag | sed 's/^v//' | sed 's/\///' | awk -F'_' '{print $4 }')
|
651
|
-
fi
|
652
|
-
|
653
|
-
rvm_ruby_version=${rvm_ruby_version:-1.8.6} # Default verison is 1.8.6
|
654
|
-
if [ "$rvm_ruby_version" = "1.9.1" ] ; then
|
655
|
-
rvm_ruby_patch_level="${rvm_ruby_patch_level:-p243}"
|
656
|
-
|
657
|
-
elif [ "$rvm_ruby_version" = "1.9.2" ] ; then
|
658
|
-
rvm_ruby_patch_level="${rvm_ruby_patch_level:-preview1}"
|
659
|
-
|
660
|
-
elif [ "$rvm_ruby_version" = "1.8.6" ] ; then
|
661
|
-
rvm_ruby_patch_level="${rvm_ruby_patch_level:-p383}"
|
662
|
-
|
663
|
-
elif [ "$rvm_ruby_version" = "1.8.7" ] ; then
|
664
|
-
rvm_ruby_patch_level="${rvm_ruby_patch_level:-p174}"
|
665
|
-
|
666
|
-
elif [ "$rvm_ruby_version" = "1.8.5" ] ; then
|
667
|
-
rvm_ruby_patch_level="${rvm_ruby_patch_level:-p115}"
|
668
|
-
|
669
|
-
elif [ "$rvm_ruby_version" = "1.8.0" -o "$rvm_ruby_version" = "1.8.1" -o "$rvm_ruby_version" = "1.8.2" -o "$rvm_ruby_version" = "1.8.3" -o "$rvm_ruby_version" = "1.8.4" ] ; then
|
670
|
-
unset rvm_ruby_patch_level
|
671
|
-
|
672
|
-
else
|
673
|
-
__rvm_log "fail" "Unknown ruby version: $rvm_ruby_version"
|
674
|
-
fi
|
675
|
-
;;
|
676
|
-
|
677
|
-
default|system)
|
678
|
-
#noop?
|
679
|
-
;;
|
680
|
-
*)
|
681
|
-
__rvm_log "fail" "Ruby implementation '$rvm_ruby_interpreter' is not known."
|
682
|
-
esac
|
683
|
-
|
684
|
-
if [ ! -z "$rvm_ruby_rev" ] ; then
|
685
|
-
if [ "$rvm_ruby_rev" = "head" -o "$rvm_ruby_rev" = "trunk" ] ; then
|
686
|
-
rvm_ruby_patch_level="head"
|
687
|
-
else
|
688
|
-
rvm_ruby_patch_level="$rvm_ruby_rev"
|
689
|
-
fi
|
690
|
-
fi
|
691
|
-
|
692
|
-
if [ ! -z "$rvm_ruby_interpreter" -a ! -z "$rvm_ruby_version" ] ; then
|
693
|
-
rvm_major_version=$(echo $rvm_ruby_version | awk -F'.' '{ print $2 }')
|
694
|
-
rvm_minor_version=$(echo $rvm_ruby_version | awk -F'.' '{ print $3 }')
|
695
|
-
|
696
|
-
if [ -z "$rvm_gem_set_name" ] ; then
|
697
|
-
rvm_gem_home="$rvm_gem_path/$rvm_ruby_interpreter/$rvm_ruby_version"
|
698
|
-
else
|
699
|
-
if [ ! -z "$rvm_gem_set_name_rm" -a -d $rvm_gem_path/$rvm_ruby_interpreter/$rvm_ruby_version-$rvm_gem_set_name ] ; then
|
700
|
-
rm -rf $rvm_gem_path/$rvm_ruby_interpreter/$rvm_ruby_version-$rvm_gem_set_name/
|
701
|
-
if [ "$rvm_gem_set_name_rm" = "$rvm_gem_set_name" ] ; then unset rvm_gem_set_name ; fi
|
702
|
-
else
|
703
|
-
rvm_gem_home="$rvm_gem_path/$rvm_ruby_interpreter/$rvm_ruby_version-$rvm_gem_set_name"
|
704
|
-
fi
|
705
|
-
fi
|
706
|
-
mkdir -p $rvm_gem_home
|
707
|
-
|
708
|
-
if [ -z "$rvm_ruby_patch_level" ] ; then
|
709
|
-
rvm_ruby_package_name="${rvm_ruby_package_name:-"$rvm_ruby_interpreter-$rvm_ruby_version"}"
|
710
|
-
rvm_ruby_home="${rvm_ruby_home:-"$rvm_install_path/$rvm_ruby_interpreter-$rvm_ruby_version"}"
|
711
|
-
else
|
712
|
-
rvm_ruby_package_name="${rvm_ruby_package_name:-"$rvm_ruby_interpreter-$rvm_ruby_version-$rvm_ruby_patch_level"}"
|
713
|
-
rvm_ruby_home="${rvm_ruby_home:-"$rvm_install_path/$rvm_ruby_interpreter-$rvm_ruby_version-$rvm_ruby_patch_level"}"
|
714
|
-
fi
|
715
|
-
rvm_ruby_log_path="$rvm_log_path/$rvm_ruby_package_name"
|
716
|
-
rvm_ruby_src_path="$rvm_source_path/$rvm_ruby_package_name"
|
717
|
-
rvm_ruby_binary="$rvm_ruby_home/bin/ruby"
|
718
|
-
rvm_ruby_irbrc="$rvm_ruby_home/.irbrc"
|
719
|
-
rvm_selected=1
|
720
|
-
else
|
721
|
-
unset rvm_selected
|
722
|
-
fi
|
723
|
-
|
724
|
-
}
|
725
|
-
|
726
|
-
function __rvm_use {
|
727
|
-
|
728
|
-
if [ -z "$rvm_selected" ] ; then __rvm_select $* ; fi
|
729
|
-
if [ -z "$rvm_ruby_interpreter" ] ; then rvm_ruby_interpreter="default" ; fi
|
730
|
-
|
731
|
-
if [ "$rvm_ruby_interpreter" = "default" -o "$rvm_ruby_interpreter" = "system" ] ; then
|
732
|
-
unset GEM_HOME MY_RUBY_HOME IRBRC
|
733
|
-
PATH="$rvm_default_path" ; export PATH
|
734
|
-
if [ "$rvm_ruby_interpreter" = "default" -a -s $rvm_install_path/current ] ; then
|
735
|
-
source $rvm_install_path/current
|
736
|
-
fi
|
737
|
-
|
738
|
-
else
|
739
|
-
GEM_HOME=$rvm_gem_home ; export GEM_HOME
|
740
|
-
MY_RUBY_HOME=$rvm_ruby_home ; export MY_RUBY_HOME
|
741
|
-
IRBRC="$rvm_ruby_irbrc" ; export IRBRC
|
742
|
-
|
743
|
-
# Install if not installed
|
744
|
-
if [ ! -d $MY_RUBY_HOME ] ; then
|
745
|
-
__rvm_log "warn" "$rvm_ruby_interpreter $rvm_ruby_version is not installed."
|
746
|
-
__rvm_install-ruby $rvm_ruby_interpreter $rvm_ruby_version $rvm_ruby_patch_level
|
747
|
-
fi
|
748
|
-
|
749
|
-
if [ ! -s "$rvm_ruby_irbrc" ] ; then
|
750
|
-
rvm_irbrc_file=$(cat <<Config
|
751
|
-
require "irb/completion" rescue nil
|
752
|
-
@prompt = {
|
753
|
-
:PROMPT_I => "${rvm_ruby_package_name} > ", # default prompt
|
754
|
-
:PROMPT_S => "${rvm_ruby_package_name}%l> ", # known continuation
|
755
|
-
:PROMPT_C => "${rvm_ruby_package_name} > ",
|
756
|
-
:PROMPT_N => "${rvm_ruby_package_name} ?> ", # unknown continuation
|
757
|
-
:RETURN => " => %s \n",
|
758
|
-
:AUTO_INDENT => true
|
759
|
-
}
|
760
|
-
@prompt_mode = :DEFAULT
|
761
|
-
IRB.conf[:PROMPT][@prompt_mode] = @prompt
|
762
|
-
IRB.conf[:PROMPT_MODE] = @prompt_mode
|
763
|
-
|
764
|
-
Config
|
765
|
-
)
|
766
|
-
if [ -s ~/.irbrc ] ; then
|
767
|
-
cat ~/.irbrc > $rvm_ruby_home/.irbrc
|
768
|
-
fi
|
769
|
-
echo "$rvm_irbrc_file" >> $rvm_ruby_home/.irbrc
|
770
|
-
fi
|
771
|
-
PATH=$MY_RUBY_HOME/bin:$GEM_HOME/bin:$rvm_install_path/bin:$rvm_default_path ; export PATH
|
772
|
-
|
773
|
-
rvm_prompt="$rvm_ruby_package_name" ; export rvm_prompt
|
774
|
-
if [ ! -z "$rvm_set_prompt" -a ! -z "$PS1" ] ; then
|
775
|
-
PS1="\033[0;32m${rvm_prompt}\033[0m:: ${rvm_default_ps1}" ; export PS1
|
776
|
-
fi
|
777
|
-
|
778
|
-
if [ ! -z "$rvm_set_default" ] ; then
|
779
|
-
RUBY_VERSION="$($MY_RUBY_HOME/bin/ruby -v | sed 's/^\(.*\) (.*$/\1/')"
|
780
|
-
export GEM_HOME MY_RUBY_HOME RUBY_VERSION
|
781
|
-
|
782
|
-
echo "PATH=$MY_RUBY_HOME/bin:$GEM_HOME/bin:$rvm_install_path/bin:$rvm_default_path ; export PATH" > $rvm_install_path/current
|
783
|
-
|
784
|
-
for variable in rvm_prompt RUBY_VERSION GEM_HOME MY_RUBY_HOME ; do
|
785
|
-
eval "export $variable"
|
786
|
-
eval value=\$${variable}
|
787
|
-
echo "${variable}='$value' ; export ${variable}" >> $rvm_install_path/current
|
788
|
-
done
|
789
|
-
fi
|
790
|
-
fi
|
791
|
-
}
|
792
|
-
|
793
|
-
function __rvm_symlinks {
|
794
|
-
|
795
|
-
mkdir -p ${rvm_install_path}/bin
|
796
|
-
for release in `/bin/ls $rvm_install_path | grep 'ruby-'` ; do
|
797
|
-
for binary in irb gem rdoc ri erb ; do
|
798
|
-
if [ -x $rvm_install_path/$release/bin/$binary ] ; then
|
799
|
-
ln -fs $rvm_install_path/$release/bin/$binary $rvm_install_path/bin/$binary-${release#ruby-}
|
800
|
-
fi
|
801
|
-
done
|
802
|
-
done
|
803
|
-
|
804
|
-
}
|
805
|
-
|
806
|
-
function __rvm_list {
|
807
|
-
|
808
|
-
if [ "$rvm_all" ] ; then
|
809
|
-
svn list http://svn.ruby-lang.org/repos/ruby/tags/ | grep 'v1_[8|9]' | sed 's/^v1_//' | sed 's/\/$//' | awk -F'_' '{print "1."$1"."$2 " -l "$3}' | sed 's/p$//'
|
810
|
-
|
811
|
-
echo "jruby 1.2.0"
|
812
|
-
echo "jruby 1.3.0"
|
813
|
-
echo "jruby 1.3.1"
|
814
|
-
echo "jruby head"
|
815
|
-
echo "rubinius head"
|
816
|
-
echo "rbx head"
|
817
|
-
echo "ree 20090610"
|
818
|
-
else
|
819
|
-
echo -e "\nruby:\n$(/bin/ls -l $rvm_install_path/ | awk '/ ruby-[1-2].*/ { print " - " $NF }')\n"
|
820
|
-
echo -e "jruby:\n$(/bin/ls -l $rvm_install_path/ | awk '/jruby-.*/ { print " - " $NF }')\n"
|
821
|
-
echo -e "ree:\n$(/bin/ls $rvm_install_path/ | awk '/ruby-enterprise-.*/ { print " - " $NF }')\n"
|
822
|
-
echo -e "system:\n - ($($default_system_ruby -v))\n"
|
823
|
-
fi
|
824
|
-
|
825
|
-
}
|
826
|
-
|
827
|
-
function __rvm_reset {
|
828
|
-
|
829
|
-
PATH="$rvm_install_path/bin:$rvm_default_path" ; export PATH
|
830
|
-
for variable in RUBY_VERSION GEM_HOME MY_RUBY_HOME rvm_prompt ; do unset $variable ; done
|
831
|
-
rm -f $rvm_install_path/default*
|
832
|
-
rm -f $rvm_install_path/current
|
833
|
-
|
834
|
-
__rvm_select "system"
|
835
|
-
|
836
|
-
}
|
837
|
-
|
838
|
-
function __rvm_implode {
|
839
|
-
while : ; do
|
840
|
-
__rvm_log "warn" "Are you SURE you wish for rvm to implode? This will remove $rvm_install_path ? (type 'yes' or 'no')"
|
841
|
-
read response
|
842
|
-
if [ "$response" = "yes" ] ; then
|
843
|
-
if [ -d $rvm_install_path ] ; then
|
844
|
-
__rvm_log "info" "Hai! Removing $rvm_install_path"
|
845
|
-
rm -rf $rvm_install_path/
|
846
|
-
else
|
847
|
-
__rvm_log "info" "It appears that $rvm_install_path is already non existant."
|
848
|
-
fi
|
849
|
-
break
|
850
|
-
elif [ "$response" = "no" ] ; then
|
851
|
-
__rvm_log "info" "Cancelling implosion, no harm done :)"
|
852
|
-
break
|
853
|
-
fi
|
854
|
-
done
|
855
|
-
}
|
856
|
-
|
857
|
-
function __rvm_gem-dir {
|
858
|
-
|
859
|
-
if [ -z "$rvm_selected" ] ; then __rvm_select $* ; fi
|
860
|
-
|
861
|
-
mkdir -p $rvm_gem_home
|
862
|
-
echo $rvm_gem_home
|
863
|
-
}
|
864
|
-
|
865
|
-
function __rvm_src-dir {
|
866
|
-
|
867
|
-
if [ -z "$rvm_selected" ] ; then __rvm_select $* ; fi
|
868
|
-
|
869
|
-
if [ -z "$rvm_ruby_src_path" ] ; then
|
870
|
-
__rvm_log "fail" "No source directory exists for the default implementation."
|
871
|
-
else
|
872
|
-
echo "$rvm_ruby_src_path"
|
873
|
-
fi
|
874
|
-
|
875
|
-
}
|
876
|
-
|
877
|
-
# clones from source implementation/version to current
|
878
|
-
function __rvm_gem-dup {
|
879
|
-
|
880
|
-
if [ "$1" = "default" ] ; then
|
881
|
-
rvm_source_gem_dir="$rvm_default_user_gem_path"
|
882
|
-
elif [ "$1" = "system" ] ; then
|
883
|
-
rvm_source_gem_dir="$rvm_default_system_gem_path"
|
884
|
-
else
|
885
|
-
rvm_source_gem_dir=${1:-$rvm_default_user_gem_path} # TODO: check for and remove trailing /gems
|
886
|
-
fi
|
887
|
-
|
888
|
-
if [ ! -z "$rvm_source_gem_dir" ] ; then
|
889
|
-
for rvm_gem_name_version in `/bin/ls $rvm_source_gem_dir/gems` ; do
|
890
|
-
rvm_gem_name=${rvm_gem_name_version%-*}
|
891
|
-
rvm_gem_version=${rvm_gem_name_version##*-}
|
892
|
-
if [ -d $GEM_HOME/gems/$rvm_gem_name_version ] ; then
|
893
|
-
echo "$rvm_gem_name_version already installed."
|
894
|
-
else
|
895
|
-
__rvm_gi $rvm_source_gem_dir/cache/$rvm_gem_name-$rvm_gem_version.gem
|
896
|
-
fi
|
897
|
-
done
|
898
|
-
unset rvm_gem_name_version rvm_gem_name rvm_gem_version
|
899
|
-
else
|
900
|
-
__rvm_log "fail" "Unknown $rvm_ruby_interpreter version: $rvm_ruby_version"
|
901
|
-
fi
|
902
|
-
|
903
|
-
}
|
904
|
-
|
905
|
-
function __rvm_run {
|
906
|
-
log_file="1" ; shift
|
907
|
-
command="$*"
|
908
|
-
if [ $rvm_debug ] ; then __rvm_log "debug" "Executing: $command" ; fi
|
909
|
-
eval "nice -n $rvm_niceness $command" > $rvm_ruby_log_path/log_file.log 2> $rvm_ruby_log_path/log_file.error.log
|
910
|
-
if [ $? -gt 0 ] ; then __rvm_log "error" "There was an error, please check $rvm_ruby_log_path/log_file.error.log" ; popd 2> /dev/null ; return 1 ; fi
|
911
|
-
unset log_file command
|
912
|
-
}
|
913
|
-
|
914
|
-
function __rvm_cache {
|
915
|
-
rvm_cache_file="$rvm_config_path/cache"
|
916
|
-
touch $rvm_cache_file
|
917
|
-
key="$1" ; shift
|
918
|
-
|
919
|
-
if [ -z "$key" ] ; then
|
920
|
-
__rvm_log "fail" "__rvm_cache must be called with at least one argument: __rvm_cache key [value]"
|
921
|
-
else
|
922
|
-
if [ "$key" = "unset" -o "$key" = "delete" ] ; then
|
923
|
-
sed -i~ "s/^$2=.*$//" $rvm_cache_file
|
924
|
-
else
|
925
|
-
value="$*"
|
926
|
-
if [ -z "$value" ] ; then # get
|
927
|
-
grep "^$key=" $rvm_cache_file | awk -F'=' '{print $2}'
|
928
|
-
else # set
|
929
|
-
if [ -z "$(grep "^$key=" $rvm_cache_file)" ] ; then # append
|
930
|
-
echo "$key=$value" >> $rvm_cache_file
|
931
|
-
else # overwrite
|
932
|
-
sed -i~ "s/^$key=.*$/$key=$value/" $rvm_cache_file
|
933
|
-
fi
|
934
|
-
fi
|
935
|
-
fi
|
936
|
-
fi
|
937
|
-
}
|
938
|
-
|
939
|
-
function __rvm_cleanup-variables {
|
940
|
-
unset rvm_selected rvm_action rvm_ruby_interpreter rvm_ruby_patch_level rvm_ruby_version rvm_irbrc_file rvm_ruby_irbrc rvm_source_path rvm_install_path rvm_debug rvm_prefix_path rvm_ruby_package_name rvm_gem_path rvm_command rvm_error_message IRBRC rvm_ruby_home rvm_ruby_binary rvm_gem_set_name rvm_delete_flag rvm_ruby_tag rvm_ruby_rev rvm_url rvm_ruby_make rvm_ruby_make_install rvm_config_path rvm_bin_path rvm_force rvm_set_prompt rvm_all
|
941
|
-
}
|
942
|
-
|
943
|
-
function __rvm_get-user-defaults {
|
944
|
-
# NOW load defaults settings. TODO: root user loads /etc/rvmrc
|
945
|
-
if [ -s ~/.rvmrc ] ; then source ~/.rvmrc ; fi
|
946
|
-
}
|
947
|
-
|
948
|
-
function __rvm_parse-args {
|
949
|
-
while [ $# -gt 0 ] ; do
|
950
|
-
rvm_token="$1" ; shift
|
951
|
-
case "$rvm_token" in
|
952
|
-
install|uninstall|path|info|setup|version|srcdir|list|symlinks|reset|debug|reload|usage|help|implode|update)
|
953
|
-
rvm_action=$rvm_token
|
954
|
-
;;
|
955
|
-
use)
|
956
|
-
rvm_action=$rvm_token
|
957
|
-
if [ "$1" = "default" ] ; then
|
958
|
-
rvm_ruby_interpreter="system" ; shift
|
959
|
-
elif [ -z "$1" ] ; then
|
960
|
-
rvm_ruby_interpreter="system"
|
961
|
-
fi
|
962
|
-
;;
|
963
|
-
|
964
|
-
ruby|jruby|ree|macruby|rbx|rubinius|default|all)
|
965
|
-
rvm_ruby_interpreter="$rvm_token"
|
966
|
-
rvm_action="${rvm_action:-use}"
|
967
|
-
;;
|
968
|
-
|
969
|
-
gemdir)
|
970
|
-
rvm_action=$rvm_token
|
971
|
-
|
972
|
-
if [ "$1" = "system" ] ; then
|
973
|
-
rvm_ruby_interpreter="system" ; shift
|
974
|
-
fi
|
975
|
-
|
976
|
-
if [ "$1" = "user" ] ; then
|
977
|
-
rvm_ruby_interpreter="user" ; shift
|
978
|
-
fi
|
979
|
-
|
980
|
-
rvm_ruby_interpreter="${rvm_ruby_interpreter:-current}"
|
981
|
-
;;
|
982
|
-
|
983
|
-
gemdup)
|
984
|
-
rvm_action=$rvm_token
|
985
|
-
if [ -z "$1" ] ; then
|
986
|
-
rvm_ruby_interpreter="default"
|
987
|
-
elif [ "$1" = "system" ] ; then
|
988
|
-
rvm_ruby_interpreter=$1 ; shift
|
989
|
-
elif [ "$1" = "default" ] ; then
|
990
|
-
rvm_ruby_interpreter=$1 ; shift
|
991
|
-
else
|
992
|
-
rvm_ruby_interpreter=$1 ; shift
|
993
|
-
rvm_ruby_version=$2 ; shift
|
994
|
-
fi
|
995
|
-
;;
|
996
|
-
|
997
|
-
do|rubydo)
|
998
|
-
rvm_action=$rvm_token
|
999
|
-
temp=$(echo $1 | awk '{print substr($1, 0, 1)}')
|
1000
|
-
if [ "$temp" != "-" ] ; then
|
1001
|
-
if [ ! -z "$(echo $temp | grep '[0-9]')" ] ; then
|
1002
|
-
rvm_ruby_version=$(echo "$1" | tr ',' ' ') ; shift
|
1003
|
-
else
|
1004
|
-
rvm_ruby_version=$1 ; shift
|
1005
|
-
fi
|
1006
|
-
else
|
1007
|
-
unset rvm_ruby_version
|
1008
|
-
fi
|
1009
|
-
unset rvm_ruby_interpreter
|
1010
|
-
;;
|
1011
|
-
|
1012
|
-
1.8|1.8.0|1.8.1|1.8.2|1.8.3|1.8.4|1.8.5|1.8.6|1.8.7|1.9|1.9.1|1.9.2)
|
1013
|
-
rvm_ruby_interpreter="ruby"
|
1014
|
-
rvm_ruby_version="$rvm_token"
|
1015
|
-
rvm_action="${rvm_action:-use}"
|
1016
|
-
;;
|
1017
|
-
1.2.0|1.3.1)
|
1018
|
-
rvm_ruby_interpreter="jruby"
|
1019
|
-
rvm_ruby_version="$rvm_token"
|
1020
|
-
rvm_action="${rvm_action:-use}"
|
1021
|
-
;;
|
1022
|
-
|
1023
|
-
-v|--version)
|
1024
|
-
if [ -z "$1" ] ; then
|
1025
|
-
rvm_action="version"
|
1026
|
-
else
|
1027
|
-
rvm_ruby_version="$1"
|
1028
|
-
fi
|
1029
|
-
shift
|
1030
|
-
;;
|
1031
|
-
|
1032
|
-
-t|--tag) rvm_ruby_tag="$1";
|
1033
|
-
rvm_action="${rvm_action:-use}"
|
1034
|
-
shift ;;
|
1035
|
-
-r|--rev) rvm_ruby_rev="$1";
|
1036
|
-
rvm_action="${rvm_action:-use}"
|
1037
|
-
shift ;;
|
1038
|
-
-b|--branch) rvm_ruby_rev="$1";
|
1039
|
-
rvm_action="${rvm_action:-use}"
|
1040
|
-
shift ;;
|
1041
|
-
|
1042
|
-
|
1043
|
-
-P|--prefix) rvm_prefix_path="$1" ; shift ;;
|
1044
|
-
-B|--bin) rvm_bin_path="$1" ; shift ;;
|
1045
|
-
-S|--source) rvm_source_path="$1" ; shift ;;
|
1046
|
-
-A|--archive) rvm_archives_path="$1" ; shift ;;
|
1047
|
-
-G|--gems) rvm_gem_path="$1" ; shift ;;
|
1048
|
-
-C|--configure)
|
1049
|
-
if [ ! -z "$1" ] ; then
|
1050
|
-
rvm_ruby_configure="$(echo $1 | tr ',' ' ')"
|
1051
|
-
shift
|
1052
|
-
else
|
1053
|
-
rvm_action="error"
|
1054
|
-
rvm_error_message="--configure *must* be followed by configure flags."
|
1055
|
-
break;
|
1056
|
-
fi
|
1057
|
-
;;
|
1058
|
-
-M|--make) rvm_ruby_make="$1" ; shift ;;
|
1059
|
-
-I|--make-install) rvm_ruby_make_install="$1" ; shift ;;
|
1060
|
-
-l|--level) rvm_ruby_patch_level="$1" ; shift ;;
|
1061
|
-
-n|--nice) rvm_niceness="$1" ; shift ;;
|
1062
|
-
-f|--file) rvm_ruby_args="$1" ; shift ;;
|
1063
|
-
-h|--help) rvm_action=help ; shift ;;
|
1064
|
-
-d|--default) rvm_set_default=1 ;;
|
1065
|
-
--head) rvm_ruby_rev="head" ;;
|
1066
|
-
--trace|--debug) rvm_debug=1 ;;
|
1067
|
-
--force) rvm_force=1 ;;
|
1068
|
-
--set-prompt) rvm_set_prompt=1 ;;
|
1069
|
-
--all) rvm_all=1 ; shift ;;
|
1070
|
-
-m|--gem-set) rvm_gem_set_name="$1" ; shift ;;
|
1071
|
-
--rm-gem-set) rvm_gem_set_name_rm="$1" ; shift ;;
|
1072
|
-
--jit) rvm_rubinius_jit="RBX_LLVM=1" ;;
|
1073
|
-
|
1074
|
-
default|system)
|
1075
|
-
rvm_action="use"
|
1076
|
-
rvm_ruby_interpreter="system"
|
1077
|
-
;;
|
1078
|
-
*)
|
1079
|
-
rvm_action="error"
|
1080
|
-
rvm_error_message="Unrecognized command line argument(s): '$rvm_token $*'"
|
1081
|
-
break;
|
1082
|
-
esac
|
1083
|
-
if [ ! -z "$rvm_ruby_args" -o ! -z "$rvm_error_message" ] ; then break; fi
|
1084
|
-
done
|
1085
|
-
|
1086
|
-
if [ ! -z "$rvm_error_message" ] ; then popd 2> /dev/null ; return 1 ; fi
|
1087
|
-
if [ -z "$rvm_debug" ] ; then set +x ; else set -x ; fi
|
1088
|
-
|
1089
|
-
}
|
1090
|
-
|
1091
|
-
function rvm {
|
1092
|
-
|
1093
|
-
__rvm_cleanup-variables
|
1094
|
-
__rvm_get-user-defaults
|
1095
|
-
__rvm_initialize
|
1096
|
-
__rvm_set-defaults
|
1097
|
-
__rvm_parse-args $*
|
1098
|
-
|
1099
|
-
case "$rvm_action" in
|
1100
|
-
install) __rvm_install-ruby $rvm_ruby_interpreter $rvm_ruby_version $rvm_ruby_patch_level ;;
|
1101
|
-
uninstall) __rvm_uninstall $rvm_ruby_interpreter $rvm_ruby_version $rvm_ruby_patch_level ;;
|
1102
|
-
use) __rvm_use $rvm_ruby_interpreter $rvm_ruby_version $rvm_ruby_patch_level ;;
|
1103
|
-
list) __rvm_list ;;
|
1104
|
-
gemdir) __rvm_gem-dir $rvm_ruby_interpreter $rvm_ruby_version $rvm_ruby_patch_level ;;
|
1105
|
-
srcdir) __rvm_src-dir $rvm_ruby_interpreter $rvm_ruby_version $rvm_ruby_patch_level ;;
|
1106
|
-
gemdup) __rvm_gem-dup $rvm_ruby_interpreter $rvm_ruby_version $rvm_ruby_patch_level ;;
|
1107
|
-
symlinks) __rvm_symlinks ;;
|
1108
|
-
version) __rvm_version ;;
|
1109
|
-
rubydo)
|
1110
|
-
if [ ! -z "$rvm_ruby_version" ] ; then
|
1111
|
-
rvm_ruby_versions=$(echo $rvm_ruby_version | tr ',' ' ')
|
1112
|
-
for rvm_ruby_version in $rvm_ruby_versions ; do
|
1113
|
-
temp=$(echo $rvm_ruby_version | awk '{print substr($1, 0, 1)}')
|
1114
|
-
if [ ! -z "$(echo $temp | grep '[0-9]')" ] ; then
|
1115
|
-
rvm_ruby_interpreter="ruby"
|
1116
|
-
else
|
1117
|
-
rvm_ruby_interpreter="$rvm_ruby_version"
|
1118
|
-
unset rvm_ruby_version
|
1119
|
-
fi
|
1120
|
-
unset temp
|
1121
|
-
__rvm_select $rvm_ruby_interpreter $rvm_ruby_version
|
1122
|
-
|
1123
|
-
rvm_command="$rvm_ruby_binary $rvm_ruby_args"
|
1124
|
-
echo "$(basename $rvm_ruby_binary):"
|
1125
|
-
eval $rvm_command
|
1126
|
-
unset rvm_ruby_interpreter rvm_ruby_patch_level rvm_ruby_version rvm_ruby_package_name rvm_ruby_home rvm_ruby_irbrc rvm_ruby_binary
|
1127
|
-
done
|
1128
|
-
else # all
|
1129
|
-
rvm_ruby_versions=`/bin/ls $rvm_install_path/bin/ruby-*`
|
1130
|
-
for rvm_ruby_binary in $rvm_ruby_versions ; do
|
1131
|
-
if [ -x $rvm_ruby_binary ] ; then
|
1132
|
-
rvm_command="$rvm_ruby_binary $rvm_ruby_args"
|
1133
|
-
echo "$(basename $rvm_ruby_binary):"
|
1134
|
-
eval $rvm_command
|
1135
|
-
fi
|
1136
|
-
done
|
1137
|
-
fi
|
1138
|
-
;;
|
1139
|
-
reset) __rvm_reset ;;
|
1140
|
-
# TODO: how can we use bin_path here for reload, default file?
|
1141
|
-
reload) source ~/.rvm/scripts/rvm ;;
|
1142
|
-
implode) __rvm_implode ;;
|
1143
|
-
update)
|
1144
|
-
if [ "$rvm_ruby_rev" = "head" ] ; then
|
1145
|
-
if [ -d $rvm_source_path/rvm/.git ] ; then
|
1146
|
-
cd $rvm_source_path/rvm/ && git pull origin master
|
1147
|
-
else
|
1148
|
-
cd $rvm_source_path && git clone git://github.com/wayneeseguin/rvm.git && cd rvm/
|
1149
|
-
fi
|
1150
|
-
./scripts/rvm-update
|
1151
|
-
else
|
1152
|
-
# TODO: rvm_install_path:
|
1153
|
-
gem install rvm --no-rdoc --no-ri -q && rvm-update && source ~/.rvm/scripts/rvm
|
1154
|
-
fi
|
1155
|
-
;;
|
1156
|
-
error) __rvm_log "fail" "$rvm_error_message ( see: rvm usage )" ; popd 2> /dev/null ; return 1; ;;
|
1157
|
-
info|debug)
|
1158
|
-
__rvm_version
|
1159
|
-
cat <<-Info
|
1160
|
-
|
1161
|
-
ruby:
|
1162
|
-
interpreter: "$(ruby -v | awk '{print $1}')"
|
1163
|
-
version: "$(ruby -v | awk '{print $2}')"
|
1164
|
-
date: "$(ruby -v | sed 's/^.*(\([0-9]\{4\}\(-[0-9][0-9]\)\{2\}\).*$/\1/')"
|
1165
|
-
platform: "$(ruby -v | sed 's/^.*\[//' | sed 's/\].*$//')"
|
1166
|
-
patchlevel: "$(ruby -v | sed 's/^.*(//' | sed 's/).*$//')"
|
1167
|
-
full_version: "$(ruby -v)"
|
1168
|
-
|
1169
|
-
homes:
|
1170
|
-
gem: "${GEM_HOME:-'not set'}"
|
1171
|
-
ruby: "${MY_RUBY_HOME:-'not set'}"
|
1172
|
-
|
1173
|
-
binaries:
|
1174
|
-
ruby: "$(which ruby)"
|
1175
|
-
irb: "$(which irb)"
|
1176
|
-
gem: "$(which gem)"
|
1177
|
-
|
1178
|
-
environment:
|
1179
|
-
GEM_HOME: "$GEM_HOME"
|
1180
|
-
MY_RUBY_HOME: "$MY_RUBY_HOME"
|
1181
|
-
IRBRC: "$IRBRC"
|
1182
|
-
Info
|
1183
|
-
|
1184
|
-
if [ "$rvm_action" = "debug" ] ; then
|
1185
|
-
__rvm_log "info" "PATH:$(echo $PATH | awk -F":" '{print $1":"$2":"$3":"$4":"$5}')"
|
1186
|
-
for file in .bash_profile .bashrc .zshrc ; do
|
1187
|
-
if [ -s $file ] ; then
|
1188
|
-
__rvm_log "debug" "~/$file:\n$(cat ~/$file | grep rvm)\n"
|
1189
|
-
fi
|
1190
|
-
done
|
1191
|
-
if [ -s $rvm_install_path/current ] ; then
|
1192
|
-
__rvm_log "debug" "$rvm_install_path/current:\n$($rvm_install_path/current)\n"
|
1193
|
-
fi
|
1194
|
-
if [ -e $rvm_install_path/bin/rvm ] ; then
|
1195
|
-
__rvm_log "debug" "rvm script in bin:\n$(ls -laht $rvm_install_path/bin/rvm)"
|
1196
|
-
fi
|
1197
|
-
fi
|
1198
|
-
return 0
|
1199
|
-
;;
|
1200
|
-
usage|help) __rvm_usage ;;
|
1201
|
-
*)
|
1202
|
-
if [ ! -z "$rvm_action" ] ; then
|
1203
|
-
__rvm_log "fail" "unknown action '$rvm_action'"
|
1204
|
-
else
|
1205
|
-
__rvm_usage
|
1206
|
-
fi
|
1207
|
-
return 1
|
1208
|
-
esac
|
1209
|
-
|
1210
|
-
if [ "$rvm_debug" = "1" ] ; then set +x ; unset rvm_debug ; fi
|
1211
|
-
}
|
9
|
+
if [ -s ~/.rvmrc ] ; then source ~/.rvmrc ; fi
|
10
|
+
eval rvm_path="${rvm_path:-~/.rvm}"
|
1212
11
|
|
1213
|
-
|
12
|
+
source $rvm_path/scripts/rvm-utility
|
13
|
+
source $rvm_path/scripts/rvm-selector
|
14
|
+
source $rvm_path/scripts/rvm-ruby-installer # TODO: Script not function.
|
15
|
+
source $rvm_path/scripts/rvm-cli
|
1214
16
|
|
17
|
+
if [ -f ~/.rvm/current ] ; then source ~/.rvm/current ; fi
|