wayneeseguin-rvm 0.0.40 → 0.0.42

Sign up to get free protection for your applications and to get access to all the features.
@@ -14,10 +14,16 @@ if [ ! -d "$source_dir" ] ; then unset source_dir ; fi
14
14
  source_dir="${source_dir:-$cwd}"
15
15
  rvm_dir=~/.rvm
16
16
 
17
- echo -e "\nInstalling rvm source to ~/.rvm/scripts/rvm..."
17
+ echo -e "\nInstalling rvm to ~/.rvm/ ..."
18
18
  for dir in src scripts bin log archives config gems examples ; do
19
19
  mkdir -p $rvm_dir/$dir
20
20
  done
21
+ for dir in config scripts examples lib ; do
22
+ mkdir -p $rvm_dir/$dir
23
+ /bin/cp -r $source_dir/$dir/ $rvm_dir/$dir
24
+ done
25
+ cp $source_dir/scripts/rvm-prompt $rvm_dir/bin/
26
+ chmod +x $rvm_dir/bin/rvm-prompt
21
27
 
22
28
  # State what is required to use rvm
23
29
  echo -e "\n\033[0;32mrvm\033[0m is a shell script that allows a user to manage multiple ruby versions in their own account."
@@ -116,15 +122,6 @@ if [ -f ~/.rvm/bin/rvm ] ; then
116
122
  rm -f ~/.rvm/bin/rvm
117
123
  fi
118
124
 
119
- for dir in config scripts examples ; do
120
- mkdir -p $rvm_dir/$dir
121
- for file in `/bin/ls $source_dir/$dir/`; do
122
- cp $source_dir/$dir/$file $rvm_dir/$dir/$file
123
- done
124
- done
125
- cp $source_dir/scripts/rvm-prompt $rvm_dir/bin/
126
- cp $source_dir/VERSION.yml $rvm_dir/
127
-
128
125
  system=`uname`
129
126
  if [ "$system" = "Linux" ] ; then
130
127
  rvm_apt_get_binary=`which apt-get 2> /dev/null`
@@ -136,7 +133,7 @@ if [ "$system" = "Linux" ] ; then
136
133
  echo -e "\033[0;33m <w> \033[0mFor jRuby (if you wish to use it) you will need:"
137
134
  echo -e "\033[0;32m <i> \033[0msudo apt-get install sun-java6-bin sun-java6-jre sun-java6-jdk"
138
135
  echo -e "\033[0;33m <w> \033[0mFor ree (if you wish to use it) you will need:"
139
- echo -e "\033[0;32m <i> \033[0msudo apt-get install libreadline5-dev libssl-dev "
136
+ echo -e "\033[0;32m <i> \033[0msudo apt-get install libreadline5-dev libssl-dev bison"
140
137
 
141
138
  elif [ ! -z "$rvm_emerge_binary" ] ; then
142
139
  echo -e "\033[0;33m <w> \033[0mFor jRuby (if you wish to use it) you will need:"
@@ -1,5 +1,5 @@
1
1
  #!/bin/bash
2
- if [ ! -z "$(echo `which ruby` | grep 'rvm')" ] ; then
2
+ if [ ! -z "$(echo `which ruby` | grep '\.rvm')" ] ; then
3
3
  echo "[$(which ruby | xargs dirname | xargs dirname | xargs basename | tr '-' ':')]"
4
4
  fi
5
5
 
@@ -4,13 +4,13 @@ function __rvm_install-source {
4
4
 
5
5
  if [ -z "$rvm_selected" ] ; then __rvm_select $* ; fi
6
6
 
7
- status=0
7
+ result=0
8
8
  __rvm_log "info" "Installing Ruby from source to: $rvm_ruby_home"
9
9
  mkdir -p $rvm_ruby_log_path
10
10
 
11
11
  pushd $rvm_source_path > /dev/null
12
12
 
13
- if [ ! -z "$rvm_force" ] ; then
13
+ if [ ! -z "$rvm_force_flag" ] ; then
14
14
  rm -rf $rvm_ruby_home
15
15
  rm -rf $rvm_ruby_src_path
16
16
  fi
@@ -20,11 +20,11 @@ function __rvm_install-source {
20
20
  rvm_url="${rvm_url:-"ftp://ftp.ruby-lang.org/pub/ruby/1.$rvm_major_version/$rvm_ruby_package_name.tar.gz"}"
21
21
  __rvm_log "info" "\tDownloading $rvm_ruby_package_name, this may take a while depending on your connection..."
22
22
  __rvm_fetch $rvm_url
23
- if [ $? -gt 0 ] ; then status=$? ; return $status ; fi
23
+ if [ $? -gt 0 ] ; then result=$? ; return $result ; fi
24
24
  __rvm_log "info" "\tExtracting $rvm_ruby_package_name ..."
25
25
  mkdir -p $rvm_ruby_src_path # Is this line necessary considering -C below? v
26
26
  __rvm_run "extract" tar xzf $rvm_archives_path/$rvm_ruby_package_name.tar.gz -C $rvm_source_path
27
- if [ $? -gt 0 ] ; then status=$? ; return $status ; fi
27
+ if [ $? -gt 0 ] ; then result=$? ; return $result ; fi
28
28
  fi
29
29
  else
30
30
  __rvm_log "info" "\tRetrieving Ruby from $rvm_url"
@@ -33,14 +33,14 @@ function __rvm_install-source {
33
33
  cd $rvm_ruby_src_path
34
34
  if [ -z "$rvm_ruby_rev" ] ; then
35
35
  git pull origin master
36
- if [ $? -gt 0 ] ; then status=$? ; return $status ; fi
36
+ if [ $? -gt 0 ] ; then result=$? ; return $result ; fi
37
37
  else
38
38
  git checkout ${rvm_ruby_rev:-HEAD}
39
- if [ $? -gt 0 ] ; then status=$? ; return $status ; fi
39
+ if [ $? -gt 0 ] ; then result=$? ; return $result ; fi
40
40
  fi
41
41
  else
42
42
  git clone --depth 1 $rvm_ruby_repo_url $rvm_ruby_src_path
43
- if [ $? -gt 0 ] ; then status=$? ; return $status ; fi
43
+ if [ $? -gt 0 ] ; then result=$? ; return $result ; fi
44
44
  fi
45
45
  else
46
46
  if [ -z "$rvm_ruby_rev" ] ; then
@@ -67,36 +67,33 @@ function __rvm_install-source {
67
67
  else
68
68
  svn checkout -q $rvm_rev --force $rvm_url $rvm_ruby_src_path
69
69
  fi
70
- if [ $? -gt 0 ] ; then status=$? ; return $status ; fi
70
+ if [ $? -gt 0 ] ; then result=$? ; return $result ; fi
71
71
  fi
72
72
  fi
73
73
 
74
74
  cd $rvm_ruby_src_path
75
- if [ $? -gt 0 ] ; then status=$? ; __rvm_log "error" "There was an error, please check $rvm_ruby_log_path/*.error.log" ; popd > /dev/null ; return $status ; fi
76
-
77
- # Readline
78
- if [ ! -d $rvm_path/usr/include/readline ] ; then __rvm_readline_install ; fi
75
+ if [ $? -gt 0 ] ; then result=$? ; __rvm_log "error" "There was an error, please check $rvm_ruby_log_path/*.error.log" ; popd > /dev/null ; return $result ; fi
79
76
 
80
77
  if [ ! -s "$rvm_ruby_src_path/configure" -a "$rvm_ruby_interpreter" = "ruby" ] ; then
81
78
  rvm_autoconf=`which autoconf`
82
- if [ $? -gt 0 ] ; then __rvm_log "fail" "rvm expects autoconf" ; status=$? ; return $status ; fi
79
+ if [ $? -gt 0 ] ; then __rvm_log "fail" "rvm expects autoconf" ; result=$? ; return $result ; fi
83
80
  __rvm_run "autoconf" $rvm_autoconf
84
- if [ $? -gt 0 ] ; then status=$? ; return $status ; fi
81
+ if [ $? -gt 0 ] ; then result=$? ; return $result ; fi
85
82
  fi
86
83
 
87
- if [ -s ./Makefile -a -z "$rvm_re_configure" ] ; then
84
+ if [ -s ./Makefile -a -z "$rvm_reconfigure_flag" ] ; then
88
85
  __rvm_log "warn" "\tSkipping configure step, Makefile exists so configure must have already been run."
89
86
  elif [ -s ./configure ] ; then
90
87
  __rvm_log "info" "\tConfiguring $rvm_ruby_package_name using $rvm_ruby_configure, this may take a while depending on your cpu(s)..."
91
88
  if [ -d $rvm_path/usr/include/readline/ ] ; then
92
- parameters="$parameters --with-readline-dir=$rvm_path/usr/include/readline/"
89
+ configure_parameters="$configure_parameters --with-readline-dir=$rvm_path/usr/include/readline/"
93
90
  fi
94
91
  if [ -d $rvm_path/usr/include/iconv/ ] ; then
95
- parameters="$parameters --with-iconv-dir=$rvm_path/usr/include/iconv/"
92
+ configure_parameters="$configure_parameters --with-iconv-dir=$rvm_path/usr/include/iconv/"
96
93
  fi
97
- __rvm_run "configure" "./configure --prefix=$rvm_ruby_home --enable-shared=true $rvm_ruby_configure $parameters"
98
- unset parameters
99
- if [ $? -gt 0 ] ; then status=$? ; return $status ; fi
94
+ __rvm_run "configure" "./configure --prefix=$rvm_ruby_home $rvm_ruby_configure $configure_parameters"
95
+ unset configure_parameters
96
+ if [ $? -gt 0 ] ; then result=$? ; return $result ; fi
100
97
  else
101
98
  __rvm_log "error" "\tSkipping configure step, 'configure' script does not exist, did autoconf not run successfully?"
102
99
  fi
@@ -107,7 +104,7 @@ function __rvm_install-source {
107
104
  else
108
105
  __rvm_run "make" $rvm_ruby_make
109
106
  fi
110
- if [ $? -gt 0 ] ; then status=$? ; return $status ; fi
107
+ if [ $? -gt 0 ] ; then result=$? ; return $result ; fi
111
108
 
112
109
  if [ -z "$rvm_ruby_make" ] ; then
113
110
  __rvm_log "info" "\tInstalling $rvm_ruby_package_name"
@@ -115,16 +112,16 @@ function __rvm_install-source {
115
112
  else
116
113
  __rvm_run "install" $rvm_ruby_make_install
117
114
  fi
118
- if [ $? -gt 0 ] ; then status=$? ; return $status ; fi
115
+ if [ $? -gt 0 ] ; then result=$? ; return $result ; fi
119
116
 
120
- __rvm_run "chmod.bin" chmod +x $rvm_ruby_home/bin/*
121
- __rvm_bin_script
122
117
  __rvm_log "info" "Installation of $rvm_ruby_package_name is complete."
123
118
 
124
119
  GEM_HOME="$rvm_gem_home" ; export GEM_HOME
125
120
  GEM_PATH="$rvm_gem_home" ; export GEM_PATH
126
121
 
127
122
  __rvm_rubygems_setup
123
+ __rvm_bin_script
124
+ __rvm_run "chmod.bin" chmod +x $rvm_ruby_home/bin/*
128
125
 
129
126
  popd > /dev/null
130
127
 
@@ -140,13 +137,15 @@ function __rvm_install-ruby {
140
137
 
141
138
  macruby)
142
139
  if [ "`uname`" = "Darwin" ] ; then
140
+ #rvm_macruby_repo_url="${rvm_macruby_repo_url:-"http://svn.macosforge.org/repository/ruby/MacRuby"}"
141
+ rvm_macruby_repo_url="${rvm_macruby_repo_url:-"git://github.com/masterkain/macruby.git"}"
143
142
  rvm_ruby_repo_url=$rvm_macruby_repo_url
144
- #/macruby_nightly-2009-09-10.pkg
145
- rvm_macruby_nightly_url=`__rvm_db "macruby_nightly_url"`
143
+ #rvm_macruby_nightly_url=`__rvm_db "macruby_nightly_url"`
146
144
  rvm_ruby_configure=""
147
145
  rvm_ruby_make="rake macruby:build framework_instdir=$rvm_path/macruby-head framework_name=/macruby-head --trace"
148
146
  rvm_ruby_make_install="rake framework:install framework_instdir=$rvm_path/macruby-head framework_name=/macruby-head --trace"
149
- #rvm_ruby_rev="${rvm_ruby_rev:-head}" # Hard coding this for now
147
+ rvm_ruby_rev="${rvm_ruby_rev:-head}" # Hard coding this for now
148
+ rvm_url=$rvm_ruby_repo_url
150
149
 
151
150
  DESTDIR="$rvm_ruby_home" ; export DESTDIR
152
151
  if [ -z "$rvm_ruby_rev" ] ; then
@@ -162,9 +161,9 @@ function __rvm_install-ruby {
162
161
  rvm_ruby_rev="-r $rvm_ruby_rev"
163
162
  fi
164
163
  fi
165
- __rvm_fetch $rvm_url
166
- __rvm_run /usr/sbin/installer -pkg $rvm_ruby_package_name.pkg -target "$rvm_path/$rvm_ruby_package_name/"
167
- #__rvm_install-source
164
+ #__rvm_fetch $rvm_url
165
+ #__rvm_run /usr/sbin/installer -pkg $rvm_ruby_package_name.pkg -target "$rvm_path/$rvm_ruby_package_name/"
166
+ __rvm_install-source
168
167
  unset DESTDIR
169
168
  else
170
169
  __rvm_log "fail" "MacRuby can only be installed on a Darwin OS."
@@ -181,30 +180,34 @@ function __rvm_install-ruby {
181
180
  else
182
181
  __rvm_log "info" "\tDownloading $rvm_ruby_package_name, this may take a while depending on your connection..."
183
182
  __rvm_fetch $rvm_url
184
- if [ $? -gt 0 ] ; then __rvm_log "error" "There was an error, please check $rvm_ruby_log_path/*.error.log" ; popd > /dev/null ; return 1 ; fi
183
+ if [ $? -gt 0 ] ; then result=$? ; return $result ; fi
185
184
  __rvm_log "info" "\tExtracting $rvm_ruby_package_name..."
186
185
  mkdir -p $rvm_ruby_src_path
187
186
  __rvm_run "extract" tar xzf $rvm_archives_path/$rvm_ruby_package_name.tar.gz -C $rvm_source_path
187
+ if [ $? -gt 0 ] ; then result=$? ; return $result ; fi
188
188
  fi
189
189
 
190
190
  __rvm_log "info" "\tInstalling $rvm_ruby_package_name, this may take a while, depending on your cpu(s)..."
191
191
  mkdir -p $rvm_ruby_log_path
192
192
 
193
193
  cd $rvm_ruby_src_path
194
+ mkdir -p $rvm_ruby_home/lib/ruby/gems/1.8/gems
194
195
  if [ ! -z "$rvm_ruby_configure" ] ; then rvm_ruby_configure="-c $rvm_ruby_configure"; fi
195
196
  __rvm_run "install" ./installer -a $rvm_path/ruby-enterprise-$rvm_ruby_version-$rvm_ruby_patch_level --dont-install-useful-gems --no-tcmalloc $rvm_ruby_configure
197
+ if [ $? -gt 0 ] ; then result=$? ; return $result ; fi
196
198
  chmod +x $rvm_ruby_home/bin/*
197
199
 
198
- __rvm_bin_script
199
200
  __rvm_rubygems_setup
200
201
 
201
- popd > /dev/null
202
-
203
202
  for rvm_gem_name in rake ; do
204
203
  __rvm_log "info" "Installing $rvm_gem_name"
205
204
  __rvm_run "gems" $rvm_ruby_home/bin/gem install $rvm_gem_name --no-rdoc --no-ri -q
206
205
  done
207
- ;;
206
+
207
+ __rvm_bin_script
208
+
209
+ popd > /dev/null
210
+ ;;
208
211
 
209
212
  rbx|rubinius)
210
213
  # TODO: check if system is 1.8.X otherwise use rvm's 1.8.X and check for parsetree, install if missing
@@ -219,17 +222,20 @@ function __rvm_install-ruby {
219
222
  #rvm_ruby_rev="head"
220
223
  # TODO: Check if already git repo, then git pull origin master && build
221
224
 
222
- __rvm_bin_script
223
-
224
225
  if [ ! -d $rvm_ruby_home -o ! -d $rvm_ruby_home/.git ] ; then
225
226
  rm -rf $rvm_ruby_home
226
227
  git clone --depth 1 $rvm_ruby_repo_url $rvm_ruby_home
227
228
  fi
228
229
  cd $rvm_ruby_home
229
- __rvm_run "build" $rvm_rubinius_jit rake build
230
+ if [ ! -z "$rvm_jit_flag" ]; then
231
+ __rvm_run "build" RBX_LLVM=1 rake build
232
+ else
233
+ __rvm_run "build" rake build
234
+ fi
230
235
  for binary in ruby irb ; do
231
236
  ln -fs $rvm_ruby_home/bin/rbx $rvm_ruby_home/bin/$binary
232
237
  done
238
+ __rvm_bin_script
233
239
  ;;
234
240
 
235
241
  jruby)
@@ -273,15 +279,19 @@ function __rvm_install-ruby {
273
279
  ln -fs $rvm_ruby_home/bin/$binary $rvm_ruby_home/bin/${binary#j}
274
280
  done
275
281
 
282
+ __rvm_bin_script
283
+
276
284
  ln -fs $rvm_ruby_home/bin/ruby $rvm_path/bin/$rvm_ruby_package_name
277
285
  for rvm_gem_name in rake jruby-openssl ; do
278
286
  __rvm_log "info" "Installing $rvm_gem_name"
279
- __rvm_run "gems" $rvm_ruby_home/bin/jgem install $rvm_gem_name --no-rdoc --no-ri -q
287
+ __rvm_run "gems" $rvm_ruby_home/bin/gem install $rvm_gem_name --no-rdoc --no-ri -q
280
288
  done
281
289
  ;;
282
290
 
283
291
  ruby)
284
- if [ -z "rvm_ruby_configure" ] ; then rvm_ruby_configure="--enable-shared=true --enable-pthread=true " ; fi
292
+ # Merge configure options with user specified options
293
+ rvm_ruby_configure="--enable-shared=true --enable-pthread $rvm_ruby_configure "
294
+ if [ "`uname`" = "Darwin" ] ; then ARCHFLAGS="-arch x86_64 -arch i386" ; export ARCHFLAGS ; fi
285
295
  __rvm_install-source $*
286
296
  ;;
287
297
 
@@ -299,12 +309,34 @@ function __rvm_install-ruby {
299
309
 
300
310
  }
301
311
 
312
+ # TODO: DRY up __rvm_remove and __rvm_uninstall
313
+ function __rvm_remove {
314
+ if [ -z "$rvm_selected" ] ; then __rvm_select $* ; fi
315
+
316
+ if [ ! -z "$rvm_ruby_package_name" ] ; then
317
+ for dir in $rvm_source_path $rvm_path ; do
318
+ if [ -d $dir/$rvm_ruby_package_name ] ; then
319
+ __rvm_log "info" "Removing $dir/$rvm_ruby_package_name..."
320
+ rm -rf $dir/$rvm_ruby_package_name
321
+ else
322
+ __rvm_log "info" "it seems that $dir/$rvm_ruby_package_name is already non existent."
323
+ fi
324
+ if [ -e $rvm_bin_path/$rvm_ruby_package_name ] ; then
325
+ rm -f $rvm_bin_path/$rvm_ruby_package_name
326
+ fi
327
+ done ; unset dir
328
+ rm -rf $rvm_gem_path/$rvm_ruby_interpreter/$rvm_ruby_version*/
329
+ else
330
+ __rvm_log "fail" "Cannot uninstall unknown package '$rvm_ruby_package_name'"
331
+ fi
332
+ }
333
+
302
334
  function __rvm_uninstall {
303
335
 
304
336
  if [ -z "$rvm_selected" ] ; then __rvm_select $* ; fi
305
337
 
306
338
  if [ ! -z "$rvm_ruby_package_name" ] ; then
307
- for dir in $rvm_source_path $rvm_path ; do
339
+ for dir in $rvm_path ; do
308
340
  if [ -d $dir/$rvm_ruby_package_name ] ; then
309
341
  __rvm_log "info" "Removing $dir/$rvm_ruby_package_name..."
310
342
  rm -rf $dir/$rvm_ruby_package_name
@@ -325,7 +357,7 @@ function __rvm_uninstall {
325
357
  function __rvm_post_install {
326
358
 
327
359
  for binary in gem irb erb ri rdoc testrb rake ; do
328
- if [ -x $rvm_ruby_src_path/bin/$binary ] ; then
360
+ if [ -f $rvm_ruby_src_path/bin/$binary ] ; then
329
361
  if [ "$rvm_ruby_src_path" != "$rvm_ruby_home" ] ; then
330
362
  cp $rvm_ruby_src_path/bin/$binary $rvm_ruby_home/bin/$binary
331
363
  fi
@@ -348,9 +380,9 @@ function __rvm_post_install {
348
380
  __rvm_log "info" "Installation of gems for $rvm_ruby_package_name is complete."
349
381
 
350
382
  binary=rake
351
- if [ -x $rvm_ruby_src_path/bin/$binary ] ; then
352
- if [ "$rvm_ruby_src_path" != "$rvm_ruby_home" ] ; then
353
- cp $rvm_ruby_src_path/bin/$binary $rvm_ruby_home/bin/$binary
383
+ if [ -x $rvm_gem_home/bin/$binary ] ; then
384
+ if [ "$rvm_gem_home" != "$rvm_ruby_home" ] ; then
385
+ cp $rvm_gem_home/bin/$binary $rvm_ruby_home/bin/$binary
354
386
  fi
355
387
  # TODO: Account for rubygem installed rake vs system rake
356
388
  string="ENV['GEM_HOME']=ENV['GEM_HOME'] || '$rvm_gem_home'\nENV['GEM_PATH']=ENV['GEM_PATH'] || '$rvm_gem_home'\nENV['PATH']='$rvm_ruby_home/bin:$rvm_gem_home/bin:' + ENV['PATH']"
@@ -376,16 +408,11 @@ function __rvm_rubygems_setup {
376
408
  mkdir -p $rvm_source_path/$rvm_gem_package_name
377
409
  __rvm_run "rubygems.extract" tar zxf $rvm_archives_path/$rvm_gem_package_name.tgz -C $rvm_source_path
378
410
  fi
379
- # Well this is fun... fix nil error on require_paths:
380
- # Q: Is this necessary any longer?
381
- #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
382
- #rm -f $rvm_source_path/$rvm_gem_package_name/lib/rubygems/gem_path_searcher.rb.orig
383
- __rvm_run "rubygems.install" GEM_HOME=$rvm_gem_path GEM_HOME=$rvm_gem_home $rvm_ruby_home/bin/ruby $rvm_source_path/$rvm_gem_package_name/setup.rb
384
- status=$?
385
- if [ $status -eq 0 ] ; then
411
+ __rvm_run "rubygems.install" GEM_PATH=$rvm_gem_path GEM_HOME=$rvm_gem_home $rvm_ruby_home/bin/ruby $rvm_source_path/$rvm_gem_package_name/setup.rb
412
+ result=$?
413
+ if [ $result -eq 0 ] ; then
386
414
  __rvm_log "info" "Installation of rubygems $rvm_ruby_package_name completed successfully."
387
415
  fi
388
- if [ $status -eq 0 ] ; then status=$? ; fi
389
416
  else
390
417
  # 1.9 has it's own built gem command, let's adjust the shebang line.
391
418
  mv $rvm_ruby_src_path/bin/gem $rvm_ruby_src_path/bin/gem.orig
@@ -394,6 +421,6 @@ function __rvm_rubygems_setup {
394
421
  __rvm_run "rubygems.update" $rvm_ruby_home/bin/gem update --system
395
422
  fi
396
423
 
397
- return $status
424
+ return $result
398
425
  }
399
426
 
@@ -3,7 +3,7 @@
3
3
  # __rvm_select implementation version patch_level
4
4
  function __rvm_select {
5
5
 
6
- __rvm_ruby_string
6
+ if [ ! -z "$rvm_ruby_string" ] ; then __rvm_ruby_string ; fi
7
7
 
8
8
  rvm_ruby_interpreter="${1:-$rvm_ruby_interpreter}"
9
9
  rvm_ruby_interpreter="${rvm_ruby_interpreter:-ruby}" # Default is standard ruby
@@ -22,9 +22,11 @@ function __rvm_select {
22
22
  macruby)
23
23
  if [ "`uname`" = "Darwin" ] ; then
24
24
  rvm_ruby_repo_url="${rvm_ruby_repo_url:-`__rvm_db "macruby_repo_url"`}"
25
- rvm_ruby_version="${rvm_ruby_version:-`__rvm_db "macruby_version"`}"
26
- rvm_ruby_package_name=${rvm_ruby_interpreter}_nightly-${rvm_ruby_version}
27
- rvm_url="http://dl.getdropbox.com/u/163257/$rvm_ruby_package_name.pkg" # For now we are only supporting the 'nightly' builds
25
+ rvm_ruby_version="head"
26
+ rvm_ruby_package_name=${rvm_ruby_interpreter}-${rvm_ruby_version}
27
+ #rvm_ruby_version="${rvm_ruby_version:-`__rvm_db "macruby_version"`}"
28
+ #rvm_ruby_package_name=${rvm_ruby_interpreter}_nightly-${rvm_ruby_version}
29
+ #rvm_url="http://dl.getdropbox.com/u/163257/$rvm_ruby_package_name.pkg" # 'nightly' builds
28
30
  unset rvm_ruby_patch_level
29
31
  else
30
32
  __rvm_log "fail" "MacRuby can only be installed on a Darwin OS."
@@ -67,8 +69,9 @@ function __rvm_select {
67
69
  rvm_ruby_version=$(echo $rvm_ruby_tag | sed 's/^v//' | sed 's/\///' | awk -F'_' '{print 1 "." $2 "." $3 }')
68
70
  rvm_ruby_patch_level=$rvm_ruby_tag # $(echo $rvm_ruby_tag | sed 's/^v//' | sed 's/\///' | awk -F'_' '{print $4 }')
69
71
  fi
70
-
71
- rvm_ruby_version=${rvm_ruby_version:-`__rvm_db "ruby_version"`} # Default verison is 1.8.6
72
+ if [ -z "$rvm_ruby_version" ] ; then
73
+ rvm_ruby_version=`__rvm_db "ruby_version"` # Default verison is 1.8.6
74
+ fi
72
75
  rvm_ruby_patch_level=${rvm_ruby_patch_level:-`__rvm_db "ruby_${rvm_ruby_version}_patch_level"`} # Default verison is 1.8.6
73
76
  if [ -z "rvm_ruby_patch_level" ] ; then unset rvm_ruby_patch_level ; fi
74
77
 
@@ -107,17 +110,17 @@ function __rvm_select {
107
110
  fi
108
111
  fi
109
112
 
110
- if [ ! -z "$rvm_load" ] ; then __rvm_gemset_load ; fi
111
- if [ ! -z "$rvm_dump" ] ; then __rvm_gemset_dump ; fi
112
-
113
113
  mkdir -p $rvm_gem_home
114
114
 
115
115
  if [ -z "$rvm_ruby_patch_level" ] ; then
116
116
  rvm_ruby_package_name="${rvm_ruby_package_name:-"$rvm_ruby_interpreter-$rvm_ruby_version"}"
117
117
  rvm_ruby_home="${rvm_ruby_home:-"$rvm_path/$rvm_ruby_interpreter-$rvm_ruby_version"}"
118
118
  else
119
- if [ "`echo $rvm_ruby_patch_level | awk '{print substr($1, 0, 1)}'`" != "p" ] ; then
120
- rvm_ruby_patch_level="p$rvm_ruby_patch_level"
119
+ if [ "$rvm_ruby_interpreter" != "ruby-enterprise" ] ; then
120
+ if [ ! -z "`echo $rvm_ruby_patch_level | awk '/[0-9]+/{print}'`" ] ; then
121
+ rvm_ruby_patch_level="p$rvm_ruby_patch_level"
122
+ fi
123
+ rvm_ruby_patch_level="`echo $rvm_ruby_patch_level | sed 's/^pp/p/'`" # sanity check, thanks sfpyra
121
124
  fi
122
125
  rvm_ruby_package_name="${rvm_ruby_package_name:-"$rvm_ruby_interpreter-$rvm_ruby_version-$rvm_ruby_patch_level"}"
123
126
  rvm_ruby_home="${rvm_ruby_home:-"$rvm_path/$rvm_ruby_interpreter-$rvm_ruby_version-$rvm_ruby_patch_level"}"
@@ -129,7 +132,10 @@ function __rvm_select {
129
132
  rvm_ruby_string="$rvm_ruby_package_name"
130
133
  rvm_selected=1
131
134
 
132
- export rvm_ruby_interpreter rvm_ruby_version rvm_ruby_repo_url rvm_ruby_version rvm_ruby_package_name rvm_url rvm_ruby_patch_level rvm_ruby_configure rvm_ruby_make rvm_ruby_make_install rvm_ruby_rev rvm_ruby_tag rvm_major_version rvm_minor_version rvm_gem_set_name rvm_gem_path rvm_gem_home rvm_path rvm_source_path rvm_bin_path rvm_ruby_binary rvm_ruby_package_name rvm_ruby_home rvm_log_path rvm_ruby_log_path rvm_source_path rvm_ruby_src_path rvm_ruby_irbrc rvm_selected rvm_ruby_string
135
+ export rvm_ruby_interpreter rvm_ruby_version rvm_ruby_repo_url rvm_ruby_package_name rvm_url rvm_ruby_patch_level rvm_ruby_configure rvm_ruby_make rvm_ruby_make_install rvm_ruby_rev rvm_ruby_tag rvm_major_version rvm_minor_version rvm_gem_set_name rvm_gem_path rvm_gem_home rvm_path rvm_source_path rvm_bin_path rvm_ruby_binary rvm_ruby_home rvm_log_path rvm_ruby_log_path rvm_source_path rvm_ruby_src_path rvm_ruby_irbrc rvm_selected rvm_ruby_string
136
+
137
+ if [ ! -z "$rvm_load_flag" ] ; then __rvm_gemset_load ; fi
138
+ if [ ! -z "$rvm_dump_flag" ] ; then __rvm_gemset_dump ; fi
133
139
 
134
140
  else
135
141
  rvm_gem_home=$GEM_HOME
@@ -156,6 +162,7 @@ function __rvm_use {
156
162
  elif [ "$rvm_ruby_interpreter" = "system" ] ; then
157
163
 
158
164
  unset GEM_HOME GEM_PATH MY_RUBY_HOME RUBY_VERSION IRBRC
165
+ # TODO: Remove .rvm/bin from the path
159
166
  PATH="$rvm_system_path" ; export PATH
160
167
  if [ -s $rvm_path/system ] ; then
161
168
  grep "^MY_RUBY_HOME='$rvm_path" "$rvm_path/system" > /dev/null
@@ -174,15 +181,9 @@ function __rvm_use {
174
181
  IRBRC="$rvm_ruby_irbrc" ; export IRBRC
175
182
  if [ -z "$IRBRC" ] ; then unset IRBRC ; fi
176
183
 
177
- # Install if not installed
178
184
  if [ ! -d $MY_RUBY_HOME ] ; then
179
185
  __rvm_log "warn" "$rvm_ruby_interpreter $rvm_ruby_version is not installed."
180
- echo -n -e "Would you like rvm to install $rvm_ruby_interpreter $rvm_ruby_version for you now?\n(Y/n) ? "
181
- read response
182
- if [ "$response" = 'n' ] ; then
183
- __rvm_log "warn" "Please run 'rvm install $rvm_ruby_interpreter $rvm_ruby_version' if you wish to use it.\n"
184
- return 0
185
- else
186
+ if [ ! -z "$rvm_install_on_use" ] ; then
186
187
  __rvm_install-ruby $rvm_ruby_interpreter $rvm_ruby_version $rvm_ruby_patch_level
187
188
  fi
188
189
  fi
@@ -191,7 +192,7 @@ function __rvm_use {
191
192
 
192
193
  PATH="$MY_RUBY_HOME/bin:$GEM_HOME/bin:$rvm_path/bin:$rvm_system_path" ; export PATH
193
194
 
194
- if [ ! -z "$rvm_set_default" ] ; then
195
+ if [ ! -z "$rvm_default_flag" ] ; then
195
196
  RUBY_VERSION="$($MY_RUBY_HOME/bin/ruby -v | sed 's/^\(.*\) (.*$/\1/')"
196
197
  export GEM_HOME GEM_PATH MY_RUBY_HOME RUBY_VERSION
197
198
 
@@ -213,13 +214,9 @@ function __rvm_use {
213
214
  ln -fs $rvm_path/bin/gem-$rvm_ruby_package_name $rvm_path/bin/gem
214
215
  ln -fs $rvm_path/bin/irb-$rvm_ruby_package_name $rvm_path/bin/irb
215
216
  else
216
- rm -f $rvm_path/bin/ruby
217
- rm -f $rvm_path/bin/default-ruby
218
- rm -f $rvm_path/bin/gem
219
- rm -f $rvm_path/bin/irb
217
+ rm -f $rvm_path/bin/ruby $rvm_path/bin/default-ruby $rvm_path/bin/gem $rvm_path/bin/irb
220
218
  fi
221
-
222
- unset rvm_set_default
219
+ unset rvm_default_flag
223
220
  fi
224
221
  fi
225
222
  }