rvm 0.0.55 → 0.0.56

Sign up to get free protection for your applications and to get access to all the features.
data/config/db CHANGED
@@ -1,7 +1,7 @@
1
1
  niceness=0
2
2
  ruby_repo_url=http://svn.ruby-lang.org/repos/ruby
3
3
  rubinius_repo_url=git://github.com/evanphx/rubinius.git
4
- macruby_repo_url=http://svn.macosforge.org/repository/ruby/MacRuby
4
+ macruby_repo_url=git://git.macruby.org/macruby/MacRuby.git
5
5
  macruby_nightly_url=http://macruby.icoretech.org/latest
6
6
  jruby_repo_url=git://kenai.com/jruby~main
7
7
  ruby_configure=--enable-shared
@@ -9,7 +9,6 @@ interpreter=ruby
9
9
  ruby_version=1.8.6
10
10
  ruby_patchlevel=383
11
11
  jruby_version=1.3.1
12
- ree_interpreter=ruby-enterprise
13
12
  ree_version=1.8.7
14
13
  ree_1.8.6_patch_level=20090610
15
14
  ree_1.8.6_url=http://rubyforge.org/frs/download.php/58677
@@ -33,3 +33,6 @@
33
33
 
34
34
  # Install rubies on use when they are not installed
35
35
  #ruby_install_on_use=1
36
+
37
+ # Make Flags, I have 2 cpu's so I can do 2 make threads:
38
+ #rvm_make_flags="-j 2"
data/install CHANGED
@@ -21,6 +21,7 @@ for dir_name in src scripts bin log archives config gems examples ; do
21
21
  mkdir -p $rvm_path/$dir_name
22
22
  done
23
23
 
24
+ rm -rf $rvm_path/scripts # Clear the old scripts directory so that the old style rvm- scripts are cleared out.
24
25
  for dir_name in config scripts examples lib ; do
25
26
  mkdir -p $rvm_path/$dir_name
26
27
  /bin/cp -Rf $source_dir/$dir_name $rvm_path
@@ -1,4 +1,4 @@
1
1
  ---
2
2
  :major: 0
3
3
  :minor: 0
4
- :patch: 55
4
+ :patch: 56
@@ -5,7 +5,7 @@ function __rvm_meta {
5
5
  rvm_meta_author_email="wayneeseguin@gmail.com"
6
6
  rvm_meta_website="http://rvm.beginrescueend.com/"
7
7
  rvm_meta_version="`cat $rvm_path/lib/VERSION.yml | tail -n 3 | sed 's/^.*: //g' | tr "\n" '.' | sed 's/\.$//'`"
8
- rvm_meta_updated="2009.10.05"
8
+ rvm_meta_updated="2009.10.09"
9
9
  }
10
10
 
11
11
  function __rvm_version { __rvm_meta ; echo "rvm $rvm_meta_version ($rvm_meta_updated) [$rvm_meta_website]" ; }
@@ -103,7 +103,7 @@ Resources:
103
103
  " | ${PAGER:-/usr/bin/less}
104
104
  }
105
105
 
106
- function __rvm_parse-args {
106
+ function __rvm_parse_args {
107
107
  while [ $# -gt 0 ] ; do
108
108
  rvm_token="$1" ; shift
109
109
  case "$rvm_token" in
@@ -140,18 +140,14 @@ function __rvm_parse-args {
140
140
  fi
141
141
  ;;
142
142
 
143
- gemset)
144
- rvm_action=$rvm_token
145
- if [ "$1" = "delete" ] ; then
146
- rvm_delete_flag=1
147
- shift
148
- if [ -z "$1" -a -z "$rvm_gem_set_name" ] ; then
149
- rvm_action="error"
150
- rvm_error_message="A gem set name must be specified with 'gemset delete'"
151
- else
152
- rvm_gem_set_name="$1"
153
- shift
154
- fi
143
+ gems|gemset)
144
+ rvm_action="gems"
145
+ if [ "$1" = "name" -o "$1" = "dir" -o "$1" = "list" -o "$1" = "empty" -o "$1" = "delete" ] ; then
146
+ eval "rvm_${1}_flag=1" ; shift
147
+ elif [ "$1" = "dump" -o "$1" = "load" ] ; then
148
+ eval "rvm_${1}_flag=1" ; shift
149
+ else
150
+ rvm_use_flag=1 # Default is to use the (named) gem set.
155
151
  fi
156
152
  ;;
157
153
 
@@ -163,14 +159,13 @@ function __rvm_parse-args {
163
159
  ;;
164
160
 
165
161
  --load|load|dump)
166
- rvm_action=gemset
162
+ rvm_action=gems
167
163
  eval "rvm_${rvm_token}_flag=1"
168
164
  if [ ! -z "$1" ] ; then
169
- rvm_gem_set_name=$(echo $1 | sed 's/\.gemset//' | xargs basename)
170
- rvm_file_name="$(echo $1 | sed 's/\.gemset//').gemset"
165
+ rvm_file_name="$(echo $1 | sed 's/\.gems//').gems"
171
166
  shift
172
167
  else
173
- rvm_file_name="$rvm_gem_set_name.gemset"
168
+ rvm_file_name="$rvm_gem_set_name.gems"
174
169
  fi
175
170
  ;;
176
171
 
@@ -194,7 +189,7 @@ function __rvm_parse-args {
194
189
  if [ "$rvm_action" = "do" ] ; then rvm_action="ruby" ; fi
195
190
  rvm_action=$(echo $rvm_token | sed 's/do//g')
196
191
 
197
- if [ "$rvm_action" = "rake" -o "$rvm_action" = "gem" ] ; then
192
+ if [ "$rvm_action" = "rake" -o "$rvm_action" = "gem" -o "$rvm_action" = "ruby" ] ; then
198
193
  rvm_action="ruby"
199
194
  rvm_ruby_args="$rvm_token $@"
200
195
  rvm_parse_break=1
@@ -263,13 +258,13 @@ function __rvm_parse-args {
263
258
  ;;
264
259
 
265
260
  --head)
266
- rvm_ruby_rev="head"
261
+ rvm_ruby_revision="head"
267
262
  rvm_head_flag=1
268
263
  rvm_action="${rvm_action:-use}"
269
264
  ;;
270
265
 
271
266
  --rev|--revision)
272
- rvm_ruby_rev="$1";
267
+ rvm_ruby_revision="$1";
273
268
  rvm_action="${rvm_action:-use}"
274
269
  shift
275
270
  ;;
@@ -347,17 +342,16 @@ function __rvm_parse-args {
347
342
  ;;
348
343
 
349
344
  --install) rvm_install_on_use_flag=1 ;;
345
+ -h|--help|usage|help) rvm_action=help ;;
350
346
  --prefix) rvm_prefix_path="$1" ; shift ;;
351
347
  -G|--gems) rvm_gem_path="$1" ; shift ;;
352
- --source) rvm_source_path="$1" ; shift ;;
348
+ --source) rvm_src_path="$1" ; shift ;;
353
349
  --archives) rvm_archives_path="$1" ; shift ;;
354
350
  --make) rvm_ruby_make="$1" ; shift ;;
355
351
  --make-install) rvm_ruby_make_install="$1"; shift ;;
356
352
  --nice) rvm_niceness="$1" ; shift ;;
357
353
  -l|--level) rvm_ruby_patch_level="$1" ; shift ;;
358
- -h|--help|usage|help) rvm_action=help ; shift ;;
359
354
  -m|--gem-set) rvm_gem_set_name="$1" ; shift ;;
360
- --rm-gem-set) rvm_gem_set_name_rm="$1" ; shift ;;
361
355
  tests|specs) rvm_action="tests" ;;
362
356
 
363
357
  --trace)
@@ -374,13 +368,18 @@ function __rvm_parse-args {
374
368
 
375
369
  *)
376
370
  if [ ! -z "$rvm_token" ] ; then
377
- if [ ! -z "`echo $rvm_token | awk '/,/'`" ] ; then
371
+ if [ "$rvm_action" = "gems" ] ; then
372
+ if [ -z "$(echo $rvm_token | awk '/\.gems$/')" ] ; then
373
+ rvm_gem_set_name=$(echo $rvm_token | sed 's/\.gems//g')
374
+ else
375
+ rvm_file_name="$(echo $rvm_token | sed 's/\.gems//g').gems"
376
+ fi
377
+ elif [ ! -z "$(echo $rvm_token | awk '/,/')" ] ; then
378
378
  rvm_ruby_version="$rvm_token"
379
379
  if [ -z "$rvm_action" ] ; then
380
- rvm_action="ruby" # Not sure if we really want to do this but we'll try it out.
380
+ rvm_action="do" # Not sure if we really want to do this but we'll try it out.
381
381
  fi
382
382
  else
383
-
384
383
  if [ ! -z "`echo $rvm_token | awk '/\.rb$/{print}' 2> /dev/null`" ] ; then # we have a specified ruby script
385
384
  rvm_ruby_args=$rvm_token
386
385
  rvm_ruby_file=$rvm_token
@@ -409,11 +408,13 @@ function __rvm_parse-args {
409
408
 
410
409
  function rvm {
411
410
 
411
+ trap '__rvm_cleanup_variables ; rm -f "/tmp/rvm/$$" >/dev/null 2>&1' 0 1 2 3 15
412
+
412
413
  __rvm_cleanup_variables
413
414
  __rvm_load-rvmrc
414
415
  __rvm_initialize
415
416
  __rvm_load_defaults
416
- __rvm_parse-args $@
417
+ __rvm_parse_args $@
417
418
 
418
419
  if [ -z "$rvm_trace_flag" ] ; then set +x ; else set -x ; fi
419
420
  result=0
@@ -436,27 +437,15 @@ function rvm {
436
437
  benchmark) __rvm_benchmark ; result=$? ;;
437
438
  ruby) __rvm_do ; result=$? ;;
438
439
  inspect) __rvm_inspect ; result=$? ;;
440
+ gems) __rvm_gems ; result=$? ;;
439
441
 
440
442
  install|uninstall|remove)
441
443
  __rvm_manage_rubies
442
444
  result=$?
443
445
  ;;
444
446
 
445
- gemset)
446
- if [ ! -z "$rvm_load_flag" ] ; then
447
- __rvm_gemset_load
448
- elif [ ! -z "$rvm_dump_flag" ] ; then
449
- __rvm_gemset_load
450
- elif [ ! -z "$rvm_delete_flag" ] ; then
451
- __rvm_gemset_delete
452
- else
453
- rvm_action="error"
454
- rvm_error_message="At least one of load, dump, or delete must be specified with 'gemset'."
455
- fi
456
- ;;
457
-
458
447
  gemsync)
459
- rvm_source_gem_path=`__rvm_select ; echo $rvm_gem_home`
448
+ rvm_source_gem_path=`__rvm_select ; echo $rvm_ruby_gem_home`
460
449
  __rvm_gem_sync
461
450
  ;;
462
451
 
@@ -83,7 +83,7 @@ _rvm ()
83
83
  --install) rvm_install_on_use_flag=1 ;;
84
84
  --prefix) rvm_prefix_path="$1" ; shift ;;
85
85
  -G|--gems) rvm_gem_path="$1" ; shift ;;
86
- --source) rvm_source_path="$1" ; shift ;;
86
+ --source) rvm_src_path="$1" ; shift ;;
87
87
  --archives) rvm_archives_path="$1" ; shift ;;
88
88
  --make) rvm_ruby_make="$1" ; shift ;;
89
89
  --make-install) rvm_ruby_make_install="$1"; shift ;;
@@ -135,7 +135,7 @@ function _rvm {
135
135
  __rvm_load-rvmrc
136
136
  __rvm_initialize
137
137
  __rvm_load_defaults
138
- __rvm_parse-args $@
138
+ __rvm_parse_args $@
139
139
 
140
140
  result=0
141
141
  case "$rvm_action" in
@@ -0,0 +1,180 @@
1
+ #!/bin/bash
2
+ __rvm_gems() {
3
+ if [ -z "$rvm_selected_flag" ] ; then __rvm_select $* ; fi
4
+
5
+ if [ ! -z "$rvm_use_flag" ] ; then
6
+ __rvm_gems_use
7
+ elif [ ! -z "$rvm_load_flag" ] ; then
8
+ __rvm_gems_load
9
+ elif [ ! -z "$rvm_dump_flag" ] ; then
10
+ __rvm_gems_dump
11
+ elif [ ! -z "$rvm_delete_flag" ] ; then
12
+ __rvm_gems_delete
13
+ elif [ ! -z "$rvm_name_flag" ] ; then
14
+ __rvm_gems_name
15
+ elif [ ! -z "$rvm_dir_flag" ] ; then
16
+ __rvm_gems_dir
17
+ elif [ ! -z "$rvm_list_flag" ] ; then
18
+ __rvm_gems_list
19
+ elif [ ! -z "$rvm_clear_flag" ] ; then
20
+ __rvm_gems_clear
21
+ fi
22
+ }
23
+
24
+ __rvm_gems_select() {
25
+ if [ -z "$rvm_gem_set_name" ] ; then
26
+ if [ -z "$GEM_HOME" ] ; then
27
+ rvm_ruby_gem_home=$(gem env gemdir)
28
+ elif [ ! -z "$GEM_HOME" ] ; then
29
+ rvm_ruby_gem_home="$GEM_HOME"
30
+ elif [ ! -z "$rvm_ruby_interpreter" -a ! -z "$rvm_ruby_version" -a "$rvm_ruby_interpreter" != "system" ] ; then
31
+ rvm_ruby_gem_home="$rvm_gem_path/$rvm_ruby_interpreter/$rvm_ruby_version"
32
+ else
33
+ __rvm_log "error" "Cannot select gem home, something definitely wrong :/"
34
+ fi
35
+
36
+ if [ -z "$rvm_gem_set_name" -a ! -z "$rvm_ruby_gem_home" -a ! -z "$rvm_ruby_version" ] ; then
37
+ rvm_gem_set_name=$(echo $rvm_ruby_gem_home | xargs basename | sed "s/${rvm_ruby_version}-//")
38
+ fi
39
+
40
+ if [ -z "$rvm_gem_set_name" ] ; then unset rvm_gem_set_name ; fi
41
+
42
+ if [ ! -z "$rvm_gem_set_name" -a ! -z "$(echo $rvm_gem_set_name | awk '/^'$rvm_ruby_version'/')" ] ; then
43
+ rvm_ruby_gem_home="$rvm_gem_path/$rvm_ruby_interpreter/$rvm_ruby_version-$rvm_gem_set_name"
44
+ else
45
+ rvm_ruby_gem_home="$rvm_gem_path/$rvm_ruby_interpreter/$rvm_ruby_version"
46
+ fi
47
+ else
48
+ rvm_ruby_gem_home="$rvm_gem_path/$rvm_ruby_interpreter/$rvm_ruby_version-$rvm_gem_set_name"
49
+ fi
50
+ }
51
+
52
+ __rvm_gems_use() {
53
+ __rvm_gems_select ; mkdir -p "$rvm_ruby_gem_home" ; GEM_HOME="$rvm_ruby_gem_home" ; export GEM_HOME
54
+ }
55
+
56
+ __rvm_gems_name() {
57
+ __rvm_gems_select ; echo "$rvm_gem_set_name"
58
+ }
59
+
60
+ __rvm_gems_dir() {
61
+ __rvm_gems_select ; echo "$rvm_ruby_gem_home"
62
+ }
63
+
64
+ __rvm_gems_list() {
65
+ __rvm_gems_select ; gem list
66
+ }
67
+
68
+ __rvm_gems_clear() {
69
+ __rvm_gems_use
70
+ if [ -d "$rvm_ruby_gem_home" -a "$rvm_ruby_gem_home" != '/' ] ; then
71
+ rm -rf "$rvm_ruby_gem_home"
72
+ fi
73
+ }
74
+
75
+ __rvm_gems_dump() {
76
+ if [ -z "$rvm_selected_flag" ] ; then __rvm_select $* ; fi
77
+ __rvm_gems_select
78
+ rvm_gem_set_name="${rvm_gem_set_name:-"default"}"
79
+ rvm_file_name="${rvm_file_name:-"$rvm_gem_set_name.gems"}"
80
+
81
+ echo "# $rvm_file_name generated gem dump file. Note that any env variable settings will be missing. Append these after using a ';' field separator" > $rvm_file_name
82
+
83
+ for gem in $(gem list | sed 's/[\(|\)]//g' | sed 's/, /,/g' | tr ' ' ';') ; do
84
+ name="$(echo $gem | awk -F';' '{print $1}')"
85
+ if [ -z "$rvm_latest_flag" ] ; then
86
+ versions="$(echo $gem | awk -F';' '{print $2}' | sed 's/,/ /g')"
87
+ for version in $versions ; do
88
+ echo "$name -v$version" >> $rvm_file_name
89
+ done ; unset version versions
90
+ else
91
+ echo "$name" >> $rvm_file_name
92
+ fi ; unset name
93
+ done ; unset file_name
94
+ }
95
+
96
+ __rvm_gems_load() {
97
+ if [ -z "$rvm_selected_flag" ] ; then __rvm_select $* ; fi
98
+ __rvm_gems_select
99
+ rvm_gem_set_name="${rvm_gem_set_name:-"default"}"
100
+ rvm_file_name="${rvm_file_name:-"$rvm_gem_set_name.gems"}"
101
+
102
+ echo "Loading $rvm_file_name file..."
103
+ rvm_ruby_gem_list=$(/bin/ls $rvm_ruby_gem_home/specifications/ 2> /dev/null | sed 's/\.gemspec$//' 2> /dev/null)
104
+ while read line
105
+ do # Keep this on 2nd line :( bash fail.
106
+ # TODO: Switch to a different field separator than ; to allow for evals
107
+ gem="$(echo $line | awk -F';' '{print $1}')"
108
+ gem_prefix="$(echo $line | awk -F';' '{print $2}')"
109
+ gem_name="$(echo $gem | awk '{print $1}')"
110
+ gem_version="$(echo $gem | sed 's/^.*-v[=]*[ ]*//' | awk '{print $1}')"
111
+ gem_postfix="$(echo $gem | sed "s/$gem_name//" | sed "s/-v[=]*[ ]*$gem_version//")"
112
+
113
+ if [ -f "$gem" ] ; then
114
+ gem_file_name="${gem}"
115
+ elif [ -z "$gem_version" ] ; then # no version
116
+ gem_file_name="${gem_name}*.gem"
117
+ else # version
118
+ gem_file_name="$gem_name-$gem_version.gem"
119
+ fi
120
+
121
+ cache_file=$(/bin/ls -t $rvm_gem_path/*/*/cache/${gem_file_name}* 2> /dev/null | head -n1)
122
+ if [ -z "$cache_file" ] ; then
123
+ if [ -z "$gem_version" ] ; then
124
+ gem="$gem_name"
125
+ else
126
+ gem="$gem_name -v $gem_version"
127
+ fi
128
+ else # cached
129
+ gem_file_name="$(basename $cache_file)"
130
+ gem_string="$(echo "$gem_file_name" | sed 's/\.gem$//')"
131
+ if [ ! -z "$(echo "$rvm_ruby_gem_list" | awk "/$gem_string/{print}")" ] ; then
132
+ if [ ! -z "$rvm_force_flag" ] ; then
133
+ cp $cache_file $rvm_temp_path/$gem_file_name
134
+ gem="$rvm_temp_path/$gem_file_name" # install as a named local gem
135
+ else
136
+ unset gem
137
+ __rvm_log "info" "$gem_name $gem_version is already installed, skipping. (use --force to force these to install regardless)"
138
+ fi
139
+ else
140
+ gem="$cache_file"
141
+ fi
142
+ fi
143
+
144
+ if [ ! -z "$gem" ] ; then
145
+ # TODO: Set vars if fourth field is non-empty (means that there are conditional statements to execute in the gem install line.
146
+ if [ -z "$vars" ] ; then
147
+ GEM_HOME="$rvm_ruby_gem_home" GEM_PATH="$rvm_ruby_gem_home" $gem_prefix $rvm_ruby_home/bin/gem install --no-rdoc --no-ri -q $gem $gem_postfix
148
+ else
149
+ eval "GEM_HOME='$rvm_ruby_gem_home' GEM_PATH='$rvm_ruby_gem_home' $gem_prefix $rvm_ruby_home/bin/gem install --no-rdoc --no-ri -q $gem $gem_postfix"
150
+ fi
151
+ fi
152
+ unset gem gem_prefix gem_name gem_version gem_file_name gem_postfix cache_file gem_file_name gem_string
153
+ done < <(awk '/^[\.\/a-zA-Z]/{print}' "$rvm_file_name")
154
+ }
155
+
156
+ __rvm_gems_delete () {
157
+ if [ -z "$rvm_selected_flag" ] ; then __rvm_select $* ; fi
158
+ __rvm_gems_select
159
+ if [ ! -z "$rvm_gem_set_name" ] ; then
160
+ gemdir="$rvm_gem_path/$rvm_ruby_interpreter/$rvm_ruby_version-$rvm_gem_set_name"
161
+ if [ -d "$gemdir" -a ! -z "$rvm_force_flag" ] ; then
162
+ rm -rf $gemdir
163
+ elif [ -d "$gemdir" ] ; then
164
+ __rvm_log "warn" "Are you SURE you wish to remove the installed gems '$rvm_gem_set_name ' ($gemdir)?"
165
+ echo -n "(anything other than 'yes' will cancel) > "
166
+ read response
167
+ if [ "$response" = "yes" ] ; then
168
+ rm -rf $gemdir
169
+ else
170
+ __rvm_log "info" "Not doing anything, phew... close call that one eh?"
171
+ fi
172
+ else
173
+ __rvm_log "info" "$gemdir already does not exist."
174
+ fi ; unset gemdir
175
+ else
176
+ __rvm_log "error" "A gems name must be specified in order to delete a gems."
177
+ fi
178
+ }
179
+
180
+
@@ -21,6 +21,7 @@ for dir_name in src scripts bin log archives config gems examples ; do
21
21
  mkdir -p $rvm_path/$dir_name
22
22
  done
23
23
 
24
+ rm -rf $rvm_path/scripts # Clear the old scripts directory so that the old style rvm- scripts are cleared out.
24
25
  for dir_name in config scripts examples lib ; do
25
26
  mkdir -p $rvm_path/$dir_name
26
27
  /bin/cp -Rf $source_dir/$dir_name $rvm_path
@@ -1,38 +1,37 @@
1
1
  #!/bin/bash
2
2
 
3
3
  function __rvm_install_source {
4
- if [ -z "$rvm_selected" ] ; then __rvm_select $* ; fi
4
+ if [ -z "$rvm_selected_flag" ] ; then __rvm_select $* ; fi
5
5
  __rvm_log "info" "Installing Ruby from source to: $rvm_ruby_home"
6
- mkdir -p $rvm_ruby_log_path
6
+ mkdir -p "$rvm_ruby_log_path"
7
7
 
8
- __rvm_pushpop $rvm_source_path
8
+ __rvm_pushpop "$rvm_src_path"
9
9
 
10
10
  if [ ! -z "$rvm_force_flag" ] ; then
11
- rm -rf $rvm_ruby_home
12
- rm -rf $rvm_ruby_src_path
11
+ rm -rf "$rvm_ruby_home" "$rvm_ruby_src_path"
13
12
  fi
14
13
 
15
14
  result=0
16
- if [ -z "$rvm_ruby_tag" -a -z "$rvm_ruby_rev" ] ; then
15
+ if [ -z "$rvm_ruby_tag" -a -z "$rvm_ruby_revision" ] ; then
17
16
  if [ ! -f $rvm_archives_path/$rvm_ruby_package_name.tar.gz ] ; then
18
17
  rvm_url="${rvm_url:-"ftp://ftp.ruby-lang.org/pub/ruby/1.$rvm_major_version/$rvm_ruby_package_name.tar.gz"}"
19
18
  __rvm_log "info" "Downloading $rvm_ruby_package_name, this may take a while depending on your connection..."
20
- __rvm_fetch $rvm_url
19
+ __rvm_fetch "$rvm_url"
21
20
  if [ $? -gt 0 ] ; then result=$? ; return $result ; fi
22
21
  fi
23
- mkdir -p $rvm_ruby_src_path # Is this line necessary considering -C below? v
24
- __rvm_run "extract" "tar xzf $rvm_archives_path/$rvm_ruby_package_name.tar.gz -C $rvm_source_path" "Extracting $rvm_ruby_package_name ..."
22
+ #mkdir -p "$rvm_ruby_src_path" # Is this line necessary considering -C below? v
23
+ __rvm_run "extract" "tar xzf $rvm_archives_path/$rvm_ruby_package_name.tar.gz -C $rvm_src_path" "Extracting $rvm_ruby_package_name ..."
25
24
  if [ $? -gt 0 ] ; then result=$? ; return $result ; fi
26
25
  else
27
26
  __rvm_log "info" "Retrieving Ruby from $rvm_url"
28
27
  if [ ! -z "`echo $rvm_url | awk '/^git/'`" ] ; then
29
28
  if [ -d "$rvm_ruby_src_path/.git" ] ; then
30
29
  cd $rvm_ruby_src_path
31
- if [ -z "$rvm_ruby_rev" ] ; then
30
+ if [ -z "$rvm_ruby_revision" ] ; then
32
31
  git pull origin master
33
32
  if [ $? -gt 0 ] ; then result=$? ; return $result ; fi
34
33
  else
35
- git checkout ${rvm_ruby_rev:-HEAD}
34
+ git checkout ${rvm_ruby_revision:-HEAD}
36
35
  if [ $? -gt 0 ] ; then result=$? ; return $result ; fi
37
36
  fi
38
37
  else
@@ -40,17 +39,17 @@ function __rvm_install_source {
40
39
  if [ $? -gt 0 ] ; then result=$? ; return $result ; fi
41
40
  fi
42
41
  else
43
- if [ -z "$rvm_ruby_rev" ] ; then
42
+ if [ -z "$rvm_ruby_revision" ] ; then
44
43
  # TODO: Check if tag v is valid
45
44
  rvm_url="$rvm_ruby_repo_url/tags/$rvm_ruby_tag"
46
45
  rvm_rev=""
47
46
  else
48
- if [ "$rvm_ruby_rev" = "head" -o "$rvm_ruby_rev" = "trunk" ] ; then
47
+ if [ "$rvm_ruby_revision" = "head" -o "$rvm_ruby_revision" = "trunk" ] ; then
49
48
  rvm_url="$rvm_ruby_repo_url/trunk"
50
49
  rvm_rev=""
51
50
  else
52
51
  rvm_url=$rvm_ruby_repo_url/branches/ruby_1_${rvm_major_version}_${rvm_minor_version}
53
- rvm_rev="-r $rvm_ruby_rev"
52
+ rvm_rev="-r $rvm_ruby_revision"
54
53
  fi
55
54
  fi
56
55
 
@@ -106,8 +105,8 @@ function __rvm_install_source {
106
105
 
107
106
  __rvm_log "info" "Installation of $rvm_ruby_package_name is complete."
108
107
 
109
- GEM_HOME="$rvm_gem_home" ; export GEM_HOME
110
- GEM_PATH="$rvm_gem_home" ; export GEM_PATH
108
+ GEM_HOME="$rvm_ruby_gem_home" ; export GEM_HOME
109
+ GEM_PATH="$rvm_ruby_gem_home" ; export GEM_PATH
111
110
 
112
111
  __rvm_rubygems_setup
113
112
  __rvm_bin_script
@@ -118,9 +117,9 @@ function __rvm_install_source {
118
117
 
119
118
  function __rvm_install_ruby {
120
119
 
121
- if [ -z "$rvm_selected" ] ; then __rvm_select $* ; fi
122
- if [ ! -z "$RUBYOPT" ] ; then ruby_options=$RUBYOPT ; unset RUBYOPT ; fi
123
- if [ "`uname`" = "Darwin" ] ; then ARCHFLAGS="-arch x86_64 -arch i386" ; export ARCHFLAGS ; fi
120
+ if [ -z "$rvm_selected_flag" ] ; then __rvm_select $* ; fi
121
+ if [ ! -z "$RUBYOPT" ] ; then ruby_options="$RUBYOPT" ; unset RUBYOPT ; fi
122
+ if [ "`uname`" = "Darwin" ] ; then ARCHFLAGS="$rvm_archflags" ; export ARCHFLAGS ; fi
124
123
 
125
124
  case "$rvm_ruby_interpreter" in
126
125
  macruby)
@@ -136,29 +135,28 @@ function __rvm_install_ruby {
136
135
  __rvm_irbrc
137
136
  ;;
138
137
 
139
- ruby-enterprise|ree)
138
+ ree)
140
139
  if [ ! -z "$(echo $rvm_ruby_version | awk '/^1\.8/')" -a -z "$rvm_head_flag" ] ; then
141
- # ruby-enterprise-1.8.7-20090928.tar.gz
142
- rvm_url="`__rvm_db "ree_${rvm_ruby_version}_url"`/$rvm_ruby_package_name.tar.gz"
140
+ rvm_url="$(__rvm_db "ree_${rvm_ruby_version}_url")/$rvm_ruby_package_file.tar.gz"
143
141
  __rvm_log "info" "Installing Ruby Enterprise Edition from source to: $rvm_ruby_home"
144
- __rvm_pushpop $rvm_source_path
145
- if [ -d $rvm_ruby_src_path ] ; then
146
- cd $rvm_ruby_src_path
142
+ __rvm_pushpop "$rvm_src_path"
143
+ if [ -z "$rvm_force_flag" -a -d "$rvm_ruby_src_path" -a ! -z $($rvm_ruby_src_path/*) ] ; then
144
+ __rvm_log "It appears that the archive has already been extracted. Skipping extract (use --force to force re-download and extract)."
147
145
  else
148
- __rvm_log "Downloading $rvm_ruby_package_name, this may take a while depending on your connection..."
149
- __rvm_fetch $rvm_url
146
+ __rvm_log "Downloading $rvm_ruby_package_file, this may take a while depending on your connection..."
147
+ __rvm_fetch "$rvm_url"
150
148
  if [ $? -gt 0 ] ; then result=$? ; return $result ; fi
151
- mkdir -p $rvm_ruby_src_path
152
- __rvm_run "extract" "tar xzf $rvm_archives_path/$rvm_ruby_package_name.tar.gz -C $rvm_source_path" "Extracting $rvm_ruby_package_name..."
149
+ rm -rf "$rvm_ruby_src_path"
150
+ __rvm_run "extract" "tar xzf $rvm_archives_path/$rvm_ruby_package_file.tar.gz -C $rvm_src_path" "Extracting $rvm_ruby_package_file..."
153
151
  if [ $? -gt 0 ] ; then result=$? ; return $result ; fi
152
+ mv "$rvm_src_path/$rvm_ruby_package_file" "$rvm_ruby_src_path"
154
153
  fi
154
+ cd "$rvm_ruby_src_path"
155
155
 
156
- mkdir -p $rvm_ruby_log_path
157
-
158
- cd $rvm_ruby_src_path
159
- mkdir -p $rvm_ruby_home/lib/ruby/gems/1.8/gems
156
+ mkdir -p "$rvm_ruby_log_path"
157
+ mkdir -p "${rvm_ruby_home}/lib/ruby/gems/1.8/gems"
160
158
  if [ ! -z "$rvm_ruby_configure" ] ; then rvm_ruby_configure="-c $rvm_ruby_configure"; fi
161
- __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" "Installing $rvm_ruby_package_name, this may take a while, depending on your cpu(s)..."
159
+ __rvm_run "install" "./installer -a $rvm_path/$rvm_ruby_interpreter-$rvm_ruby_version-$rvm_ruby_patch_level --dont-install-useful-gems --no-tcmalloc $rvm_ruby_configure" "Installing $rvm_ruby_string, this may take a while, depending on your cpu(s)..."
162
160
  if [ $? -gt 0 ] ; then result=$? ; return $result ; fi
163
161
  chmod +x $rvm_ruby_home/bin/*
164
162
 
@@ -167,6 +165,9 @@ function __rvm_install_ruby {
167
165
  for rvm_gem_name in rake ; do
168
166
  __rvm_run "gems" "$rvm_ruby_home/bin/gem install $rvm_gem_name --no-rdoc --no-ri -q" "Installing $rvm_gem_name"
169
167
  done
168
+ __rvm_inject_ruby_shebang "$rvm_ruby_gem_home/bin/rake"
169
+ __rvm_inject_gem_env "$rvm_ruby_gem_home/bin/rake"
170
+
170
171
  __rvm_irbrc
171
172
  __rvm_bin_scripts
172
173
  __rvm_post_install
@@ -195,15 +196,15 @@ function __rvm_install_ruby {
195
196
  rvm_ruby_make="rake"
196
197
  rvm_ruby_make_install="rake install"
197
198
  rvm_ruby_home="$rvm_path/$rvm_ruby_interpreter-$rvm_ruby_version"
198
- #rvm_ruby_rev="head"
199
+ #rvm_ruby_revision="head"
199
200
 
200
201
  # For Installer, can do this once it's ready:
201
202
  RBX_PREFIX=$rvm_ruby_home ; export RBX_PREFIX
202
203
  # Also see 'rakelib/configuration.rake'
203
204
 
204
- if [ ! -d $rvm_ruby_home -o ! -d $rvm_ruby_home/.git ] ; then
205
- rm -rf $rvm_ruby_home
206
- __rvm_run "rbx.repo" "git clone --depth 1 $rvm_ruby_repo_url $rvm_ruby_home" "Cloning $rvm_ruby_repo_url"
205
+ if [ ! -d $rvm_ruby_src_path -o ! -d $rvm_ruby_src_path/.git ] ; then
206
+ rm -rf $rvm_ruby_src_path
207
+ __rvm_run "rbx.repo" "git clone --depth 1 $rvm_ruby_repo_url $rvm_ruby_src_path" "Cloning $rvm_ruby_repo_url"
207
208
  cd $rvm_ruby_home
208
209
  else
209
210
  cd $rvm_ruby_home
@@ -215,12 +216,15 @@ function __rvm_install_ruby {
215
216
  echo `rvm 1.8.6 -m rbx ; gem install --no-rdoc --no-ri rake ParseTree` # This should install if missing.
216
217
  rvm_ruby_interpreter="rbx"
217
218
  __rvm_select
219
+
218
220
  if [ ! -z "$rvm_jit_flag" ]; then
219
- __rvm_run "build" "\`rvm 1.8.6 -m rbx ; RBX_LLVM=1 rake build\`" "Building rbx with RBX_LLVM=1"
221
+ __rvm_run "configure" "./configure --prefix=$rvm_ruby_home --enable-llvm" "Configuring rbx with LLVM enabled"
220
222
  else
221
- __rvm_run "build" "\`rvm 1.8.6 -m rbx ; rake build\`" "Building rbx"
223
+ __rvm_run "configure" "./configure --prefix=$rvm_ruby_home" "Configuring rbx"
222
224
  fi
223
225
 
226
+ __rvm_run "build" "\`rvm 1.8.6 -m rbx ; rake build\`" "Building rbx"
227
+
224
228
  binaries="ruby irb" # Trick to work in more shells :)
225
229
  for binary_name in $(echo $binaries) ; do
226
230
  ln -fs $rvm_ruby_home/bin/rbx $rvm_ruby_home/bin/$binary_name
@@ -228,9 +232,9 @@ function __rvm_install_ruby {
228
232
 
229
233
  __rvm_run "rake.install" "$rvm_ruby_home/bin/rbx gem install rake --no-rdoc --no-ri" "Installing Rake"
230
234
  binary=rake
231
- if [ -f $rvm_gem_home/bin/$binary ] ; then
232
- if [ "$rvm_gem_home" != "$rvm_ruby_home" ] ; then
233
- cp $rvm_gem_home/bin/$binary $rvm_ruby_home/bin/$binary
235
+ if [ -f $rvm_ruby_gem_home/bin/$binary ] ; then
236
+ if [ "$rvm_ruby_gem_home" != "$rvm_ruby_home" ] ; then
237
+ cp $rvm_ruby_gem_home/bin/$binary $rvm_ruby_home/bin/$binary
234
238
  fi
235
239
  chmod +x $rvm_ruby_home/bin/$binary
236
240
  __rvm_inject_ruby_shebang "$rvm_ruby_home/bin/$binary"
@@ -246,10 +250,10 @@ function __rvm_install_ruby {
246
250
  ruby_wrapper=$(cat <<RubyWrapper
247
251
  #!/bin/bash
248
252
 
249
- GEM_HOME="$rvm_gem_home" ; export GEM_HOME
250
- GEM_PATH="$rvm_gem_home" ; export GEM_PATH
253
+ GEM_HOME="$rvm_ruby_gem_home" ; export GEM_HOME
254
+ GEM_PATH="$rvm_ruby_gem_home" ; export GEM_PATH
251
255
  MY_RUBY_HOME="$rvm_ruby_home" ; export MY_RUBY_HOME
252
- PATH="$rvm_ruby_home/bin:$rvm_gem_home/bin:\$PATH" ; export PATH
256
+ PATH="$rvm_ruby_home/bin:$rvm_ruby_gem_home/bin:\$PATH" ; export PATH
253
257
 
254
258
  exec $rvm_ruby_home/bin/rbx $prefix $binary_name "\$@"
255
259
  RubyWrapper
@@ -268,9 +272,9 @@ RubyWrapper
268
272
 
269
273
  jruby)
270
274
  mkdir -p $rvm_ruby_log_path
271
- __rvm_pushpop $rvm_source_path
275
+ __rvm_pushpop $rvm_src_path
272
276
 
273
- if [ ! -z "$rvm_ruby_rev" ] ; then
277
+ if [ ! -z "$rvm_ruby_revision" ] ; then
274
278
  if [ ! -d $rvm_path/$rvm_ruby_interpreter-$rvm_ruby_version -o ! -d $rvm_path/$rvm_ruby_interpreter-$rvm_ruby_version/.git ] ; then
275
279
  git clone --depth 1 $rvm_jruby_repo_url $rvm_ruby_src_path
276
280
  cd $rvm_ruby_src_path && ant # TODO: Test if 'ant' is installed, if not throw error.
@@ -285,9 +289,9 @@ RubyWrapper
285
289
  __rvm_log "info" "Downloading $rvm_package_file, this may take a while depending on your connection..."
286
290
  __rvm_fetch $rvm_url
287
291
  fi
288
- __rvm_run "extract" "tar zxf $rvm_archives_path/$rvm_package_file.tar.gz -C $rvm_source_path" "Extracting $rvm_package_file..."
292
+ __rvm_run "extract" "tar zxf $rvm_archives_path/$rvm_package_file.tar.gz -C $rvm_src_path" "Extracting $rvm_package_file..."
289
293
  if [ "$rvm_package_file" != "$rvm_ruby_string" ] ; then
290
- mv $rvm_source_path/$rvm_package_file $rvm_source_path/$rvm_ruby_string
294
+ mv $rvm_src_path/$rvm_package_file $rvm_src_path/$rvm_ruby_string
291
295
  fi
292
296
  cd $rvm_ruby_src_path
293
297
  fi
@@ -326,9 +330,8 @@ RubyWrapper
326
330
 
327
331
  ruby)
328
332
  if [ "`uname`" = "Darwin" ] ; then
329
- ARCHFLAGS="-arch x86_64 -arch i386" ; export ARCHFLAGS
330
333
  if [ "$(echo $rvm_ruby_version | awk '/1\.8/')" ] ; then
331
- rvm_ruby_configure="${rvm_ruby_configure:-"--enable-shared --disable-pthread"} "
334
+ rvm_ruby_configure="${rvm_ruby_configure:-"--enable-shared"} "
332
335
  else
333
336
  rvm_ruby_configure="${rvm_ruby_configure:-"--enable-shared"} "
334
337
  fi
@@ -387,7 +390,7 @@ function __rvm_manage_rubies {
387
390
  }
388
391
 
389
392
  function __rvm_uninstall_ruby {
390
- if [ -z "$rvm_selected" ] ; then __rvm_select $* ; fi
393
+ if [ -z "$rvm_selected_flag" ] ; then __rvm_select $* ; fi
391
394
 
392
395
  if [ ! -z "$rvm_ruby_package_name" ] ; then
393
396
  for dir in $rvm_path ; do
@@ -408,10 +411,10 @@ function __rvm_uninstall_ruby {
408
411
  }
409
412
 
410
413
  function __rvm_remove_ruby {
411
- if [ -z "$rvm_selected" ] ; then __rvm_select $* ; fi
414
+ if [ -z "$rvm_selected_flag" ] ; then __rvm_select $* ; fi
412
415
 
413
416
  if [ ! -z "$rvm_ruby_package_name" ] ; then
414
- for dir in $rvm_source_path $rvm_path ; do
417
+ for dir in $rvm_src_path $rvm_path ; do
415
418
  if [ -d $dir/$rvm_ruby_package_name ] ; then
416
419
  __rvm_log "info" "Removing $dir/$rvm_ruby_package_name..."
417
420
  rm -rf $dir/$rvm_ruby_package_name
@@ -434,8 +437,8 @@ function __rvm_post_install {
434
437
  if [ -e $rvm_ruby_home/bin/$binary -o -e $rvm_ruby_src_path/bin/$binary ] ; then
435
438
  if [ "$rvm_ruby_src_path" != "$rvm_ruby_home" -a -f $rvm_ruby_src_path/bin/$binary ] ; then
436
439
  cp -f $rvm_ruby_src_path/bin/$binary $rvm_ruby_home/bin/$binary
437
- elif [ -f "$rvm_gem_home/bin/$binary" ] ; then
438
- cp -f $rvm_gem_home/bin/$binary $rvm_ruby_home/bin/$binary
440
+ elif [ -f "$rvm_ruby_gem_home/bin/$binary" ] ; then
441
+ cp -f $rvm_ruby_gem_home/bin/$binary $rvm_ruby_home/bin/$binary
439
442
  fi
440
443
  __rvm_inject_gem_env $rvm_ruby_home/bin/$binary
441
444
  __rvm_inject_ruby_shebang $rvm_ruby_home/bin/$binary
@@ -452,9 +455,9 @@ function __rvm_post_install {
452
455
  __rvm_log "info" "Installation of gems for $rvm_ruby_package_name is complete."
453
456
 
454
457
  binary=rake
455
- if [ -x $rvm_gem_home/bin/$binary ] ; then
456
- if [ "$rvm_gem_home" != "$rvm_ruby_home" ] ; then
457
- cp $rvm_gem_home/bin/$binary $rvm_ruby_home/bin/$binary
458
+ if [ -x $rvm_ruby_gem_home/bin/$binary ] ; then
459
+ if [ "$rvm_ruby_gem_home" != "$rvm_ruby_home" ] ; then
460
+ cp $rvm_ruby_gem_home/bin/$binary $rvm_ruby_home/bin/$binary
458
461
  fi
459
462
  __rvm_inject_ruby_shebang "$rvm_ruby_home/bin/$binary"
460
463
  __rvm_inject_gem_env "$rvm_ruby_home/bin/$binary"
@@ -478,15 +481,15 @@ function __rvm_rubygems_setup {
478
481
  __rvm_log "info" "Installing rubygems dedicated to $rvm_ruby_package_name..."
479
482
  rvm_gem_package_name="rubygems-1.3.5"
480
483
  rvm_gem_url="http://rubyforge.org/frs/download.php/60718/$rvm_gem_package_name.tgz"
481
- if [ -d $rvm_source_path/$rvm_gem_package_name ] ; then
482
- cd $rvm_source_path/$rvm_gem_package_name
484
+ if [ -d $rvm_src_path/$rvm_gem_package_name ] ; then
485
+ cd $rvm_src_path/$rvm_gem_package_name
483
486
  else
484
487
  __rvm_log "info" "Retrieving $rvm_gem_package_name"
485
488
  __rvm_fetch $rvm_gem_url
486
- mkdir -p $rvm_source_path/$rvm_gem_package_name
487
- __rvm_run "rubygems.extract" "tar zxf $rvm_archives_path/$rvm_gem_package_name.tgz -C $rvm_source_path" "Extracting $rvm_gem_package_name"
489
+ mkdir -p $rvm_src_path/$rvm_gem_package_name
490
+ __rvm_run "rubygems.extract" "tar zxf $rvm_archives_path/$rvm_gem_package_name.tgz -C $rvm_src_path" "Extracting $rvm_gem_package_name"
488
491
  fi
489
- __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" "Installing rubygems for $rvm_ruby_home/bin/ruby"
492
+ __rvm_run "rubygems.install" "GEM_PATH=$rvm_gem_path GEM_HOME=$rvm_ruby_gem_home $rvm_ruby_home/bin/ruby $rvm_src_path/$rvm_gem_package_name/setup.rb" "Installing rubygems for $rvm_ruby_home/bin/ruby"
490
493
  result=$?
491
494
  if [ $result -eq 0 ] ; then
492
495
  __rvm_log "info" "Installation of rubygems $rvm_ruby_package_name completed successfully."
@@ -510,9 +513,9 @@ function __rvm_inject_gem_env {
510
513
  __rvm_actual_file $1
511
514
  if [ -f $actual_file ] ; then
512
515
  if [ ! -z "`head -n 1 $actual_file | awk '/[j]*ruby/'`" ] ; then
513
- 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']"
516
+ string="ENV['GEM_HOME']=ENV['GEM_HOME'] || '$rvm_ruby_gem_home'\nENV['GEM_PATH']=ENV['GEM_PATH'] || '$rvm_ruby_gem_home'\nENV['PATH']='$rvm_ruby_home/bin:$rvm_ruby_gem_home/bin:' + ENV['PATH']"
514
517
  elif [ ! -z "`head -n 1 $actual_file | awk '/bash/'`" ] ; then
515
- string="GEM_HOME=\${GEM_HOME:-'$rvm_gem_home'}\nGEM_PATH=\${GEM_PATH:-'$rvm_gem_home'}\nPATH=$rvm_ruby_home/bin:$rvm_gem_home/bin:\$PATH"
518
+ string="GEM_HOME=\${GEM_HOME:-'$rvm_ruby_gem_home'}\nGEM_PATH=\${GEM_PATH:-'$rvm_ruby_gem_home'}\nPATH=$rvm_ruby_home/bin:$rvm_ruby_gem_home/bin:\$PATH"
516
519
  fi
517
520
  if [ ! -z "$string" ] ; then
518
521
  awk "NR==2 {print \"$string\"} {print}" $actual_file > $actual_file.new