rvm 0.0.37 → 0.0.38

Sign up to get free protection for your applications and to get access to all the features.
data/config/db CHANGED
@@ -2,6 +2,7 @@ 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
4
  macruby_repo_url=http://svn.macosforge.org/repository/ruby/MacRuby
5
+ macruby_nightly_url=http://dl.getdropbox.com/u/163257
5
6
  jruby_repo_url=git://kenai.com/jruby~main
6
7
  ruby_configure=--enable-shared
7
8
  interpreter=ruby
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{rvm}
8
- s.version = "0.0.37"
8
+ s.version = "0.0.38"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Wayne E. Seguin"]
12
- s.date = %q{2009-09-09}
12
+ s.date = %q{2009-09-14}
13
13
  s.default_executable = %q{rvm-install}
14
14
  s.description = %q{Manages Ruby interpreter installations and switching between them.}
15
15
  s.email = %q{wayneeseguin@gmail.com}
@@ -33,6 +33,7 @@ Gem::Specification.new do |s|
33
33
  "scripts/rvm-prompt",
34
34
  "scripts/rvm-ruby-installer",
35
35
  "scripts/rvm-selector",
36
+ "scripts/rvm-update",
36
37
  "scripts/rvm-utility"
37
38
  ]
38
39
  s.homepage = %q{http://github.com/wayneeseguin/rvm}
@@ -14,5 +14,5 @@ source $rvm_path/scripts/rvm-selector
14
14
  source $rvm_path/scripts/rvm-ruby-installer # TODO: Script not function.
15
15
  source $rvm_path/scripts/rvm-cli
16
16
 
17
- if [ -f ~/.rvm/default ] ; then source ~/.rvm/default ; fi
17
+ if [ -f $rvm_path/default ] ; then source $rvm_path/default ; fi
18
18
 
@@ -4,17 +4,17 @@ function __rvm_parse-args {
4
4
  while [ $# -gt 0 ] ; do
5
5
  rvm_token="$1" ; shift
6
6
  case "$rvm_token" in
7
- install|uninstall|path|info|setup|version|srcdir|list|symlinks|reset|debug|reload|usage|help|implode|update)
7
+ install|uninstall|path|info|setup|version|srcdir|list|symlinks|reset|debug|reload|usage|help|implode|update|readline|iconv)
8
8
  rvm_action=$rvm_token
9
9
  ;;
10
10
 
11
11
  use)
12
12
  rvm_action=$rvm_token
13
- if [ "$1" = "default" ] ; then
14
- rvm_ruby_interpreter="system" ; shift
15
- elif [ -z "$1" ] ; then
16
- rvm_ruby_interpreter="system"
17
- fi
13
+ ;;
14
+
15
+ system|default)
16
+ rvm_action=${rvm_action:-use}
17
+ rvm_ruby_interpreter="$rvm_token"
18
18
  ;;
19
19
 
20
20
  ruby|jruby|ree|macruby|rbx|rubinius|default|all)
@@ -54,16 +54,20 @@ function __rvm_parse-args {
54
54
  rvm_action=$rvm_token
55
55
  if [ "$rvm_action" = "do" ] ; then rvm_action="do" ; fi
56
56
  temp=$(echo $1 | awk '{print substr($1, 0, 1)}')
57
- if [ "$temp" != "-" ] ; then
57
+ if [ "$temp" = "-" ] ; then
58
+ unset rvm_ruby_version
59
+ else
58
60
  if [ ! -z "$(echo $temp | grep '[0-9]')" ] ; then
59
61
  rvm_ruby_version=$(echo "$1" | tr ',' ' ') ; shift
62
+ unset rvm_ruby_interpreter
60
63
  else
61
- rvm_ruby_version=$1 ; shift
64
+ if [ "$1" = "jruby" -o "$1" = "rbx" -o "$1" = "rubinius" -o "$1" = "macruby" ] ; then
65
+ rvm_ruby_interpreter=$1 ; shift
66
+ else
67
+ unset rvm_ruby_interpreter rvm_ruby_version
68
+ fi
62
69
  fi
63
- else
64
- unset rvm_ruby_version
65
70
  fi
66
- unset rvm_ruby_interpreter
67
71
  ;;
68
72
 
69
73
  1.8|1.8.0|1.8.1|1.8.2|1.8.3|1.8.4|1.8.5|1.8.6|1.8.7|1.9|1.9.1|1.9.2)
@@ -83,25 +87,39 @@ function __rvm_parse-args {
83
87
  rvm_action="version"
84
88
  else
85
89
  rvm_ruby_version="$1"
90
+ shift
86
91
  fi
87
- shift
88
92
  ;;
89
93
 
90
94
  -t|--tag) rvm_ruby_tag="$1";
91
95
  rvm_action="${rvm_action:-use}"
92
96
  shift ;;
93
- -r|--rev) rvm_ruby_rev="$1";
97
+ --head)
98
+ rvm_ruby_rev="head"
99
+ rvm_action="${rvm_action:-use}"
100
+ ;;
101
+ --rev|--revision) rvm_ruby_rev="$1";
94
102
  rvm_action="${rvm_action:-use}"
95
103
  shift ;;
96
- -b|--branch) rvm_ruby_rev="$1";
104
+ -b|--branch) rvm_ruby_branch="$1";
97
105
  rvm_action="${rvm_action:-use}"
98
106
  shift ;;
99
107
 
100
108
 
101
109
  -P|--prefix) rvm_prefix_path="$1" ; shift ;;
102
- -B|--bin) rvm_bin_path="$1" ; shift ;;
103
- -S|--source) rvm_source_path="$1" ; shift ;;
104
- -A|--archive) rvm_archives_path="$1" ; shift ;;
110
+
111
+ --rubygems) rvm_rubygems_flag=1 ;;
112
+ --rvm|--gem) rvm_update_flag=1 ;;
113
+ --bin)
114
+ if [ "$rvm_action" = "update" ] ; then
115
+ rvm_bin_flag=1
116
+ else
117
+ rvm_bin_path="$1" ; shift
118
+ fi
119
+ ;;
120
+
121
+ --source) rvm_source_path="$1" ; shift ;;
122
+ --archive) rvm_archives_path="$1" ; shift ;;
105
123
  -G|--gems) rvm_gem_path="$1" ; shift ;;
106
124
  -C|--configure)
107
125
  if [ ! -z "$1" ] ; then
@@ -110,54 +128,115 @@ function __rvm_parse-args {
110
128
  else
111
129
  rvm_action="error"
112
130
  rvm_error_message="--configure *must* be followed by configure flags."
113
- break;
114
131
  fi
115
132
  ;;
116
133
 
117
134
  --re-configure) rvm_re_configure=1 ;;
118
- -M|--make) rvm_ruby_make="$1" ; shift ;;
119
- -I|--make-install) rvm_ruby_make_install="$1"; shift ;;
135
+ --make) rvm_ruby_make="$1" ; shift ;;
136
+ --make-install) rvm_ruby_make_install="$1"; shift ;;
137
+ -j)
138
+ if [ ! -z "$1" ] ; then
139
+ rvm_make_flags="$rvm_make_flags -j$1"
140
+ shift
141
+ else
142
+ rvm_action="error"
143
+ rvm_error_message="-j *must* be followed by an integer (normally the # of CPU's in your machine)."
144
+ fi
145
+ ;;
146
+ --nice) rvm_niceness="$1" ; shift ;;
120
147
  -l|--level) rvm_ruby_patch_level="$1" ; shift ;;
121
- -n|--nice) rvm_niceness="$1" ; shift ;;
122
- -f|--file) rvm_ruby_args="$1" ; shift ;;
123
- -e|--execute)
148
+ --summary) rvm_summary=1 ;;
149
+ -r|--require)
150
+ if [ -z "$1" ] ; then
151
+ rvm_action="error"
152
+ rvm_error_message="-r|--require *must* be followed by a library name."
153
+ else
154
+ rvm_ruby_require="$rvm_ruby_require -r$1"
155
+ shift
156
+ fi
157
+ ;;
158
+ -I|--include)
159
+ if [ -z "$1" ] ; then
160
+ rvm_action="error"
161
+ rvm_error_message="-I|--include *must* be followed by a path."
162
+ else
163
+ rvm_ruby_load_path="$rvm_ruby_load_path:$1"
164
+ shift
165
+ fi
166
+ ;;
167
+ -f|--file)
168
+ rvm_action="rubydo"
169
+ rvm_ruby_args="$1"
170
+ shift
171
+ ;;
172
+ -S|--script|-e|--execute)
173
+ rvm_action="rubydo"
124
174
  rvm_ruby_args="$@"
125
175
  rvm_parse_break=1
126
176
  ;;
127
177
 
128
178
  -h|--help) rvm_action=help ; shift ;;
129
179
  -d|--default) rvm_set_default=1 ;;
130
- --head) rvm_ruby_rev="head" ;;
131
180
  --trace|--debug) rvm_debug=1 ;;
132
181
  --force) rvm_force=1 ;;
133
- --all) rvm_all=1 ; shift ;;
182
+ --all) rvm_all=1 ;;
134
183
  -m|--gem-set) rvm_gem_set_name="$1" ; shift ;;
135
184
  --rm-gem-set) rvm_gem_set_name_rm="$1" ; shift ;;
136
- --dump) rvm_dump=1 ; shift ;;
185
+ --dump) rvm_dump=1 ;;
137
186
  --load)
138
- rvm_load=1
139
- if [ ! -z "$1" ] ; then
140
- rvm_load_file="$1"
141
- shift
142
- else
143
- rvm_action="error"
144
- rvm_error_message="--load must be followed by the .gemset file to load."
145
- break;
146
- fi
147
- shift
148
- ;;
149
-
150
- --latest) rvm_latest=1 ; shift ;;
187
+ rvm_load=1
188
+ if [ ! -z "$1" ] ; then
189
+ rvm_load_file="$1"
190
+ shift
191
+ else
192
+ rvm_action="error"
193
+ rvm_error_message="--load must be followed by the .gemset file to load."
194
+ break;
195
+ fi
196
+ shift
197
+ ;;
198
+
151
199
  --jit) rvm_rubinius_jit="RBX_LLVM=1" ;;
200
+ --latest) rvm_latest=1 ;;
201
+ --tests|--specs) rvm_action="tests" ;;
152
202
 
153
203
  default|system)
154
204
  rvm_action="use"
155
205
  rvm_ruby_interpreter="system"
156
206
  ;;
207
+
208
+ reboot|flush|asdf|damnit|wtf|argh|work|workdamnit|BOOM|boom|wth)
209
+ $rvm_action="reboot"
210
+ ;;
211
+
157
212
  *)
158
- rvm_action="error"
159
- rvm_error_message="Unrecognized command line argument(s): '$rvm_token $@'"
160
- break;
213
+ if [ ! -z "$rvm_token" ] ; then
214
+ echo "$rvm_token" | grep ',' > /dev/null
215
+ if [ $? -eq 0 ] ; then
216
+ rvm_ruby_version="$rvm_token"
217
+ if [ -z "$rvm_action" ] ; then
218
+ rvm_action="rubydo" # Not sure if we really want to do this but we'll try it out.
219
+ fi
220
+ else
221
+ echo $rvm_token | grep '\.rb$' > /dev/null
222
+ if [ $? -eq 0 ] ; then # we have a specified ruby script
223
+ rvm_ruby_args=$rvm_token
224
+ if [ -z "$rvm_action" ] ; then
225
+ rvm_action="rubydo" # Not sure if we really want to do this but we'll try it out.
226
+ fi
227
+ else
228
+ rvm_action="error"
229
+ rvm_error_message="Unrecognized command line argument: '$rvm_token'"
230
+ fi
231
+ fi
232
+ else
233
+ rvm_action="error"
234
+ rvm_error_message="Unrecognized command line argument(s): '$rvm_token $@'"
235
+ fi
236
+ if [ "$rvm_action" = "error" ] ; then
237
+ break;
238
+ fi
239
+
161
240
  esac
162
241
  if [ ! -z "$rvm_parse_break" -o ! -z "$rvm_error_message" ] ; then unset rvm_parse_break; break; fi
163
242
  done
@@ -175,70 +254,39 @@ function rvm {
175
254
  __rvm_load-defaults
176
255
  __rvm_parse-args $@
177
256
 
257
+ status=0
178
258
  case "$rvm_action" in
179
- install) __rvm_install-ruby ;;
180
- uninstall) __rvm_uninstall ;;
181
- use) __rvm_use ;;
182
- gemdir) __rvm_gem-dir ;;
183
- srcdir) __rvm_src-dir ;;
184
- gemdup) __rvm_gem-dup ;;
185
- list) __rvm_list ;;
186
- symlinks) __rvm_symlinks ;;
187
- version) __rvm_version ;;
188
- rubydo|rakedo|gemdo)
189
- if [ ! -z "$rvm_ruby_version" ] ; then
190
- rvm_ruby_versions=$(echo $rvm_ruby_version | tr ',' ' ')
191
- for rvm_ruby_version in $rvm_ruby_versions ; do
192
- temp=$(echo $rvm_ruby_version | awk '{print substr($1, 0, 1)}')
193
- if [ ! -z "$(echo $temp | grep '[0-9]')" ] ; then
194
- rvm_ruby_interpreter="ruby"
195
- else
196
- rvm_ruby_interpreter="$rvm_ruby_version"
197
- unset rvm_ruby_version
198
- fi
199
- unset temp
200
- __rvm_select $rvm_ruby_interpreter $rvm_ruby_version
201
- binary=`echo $rvm_action | sed 's/do$//'`
202
- rvm_command="$rvm_ruby_home/bin/$binary $rvm_ruby_args"
203
- echo "$(basename $rvm_ruby_home/bin/$binary):"
204
- eval $rvm_command
205
- unset rvm_ruby_interpreter rvm_ruby_patch_level rvm_ruby_version rvm_ruby_package_name rvm_ruby_home rvm_ruby_irbrc rvm_ruby_binary
206
- done
207
- else # all
208
- rvm_ruby_versions=`/bin/ls $rvm_bin_path/ruby-*`
209
- for rvm_ruby_binary in $rvm_ruby_versions ; do
210
- if [ -x $rvm_ruby_binary ] ; then
211
- rvm_command="$rvm_ruby_binary $rvm_ruby_args"
212
- echo "$(basename $rvm_ruby_binary):"
213
- eval $rvm_command
214
- fi
215
- done
216
- fi
217
- ;;
218
- reset) __rvm_reset ;;
219
- # TODO: how can we use bin_path here for reload, default file?
220
- reload) source ~/.rvm/scripts/rvm ;;
221
- implode) __rvm_implode ;;
222
- update)
223
- if [ "$rvm_ruby_rev" = "head" ] ; then
224
- if [ -d $rvm_source_path/rvm/.git ] ; then
225
- cd $rvm_source_path/rvm/ && git pull origin master && ./scripts/rvm-install
226
- else
227
- cd $rvm_source_path && git clone git://github.com/wayneeseguin/rvm.git && cd rvm/ && ./scripts/rvm-install
228
- fi
229
- else
230
- # TODO: rvm_install_path:
231
- gem install rvm --no-rdoc --no-ri -q && rvm-install && source ~/.rvm/scripts/rvm
232
- fi
259
+ install) __rvm_install-ruby ;status=$? ;;
260
+ uninstall) __rvm_uninstall ;status=$? ;;
261
+ use) __rvm_use ;status=$? ;;
262
+ gemdir) __rvm_gem-dir ;status=$? ;;
263
+ srcdir) __rvm_src-dir ;status=$? ;;
264
+ gemdup) __rvm_gem-dup ;status=$? ;;
265
+ list) __rvm_list ;status=$? ;;
266
+ symlinks) __rvm_symlinks ;status=$? ;;
267
+ version) __rvm_version ;status=$? ;;
268
+ tests|specs)
269
+ rvm_do_summary=1
270
+ rvm_action="rake"
271
+ __rvm_do
233
272
  ;;
234
- error) __rvm_log "fail" "$rvm_error_message ( see: rvm usage )" ; popd 2> /dev/null ; return 1; ;;
273
+ rubydo|rakedo|gemdo) __rvm_do ; status=$? ;;
274
+ reset) __rvm_reset ;;
275
+ # TODO: how can we use bin_path here for reload, default file?
276
+ reload) __rvm_reload ;;
277
+ implode) __rvm_implode ;;
278
+ update) __rvm_update ;;
279
+ readline) __rvm_readline_install ;;
280
+ iconv) __rvm_iconv_install ;;
281
+ reboot) __rvm_reboot ;;
282
+ usage|help) __rvm_usage ;;
235
283
  info|debug)
236
284
  __rvm_version
237
285
  __rvm_info
238
286
  if [ "$rvm_action" = "debug" ] ; then __rvm_debug ; fi
239
287
  return 0
240
288
  ;;
241
- usage|help) __rvm_usage ;;
289
+ error) __rvm_log "fail" "$rvm_error_message ( see: 'rvm usage' )" ; popd 2> /dev/null ; return 1; ;;
242
290
  *)
243
291
  if [ ! -z "$rvm_action" ] ; then
244
292
  __rvm_log "fail" "unknown action '$rvm_action'"
@@ -249,4 +297,6 @@ function rvm {
249
297
  esac
250
298
 
251
299
  if [ "$rvm_debug" = "1" ] ; then set +x ; unset rvm_debug ; fi
300
+ return $status
252
301
  }
302
+
@@ -2,10 +2,9 @@
2
2
  # Thanks for the awesome idea batasrki
3
3
  function gemdir {
4
4
  if [ -z "$1" ] ; then
5
- echo "gemdir expects a parameter, which should be a valid rvm Ruby selector"
5
+ cd `gem env gemdir`
6
6
  else
7
- rvm use $1
8
- cd `rvm gemdir`
7
+ cd `rvm $1 ; rvm gemdir`
9
8
  pwd
10
9
  fi
11
10
  }
@@ -93,7 +93,12 @@ for file in ~/.bash_profile ~/.bashrc ~/.zshrc ; do
93
93
  else
94
94
  actual_file="$file"
95
95
  fi
96
- sed -i.orig 's/rvm\/bin\/rvm/rvm\/scripts\/rvm/g' $actual_file
96
+
97
+ grep 'rvm\/bin\/rvm' $actual_file > /dev/null
98
+ if [ $? -eq 0 ] ; then
99
+ sed -i.orig 's/rvm\/bin\/rvm/rvm\/scripts\/rvm/g' $actual_file
100
+ rm -f $actual_file.orig
101
+ fi
97
102
 
98
103
  if [ -f ~/.profile ] ; then
99
104
  grep '.profile' $actual_file > /dev/null
@@ -117,6 +122,8 @@ for dir in config scripts examples ; do
117
122
  cp $source_dir/$dir/$file $rvm_dir/$dir/$file
118
123
  done
119
124
  done
125
+ cp $source_dir/scripts/rvm-prompt $rvm_dir/bin/
126
+ cp $source_dir/VERSION.yml $rvm_dir/
120
127
 
121
128
  system=`uname`
122
129
  if [ "$system" = "Linux" ] ; then
@@ -4,6 +4,7 @@ function __rvm_install-source {
4
4
 
5
5
  if [ -z "$rvm_selected" ] ; then __rvm_select $* ; fi
6
6
 
7
+ status=0
7
8
  __rvm_log "info" "Installing Ruby from source to: $rvm_ruby_home"
8
9
  mkdir -p $rvm_ruby_log_path
9
10
 
@@ -19,9 +20,11 @@ function __rvm_install-source {
19
20
  rvm_url="${rvm_url:-"ftp://ftp.ruby-lang.org/pub/ruby/1.$rvm_major_version/$rvm_ruby_package_name.tar.gz"}"
20
21
  __rvm_log "info" "\tDownloading $rvm_ruby_package_name, this may take a while depending on your connection..."
21
22
  __rvm_fetch $rvm_url
23
+ if [ $status -eq 0 ] ; then status=$? ; fi
22
24
  __rvm_log "info" "\tExtracting $rvm_ruby_package_name ..."
23
25
  mkdir -p $rvm_ruby_src_path # Is this line necessary considering -C below? v
24
26
  __rvm_run "extract" tar xzf $rvm_archives_path/$rvm_ruby_package_name.tar.gz -C $rvm_source_path
27
+ if [ $status -eq 0 ] ; then status=$? ; fi
25
28
  fi
26
29
  else
27
30
  __rvm_log "info" "\tRetrieving Ruby from $rvm_url"
@@ -30,11 +33,14 @@ function __rvm_install-source {
30
33
  cd $rvm_ruby_src_path
31
34
  if [ -z "$rvm_ruby_rev" ] ; then
32
35
  git pull origin master
36
+ if [ $status -eq 0 ] ; then status=$? ; fi
33
37
  else
34
38
  git checkout ${rvm_ruby_rev:-HEAD}
39
+ if [ $status -eq 0 ] ; then status=$? ; fi
35
40
  fi
36
41
  else
37
42
  git clone --depth 1 $rvm_ruby_repo_url $rvm_ruby_src_path
43
+ if [ $status -eq 0 ] ; then status=$? ; fi
38
44
  fi
39
45
  else
40
46
  if [ -z "$rvm_ruby_rev" ] ; then
@@ -43,7 +49,7 @@ function __rvm_install-source {
43
49
  rvm_rev=""
44
50
  else
45
51
  if [ "$rvm_ruby_rev" = "head" -o "$rvm_ruby_rev" = "trunk" ] ; then
46
- rvm_url=$rvm_ruby_repo_url/branches/ruby_1_${rvm_major_version}_${rvm_minor_version}
52
+ rvm_url="$rvm_ruby_repo_url/trunk"
47
53
  rvm_rev=""
48
54
  else
49
55
  rvm_url=$rvm_ruby_repo_url/branches/ruby_1_${rvm_major_version}_${rvm_minor_version}
@@ -53,39 +59,47 @@ function __rvm_install-source {
53
59
 
54
60
  if [ -d "$rvm_ruby_src_path/.svn" ] ; then
55
61
  cd $rvm_ruby_src_path
56
- svn checkout -q $rvm_rev
62
+ if [ -z "$rvm_rev" ] ; then
63
+ svn update
64
+ else
65
+ svn checkout -q $rvm_rev
66
+ fi
57
67
  else
58
68
  svn checkout -q $rvm_rev --force $rvm_url $rvm_ruby_src_path
59
69
  fi
70
+ if [ $status -eq 0 ] ; then status=$? ; fi
60
71
  fi
61
72
  fi
62
73
 
63
74
  cd $rvm_ruby_src_path
64
- if [ $? -gt 0 ] ; then __rvm_log "error" "There was an error, please check $rvm_ruby_log_path/*.error.log" ; popd 2> /dev/null ; return 1 ; fi
75
+ 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
65
76
 
66
77
  if [ ! -s "$rvm_ruby_src_path/configure" -a "$rvm_ruby_interpreter" = "ruby" ] ; then
67
78
  rvm_autoconf=`which autoconf`
68
79
  if [ $? -ne 0 ] ; then __rvm_log "fail" "rvm expects autoconf" ; fi
69
80
  __rvm_run "autoconf" $rvm_autoconf
81
+ if [ $status -eq 0 ] ; then status=$? ; fi
70
82
  fi
71
83
 
72
- if [ $? -gt 0 ] ; then __rvm_log "error" "There was an error, please check $rvm_ruby_log_path/*.error.log" ; popd 2> /dev/null ; return 1 ; fi
84
+ 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
73
85
 
74
86
  if [ -s ./Makefile -a -z "$rvm_re_configure" ] ; then
75
87
  __rvm_log "warn" "\tSkipping configure step, Makefile exists so configure must have already been run."
76
88
  elif [ -s ./configure ] ; then
77
89
  __rvm_log "info" "\tConfiguring $rvm_ruby_package_name using $rvm_ruby_configure, this may take a while depending on your cpu(s)..."
78
90
  __rvm_run "configure" ./configure --prefix=$rvm_ruby_home $rvm_ruby_configure
91
+ if [ $status -eq 0 ] ; then status=$? ; fi
79
92
  else
80
93
  __rvm_log "warn" "\tSkipping configure step, 'configure' script does not exist, did autoconf not run successfully?"
81
94
  fi
82
95
 
83
96
  __rvm_log "info" "\tCompiling $rvm_ruby_package_name, this may take a while, depending on your cpu(s)..."
84
97
  if [ -z "$rvm_ruby_make" ] ; then
85
- __rvm_run "make" make
98
+ __rvm_run "make" make $rvm_make_flags
86
99
  else
87
100
  __rvm_run "make" $rvm_ruby_make
88
101
  fi
102
+ if [ $status -eq 0 ] ; then status=$? ; fi
89
103
 
90
104
  if [ -z "$rvm_ruby_make" ] ; then
91
105
  __rvm_log "info" "\tInstalling $rvm_ruby_package_name"
@@ -93,59 +107,27 @@ function __rvm_install-source {
93
107
  else
94
108
  __rvm_run "install" $rvm_ruby_make_install
95
109
  fi
110
+ if [ $status -eq 0 ] ; then status=$? ; fi
96
111
  __rvm_run "chmod.bin" chmod +x $rvm_ruby_home/bin/*
97
112
 
98
- __rvm_bin_scripts
113
+ __rvm_bin_script
99
114
  __rvm_log "info" "Installation of $rvm_ruby_package_name is complete."
100
115
 
101
-
102
- __rvm_log "info" "\tInstalling rubygems dedicated to $rvm_ruby_package_name..."
103
116
  GEM_HOME="$rvm_gem_home" ; export GEM_HOME
104
- rvm_gem_package_name="rubygems-1.3.5"
105
- rvm_gem_url="http://rubyforge.org/frs/download.php/60718/$rvm_gem_package_name.tgz"
106
- if [ -d $rvm_source_path/$rvm_gem_package_name ] ; then
107
- cd $rvm_source_path/$rvm_gem_package_name
108
- else
109
- __rvm_fetch $rvm_gem_url
110
- mkdir -p $rvm_source_path/$rvm_gem_package_name
111
- __rvm_run "rubygems.extract" tar zxf $rvm_archives_path/$rvm_gem_package_name.tgz -C $rvm_source_path
112
- fi
113
- # Well this is fun... fix nil error on require_paths:
114
- 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
115
-
116
- __rvm_run "rubygems.install" $rvm_ruby_binary $rvm_source_path/$rvm_gem_package_name/setup.rb
117
- popd 2> /dev/null
118
-
119
- for binary in gem irb erb ri rdoc testrb rake ; do
120
- if [ -x $rvm_ruby_src_path/bin/$binary ] ; then
121
- cp $rvm_ruby_src_path/bin/$binary $rvm_ruby_home/bin/$binary
122
- string="ENV['GEM_HOME']=ENV['GEM_HOME'] || '$rvm_gem_home'\nENV['PATH']='$rvm_ruby_home/bin:$rvm_gem_home/bin:' + ENV['PATH']"
123
- awk "NR==2 {print \"$string\"} {print}" $rvm_ruby_home/bin/$binary > $rvm_ruby_home/bin/$binary.new
124
- mv $rvm_ruby_home/bin/$binary.new $rvm_ruby_home/bin/$binary
125
- chmod +x $rvm_ruby_home/bin/$binary
126
- else
127
- __rvm_log "warn" "$rvm_ruby_src_path/bin/$binary is missing"
128
- fi
129
- done
130
-
131
- for rvm_gem_name in rake ; do
132
- __rvm_log "info" "Installing $rvm_gem_name"
133
- __rvm_run "gems" $rvm_ruby_home/bin/gem install $rvm_gem_name --no-rdoc --no-ri -q
134
- done
135
-
136
- __rvm_log "info" "Installation of rubygems for $rvm_ruby_package_name is complete."
117
+ GEM_PATH="$rvm_gem_home" ; export GEM_PATH
137
118
 
138
- binary=rake
139
- if [ -x $rvm_gem_home/bin/$binary ] ; then
140
- cp $rvm_gem_home/bin/$binary $rvm_ruby_home/bin/$binary
141
- string="ENV['GEM_HOME']=ENV['GEM_HOME'] || '$rvm_gem_home'\nENV['PATH']='$rvm_ruby_home/bin:$rvm_gem_home/bin:' + ENV['PATH']"
142
- awk "NR==2 {print \"$string\"} {print}" $rvm_ruby_home/bin/$binary > $rvm_ruby_home/bin/$binary.new
143
- mv $rvm_ruby_home/bin/$binary.new $rvm_ruby_home/bin/$binary
144
- chmod +x $rvm_ruby_home/bin/$binary
119
+ echo $rvm_ruby_vesion | grep '^1\.9' > /dev/null
120
+ if [ $? -gt 0 ] ; then
121
+ __rvm_rubygems_install
122
+ if [ $status -eq 0 ] ; then status=$? ; fi
145
123
  else
146
- __rvm_log "warn" "$rvm_gem_home/bin/$binary is missing"
124
+ mv $rvm_ruby_src_path/bin/gem $rvm_ruby_src_path/bin/gem.orig
125
+ cat $rvm_ruby_src_path/bin/gem.orig | sed -e "s=!# */usr/bin/env ruby=!#/usr/bin/$rvm_ruby_home/bin/ruby=" > $rvm_ruby_src_path/bin/gem
126
+ chmod +x $rvm_ruby_home/bin/gem
147
127
  fi
148
- unset binary
128
+ popd > /dev/null
129
+
130
+ __rvm_post_install
149
131
  }
150
132
 
151
133
  function __rvm_install-ruby {
@@ -158,6 +140,8 @@ function __rvm_install-ruby {
158
140
  macruby)
159
141
  if [ "`uname`" = "Darwin" ] ; then
160
142
  rvm_ruby_repo_url=$rvm_macruby_repo_url
143
+ #/macruby_nightly-2009-09-10.pkg
144
+ rvm_macruby_nightly_url=`__rvm_db "macruby_nightly_url"`
161
145
  rvm_ruby_configure=""
162
146
  rvm_ruby_make="rake macruby:build framework_instdir=$rvm_path/macruby-head framework_name=/macruby-head --trace"
163
147
  rvm_ruby_make_install="rake framework:install framework_instdir=$rvm_path/macruby-head framework_name=/macruby-head --trace"
@@ -187,6 +171,7 @@ function __rvm_install-ruby {
187
171
  ;;
188
172
 
189
173
  ruby-enterprise|ree)
174
+ __rvm_select
190
175
  rvm_url="http://rubyforge.org/frs/download.php/58677/$rvm_ruby_package_name.tar.gz"
191
176
  __rvm_log "info" "Installing Ruby Enterprise Edition from source to: $rvm_ruby_home"
192
177
  pushd $rvm_source_path > /dev/null
@@ -195,7 +180,7 @@ function __rvm_install-ruby {
195
180
  else
196
181
  __rvm_log "info" "\tDownloading $rvm_ruby_package_name, this may take a while depending on your connection..."
197
182
  __rvm_fetch $rvm_url
198
- if [ $? -gt 0 ] ; then __rvm_log "error" "There was an error, please check $rvm_ruby_log_path/*.error.log" ; popd 2> /dev/null ; return 1 ; fi
183
+ 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
199
184
  __rvm_log "info" "\tExtracting $rvm_ruby_package_name..."
200
185
  mkdir -p $rvm_ruby_src_path
201
186
  __rvm_run "extract" tar xzf $rvm_archives_path/$rvm_ruby_package_name.tar.gz -C $rvm_source_path
@@ -205,10 +190,11 @@ function __rvm_install-ruby {
205
190
  mkdir -p $rvm_ruby_log_path
206
191
 
207
192
  cd $rvm_ruby_src_path
208
- __rvm_run "install" ./installer -a $rvm_path/ruby-enterprise-$rvm_ruby_version-$rvm_ruby_patch_level --dont-install-useful-gems --no-tcmalloc
193
+ if [ ! -z "$rvm_ruby_configure" ] ; then rvm_ruby_configure="-c $rvm_ruby_configure"; fi
194
+ __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
209
195
  chmod +x $rvm_ruby_home/bin/*
210
196
 
211
- ln -fs $rvm_ruby_home/bin/ruby $rvm_path/bin/$rvm_ruby_package_name
197
+ __rvm_bin_script
212
198
 
213
199
  __rvm_log "info" "\tInstalling rubygems dedicated to $rvm_ruby_package_name..."
214
200
  rvm_gem_package_name="rubygems-1.3.5"
@@ -222,10 +208,11 @@ function __rvm_install-ruby {
222
208
  fi
223
209
  # Well this is fun... fix nil error on require_paths:
224
210
  sed -i.orig "s/require_paths\.join/require_paths.to_a.join/" $rvm_source_path/$rvm_gem_package_name/lib/rubygems/gem_path_searcher.rb > $rvm_ruby_log_path/rubygems.install.log 2> $rvm_ruby_log_path/rubygems.install.error.log
211
+ rm -f $rvm_source_path/$rvm_gem_package_name/lib/rubygems/gem_path_searcher.rb.orig
225
212
 
226
213
  __rvm_run "rubygems.install" $rvm_ruby_home/bin/ruby $rvm_source_path/$rvm_gem_package_name/setup.rb
227
214
  __rvm_log "info" "Installation of $rvm_ruby_package_name complete."
228
- popd 2> /dev/null
215
+ popd > /dev/null
229
216
 
230
217
  for rvm_gem_name in rake ; do
231
218
  __rvm_log "info" "Installing $rvm_gem_name"
@@ -235,15 +222,19 @@ function __rvm_install-ruby {
235
222
 
236
223
  rbx|rubinius)
237
224
  # TODO: check if system is 1.8.X otherwise use rvm's 1.8.X and check for parsetree, install if missing
238
- unset GEM_HOME MY_RUBY_HOME IRBRC
239
- PATH="$rvm_default_path" ; export PATH
225
+ unset GEM_HOME GEM_PATH MY_RUBY_HOME IRBRC
226
+ PATH="$rvm_system_path" ; export PATH
240
227
  rvm_ruby_repo_url=$rvm_rubinius_repo_url
241
228
  rvm_ruby_configure=""
229
+ rvm_ruby_src_path=$rvm_ruby_home
242
230
  rvm_ruby_make="rake"
243
231
  rvm_ruby_make_install="rake install"
244
232
  rvm_ruby_home="$rvm_path/$rvm_ruby_interpreter-$rvm_ruby_version"
245
233
  #rvm_ruby_rev="head"
246
234
  # TODO: Check if already git repo, then git pull origin master && build
235
+
236
+ __rvm_bin_script
237
+
247
238
  if [ ! -d $rvm_ruby_home -o ! -d $rvm_ruby_home/.git ] ; then
248
239
  rm -rf $rvm_ruby_home
249
240
  git clone --depth 1 $rvm_ruby_repo_url $rvm_ruby_home
@@ -289,8 +280,8 @@ function __rvm_install-ruby {
289
280
  __rvm_log "info" "\tInstalling $rvm_ruby_package_name..."
290
281
  mkdir -p $rvm_ruby_home/bin/
291
282
  __rvm_run "sync" rsync -ag $rvm_ruby_src_path/ $rvm_ruby_home/
292
- __rvm_run "nailgun" cd $rvm_ruby_src_path/tool/nailgun && make
293
- popd 2> /dev/null
283
+ __rvm_run "nailgun" cd $rvm_ruby_src_path/tool/nailgun && make $rvm_make_flags
284
+ popd > /dev/null
294
285
  chmod +x $rvm_ruby_home/bin/*
295
286
  for binary in jruby jgem jirb ; do
296
287
  ln -fs $rvm_ruby_home/bin/$binary $rvm_ruby_home/bin/${binary#j}
@@ -344,3 +335,67 @@ function __rvm_uninstall {
344
335
  fi
345
336
 
346
337
  }
338
+
339
+ function __rvm_post_install {
340
+
341
+ for binary in gem irb erb ri rdoc testrb rake ; do
342
+ if [ -x $rvm_ruby_src_path/bin/$binary ] ; then
343
+ if [ "$rvm_ruby_src_path" != "$rvm_ruby_home" ] ; then
344
+ cp $rvm_ruby_src_path/bin/$binary $rvm_ruby_home/bin/$binary
345
+ fi
346
+ 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']"
347
+ awk "NR==2 {print \"$string\"} {print}" $rvm_ruby_home/bin/$binary > $rvm_ruby_home/bin/$binary.new
348
+ mv $rvm_ruby_home/bin/$binary.new $rvm_ruby_home/bin/$binary
349
+ chmod +x $rvm_ruby_home/bin/$binary
350
+ else
351
+ __rvm_log "warn" "$rvm_ruby_src_path/bin/$binary is missing"
352
+ fi
353
+ done
354
+
355
+ __rvm_log "info" "Installing gems for $rvm_ruby_package_name."
356
+
357
+ for rvm_gem_name in rake ; do
358
+ __rvm_log "info" "Installing $rvm_gem_name"
359
+ __rvm_run "gems" $rvm_ruby_home/bin/gem install $rvm_gem_name --no-rdoc --no-ri -q
360
+ done
361
+
362
+ __rvm_log "info" "Installation of gems for $rvm_ruby_package_name is complete."
363
+
364
+ binary=rake
365
+ if [ -x $rvm_ruby_src_path/bin/$binary ] ; then
366
+ if [ "$rvm_ruby_src_path" != "$rvm_ruby_home" ] ; then
367
+ cp $rvm_ruby_src_path/bin/$binary $rvm_ruby_home/bin/$binary
368
+ fi
369
+ # TODO: Account for rubygem installed rake vs system rake
370
+ 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']"
371
+ awk "NR==2 {print \"$string\"} {print}" $rvm_ruby_home/bin/$binary > $rvm_ruby_home/bin/$binary.new
372
+ mv $rvm_ruby_home/bin/$binary.new $rvm_ruby_home/bin/$binary
373
+ chmod +x $rvm_ruby_home/bin/$binary
374
+ else
375
+ __rvm_log "warn" "$rvm_gem_home/bin/$binary is missing"
376
+ fi
377
+ unset binary
378
+ }
379
+
380
+ function __rvm_rubygems_install {
381
+ __rvm_log "info" "\tInstalling rubygems dedicated to $rvm_ruby_package_name..."
382
+ rvm_gem_package_name="rubygems-1.3.5"
383
+ rvm_gem_url="http://rubyforge.org/frs/download.php/60718/$rvm_gem_package_name.tgz"
384
+ if [ -d $rvm_source_path/$rvm_gem_package_name ] ; then
385
+ cd $rvm_source_path/$rvm_gem_package_name
386
+ else
387
+ __rvm_fetch $rvm_gem_url
388
+ mkdir -p $rvm_source_path/$rvm_gem_package_name
389
+ __rvm_run "rubygems.extract" tar zxf $rvm_archives_path/$rvm_gem_package_name.tgz -C $rvm_source_path
390
+ fi
391
+ # Well this is fun... fix nil error on require_paths:
392
+ 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
393
+ rm -f $rvm_source_path/$rvm_gem_package_name/lib/rubygems/gem_path_searcher.rb.orig
394
+ __rvm_run "rubygems.install" GEM_HOME=$rvm_gem_home $rvm_ruby_home/bin/ruby $rvm_source_path/$rvm_gem_package_name/setup.rb
395
+ status=$?
396
+ if [ $status -eq 0 ] ; then
397
+ __rvm_log "info" "Installation of rubygems $rvm_ruby_package_name completed successfully."
398
+ fi
399
+ return $status
400
+ }
401
+