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