wayneeseguin-rvm 0.0.9 → 0.0.15
Sign up to get free protection for your applications and to get access to all the features.
- data/README +36 -14
- data/bash/rvm +285 -141
- data/bash/rvm-install +96 -20
- data/bin/rvm-install +1 -1
- metadata +2 -3
data/README
CHANGED
@@ -1,10 +1,15 @@
|
|
1
1
|
|
2
2
|
About:
|
3
3
|
|
4
|
-
rvm 0.0.
|
4
|
+
rvm 0.0.18 http://github.com/wayneeseguin/rvm
|
5
5
|
|
6
6
|
by Wayne E. Seguin (wayneeseguin@gmail.com)
|
7
7
|
|
8
|
+
Installation:
|
9
|
+
|
10
|
+
$ gem install rvm # Install the rvm gem
|
11
|
+
$ rvm-install # Install rvm, adds hooks for bash & zsh
|
12
|
+
|
8
13
|
Usage:
|
9
14
|
|
10
15
|
rvm Action [Implementation] [Options]
|
@@ -12,15 +17,18 @@
|
|
12
17
|
Action:
|
13
18
|
|
14
19
|
* usage - Show this usage information
|
15
|
-
use - Switch to using a specific ruby
|
20
|
+
use - Switch to using a specific ruby version (new login shell)
|
16
21
|
info - Show information for current ruby
|
22
|
+
list - Show currently installed versions
|
17
23
|
gemdir - Switch to gem directory for installation (new login shell)
|
18
24
|
srcdir - Switch to src directory for the current ruby installation
|
19
|
-
gemdup - Clone source
|
20
|
-
(expiramental) Example: rvm gemdup ~/.gem/ruby/1.8/
|
25
|
+
gemdup - Clone source version gems to current version
|
26
|
+
(highly expiramental) Example: rvm gemdup ~/.gem/ruby/1.8/
|
21
27
|
install - Install a ruby version, default is from source
|
22
28
|
uninstall - Uninstall a ruby version
|
23
|
-
|
29
|
+
reset - Remove default and current settings, exit the shell.
|
30
|
+
(If you experience odd behavior try this first)
|
31
|
+
debug - Emit environment & configuration information for *current* ruby
|
24
32
|
|
25
33
|
Implementation:
|
26
34
|
|
@@ -44,29 +52,33 @@
|
|
44
52
|
* Defaults above are denoted with a '*' prefix.
|
45
53
|
* rvm is intended to be run as an individual user (not root, yet)
|
46
54
|
* All ruby installation, configuration and source files are in ~/.rvm
|
47
|
-
* To manually reset to defaults: "rm -f ~/.rvm/current", then open new shell
|
48
|
-
* To preserve previous gem installations for a particular ruby version copy,
|
49
|
-
move, symlink or copy the old gem directory to (1.8 for 1.8.X):
|
50
|
-
~/.gem/$interpreter/$version
|
51
55
|
|
52
56
|
Examples:
|
53
57
|
|
54
|
-
$
|
55
|
-
$ rvm
|
58
|
+
$ rvm -v # RVM version
|
59
|
+
$ rvm list # available rvm versions
|
60
|
+
$ rvm info # ruby information for current shell
|
56
61
|
$ rvm install jruby # Install jRuby (default version is 1.3.1)
|
57
62
|
$ rvm use ruby -v 1.9.1 # Use Ruby 1.9.1, installs if necessary
|
58
63
|
$ rvm use 1.9 # Equivalent to above, due to defaults
|
59
64
|
$ rvm use 1.8 # Use Ruby 1.8.6, installs if necessary
|
65
|
+
$ rvm gemdir # Switch to gems directory for current ruby
|
66
|
+
$ rvm gemdir system # Switch to the system gems directory
|
67
|
+
$ rvm gemdir system user # Switch to the system user gems directory
|
68
|
+
$ rvm gemdir ruby 1.9 # Switch to gems directory for ruby 1.9.1
|
60
69
|
$ rvm use default # Use the system default (as if no rvm)
|
61
|
-
$ rvm
|
70
|
+
$ rvm reset # Reset to pre-rvm state.
|
71
|
+
$ rvm uninstall 1.8.7 # Uninstall rvm installed 1.8.7 version
|
72
|
+
$ rvm gemdup default # Install gems from ~/.gem/ruby/1.8/
|
62
73
|
|
63
74
|
TODO: (in order)
|
64
75
|
|
65
|
-
* rvm
|
76
|
+
* rvm gemdup
|
66
77
|
* root support
|
67
78
|
* Settings file, user overridable
|
79
|
+
* Show current in rvm list, if applicable
|
68
80
|
|
69
|
-
|
81
|
+
Many Thanks:
|
70
82
|
|
71
83
|
Bash Support Testing
|
72
84
|
|
@@ -81,3 +93,13 @@
|
|
81
93
|
- Franco Lazzarino (flazzarino@gmail.com)
|
82
94
|
irc: flazz ; github: http://github.com/flazz
|
83
95
|
|
96
|
+
Ubuntu Linux Support Testing
|
97
|
+
|
98
|
+
- Anita Kuno (anteaya@anteaya.info)
|
99
|
+
irc: anteaya ; github: http://github.com/anteaya
|
100
|
+
|
101
|
+
Website Design
|
102
|
+
|
103
|
+
- Jim Lindley (jlindley@gmail.com)
|
104
|
+
irc: jlindley ; github: http://github.com/jlindley
|
105
|
+
|
data/bash/rvm
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
rvm_author="Wayne E. Seguin"
|
4
4
|
rvm_author_email="wayneeseguin@gmail.com"
|
5
5
|
rvm_website="http://github.com/wayneeseguin/rvm"
|
6
|
-
rvm_version="0.0.
|
6
|
+
rvm_version="0.0.19"
|
7
7
|
rvm_updated="2009.08.25"
|
8
8
|
|
9
9
|
#
|
@@ -23,6 +23,11 @@ function rvm-usage {
|
|
23
23
|
|
24
24
|
by ${rvm_author} (${rvm_author_email})
|
25
25
|
|
26
|
+
Installation:
|
27
|
+
|
28
|
+
$ gem install rvm # Install the rvm gem
|
29
|
+
$ rvm-install # Install rvm, adds hooks for bash & zsh
|
30
|
+
|
26
31
|
Usage:
|
27
32
|
|
28
33
|
rvm Action [Implementation] [Options]
|
@@ -30,16 +35,18 @@ function rvm-usage {
|
|
30
35
|
Action:
|
31
36
|
|
32
37
|
* usage - Show this usage information
|
33
|
-
use - Switch to using a specific ruby
|
38
|
+
use - Switch to using a specific ruby version (new login shell)
|
34
39
|
info - Show information for current ruby
|
35
40
|
list - Show currently installed versions
|
36
41
|
gemdir - Switch to gem directory for installation (new login shell)
|
37
42
|
srcdir - Switch to src directory for the current ruby installation
|
38
|
-
gemdup - Clone source
|
39
|
-
(expiramental) Example: rvm gemdup ~/.gem/ruby/1.8/
|
43
|
+
gemdup - Clone source version gems to current version
|
44
|
+
(highly expiramental) Example: rvm gemdup ~/.gem/ruby/1.8/
|
40
45
|
install - Install a ruby version, default is from source
|
41
46
|
uninstall - Uninstall a ruby version
|
42
|
-
|
47
|
+
reset - Remove default and current settings, exit the shell.
|
48
|
+
(If you experience odd behavior try this first)
|
49
|
+
debug - Emit environment & configuration information for *current* ruby
|
43
50
|
|
44
51
|
Implementation:
|
45
52
|
|
@@ -63,30 +70,33 @@ function rvm-usage {
|
|
63
70
|
* Defaults above are denoted with a '*' prefix.
|
64
71
|
* rvm is intended to be run as an individual user (not root, yet)
|
65
72
|
* All ruby installation, configuration and source files are in ~/.rvm
|
66
|
-
* To manually reset to defaults: "rm -f ~/.rvm/current", then open new shell
|
67
|
-
* To preserve previous gem installations for a particular ruby version copy,
|
68
|
-
move, symlink or copy the old gem directory to (1.8 for 1.8.X):
|
69
|
-
~/.gem/\$interpreter/\$version
|
70
73
|
|
71
74
|
Examples:
|
72
75
|
|
73
|
-
$
|
74
|
-
$ rvm
|
76
|
+
$ rvm -v # RVM version
|
77
|
+
$ rvm list # available rvm versions
|
78
|
+
$ rvm info # ruby information for current shell
|
75
79
|
$ rvm install jruby # Install jRuby (default version is 1.3.1)
|
76
80
|
$ rvm use ruby -v 1.9.1 # Use Ruby 1.9.1, installs if necessary
|
77
81
|
$ rvm use 1.9 # Equivalent to above, due to defaults
|
78
82
|
$ rvm use 1.8 # Use Ruby 1.8.6, installs if necessary
|
83
|
+
$ rvm gemdir # Switch to gems directory for current ruby
|
84
|
+
$ rvm gemdir system # Switch to the system gems directory
|
85
|
+
$ rvm gemdir system user # Switch to the system user gems directory
|
86
|
+
$ rvm gemdir ruby 1.9 # Switch to gems directory for ruby 1.9.1
|
79
87
|
$ rvm use default # Use the system default (as if no rvm)
|
80
|
-
$ rvm
|
88
|
+
$ rvm reset # Reset to pre-rvm state.
|
89
|
+
$ rvm uninstall 1.8.7 # Uninstall rvm installed 1.8.7 version
|
90
|
+
$ rvm gemdup default # Install gems from ~/.gem/ruby/1.8/
|
81
91
|
|
82
92
|
TODO: (in order)
|
83
93
|
|
84
|
-
* rvm
|
94
|
+
* rvm gemdup
|
85
95
|
* root support
|
86
96
|
* Settings file, user overridable
|
87
97
|
* Show current in rvm list, if applicable
|
88
98
|
|
89
|
-
|
99
|
+
Many Thanks:
|
90
100
|
|
91
101
|
Bash Support Testing
|
92
102
|
|
@@ -101,39 +111,51 @@ function rvm-usage {
|
|
101
111
|
- Franco Lazzarino (flazzarino@gmail.com)
|
102
112
|
irc: flazz ; github: http://github.com/flazz
|
103
113
|
|
114
|
+
Ubuntu Linux Support Testing
|
115
|
+
|
116
|
+
- Anita Kuno (anteaya@anteaya.info)
|
117
|
+
irc: anteaya ; github: http://github.com/anteaya
|
118
|
+
|
119
|
+
Website Design
|
120
|
+
|
121
|
+
- Jim Lindley (jlindley@gmail.com)
|
122
|
+
irc: jlindley ; github: http://github.com/jlindley
|
123
|
+
|
104
124
|
Usage
|
105
125
|
|
106
126
|
}
|
107
127
|
|
108
128
|
# Logging functions based on level
|
109
|
-
function log { echo -e "\n $* \e[0m" ; }
|
110
|
-
function debug { log "\e[4;34m <d> \e[0m$*" ; }
|
111
|
-
function info { log "\e[0;32m <i> \e[0m$*" ; }
|
112
|
-
function warn { log "\e[0;33m <w> \e[0m$*" ; }
|
113
|
-
function error { log "\e[0;31m <e> \e[0m$*" ; }
|
114
|
-
function fail { log "\e[0;31m <e> \e[0m$*" ; return 1 ; }
|
129
|
+
function rvm-log { echo -e "\n $* \e[0m" ; }
|
130
|
+
function rvm-log-debug { rvm-log "\e[4;34m <d> \e[0m$*" ; }
|
131
|
+
function rvm-log-info { rvm-log "\e[0;32m <i> \e[0m$*" ; }
|
132
|
+
function rvm-log-warn { rvm-log "\e[0;33m <w> \e[0m$*" ; }
|
133
|
+
function rvm-log-error { rvm-log "\e[0;31m <e> \e[0m$*" ; }
|
134
|
+
function rvm-log-fail { rvm-log "\e[0;31m <e> \e[0m$*" ; return 1 ; }
|
115
135
|
|
116
136
|
function rvm-gi { gem install -q --no-rdoc --no-ri $* ; }
|
117
137
|
|
118
138
|
function rvm-info {
|
119
139
|
|
120
|
-
full_version=$(ruby -v)
|
121
|
-
ruby_implementation=$(echo "$full_version" | awk '{print $1}')
|
122
|
-
ruby_version=$(echo "$full_version" | awk '{print $2}')
|
123
|
-
ruby_patchlevel=$(echo "$full_version" | sed 's/^.*(//' | sed 's/).*$//')
|
124
|
-
ruby_date=$(echo "$full_version" | sed 's/^.*(\([0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]\).*$/\1/')
|
125
|
-
ruby_platform=$(echo "$full_version" | sed 's/^.*\[//' | sed 's/\].*$//')
|
126
|
-
|
127
140
|
cat <<-Info
|
141
|
+
|
128
142
|
ruby:
|
129
|
-
|
130
|
-
version:
|
131
|
-
date:
|
132
|
-
platform:
|
133
|
-
patchlevel:
|
134
|
-
|
135
|
-
|
136
|
-
|
143
|
+
interpreter: "$(ruby -v | awk '{print $1}')"
|
144
|
+
version: "$(ruby -v | awk '{print $2}')"
|
145
|
+
date: "$(ruby -v | sed 's/^.*(\([0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]\).*$/\1/')"
|
146
|
+
platform: "$(ruby -v | sed 's/^.*\[//' | sed 's/\].*$//')"
|
147
|
+
patchlevel: "$(ruby -v | sed 's/^.*(//' | sed 's/).*$//')"
|
148
|
+
full_version: "$(ruby -v)"
|
149
|
+
|
150
|
+
homes:
|
151
|
+
gem: "${GEM_HOME-not set}"
|
152
|
+
ruby: "${MY_RUBY_HOME-not set}"
|
153
|
+
|
154
|
+
binaries:
|
155
|
+
ruby: "$(which ruby)"
|
156
|
+
irb: "$(which irb)"
|
157
|
+
gem: "$(which gem)"
|
158
|
+
|
137
159
|
Info
|
138
160
|
|
139
161
|
}
|
@@ -146,13 +168,13 @@ function rvm-install-source {
|
|
146
168
|
1.9.2) major="1.9" ; minor="2" ; level="${2-review1}" ;;
|
147
169
|
1.8|1.8.6) major="1.8" ; minor="6" ; level="${2-369}" ;;
|
148
170
|
1.8.7) major="1.8" ; minor="7" ; level="${2-174}" ;;
|
149
|
-
*) fail "Ruby version '$version' is unknown."
|
171
|
+
*) rvm-log-fail "Ruby version '$version' is unknown."
|
150
172
|
esac
|
151
173
|
|
152
174
|
package_name="ruby-$major.$minor-p$level"
|
153
175
|
url="ftp://ftp.ruby-lang.org/pub/ruby/$major/$package_name.tar.gz"
|
154
176
|
|
155
|
-
info "Installing Ruby from source to: $install_path/$package_name"
|
177
|
+
rvm-log-info "Installing Ruby from source to: $install_path/$package_name"
|
156
178
|
mkdir -p $install_path/$package_name
|
157
179
|
|
158
180
|
pushd $source_path > /dev/null
|
@@ -160,41 +182,44 @@ function rvm-install-source {
|
|
160
182
|
cd $package_name
|
161
183
|
else
|
162
184
|
if [ ! -f "$package_name.tar.gz" ] ; then
|
163
|
-
info "\tDownloading $package_name, this may take a while depending on your connection..."
|
164
|
-
curl
|
185
|
+
rvm-log-info "\tDownloading $package_name, this may take a while depending on your connection..."
|
186
|
+
$curl $url
|
165
187
|
fi
|
166
|
-
info "\tExtracting $package_name..."
|
188
|
+
rvm-log-info "\tExtracting $package_name..."
|
167
189
|
tar xzf $package_name.tar.gz && cd $package_name
|
168
190
|
fi
|
169
191
|
|
170
|
-
info "\tConfiguring $package_name using ${configure-'--enable-shared'}, this may take a while depending on your cpu(s)..."
|
192
|
+
rvm-log-info "\tConfiguring $package_name using ${configure-'--enable-shared'}, this may take a while depending on your cpu(s)..."
|
171
193
|
./configure --prefix=$install_path/$package_name ${configure-'--enable-shared'} > $install_path/$package_name/configure.log 2> $install_path/$package_name/configure.error.log
|
172
194
|
|
173
|
-
info "\tCompiling $package_name, this may take a while, depending on your cpu(s)..."
|
195
|
+
rvm-log-info "\tCompiling $package_name, this may take a while, depending on your cpu(s)..."
|
174
196
|
make > $install_path/$package_name/make.log 2> $install_path/$package_name/make.error.log
|
175
197
|
|
176
|
-
info "\tInstalling $package_name"
|
198
|
+
rvm-log-info "\tInstalling $package_name"
|
177
199
|
make install > $install_path/$package_name/install.log 2> $install_path/$package_name/install.error.log
|
178
200
|
chmod +x $install_path/$package_name/bin/*
|
179
201
|
|
202
|
+
# Create the ~/.rvm/bin/$package_name
|
203
|
+
ln -fs $install_path/$package_name/bin/ruby $install_path/bin/$package_name
|
204
|
+
|
180
205
|
# Now install rubygems for this ruby version.
|
181
|
-
info "\tInstalling rubygems dedicated to $package_name..."
|
206
|
+
rvm-log-info "\tInstalling rubygems dedicated to $package_name..."
|
182
207
|
gem_package_name="rubygems-1.3.5"
|
183
208
|
gem_url="http://rubyforge.org/frs/download.php/60718/$gem_package_name.tgz"
|
184
209
|
if [ -d $gem_package_name ] ; then
|
185
210
|
cd $gem_package_name
|
186
211
|
else
|
187
|
-
if [ ! -f $gem_package_name.tgz ] ; then curl
|
212
|
+
if [ ! -f $gem_package_name.tgz ] ; then $curl $gem_url ; fi
|
188
213
|
tar zxf $gem_package_name.tgz && cd $gem_package_name
|
189
214
|
fi
|
190
215
|
# Well this is fun... fix nil error on require_paths:
|
191
216
|
sed -i '' "s/require_paths\.join/require_paths.to_a.join/" $source_path/$package_name/$gem_package_name/lib/rubygems/gem_path_searcher.rb
|
192
217
|
$install_path/$package_name/bin/ruby ./setup.rb > $install_path/$package_name/rubygems.install.log 2> $install_path/$package_name/rubygems.install.error.log
|
193
218
|
popd > /dev/null
|
194
|
-
info "Installation of $package_name complete."
|
219
|
+
rvm-log-info "Installation of $package_name complete."
|
195
220
|
|
196
221
|
for gem_name in rake ; do
|
197
|
-
info "Installing $gem_name"
|
222
|
+
rvm-log-info "Installing $gem_name"
|
198
223
|
$install_path/$package_name/bin/gem install $gem_name --no-rdoc --no-ri -q >> $install_path/$package_name/gems.install.log
|
199
224
|
done
|
200
225
|
}
|
@@ -208,41 +233,43 @@ function rvm-install-ruby {
|
|
208
233
|
patchlevel=${patchlevel-20090610}
|
209
234
|
package_name="ruby-enterprise-$version-$patchlevel"
|
210
235
|
url="http://rubyforge.org/frs/download.php/58677/$package_name.tar.gz"
|
211
|
-
info "Installing Ruby Enterprise Edition from source to: $install_path/$package_name"
|
236
|
+
rvm-log-info "Installing Ruby Enterprise Edition from source to: $install_path/$package_name"
|
212
237
|
pushd $source_path > /dev/null
|
213
238
|
if [ -d $package_name ] ; then
|
214
239
|
cd $package_name
|
215
240
|
else
|
216
241
|
if [ ! -f "$package_name.tar.gz" ] ; then
|
217
|
-
info "\tDownloading $package_name, this may take a while depending on your connection..."
|
218
|
-
curl
|
242
|
+
rvm-log-info "\tDownloading $package_name, this may take a while depending on your connection..."
|
243
|
+
$curl $url
|
219
244
|
fi
|
220
|
-
info "\tExtracting $package_name..."
|
245
|
+
rvm-log-info "\tExtracting $package_name..."
|
221
246
|
tar xzf $package_name.tar.gz && cd $package_name
|
222
247
|
fi
|
223
248
|
|
224
|
-
info "\tInstalling $package_name, this may take a while, depending on your cpu(s)..."
|
249
|
+
rvm-log-info "\tInstalling $package_name, this may take a while, depending on your cpu(s)..."
|
225
250
|
mkdir -p $install_path/$package_name
|
226
251
|
./installer -a $install_path/ruby-enterprise-$version-$patchlevel --dont-install-useful-gems > $install_path/$package_name/install.log 2> $install_path/$package_name/install.error.log
|
227
252
|
chmod +x $install_path/$package_name/bin/*
|
228
253
|
|
229
|
-
|
254
|
+
ln -fs $install_path/$package_name/bin/ruby $install_path/bin/$package_name
|
255
|
+
|
256
|
+
rvm-log-info "\tInstalling rubygems dedicated to $package_name..."
|
230
257
|
gem_package_name="rubygems-1.3.5"
|
231
258
|
gem_url="http://rubyforge.org/frs/download.php/60718/$gem_package_name.tgz"
|
232
259
|
if [ -d $gem_package_name ] ; then
|
233
260
|
cd $gem_package_name
|
234
261
|
else
|
235
|
-
if [ ! -f $gem_package_name.tgz ] ; then curl
|
262
|
+
if [ ! -f $gem_package_name.tgz ] ; then $curl $gem_url ; fi
|
236
263
|
tar zxf $gem_package_name.tgz && cd $gem_package_name
|
237
264
|
fi
|
238
265
|
# Well this is fun... fix nil error on require_paths:
|
239
266
|
sed -i '' "s/require_paths\.join/require_paths.to_a.join/" $source_path/$package_name/$gem_package_name/lib/rubygems/gem_path_searcher.rb
|
240
267
|
$install_path/$package_name/bin/ruby ./setup.rb > $install_path/$package_name/rubygems.install.log 2> $install_path/$package_name/rubygems.install.error.log
|
241
|
-
info "Installation of $package_name complete."
|
268
|
+
rvm-log-info "Installation of $package_name complete."
|
242
269
|
popd > /dev/null
|
243
270
|
|
244
271
|
for gem_name in rake ; do
|
245
|
-
info "Installing $gem_name"
|
272
|
+
rvm-log-info "Installing $gem_name"
|
246
273
|
$install_path/$package_name/bin/gem install $gem_name --no-rdoc --no-ri -q >> $install_path/$package_name/gems.install.log
|
247
274
|
done
|
248
275
|
;;
|
@@ -254,31 +281,34 @@ function rvm-install-ruby {
|
|
254
281
|
package_name="$implementation-$version"
|
255
282
|
url="http://dist.codehaus.org/$implementation/$version/$zipfile.zip"
|
256
283
|
|
257
|
-
info "Installing jRuby to: $install_path/$package_name"
|
284
|
+
rvm-log-info "Installing jRuby to: $install_path/$package_name"
|
258
285
|
mkdir -p $install_path/$package_name
|
259
286
|
pushd $source_path > /dev/null
|
260
287
|
if [ -d $zipfile ] ; then
|
261
288
|
cd $zipfile
|
262
289
|
else
|
263
290
|
if [ ! -f "$zipfile.zip" ] ; then
|
264
|
-
info "\tDownloading $zipfile, this may take a while depending on your connection..."
|
265
|
-
curl
|
291
|
+
rvm-log-info "\tDownloading $zipfile, this may take a while depending on your connection..."
|
292
|
+
$curl $url
|
266
293
|
fi
|
267
|
-
info "\tExtracting $zipfile..."
|
294
|
+
rvm-log-info "\tExtracting $zipfile..."
|
268
295
|
jar xf $zipfile.zip
|
269
296
|
fi
|
270
297
|
|
271
|
-
info "\tInstalling $package_name..."
|
298
|
+
rvm-log-info "\tInstalling $package_name..."
|
272
299
|
mkdir -p $install_path/$package_name/bin/
|
273
300
|
rsync -ag $source_path/$package_name/ $install_path/$package_name/
|
274
301
|
cd $source_path/$package_name/tool/nailgun && make > $install_path/$package_name/install.nailgun.log 2> $install_path/$package_name/install.error.nailgun.log
|
275
302
|
popd > /dev/null
|
276
303
|
chmod +x $install_path/$package_name/bin/*
|
277
304
|
for binary in jruby jgem jirb ; do
|
278
|
-
ln -
|
305
|
+
ln -fs $install_path/$package_name/bin/$binary $install_path/$package_name/bin/${binary#j}
|
279
306
|
done
|
307
|
+
|
308
|
+
ln -fs $install_path/$package_name/bin/ruby $install_path/bin/$package_name
|
309
|
+
|
280
310
|
for gem_name in rake jruby-openssl ; do
|
281
|
-
info "Installing $gem_name"
|
311
|
+
rvm-log-info "Installing $gem_name"
|
282
312
|
$install_path/$package_name/bin/jgem install $gem_name --no-rdoc --no-ri -q >> $install_path/$package_name/gems.install.log
|
283
313
|
done
|
284
314
|
;;
|
@@ -288,9 +318,9 @@ function rvm-install-ruby {
|
|
288
318
|
;;
|
289
319
|
|
290
320
|
default)
|
291
|
-
fail "please specify a ruby implementation to install."
|
321
|
+
rvm-log-fail "please specify a ruby implementation to install."
|
292
322
|
;;
|
293
|
-
*) fail "Ruby implementation '$implementation' is not known."
|
323
|
+
*) rvm-log-fail "Ruby implementation '$implementation' is not known."
|
294
324
|
|
295
325
|
esac
|
296
326
|
|
@@ -306,7 +336,7 @@ function rvm-uninstall {
|
|
306
336
|
if [ "$version" = "1.2.0" -o "$version" = "1.3.1" ] ; then
|
307
337
|
package_name="jruby*-$version"
|
308
338
|
else
|
309
|
-
fail "Unknown jRuby version: $version"
|
339
|
+
rvm-log-fail "Unknown jRuby version: $version"
|
310
340
|
fi
|
311
341
|
;;
|
312
342
|
|
@@ -315,7 +345,7 @@ function rvm-uninstall {
|
|
315
345
|
if [ "$version" = "1.8.6" ] ; then
|
316
346
|
package_name="$install_path/ruby-enterprise-$version-${3-20090610}"
|
317
347
|
else
|
318
|
-
fail "Unknown Ruby Enterprise Edition version: $version"
|
348
|
+
rvm-log-fail "Unknown Ruby Enterprise Edition version: $version"
|
319
349
|
fi
|
320
350
|
;;
|
321
351
|
|
@@ -333,24 +363,24 @@ function rvm-uninstall {
|
|
333
363
|
package_name="ruby-1.9.1-p${patchlevel-243}"
|
334
364
|
|
335
365
|
else
|
336
|
-
fail "Unknown ruby version: $version"
|
366
|
+
rvm-log-fail "Unknown ruby version: $version"
|
337
367
|
fi
|
338
368
|
;;
|
339
369
|
|
340
370
|
*)
|
341
|
-
fail "Ruby implementation '$implementation' is not known."
|
371
|
+
rvm-log-fail "Ruby implementation '$implementation' is not known."
|
342
372
|
|
343
373
|
esac
|
344
374
|
|
345
375
|
if [ ! -z "$package_name" ] ; then
|
346
376
|
for path in $source_path $install_path ; do
|
347
377
|
if [ -d $path/$package_name ] ; then
|
348
|
-
info "Removing $path/$package_name"
|
378
|
+
rvm-log-info "Removing $path/$package_name"
|
349
379
|
rm -rf $path/$package_name
|
350
380
|
fi
|
351
381
|
done
|
352
382
|
else
|
353
|
-
fail "Cannot uninstall unknown package '$package_name'"
|
383
|
+
rvm-log-fail "Cannot uninstall unknown package '$package_name'"
|
354
384
|
fi
|
355
385
|
|
356
386
|
}
|
@@ -361,15 +391,11 @@ function rvm-use {
|
|
361
391
|
case "$implementation" in
|
362
392
|
|
363
393
|
default)
|
364
|
-
|
365
|
-
|
366
|
-
|
367
|
-
|
368
|
-
unset GEM_HOME
|
369
|
-
unset RUBY_VERSION
|
370
|
-
PATH=$original_path ; export PATH
|
394
|
+
rm -f $install_path/current
|
395
|
+
source $install_path/default
|
396
|
+
unset GEM_HOME MY_RUBY_HOME
|
397
|
+
PATH="$default_path" ; export PATH
|
371
398
|
;;
|
372
|
-
#leopard) MY_RUBY_HOME="/System/Library/Frameworks/Ruby.framework/Versions/Current/usr"; GEM_HOME="$HOME/.gem/ruby/1.8" ;;
|
373
399
|
|
374
400
|
jruby)
|
375
401
|
version="${version-1.3.1}"
|
@@ -379,7 +405,7 @@ function rvm-use {
|
|
379
405
|
alias ruby_ng="jruby --ng"
|
380
406
|
alias ruby_ng_server="jruby --ng-server"
|
381
407
|
else
|
382
|
-
fail "Unknown jRuby version: $version"
|
408
|
+
rvm-log-fail "Unknown jRuby version: $version"
|
383
409
|
fi
|
384
410
|
;;
|
385
411
|
|
@@ -390,7 +416,7 @@ function rvm-use {
|
|
390
416
|
MY_RUBY_HOME="$install_path/ruby-enterprise-$version-$patchlevel"
|
391
417
|
GEM_HOME="$HOME/.gem/ruby-enterprise/1.8"
|
392
418
|
else
|
393
|
-
fail "Unknown Ruby Enterprise Edition version: $version"
|
419
|
+
rvm-log-fail "Unknown Ruby Enterprise Edition version: $version"
|
394
420
|
fi
|
395
421
|
;;
|
396
422
|
|
@@ -416,136 +442,174 @@ function rvm-use {
|
|
416
442
|
GEM_HOME="$HOME/.gem/ruby/1.9.1"
|
417
443
|
|
418
444
|
else
|
419
|
-
fail "Unknown ruby version: $version"
|
445
|
+
rvm-log-fail "Unknown ruby version: $version"
|
420
446
|
fi
|
421
447
|
;;
|
422
448
|
|
423
449
|
*)
|
424
|
-
fail "Ruby implementation '$implementation' is not known."
|
450
|
+
rvm-log-fail "Ruby implementation '$implementation' is not known."
|
425
451
|
|
426
452
|
esac
|
427
453
|
|
454
|
+
# Now actually use it.
|
428
455
|
if [ ! "$implementation" = "default" ] ; then
|
456
|
+
# Install if not installed
|
429
457
|
if [ ! -d $MY_RUBY_HOME ] ; then
|
430
|
-
warn "$implementation $version is not installed."
|
458
|
+
rvm-log-warn "$implementation $version is not installed."
|
431
459
|
rvm-install-ruby $implementation $version $level
|
432
460
|
fi
|
433
461
|
|
462
|
+
# Set as 'current'
|
434
463
|
RUBY_VERSION="$($MY_RUBY_HOME/bin/ruby -v | sed 's/^\(.*\) (.*$/\1/')"
|
435
464
|
export GEM_HOME MY_RUBY_HOME RUBY_VERSION
|
436
465
|
|
437
|
-
|
438
|
-
echo "PATH=$MY_RUBY_HOME/bin:$GEM_HOME/bin:\$PATH ; export PATH" > ~/.rvm/current
|
466
|
+
echo "PATH=$MY_RUBY_HOME/bin:$GEM_HOME/bin:$default_path ; export PATH" > $install_path/current
|
439
467
|
for variable in RUBY_VERSION GEM_HOME MY_RUBY_HOME ; do
|
440
468
|
eval "export $variable"
|
441
469
|
eval value=\$${variable}
|
442
|
-
echo "${variable}='$value' ; export ${variable}" >>
|
470
|
+
echo "${variable}='$value' ; export ${variable}" >> $install_path/current
|
443
471
|
done
|
444
|
-
else
|
445
|
-
PATH=$original_path ; export PATH
|
446
472
|
fi
|
447
473
|
|
448
|
-
info "Switching to $implementation $version $patchlevel ..."
|
474
|
+
rvm-log-info "Switching to $implementation $version $patchlevel ..."
|
449
475
|
if [ ! -z "$BASH_VERSION" ] ; then
|
450
476
|
exec bash -l
|
451
477
|
elif [ ! -z "$ZSH_VERSION" ] ; then
|
452
478
|
exec zsh -l
|
453
479
|
else
|
454
|
-
fail "Your shell is not supported bash and zsh are currently supported."
|
480
|
+
rvm-log-fail "Your shell is not supported bash and zsh are currently supported."
|
455
481
|
fi
|
482
|
+
|
456
483
|
}
|
457
484
|
|
458
485
|
function rvm-list {
|
486
|
+
|
459
487
|
echo -e "\nruby:"
|
460
|
-
ls -l
|
488
|
+
ls -l $install_path/ | awk '/ ruby-[1-2].*/ { print " - " $NF }'
|
461
489
|
echo
|
462
490
|
echo "jruby:"
|
463
|
-
ls -l
|
491
|
+
ls -l $install_path/ | awk '/jruby-.*/ { print " - " $NF }'
|
464
492
|
echo
|
465
493
|
echo "ree:"
|
466
|
-
ls
|
494
|
+
ls $install_path/ | awk '/ruby-enterprise-.*/ { print " - " $NF }'
|
467
495
|
echo
|
496
|
+
echo "default:"
|
497
|
+
echo " - system (`$default_system_ruby -v`)"
|
498
|
+
|
499
|
+
}
|
500
|
+
|
501
|
+
function rvm-reset {
|
502
|
+
|
503
|
+
PATH="$default_path" ; export PATH
|
504
|
+
for variable in RUBY_VERSION GEM_HOME MY_RUBY_HOME ; do
|
505
|
+
unset $variable
|
506
|
+
done
|
507
|
+
rm -f $install_path/default* $install_path/current
|
508
|
+
if [ ! -z "$BASH_VERSION" ] ; then
|
509
|
+
exec bash -l
|
510
|
+
elif [ ! -z "$ZSH_VERSION" ] ; then
|
511
|
+
exec zsh -l
|
512
|
+
else
|
513
|
+
rvm-log-fail "Your shell is not supported bash and zsh are currently supported."
|
514
|
+
fi
|
515
|
+
|
468
516
|
}
|
469
517
|
|
470
518
|
function rvm-gem-dir {
|
471
519
|
|
472
|
-
|
520
|
+
implementation=${1-$implementation}
|
521
|
+
if [ "$implementation" = "" ] ; then implementation="current" ; fi
|
522
|
+
|
523
|
+
case "$implementation" in
|
473
524
|
jruby) GEM_HOME="$HOME/.gem/jruby/1.8" ;;
|
474
525
|
ree) GEM_HOME="$HOME/.gem/ruby-enterprise/1.8" ;;
|
475
526
|
ruby)
|
476
|
-
if [ "${2
|
527
|
+
if [ "${2-$version}" = "1.8" -o "${2-$version}" = "1.8.6" ] ; then
|
477
528
|
GEM_HOME="$HOME/.gem/ruby/1.8"
|
478
529
|
|
479
|
-
elif [ "${2
|
530
|
+
elif [ "${2-$version}" = "1.9.2" ] ; then
|
480
531
|
GEM_HOME="$HOME/.gem/ruby/1.9.2"
|
481
532
|
|
482
|
-
elif [ "${2
|
533
|
+
elif [ "${2-$version}" = "1.9" -o "${2-$version}" = "1.9.1" ] ; then
|
483
534
|
GEM_HOME="$HOME/.gem/ruby/1.9.1"
|
484
535
|
|
485
536
|
else
|
486
|
-
fail "Unknown Version: ${2
|
537
|
+
rvm-log-fail "Unknown Version: ${2-$version}"
|
487
538
|
fi
|
488
539
|
;;
|
540
|
+
current)
|
541
|
+
GEM_HOME=$(ruby -r rubygems -e "puts Gem::default_path.compact.first")
|
542
|
+
;;
|
543
|
+
system)
|
544
|
+
GEM_HOME=$default_system_gem_path
|
545
|
+
;;
|
546
|
+
user)
|
547
|
+
GEM_HOME=$default_gem_path
|
548
|
+
;;
|
489
549
|
*)
|
490
|
-
fail "Ruby implementation '$implementation' is not known."
|
550
|
+
rvm-log-fail "Ruby implementation '$implementation' is not known."
|
491
551
|
esac
|
492
552
|
|
493
553
|
if [ -d $GEM_HOME ] ; then
|
494
554
|
echo $GEM_HOME && cd $GEM_HOME
|
495
555
|
else
|
496
|
-
fail "$implementation $version GEM directory does not exist."
|
556
|
+
rvm-log-fail "$implementation $version GEM directory does not exist."
|
497
557
|
fi
|
498
558
|
|
499
559
|
}
|
500
560
|
|
501
561
|
function rvm-src-dir {
|
502
|
-
case "$implementation" in
|
562
|
+
case "${1-$implementation}" in
|
503
563
|
|
504
564
|
jruby)
|
505
|
-
version
|
506
|
-
if [ "$version" = "1.2.0" -o "$version" = "1.3.1" ] ; then
|
565
|
+
version=${version-1.3.1}
|
566
|
+
if [ "${2-$version}" = "1.2.0" -o "${2-$version}" = "1.3.1" ] ; then
|
507
567
|
src_dir="$source_path/$implementation-$version"
|
508
568
|
else
|
509
|
-
fail "Unknown jRuby version: $version"
|
569
|
+
rvm-log-fail "Unknown jRuby version: $version"
|
510
570
|
fi
|
511
571
|
;;
|
512
572
|
|
513
573
|
ree)
|
514
574
|
version=${version-1.8.6}
|
515
|
-
if [ "$version" = "1.8.6" ] ; then
|
516
|
-
src_dir="$source_path/ruby-enterprise-$version-"${3-20090610}""
|
575
|
+
if [ "${2-$version}" = "1.8.6" -o "${2-$version}" = "1.8" ] ; then
|
576
|
+
src_dir="$source_path/ruby-enterprise-${2-$version}-"${3-20090610}""
|
517
577
|
else
|
518
|
-
fail "Unknown Ruby Enterprise Edition version: $version"
|
578
|
+
rvm-log-fail "Unknown Ruby Enterprise Edition version: ${2-$version}"
|
519
579
|
fi
|
520
580
|
;;
|
521
581
|
|
522
582
|
ruby)
|
523
|
-
if [ "$version" = "1.8.7" ] ; then
|
583
|
+
if [ "${2-$version}" = "1.8.7" ] ; then
|
524
584
|
src_dir="$source_path/ruby-1.8.7-p${patchlevel-174}"
|
525
585
|
|
526
|
-
elif [ "${version
|
586
|
+
elif [ "${2-$version}" = "1.8" -o "${2-$version}" = "1.8.6" ] ; then
|
527
587
|
src_dir="$source_path/ruby-1.8.6-p${patchlevel-369}"
|
528
588
|
|
529
|
-
elif [ "$version" = "1.9.2" ] ; then
|
589
|
+
elif [ "${2-$version}" = "1.9.2" ] ; then
|
530
590
|
src_dir="$source_path/ruby-1.9.2-p${patchlevel-review1}"
|
531
591
|
|
532
|
-
elif [ "${version
|
592
|
+
elif [ "${2-$version}" = "1.9" -o "${2-$version}" = "1.9.1" ] ; then
|
533
593
|
src_dir="$source_path/ruby-1.9.1-p${patchlevel-243}"
|
534
594
|
|
535
595
|
else
|
536
|
-
fail "
|
596
|
+
rvm-log-fail "unknown Ruby version: ${2-$version}"
|
537
597
|
fi
|
538
598
|
;;
|
539
599
|
|
600
|
+
default)
|
601
|
+
rvm-log-warn "Invalid request, rvm cannot change to the default source directory."
|
602
|
+
;;
|
603
|
+
|
540
604
|
*)
|
541
|
-
fail "Ruby implementation '$implementation' is not known."
|
605
|
+
rvm-log-fail "Ruby implementation '$implementation' is not known."
|
542
606
|
return 1
|
543
607
|
esac
|
544
608
|
|
545
609
|
if [ -d $src_dir ] ; then
|
546
610
|
cd $src_dir
|
547
611
|
else
|
548
|
-
fail "$implementation $version source directory does not exist."
|
612
|
+
rvm-log-fail "$implementation $version source directory does not exist."
|
549
613
|
fi
|
550
614
|
|
551
615
|
}
|
@@ -553,7 +617,14 @@ function rvm-src-dir {
|
|
553
617
|
# clones from source implementation/version to current
|
554
618
|
function rvm-gem-dup {
|
555
619
|
|
556
|
-
|
620
|
+
if [ "$1" = "default" ] ; then
|
621
|
+
gem_dir="$default_gem_path"
|
622
|
+
elif [ "$1" = "system" ] ; then
|
623
|
+
gem_dir="$default_system_gem_path"
|
624
|
+
else
|
625
|
+
gem_dir=${1-$default_gem_path} # TODO: check for and remove trailing /gems
|
626
|
+
fi
|
627
|
+
|
557
628
|
if [ ! -z "$gem_dir" ] ; then
|
558
629
|
for gem_name_version in `ls $gem_dir/gems` ; do
|
559
630
|
gem_name=${gem_name_version%-*}
|
@@ -565,7 +636,7 @@ function rvm-gem-dup {
|
|
565
636
|
fi
|
566
637
|
done
|
567
638
|
else
|
568
|
-
fail "Unknown $implementation version: $version"
|
639
|
+
rvm-log-fail "Unknown $implementation version: $version"
|
569
640
|
fi
|
570
641
|
|
571
642
|
}
|
@@ -578,15 +649,50 @@ function rvm {
|
|
578
649
|
for variable in action implementation patchlevel version source_path install_path manager debug prefix_path ; do
|
579
650
|
eval "unset $variable"
|
580
651
|
done
|
652
|
+
|
581
653
|
while [ $# -gt 0 ] ; do
|
582
654
|
token="$1" ; shift
|
583
655
|
case "$token" in
|
584
|
-
install|uninstall|use|path|info|
|
585
|
-
|
656
|
+
install|uninstall|use|path|info|setup|version|srcdir|list|reset|debug)
|
657
|
+
action=$token
|
658
|
+
;;
|
659
|
+
|
586
660
|
ruby|jruby|ree|default|all)
|
587
|
-
|
661
|
+
implementation="$token"
|
662
|
+
action="${action-use}"
|
663
|
+
;;
|
664
|
+
|
665
|
+
gemdir)
|
666
|
+
action=$token
|
667
|
+
if [ "$1" = "system" ] ; then
|
668
|
+
implementation="system" ; shift
|
669
|
+
fi
|
670
|
+
if [ "$1" = "user" ] ; then
|
671
|
+
implementation="user" ; shift
|
672
|
+
fi
|
673
|
+
|
674
|
+
implementation="${implementation-current}"
|
675
|
+
;;
|
676
|
+
|
677
|
+
gemdup)
|
678
|
+
action=$token
|
679
|
+
if [ -z "$1" ] ; then
|
680
|
+
implementaiton="default"
|
681
|
+
elif [ "$1" = "system" ] ; then
|
682
|
+
implementation=$1 ; shift
|
683
|
+
elif [ "$1" = "default" ] ; then
|
684
|
+
implementation=$1 ; shift
|
685
|
+
else
|
686
|
+
implementation=$1 ; shift
|
687
|
+
version=$2 ; shift
|
688
|
+
fi
|
689
|
+
;;
|
690
|
+
|
588
691
|
1.8|1.8.6|1.8.7|1.9|1.9.1|1.9.2|1.2.0|1.3.1)
|
589
|
-
version="$token"
|
692
|
+
version="$token"
|
693
|
+
action="${action-use}"
|
694
|
+
;;
|
695
|
+
|
590
696
|
-v|--version)
|
591
697
|
if [ -z "$1" ] ; then
|
592
698
|
action="version"
|
@@ -595,42 +701,76 @@ function rvm {
|
|
595
701
|
fi
|
596
702
|
shift
|
597
703
|
;;
|
704
|
+
|
598
705
|
-l|--level) patchlevel="$1" ; shift ;;
|
599
706
|
-p|--prefix) install_path="$1" ; shift ;;
|
600
707
|
-s|--source) source_path="$1" ; shift ;; # Undocumented / untested "feature"
|
601
708
|
-c|--configure) configure="$1" ; shift ;;
|
602
|
-
-m|--manager) manager="$1" ; shift ;;
|
603
|
-
-u|--gemdup) action="gemdup" ; gem_dir="$1" ; shift ;;
|
604
709
|
-d|--debug) debug=1 ;;
|
605
710
|
*) rvm-usage ; return 1
|
606
711
|
esac
|
607
712
|
done
|
608
|
-
|
713
|
+
|
714
|
+
curl=`which curl`
|
715
|
+
if [ $? -ne 0 ] ; then
|
716
|
+
rvm-log-fail "rvm expects that curl is available, which curl shows no curl :("
|
717
|
+
else
|
718
|
+
curl="$curl -O -L -s"
|
719
|
+
fi
|
720
|
+
|
609
721
|
if [ -z "$implementation" -a -z "$version" ] ; then
|
610
722
|
implementation="default"
|
611
723
|
else
|
612
724
|
implementation=${implementation-'ruby'}
|
613
725
|
fi
|
614
|
-
username=`whoami`
|
615
726
|
|
616
727
|
# TODO: Sanitize user input, ensure that there is a / a the end...
|
617
|
-
if [ "
|
618
|
-
fail "root user support is not yet implemented."
|
728
|
+
if [ "`whoami`" = "root" ] ; then
|
729
|
+
rvm-log-fail "root user support is not yet implemented."
|
619
730
|
#prefix_path=${prefix-/usr/local/}
|
620
731
|
else
|
621
732
|
prefix_path=${prefix-$HOME/.}
|
622
733
|
fi
|
623
|
-
source_path="${source_path
|
734
|
+
source_path="${source_path-"${prefix_path}rvm/src"}"
|
624
735
|
install_path="${prefix_path}rvm"
|
625
736
|
|
626
|
-
mkdir -p
|
737
|
+
mkdir -p $source_path $install_path/bin
|
627
738
|
|
628
|
-
if [ -f
|
629
|
-
|
739
|
+
if [ ! -f $install_path/default ] ; then
|
740
|
+
for variable in RUBY_VERSION GEM_HOME MY_RUBY_HOME PATH ; do
|
741
|
+
eval "export $variable"
|
742
|
+
eval value=\$${variable}
|
743
|
+
echo "${variable}='$value' ; export ${variable}" >> $install_path/default
|
744
|
+
done
|
630
745
|
fi
|
631
|
-
|
632
|
-
|
633
|
-
|
746
|
+
|
747
|
+
if [ -s $install_path/default_path ] ; then
|
748
|
+
default_path=`cat $install_path/default_path`
|
749
|
+
else
|
750
|
+
echo $PATH > $install_path/default_path
|
751
|
+
default_path=$PATH
|
752
|
+
fi
|
753
|
+
|
754
|
+
# default (user) gem path
|
755
|
+
if [ -s $install_path/default_gem_path ] ; then
|
756
|
+
default_gem_path=`cat $install_path/default_gem_path`
|
757
|
+
else
|
758
|
+
ruby -r rubygems -e "puts Gem::default_path.compact.first" > $install_path/default_gem_path
|
759
|
+
fi
|
760
|
+
|
761
|
+
# system gem path
|
762
|
+
if [ -s $install_path/default_system_gem_path ] ; then
|
763
|
+
default_system_gem_path=`cat $install_path/default_system_gem_path`
|
764
|
+
else
|
765
|
+
ruby -r rubygems -e "puts Gem::default_path.compact[1] || Gem::default_path.compact.first" > $install_path/default_system_gem_path
|
766
|
+
fi
|
767
|
+
|
768
|
+
# system ruby version
|
769
|
+
if [ -s $install_path/default_system_ruby ] ; then
|
770
|
+
default_system_ruby=`cat $install_path/default_system_ruby`
|
771
|
+
else
|
772
|
+
default_system_ruby=`which ruby`
|
773
|
+
echo $default_system_ruby > $install_path/default_system_ruby
|
634
774
|
fi
|
635
775
|
|
636
776
|
if [ "$debug" = "1" ] ; then set -x ; fi
|
@@ -659,25 +799,29 @@ function rvm {
|
|
659
799
|
gemdup) rvm-gem-dup $implementation $version $patchlevel ;;
|
660
800
|
info) rvm-info $implementation $version $patchlevel ;;
|
661
801
|
version) rvm-version ;;
|
802
|
+
reset) rvm-reset ;;
|
662
803
|
debug)
|
663
804
|
rvm-version
|
664
|
-
info
|
665
|
-
info "
|
666
|
-
|
667
|
-
|
668
|
-
|
805
|
+
rvm-info
|
806
|
+
rvm-log-info "PATH:$(echo $PATH | awk -F":" '{print $1":"$2":"$3":"$4":"$5}')"
|
807
|
+
for file in .bash_profile .zshrc ; do
|
808
|
+
if [ -s $file ] ; then
|
809
|
+
rvm-log-info "~/$file: \n$(cat ~/$file| tail -n 5)\n"
|
810
|
+
fi
|
811
|
+
done
|
812
|
+
rvm-log-info "$install_path/current: \n$(cat $install_path/current)\n"
|
669
813
|
return 0
|
670
814
|
;;
|
671
815
|
*)
|
672
816
|
if [ ! -z "$action" ] ; then
|
673
|
-
fail "unknown action '$action'"
|
817
|
+
rvm-log-fail "unknown action '$action'"
|
674
818
|
else
|
675
819
|
rvm-usage
|
676
820
|
fi
|
677
821
|
return 1
|
678
822
|
esac
|
679
823
|
|
680
|
-
set +x
|
824
|
+
if [ "$debug" = "1" ] ; then set +x ; fi
|
681
825
|
|
682
826
|
}
|
683
827
|
|
data/bash/rvm-install
CHANGED
@@ -2,36 +2,112 @@
|
|
2
2
|
|
3
3
|
user=`whoami`
|
4
4
|
if [ "$user" = "root" ] ; then
|
5
|
-
echo -e "\e[0;31m <e> \e[0mroot user support is not yet implemented
|
5
|
+
echo -e "\e[0;31m <e> \e[0mroot user support is not yet implemented.\e[0m"
|
6
6
|
exit 1
|
7
7
|
fi
|
8
8
|
|
9
|
-
|
9
|
+
info="\n\e[0;32m<i>\e[0m"
|
10
|
+
question="\n\e[0;32m<?>\e[0m"
|
10
11
|
|
12
|
+
echo -e "Installing rvm source to ~/.rvm/bin/rvm..."
|
13
|
+
mkdir -p ~/.rvm/src ~/.rvm/bin
|
11
14
|
cp $(pwd)/bash/rvm ~/.rvm/bin/
|
12
15
|
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
fi
|
16
|
+
# State what is required to use rvm
|
17
|
+
echo -e "\n\e[0;32mrvm\e[0m is a shell script that allows a user to manage multiple ruby versions in their own account."
|
18
|
+
echo -e "$info In order to use rvm two items must occur in your shell's load paths:"
|
19
|
+
echo -e "\n\e[0;32m (a)\e[0m if [ -f ~/.rvm/bin/rvm ] ; then source ~/.rvm/bin/rvm ; fi"
|
20
|
+
echo -e "\e[0;32m (b)\e[0m if [ -f ~/.rvm/current ] ; then source ~/.rvm/current ; fi"
|
18
21
|
|
19
|
-
|
20
|
-
echo "
|
21
|
-
|
22
|
-
|
22
|
+
while : ; do
|
23
|
+
echo -n -e "$question Do you want this (s)cript to set this up for you, or do it (m)anually yourself ('s' or 'm')? "
|
24
|
+
read response
|
25
|
+
if [ "${response:0:1}" = "s" ] ; then
|
26
|
+
echo 'w00t!'
|
27
|
+
break
|
28
|
+
elif [ "${response:0:1}" = "m" ] ; then
|
29
|
+
echo -e "$info Please make sure that both lines (a) and (b) are in place, with (a) sourced *first*."
|
30
|
+
break
|
31
|
+
fi
|
32
|
+
done
|
23
33
|
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
34
|
+
if [ "${response:0:1}" = "s" ] ; then
|
35
|
+
|
36
|
+
while : ; do
|
37
|
+
echo -n -e "$question Do you use b(a)sh or (z)sh or b(o)th for your shell (the default on most *nix systems is bash, press control + C to cancel the installation)\n(a/z/o)? "
|
38
|
+
read response
|
39
|
+
if [ "${response:0:1}" = "a" ] ; then
|
40
|
+
user_shell="bash"
|
41
|
+
break
|
42
|
+
elif [ "${response:0:1}" = "z" ] ; then
|
43
|
+
user_shell="zsh"
|
44
|
+
break
|
45
|
+
elif [ "${response:0:1}" = "o" ] ; then
|
46
|
+
user_shell="both"
|
47
|
+
break
|
48
|
+
fi
|
49
|
+
done
|
50
|
+
|
51
|
+
touch ~/.profile
|
52
|
+
|
53
|
+
if [ "$user_shell" = "bash" -o "$user_shell" = "both" ] ; then
|
54
|
+
|
55
|
+
touch ~/.bash_profile
|
56
|
+
if [ -z "`grep '\.rvm/bin/rvm' ~/.bash_profile`" ] ; then
|
57
|
+
echo "Adding 'if [ -f ~/.rvm/bin/rvm ] ; then source ~/.rvm/bin/rvm ; fi' to your ~/.bash_profile."
|
58
|
+
echo "if [ -f ~/.rvm/bin/rvm ] ; then source ~/.rvm/bin/rvm ; fi" >> ~/.bash_profile
|
59
|
+
fi
|
60
|
+
|
61
|
+
if [ -z "`grep '\.rvm/current' ~/.bash_profile`" ] ; then
|
62
|
+
echo "Adding 'if [ -f ~/.rvm/current ] ; then source ~/.rvm/current ; fi' ~/.bash_profile."
|
63
|
+
echo "if [ -f ~/.rvm/current ] ; then source ~/.rvm/current ; fi" >> ~/.bash_profile
|
64
|
+
fi
|
65
|
+
|
66
|
+
elif [ "$user_shell" = "zsh" -o "$user_shell" = "both" ] ; then
|
67
|
+
|
68
|
+
touch ~/.zshrc
|
69
|
+
if [ -z "`grep '\.rvm/bin/rvm' ~/.zshrc`" ] ; then
|
70
|
+
echo "Adding 'if [ -f ~/.rvm/bin/rvm ] ; then source ~/.rvm/bin/rvm ; fi' to your ~/.zshrc."
|
71
|
+
echo "if [ -f ~/.rvm/bin/rvm ] ; then source ~/.rvm/bin/rvm ; fi" >> ~/.zshrc
|
72
|
+
fi
|
73
|
+
|
74
|
+
if [ -z "`grep '\.rvm/current' ~/.zshrc`" ] ; then
|
75
|
+
echo "Adding 'if [ -f ~/.rvm/current ] ; then source ~/.rvm/current ; fi' ~/.zshrc."
|
76
|
+
echo "if [ -f ~/.rvm/current ] ; then source ~/.rvm/current ; fi" >> ~/.zshrc
|
77
|
+
fi
|
78
|
+
|
79
|
+
else
|
80
|
+
|
81
|
+
echo -e "\n\e[0;31m<e> An error has occurred, we were expecting either bash or zsh however we encountered $user_shell \e[0m"
|
82
|
+
return 1
|
83
|
+
|
84
|
+
fi
|
28
85
|
fi
|
29
86
|
|
30
|
-
|
31
|
-
if [
|
32
|
-
echo "
|
33
|
-
|
87
|
+
system=`uname`
|
88
|
+
if [ "$system" = "Linux" ] ; then
|
89
|
+
echo -e "For jRuby (if you wish to use it) you will need:"
|
90
|
+
if [ ! -z "`which apt-get`" ] ; then
|
91
|
+
echo -e " sudo apt-get install sun-java6-bin sun-java6-jre sun-java6-jdk "
|
92
|
+
elif [ ! -z "`which emerge`" ] ; then
|
93
|
+
echo -e "emerge dev-java/sun-jdk dev-java/sun-jre-bin"
|
94
|
+
elif [ ! -z "`which pacman`" ] ; then
|
95
|
+
echo -e "pacman -Sy jdk jre"
|
96
|
+
elif [ ! -z "`which yum`" ] ; then
|
97
|
+
echo -e "yum install -y rpm-build gcc gcc-c++ redhat-rpm-config ; then download and rpmbuild and install the sdk, Have fun..."
|
98
|
+
else
|
99
|
+
echo -e "The SUN java runtime environment and development kit."
|
100
|
+
fi
|
101
|
+
#elif [ "$sytem" = "Darwin" ] ; then
|
102
|
+
#else
|
103
|
+
|
34
104
|
fi
|
35
105
|
|
36
|
-
echo -e "\n
|
106
|
+
echo -e "\n$info If you add ~/.rvm/bin/ to your path you will be able to refer to installed ruby binaries using: <implementation>-<version>p<patchlevel>"
|
107
|
+
echo -e " For example: ~/.ruby-1.9.1p243 -e 'puts \"hello world\"' #=> hello world"
|
108
|
+
echo -e "$info Contact wayneeseguin on irc.freenod.net in #rvm for any questions / feedback."
|
109
|
+
echo -e " I truly hope that you find rvm helpful! Thank you very much for using rvm. \n"
|
110
|
+
echo -e " ~ Wayne"
|
111
|
+
|
112
|
+
echo -e "$info To start using rvm see: \e[0;32m rvm usage\e[0m, Now close this login shell and open a new one."
|
37
113
|
|
data/bin/rvm-install
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
3
|
# Hot potato!!! Bash it!
|
4
|
-
exec "bash -c 'cd #{File.dirname(File.dirname(__FILE__))} && ./bash/rvm-install #{ARGV.join(' ')}
|
4
|
+
exec "bash -l -c 'cd #{File.dirname(File.dirname(__FILE__))} && ./bash/rvm-install #{ARGV.join(' ')} && source ~/.rvm/bin/rvm'"
|
5
5
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: wayneeseguin-rvm
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.15
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Wayne E. Seguin
|
@@ -30,7 +30,6 @@ files:
|
|
30
30
|
- lib/rvm.rb
|
31
31
|
has_rdoc: false
|
32
32
|
homepage: http://github.com/wayneeseguin/rvm
|
33
|
-
licenses:
|
34
33
|
post_install_message:
|
35
34
|
rdoc_options:
|
36
35
|
- --inline-source
|
@@ -52,7 +51,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
52
51
|
requirements: []
|
53
52
|
|
54
53
|
rubyforge_project: dynamicreports
|
55
|
-
rubygems_version: 1.
|
54
|
+
rubygems_version: 1.2.0
|
56
55
|
signing_key:
|
57
56
|
specification_version: 3
|
58
57
|
summary: Ruby Version Manager (rvm)
|