rvm 0.1.36 → 0.1.37

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/config/db CHANGED
@@ -1,6 +1,7 @@
1
1
  niceness=0
2
2
  interpreter=ruby
3
3
  ruby_version=1.8.7
4
+ ruby_configure_flags=--enable-shared
4
5
  ruby_patchlevel=174
5
6
  ruby_configure=--enable-shared
6
7
  ruby_repo_url=http://svn.ruby-lang.org/repos/ruby
@@ -27,6 +28,7 @@ rbx_version=1.0.0
27
28
  rbx_1.0.0_patch_level=20100514
28
29
  rbx_url=http://asset.rubini.us
29
30
  ree_version=1.8.7
31
+ ree_configure_flags=--dont-install-useful-gems
30
32
  ree_1.8.6_patch_level=20090610
31
33
  ree_1.8.6_url=http://rubyforge.org/frs/download.php/58677
32
34
  ree_1.8.6_repo_url=git://github.com/FooBarWidget/rubyenterpriseedition.git
@@ -1,3 +1,4 @@
1
+ # MRI Rubies
1
2
  (ruby-)1.8.6(-p399)
2
3
  (ruby-)1.8.6-head
3
4
  (ruby-)1.8.7(-p174)
@@ -5,11 +6,12 @@
5
6
  (ruby-)1.9.1(-p243)
6
7
  (ruby-)1.9.1(-p376)
7
8
  (ruby-)1.9.1-head
9
+ (ruby-)1.9.2-preview1
8
10
  (ruby-)1.9.2-preview3
9
11
  (ruby-)1.9.2-head
10
12
  ruby-head
11
13
 
12
- # Jruby
14
+ # JRuby
13
15
  jruby-1.2.0
14
16
  jruby-1.3.1
15
17
  jruby-1.4.0
@@ -37,7 +39,7 @@ mput(-head)
37
39
  macruby(-nightly) # the default macruby
38
40
  macruby-head # Build from the macruby git repository
39
41
 
40
- # Not working yet
42
+ # IronRuby -- Not implemented yet.
41
43
  ironruby-0.9.3
42
44
  ironruby-1.0-rc2
43
45
  ironruby-head
@@ -1 +1,2 @@
1
1
  rake
2
+ rdoc
@@ -0,0 +1,2 @@
1
+ rake
2
+ rdoc
data/install CHANGED
@@ -166,6 +166,21 @@ if [[ ! -z "$rvm_auto_flag" ]] ; then
166
166
  fi
167
167
  fi
168
168
 
169
+ #
170
+ # Initial Interpreter Gemsets.
171
+ #
172
+ spinner
173
+ mkdir -p "$rvm_gemsets_path"
174
+ for gemset_file in $(cd $install_source_path/gemsets ; find . -iname '*.gems' | sed 's/\.\///') ; do
175
+ source_path="$install_source_path/gemsets"
176
+ destination="$rvm_gemsets_path/$gemset_file"
177
+ destination_path="$(dirname "$destination")"
178
+ if [[ ! -s "$destination" ]] ; then
179
+ mkdir -p "$destination_path"
180
+ cp "$source_path/$gemset_file" "$destination"
181
+ fi
182
+ done ; unset destination destination_path source_path
183
+
169
184
  #
170
185
  # Migrate ~/.rvm/ruby-X,jruby-X,... to ~/.rvm/rubies/ for 0.1.0.
171
186
  #
@@ -1,4 +1,4 @@
1
1
  ---
2
2
  :major: 0
3
3
  :minor: 1
4
- :patch: 36
4
+ :patch: 37
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{rvm}
8
- s.version = "0.1.36"
8
+ s.version = "0.1.37"
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{2010-05-31}
12
+ s.date = %q{2010-06-02}
13
13
  s.default_executable = %q{rvm-install}
14
14
  s.description = %q{Manages Ruby interpreter environments and switching between them.}
15
15
  s.email = %q{wayneeseguin@gmail.com}
@@ -277,6 +277,7 @@ __rvm_parse_args() {
277
277
  rvm_action=${rvm_action:-use}
278
278
  rvm_ruby_interpreter="$rvm_token"
279
279
  rvm_ruby_string="$rvm_token"
280
+ rvm_ruby_strings="$rvm_token"
280
281
  ;;
281
282
 
282
283
  help)
data/scripts/db CHANGED
@@ -28,7 +28,7 @@ else
28
28
  sed -i.tmp "s#^$key=.*\$##" $database_file
29
29
  else
30
30
  if [[ -z "$value" ]] ; then # get
31
- awk -F= '/^'"$key"'=/{print $2}' $database_file
31
+ awk -F= '/^'"$key"'=/' $database_file | sed "s#^$key=##"
32
32
  else # set
33
33
  if [[ -z "$(awk -F= "/^'"$key"'=/{print $2}" $database_file)" ]] ; then # append
34
34
  echo "$key=$value" >> $database_file
@@ -10,15 +10,15 @@ if [[ ! -d "$rvm_ruby_gem_home" ]] && command -v gem > /dev/null 2>&1; then rvm_
10
10
 
11
11
  trap "if [[ -d $rvm_tmp_path/ ]] && [[ -s $rvm_tmp_path/$$ ]] ; then rm -f $rvm_tmp_path/$$ > /dev/null 2>&1 ; fi ; exit" 0 1 2 3 15
12
12
 
13
- __rvm_gemset_name() {
14
- __rvm_gemset_dir | awk -F${rvm_gemset_separator} '{print $2}'
13
+ gemset_name() {
14
+ gemset_dir | awk -F${rvm_gemset_separator} '{print $2}'
15
15
  }
16
16
 
17
- __rvm_gemset_dir() {
17
+ gemset_dir() {
18
18
  echo "$rvm_ruby_gem_home"
19
19
  }
20
20
 
21
- __rvm_gemset_create() {
21
+ gemset_create() {
22
22
  rvm_ruby_gem_prefix=$(echo $rvm_ruby_gem_home | sed 's/'${rvm_gemset_separator}'.*$//')
23
23
  for gemset in $(echo $gems_args) ; do
24
24
  gem_home="${rvm_ruby_gem_prefix}${rvm_gemset_separator}${gems_args/ /}"
@@ -27,7 +27,7 @@ __rvm_gemset_create() {
27
27
  done ; unset gem_home
28
28
  }
29
29
 
30
- __rvm_gemset_list() {
30
+ gemset_list() {
31
31
  if [[ -z "$rvm_ruby_selected_flag" ]] ; then __rvm_select ; fi
32
32
 
33
33
  $rvm_scripts_path/log "info" "gemsets : for $rvm_ruby_string (found in $rvm_gems_path/)"
@@ -43,7 +43,7 @@ __rvm_gemset_list() {
43
43
  fi
44
44
  }
45
45
 
46
- __rvm_gemset_delete() {
46
+ gemset_delete() {
47
47
  if [[ -z "$rvm_ruby_selected_flag" ]] ; then __rvm_select ; fi
48
48
  if [[ ! -z "$rvm_gemset_name" ]] ; then
49
49
  gemdir="$rvm_gems_path/$rvm_ruby_string${rvm_gemset_separator}$rvm_gemset_name"
@@ -67,7 +67,7 @@ __rvm_gemset_delete() {
67
67
  fi
68
68
  }
69
69
 
70
- __rvm_gemset_empty() {
70
+ gemset_empty() {
71
71
  if [[ -z "$rvm_ruby_gem_home" ]] ; then __rvm_select ; fi
72
72
  gemdir="$rvm_ruby_gem_home"
73
73
  if [[ -d "$gemdir" ]] && [[ "$gemdir" != '/' ]] && [[ ! -z "$rvm_force_flag" ]] ; then
@@ -87,7 +87,7 @@ __rvm_gemset_empty() {
87
87
  }
88
88
 
89
89
  # Migrate gemsets from ruby X to ruby Y
90
- __rvm_gemset_copy() {
90
+ gemset_copy() {
91
91
  source_ruby="$(echo $gems_args | awk '{print $1}')"
92
92
  destination_ruby="$(echo $gems_args | awk '{print $2}')"
93
93
  if [[ -z "$source_ruby" ]] ; then
@@ -115,7 +115,7 @@ __rvm_gemset_copy() {
115
115
  unset source_ruby destination_ruby source_path destination_path
116
116
  }
117
117
 
118
- __rvm_gemset_export() {
118
+ gemset_export() {
119
119
  rvm_file_name="${rvm_file_name:-$gems_args}"
120
120
 
121
121
  if [[ ! -z "$rvm_ruby_gem_home" ]] ; then
@@ -149,7 +149,7 @@ __rvm_gemset_export() {
149
149
  done ; unset file_name
150
150
  }
151
151
 
152
- __rvm_gemset_import() {
152
+ gemset_import() {
153
153
 
154
154
  if [[ ! -z "$rvm_ruby_gem_home" ]] ; then
155
155
  export GEM_HOME="$rvm_ruby_gem_home"
@@ -185,7 +185,7 @@ __rvm_gemset_import() {
185
185
  while read -r line
186
186
  do # Keep this on 2nd line :(
187
187
  if [[ ! -z "$(echo $line | sed 's/\s//g')" ]] ; then
188
- gems_args="$line" ; __rvm_gem_install
188
+ gems_args="$line" ; gem_install
189
189
  fi
190
190
  done < <(awk '/^[^#]+/{print}' "${rvm_file_name}")
191
191
  else
@@ -225,7 +225,7 @@ __rvm_parse_gems_args() {
225
225
  }
226
226
 
227
227
  # Install a gem
228
- __rvm_gem_install() {
228
+ gem_install() {
229
229
  # First we parse the gem args to pick apart the pieces.
230
230
 
231
231
  __rvm_parse_gems_args
@@ -295,7 +295,7 @@ __rvm_gem_install() {
295
295
  }
296
296
 
297
297
  # Output the user's current gem directory.
298
- __rvm_gemset_info() {
298
+ gemset_info() {
299
299
  if [[ "$rvm_user_flag" -eq 1 ]] ; then
300
300
  echo $(rvm system ; gem env | grep "\- $HOME" | awk '{print $NF}')
301
301
  elif [[ "$rvm_system_flag" -eq 1 ]] ; then
@@ -309,10 +309,74 @@ __rvm_gemset_info() {
309
309
  fi
310
310
  }
311
311
 
312
- __rvm_gem_pristine() {
312
+ gemset_prune() {
313
+ temporary_cache_path="$GEM_HOME/temporary-cache"
314
+ live_cache_path="$GEM_HOME/cache"
315
+ mkdir -p "$temporary_cache_path"
316
+ $rvm_scripts_path/log "info" "Moving active gems into temporary cache..."
317
+ while read -r used_gem; do
318
+ gem_name="$(echo "$used_gem" | sed -e 's/ .*//')"
319
+ versions="$(echo "$used_gem" | sed -e 's/.* (//' -e 's/)//' | tr ', ' ' ')"
320
+ for version in $versions; do
321
+ cached_gem_name="${gem_name}-${version}.gem"
322
+ cached_file_path="${live_cache_path}/${cached_gem_name}"
323
+ if [[ -f "$cached_file_path" ]]; then
324
+ mv "$cached_file_path" "${temporary_cache_path}/${cached_gem_name}"
325
+ fi
326
+ done
327
+ done < <(gem list --versions)
328
+ $rvm_scripts_path/log "info" "Removing live cache and restoring temporary cache..."
329
+ # Switch the cache back.
330
+ rm -rf "$live_cache_path"
331
+ mv "$temporary_cache_path" "$live_cache_path"
332
+ }
333
+
334
+ gem_pristine() {
313
335
  gem pristine --all
314
336
  }
315
337
 
338
+ # Loads the default gemsets for the current interpreter and gemset.
339
+ gemset_initial() {
340
+ $rvm_scripts_path/log "info" "Importing initial gemsets for $(__rvm_environment_identifier)."
341
+ mkdir -p "$rvm_gemsets_path/$(echo "$rvm_ruby_string" | tr '-' '/')" 2>/dev/null
342
+ for gemsets_path in "$rvm_gemsets_path" "$rvm_gemsets_path/$rvm_ruby_interpreter" "$rvm_gemsets_path/$rvm_ruby_interpreter/$rvm_ruby_version" "$rvm_gemsets_path/$rvm_ruby_interpreter/$rvm_ruby_version/$rvm_ruby_patch_level" ; do
343
+ if [[ ! -z "$rvm_gemset_name" ]] ; then
344
+ if [[ -s "${gemsets_path}/${rvm_gemset_name}.gems" ]] ; then
345
+ printf $(rvm gemset import "${gemsets_path}/${rvm_gemset_name}.gems") > /dev/null
346
+ fi
347
+ else
348
+ if [[ -d "$gemsets_path" ]] && [[ -s "${gemsets_path}/default.gems" ]] ; then
349
+ printf $(rvm gemset import "$gemsets_path/default.gems") > /dev/null
350
+ fi
351
+ if [[ -d "$gemsets_path" ]] && [[ -s "${gemsets_path}/global.gems" ]] ; then
352
+ printf $(rvm use "$rvm_ruby_string@global" --create ; rvm gemset import "${gemsets_path}/global.gems") > /dev/null
353
+ fi
354
+ fi
355
+ done
356
+ $rvm_scripts_path/log "info" "Installation of gems for $(__rvm_environment_identifier) is complete."
357
+
358
+ # Original code, which swapped out the environments on the fly.
359
+ #post_install_gems="rdoc rake"
360
+ #for rvm_gem_name in $(echo $post_install_gems); do
361
+ # home="$GEM_HOME" ; path="$GEM_PATH" # Save
362
+ # for dir in $rvm_ruby_global_gems_path $rvm_ruby_gem_home ; do
363
+ # GEM_HOME="$dir" ; GEM_PATH="$dir" ; BUNDLE_PATH="$dir"
364
+ # export GEM_HOME GEM_PATH BUNDLE_PATH
365
+ # __rvm_run "gems.install" "$rvm_ruby_home/bin/gem install --no-rdoc --no-ri $rvm_gem_name $rvm_gem_options" "Installing $rvm_gem_name to $dir"
366
+
367
+ # if [[ -x $rvm_ruby_gem_home/bin/$rvm_gem_name ]] ; then
368
+ # if [[ "$rvm_ruby_gem_home" != "$rvm_ruby_home" ]] && [[ ! -x $rvm_ruby_home/bin/$rvm_gem_name ]] ; then
369
+ # ln -nfs $rvm_ruby_gem_home/bin/$rvm_gem_name $rvm_ruby_home/bin/$rvm_gem_name
370
+ # fi
371
+ # __rvm_inject_ruby_shebang "$rvm_ruby_home/bin/$rvm_gem_name"
372
+ # __rvm_inject_gem_env "$rvm_ruby_home/bin/$rvm_gem_name"
373
+ # fi
374
+ # done ; unset home path dir
375
+ # GEM_HOME="$home" ; GEM_PATH="$path" ; BUNDLE_PATH="$home"
376
+ # export GEM_HOME GEM_PATH BUNDLE_PATH
377
+ #done ; unset rvm_gem_name post_install_gems
378
+ }
379
+
316
380
  unset GEM_PATH
317
381
 
318
382
  if ! command -v gem > /dev/null ; then
@@ -325,29 +389,33 @@ gems_args=$(echo "$*" | awk '{$1="" ; print}' | sed -e 's/^[[:space:]]*//' -e 's
325
389
  export rvm_gemset_name
326
390
 
327
391
  if [[ "import" = "$action" ]] || [[ "load" = "$action" ]] ; then
328
- __rvm_gemset_import
392
+ gemset_import
329
393
  elif [[ "export" = "$action" ]] || [[ "dump" = "$action" ]] ; then
330
- __rvm_gemset_export
394
+ gemset_export
331
395
  elif [[ "create" = "$action" ]] ; then
332
- __rvm_gemset_create
396
+ gemset_create
333
397
  elif [[ "copy" = "$action" ]] ; then
334
- __rvm_gemset_copy
398
+ gemset_copy
335
399
  elif [[ "empty" = "$action" ]] ; then
336
- __rvm_gemset_empty
400
+ gemset_empty
337
401
  elif [[ "delete" = "$action" ]] ; then
338
- __rvm_gemset_delete
402
+ gemset_delete
339
403
  elif [[ "name" = "$action" ]] || [[ "string" = "$action" ]]; then
340
- __rvm_gemset_name
404
+ gemset_name
341
405
  elif [[ "dir" = "$action" ]] ; then
342
- __rvm_gemset_dir
406
+ gemset_dir
343
407
  elif [[ "list" = "$action" ]] ; then
344
- __rvm_gemset_list
408
+ gemset_list
345
409
  elif [[ "gemdir" = "$action" ]] || [[ "gempath" = "$action" ]] || [[ "gemhome" = "$action" ]] || [[ "home" = "$action" ]] || [[ "path" = "$action" ]] || [[ "version" = "$action" ]] ; then
346
- __rvm_gemset_info
410
+ gemset_info
347
411
  elif [[ "install" = "$action" ]] ; then
348
- __rvm_gem_install $*
412
+ gem_install $*
349
413
  elif [[ "pristine" = "$action" ]] ; then
350
- __rvm_gem_pristine $*
414
+ gem_pristine $*
415
+ elif [[ "initial" = "$action" ]] ; then
416
+ gemset_initial
417
+ elif [[ "prune" = "$action" ]] ; then
418
+ gemset_prune
351
419
  elif [[ "clear" = "$action" ]] ; then
352
420
  $rvm_scripts_path/log "info" "gemset cleared."
353
421
  exit 0
@@ -13,6 +13,7 @@ rvm_project_rvmrc_default="${rvm_project_rvmrc_default:-0}"
13
13
 
14
14
  rvm_archives_path="${rvm_archives_path:-"$rvm_path/archives"}"
15
15
  rvm_src_path="${rvm_src_path:-"$rvm_path/src"}"
16
+ rvm_repo_path="${rvm_repo_path:-"$rvm_path/repos"}"
16
17
  rvm_log_path="${rvm_log_path:-"$rvm_path/log"}"
17
18
  rvm_docs_path="${rvm_docs_path:-"$rvm_path/docs"}"
18
19
  rvm_bin_path="${rvm_bin_path:-"$rvm_path/bin"}"
@@ -28,5 +29,5 @@ rvm_tmp_path="${rvm_tmp_path:-"$rvm_path/tmp"}"
28
29
  rvm_usr_path="${rvm_usr_path:-"$rvm_path/usr"}"
29
30
  rvm_gemset_separator="${rvm_gemset_separator:-"@"}"
30
31
 
31
- export rvm_path rvm_rubies_path rvm_scripts_path rvm_archives_path rvm_src_path rvm_log_path rvm_bin_path rvm_gems_path rvm_config_path rvm_tmp_path rvm_hooks_path rvm_gems_cache_path rvm_gemset_separator
32
+ export rvm_path rvm_rubies_path rvm_scripts_path rvm_archives_path rvm_src_path rvm_log_path rvm_bin_path rvm_gems_path rvm_config_path rvm_tmp_path rvm_hooks_path rvm_gems_cache_path rvm_gemset_separator rvm_gemsets_path rvm_repo_path
32
33
 
@@ -166,6 +166,21 @@ if [[ ! -z "$rvm_auto_flag" ]] ; then
166
166
  fi
167
167
  fi
168
168
 
169
+ #
170
+ # Initial Interpreter Gemsets.
171
+ #
172
+ spinner
173
+ mkdir -p "$rvm_gemsets_path"
174
+ for gemset_file in $(cd $install_source_path/gemsets ; find . -iname '*.gems' | sed 's/\.\///') ; do
175
+ source_path="$install_source_path/gemsets"
176
+ destination="$rvm_gemsets_path/$gemset_file"
177
+ destination_path="$(dirname "$destination")"
178
+ if [[ ! -s "$destination" ]] ; then
179
+ mkdir -p "$destination_path"
180
+ cp "$source_path/$gemset_file" "$destination"
181
+ fi
182
+ done ; unset destination destination_path source_path
183
+
169
184
  #
170
185
  # Migrate ~/.rvm/ruby-X,jruby-X,... to ~/.rvm/rubies/ for 0.1.0.
171
186
  #
@@ -49,33 +49,17 @@ __rvm_install_source() {
49
49
  fi
50
50
  fi
51
51
 
52
- #if [[ "1.8.5" = "$rvm_ruby_version" ]] ; then
53
- # # How to install ruby 1.8.5... "sneaky sneaky, sir"
54
- # src_dir="ruby-1.8.7-p$(__rvm_db "ruby_1.8.7_patch_level")"
55
- # if [[ ! -d "$HOME/.rvm/src/$src_dir/ext/openssl/" ]] ; then $rvm_path/bin/rvm fetch 1.8.6-p248 > /dev/null ; fi
56
- # cp ~/.rvm/src/$src_dir/ext/openssl/extconf.rb ~/.rvm/src/ruby-1.8.5-p231/ext/openssl/
57
- # cp ~/.rvm/src/$src_dir/ext/openssl/openssl_missing.* ~/.rvm/src/ruby-1.8.5-p231/ext/openssl/
58
- # cp ~/.rvm/src/$src_dir/ext/openssl/ossl_hmac.c ~/.rvm/src/ruby-1.8.5-p231/ext/openssl/
59
- # src_dir="ruby-1.8.6-p$(__rvm_db "ruby_1.8.6_patch_level")"
60
- # if [[ ! -d "$HOME/.rvm/src/$src_dir/ext/openssl/" ]] ; then $rvm_path/bin/rvm fetch 1.8.6-p383 > /dev/null ; fi
61
- # cp ~/.rvm/src/$src_dir/ext/readline/* ~/.rvm/src/ruby-1.8.5-p231/ext/readline/
62
- # unset src_dir
63
- #fi
64
-
65
- #
66
- #if [[ -s ./Makefile ]] && [[ -z "$rvm_reconfigure_flag" ]] ; then
67
- # (($rvm_debug_flag)) && $rvm_scripts_path/log "debug" "Skipping configure step, Makefile exists so configure must have already been run."
68
- #el
69
52
  if [[ ! -z "$rvm_ruby_configure" ]] ; then
70
53
  __rvm_run "configure" "$rvm_ruby_configure"
71
54
  result=$? ; if [[ "$result" -gt 0 ]] ; then
72
55
  $rvm_scripts_path/log "error" "There has been an error while configuring. Aborting the installation." ; __rvm_pushpop ; return $result
73
56
  fi
74
57
  elif [[ -s ./configure ]] ; then
75
- __rvm_run "configure" "./configure --prefix=$rvm_ruby_home $rvm_ruby_configure_flags $configure_parameters" "Configuring $rvm_ruby_string, this may take a while depending on your cpu(s)..."
58
+ __rvm_db "${rvm_ruby_interpreter}_configure_flags" "db_configure_flags"
59
+ __rvm_run "configure" "./configure --prefix=$rvm_ruby_home $db_configure_flags $rvm_ruby_configure_flags $configure_parameters" "Configuring $rvm_ruby_string, this may take a while depending on your cpu(s)..."
76
60
  result=$? ; if [[ "$result" -gt 0 ]] ; then
77
61
  $rvm_scripts_path/log "error" "There has been an error while running configure. Aborting the installation." ; __rvm_pushpop ; return $result
78
- fi ; unset configure_parameters
62
+ fi ; unset configure_parameters db_configure_flags
79
63
  else
80
64
  $rvm_scripts_path/log "error" "Skipping configure step, 'configure' does not exist, did autoconf not run successfully?"
81
65
  fi
@@ -167,7 +151,7 @@ __rvm_install_ruby() {
167
151
 
168
152
  binaries=(erb gem irb rake rdoc ri ruby testrb)
169
153
  for binary_name in ${binaries[@]}; do
170
- # if [[ $binary_name != "gem" ]] ; then prefix="-S" ; fi
154
+ # TODO: This should be generated via an external script.
171
155
  ruby_wrapper=$(cat <<RubyWrapper
172
156
  #!/usr/bin/env bash
173
157
 
@@ -180,11 +164,10 @@ exec $macruby_path/mac$binary_name $prefix "\$@"
180
164
  RubyWrapper
181
165
  )
182
166
 
183
- for file_name in "$rvm_ruby_home/bin/$binary_name" "$rvm_bin_path/$binary_name-$rvm_ruby_string" ; do
184
- rm -f $file_name
185
- echo "$ruby_wrapper" > $file_name
186
- if [[ -f $file_name ]] ; then chmod +x $file_name ; fi
187
- done
167
+ file_name="$rvm_ruby_home/bin/$binary_name"
168
+ rm -f $file_name
169
+ echo "$ruby_wrapper" > $file_name
170
+ if [[ -f $file_name ]] ; then chmod +x $file_name ; fi
188
171
  if [[ "$binary_name" = "ruby" ]] ; then
189
172
  echo "$ruby_wrapper" > $rvm_bin_path/$rvm_ruby_string
190
173
  fi
@@ -230,7 +213,9 @@ RubyWrapper
230
213
  rvm_ree_options="${rvm_ree_options} --no-tcmalloc"
231
214
  fi
232
215
 
233
- __rvm_run "install" "./installer -a $rvm_rubies_path/$rvm_ruby_interpreter-$rvm_ruby_version-$rvm_ruby_patch_level $rvm_ree_options --dont-install-useful-gems $rvm_ruby_configure_flags" "Installing $rvm_ruby_string, this may take a while, depending on your cpu(s)..."
216
+ __rvm_db "${rvm_ruby_interpreter}_configure_flags" "db_configure_flags"
217
+
218
+ __rvm_run "install" "./installer -a $rvm_rubies_path/$rvm_ruby_interpreter-$rvm_ruby_version-$rvm_ruby_patch_level $rvm_ree_options $db_configure_flags $rvm_ruby_configure_flags" "Installing $rvm_ruby_string, this may take a while, depending on your cpu(s)..."
234
219
  result=$? ; if [[ "$result" -gt 0 ]] ; then
235
220
  $rvm_scripts_path/log "error" "There has been an error while trying to run the ree installer. Aborting the installation." ; __rvm_pushpop ; return $result
236
221
  fi
@@ -238,21 +223,14 @@ RubyWrapper
238
223
  chmod +x $rvm_ruby_home/bin/*
239
224
 
240
225
  __rvm_rubygems_setup
241
-
242
- for rvm_gem_name in rdoc rake ; do
243
- __rvm_run "gems" "$rvm_ruby_home/bin/gem install $rvm_gem_name $rvm_gem_options" "Installing $rvm_gem_name"
244
- done
245
- __rvm_inject_ruby_shebang "$rvm_ruby_gem_home/bin/rake"
246
- __rvm_inject_gem_env "$rvm_ruby_gem_home/bin/rake"
247
-
248
226
  __rvm_irbrc
249
227
  __rvm_bin_script
250
228
  __rvm_post_install
251
229
  __rvm_pushpop
252
230
  else
253
- __rvm_db "ree_${rvm_ruby_version}_repo_url" "rvm_url"
231
+ __rvm_db "${rvm_ruby_interpreter}_${rvm_ruby_version}_repo_url" "rvm_url"
254
232
  if [[ -z "$rvm_url" ]] ; then
255
- $rvm_scripts_path/log "fail" "rvm does not know the rvm repo url for 'ree_${rvm_ruby_version}'"
233
+ $rvm_scripts_path/log "fail" "rvm does not know the rvm repo url for '${rvm_ruby_interpreter}_${rvm_ruby_version}'"
256
234
  result=1
257
235
  else
258
236
  rvm_ruby_repo_url=$rvm_url
@@ -292,9 +270,11 @@ RubyWrapper
292
270
  else
293
271
  __rvm_db "rubinius_repo_url" "rvm_ruby_repo_url"
294
272
  #rvm_ruby_home="$rvm_rubies_path/$rvm_ruby_interpreter-$rvm_ruby_version"
295
- if [[ ! -d "$rvm_ruby_src_path" ]] || [[ ! -d "$rvm_ruby_src_path/.git" ]] ; then
296
- rm -rf "$rvm_ruby_src_path" ; builtin cd "$rvm_home"
297
- __rvm_run "rbx.repo" "git clone --depth 1 $rvm_ruby_repo_url $rvm_ruby_src_path" "Cloning $rvm_ruby_repo_url"
273
+ if [[ ! -d "$rvm_ruby_repo_path" ]] || [[ ! -d "$rvm_ruby_repo_path/.git" ]] ; then
274
+ rm -rf "$rvm_ruby_repo_path" "$rvm_ruby_src_path"
275
+ builtin cd "$rvm_home"
276
+ __rvm_run "rbx.repo" "git clone --depth 1 $rvm_ruby_repo_url $rvm_ruby_repo_path" "Cloning $rvm_ruby_repo_url"
277
+ __rvm_run "rbx.copy" "cp -R \"$rvm_ruby_repo_path\" \"$rvm_ruby_src_path\"" "Copying from repo to source..."
298
278
  builtin cd "$rvm_ruby_src_path"
299
279
  else
300
280
  builtin cd "$rvm_ruby_src_path"
@@ -305,13 +285,12 @@ RubyWrapper
305
285
  fi
306
286
  fi
307
287
 
308
- #if [[ ! -x "$rvm_ruby_distclean" ]] ; then
309
- # __rvm_run "rake.distclean" "\$(rvm 1.8.7 ; rake distclean --trace)" "Running distclean."
310
- #fi
311
-
312
288
  builtin cd "$rvm_ruby_src_path" ; chmod +x ./configure
289
+
290
+ __rvm_db "${rvm_ruby_interpreter}_configure_flags" "db_configure_flags"
291
+
313
292
  rvm_ruby_configure_flags="${rvm_ruby_configure_flags:-"--skip-system"}"
314
- rvm_ruby_configure="ruby configure --prefix=$rvm_ruby_home $rvm_ruby_configure_flags" ; message="Configuring rbx"
293
+ rvm_ruby_configure="ruby configure --prefix=$rvm_ruby_home $db_configure_flags $rvm_ruby_configure_flags" ; message="Configuring rbx"
315
294
  if [[ "$rvm_llvm_flag" = "0" ]] ; then
316
295
  rvm_ruby_configure="$rvm_ruby_configure --disable-llvm"
317
296
  else
@@ -334,23 +313,17 @@ RubyWrapper
334
313
  $rvm_scripts_path/log "error" "There has been an error while running '$rvm_ruby_configure'. Aborting the installation." ; __rvm_pushpop ; return $result
335
314
  fi
336
315
 
337
- binaries="ruby irb" # Trick to work in more shells :)
338
- for binary_name in $(echo $binaries) ; do
339
- ln -fs $rvm_ruby_home/bin/rbx $rvm_ruby_home/bin/$binary_name
340
- done ; unset binary_name binaries
341
-
342
- for binary_name in "gem" ; do
343
- if [[ $binary_name != "gem" ]] ; then prefix="-S " ; else unset prefix; fi
344
-
345
- ruby_wrapper=$(printf "#!/usr/bin/env bash\nexec $rvm_ruby_home/bin/rbx $prefix$binary_name \"\$@\"")
346
- for file_name in "$rvm_ruby_home/bin/$binary_name" "$rvm_bin_path/$binary_name-$rvm_ruby_string" ; do
347
- rm -f $file_name
348
- echo "$ruby_wrapper" > $file_name
349
- if [[ -f $file_name ]] ; then chmod +x $file_name ; fi
350
- done
351
-
352
- unset file_name binaries ruby_wrapper binary_name files prefix
353
- done ; unset binary_name
316
+ # Symlink rubinius wrappers
317
+ ln -fs "$rvm_ruby_home/bin/rbx" "$rvm_ruby_home/bin/irb"
318
+ ln -fs "$rvm_ruby_home/bin/rbx" "$rvm_ruby_home/bin/ruby"
319
+ # Install a wrapper around gem.
320
+ file_name="$rvm_ruby_home/bin/gem"
321
+ if [[ ! -f "$file_name" ]]; then
322
+ echo "#!/usr/bin/env bash" > "$file_name"
323
+ echo "exec $rvm_ruby_home/bin/rbx gem \"\$@\"" >> "$file_name"
324
+ [[ -f "$file_name" ]] && chmod +x "$file_name"
325
+ fi
326
+ unset file_name
354
327
 
355
328
  binaries="erb ri rdoc"
356
329
  __rvm_post_install
@@ -578,36 +551,6 @@ RubyWrapper
578
551
  ln -fs $rvm_ruby_home/bin/ir $rvm_ruby_home/bin/ruby
579
552
 
580
553
  __rvm_run "gems.install" "PATH=$rvm_ruby_gem_home/bin:$rvm_ruby_global_gems_path/bin:$rvm_ruby_home/bin:$PATH GEM_HOME=$rvm_ruby_gem_home GEM_PATH=$rvm_ruby_gem_home $rvm_ruby_home/bin/gem install --no-rdoc --no-ri rake $rvm_gem_options" "Installing $rvm_gem_name to $dir"
581
-
582
- binaries=() # Don't wrap any longer.
583
- for binary_name in ${binaries[@]} ; do
584
- binary_path=""
585
- if [[ "ruby" != "$binary_name" ]] ; then
586
- binary_path="$rvm_ruby_home/bin/i$binary_name"
587
- fi
588
- ruby_wrapper=$(cat <<RubyWrapper
589
- #!/bin/bash
590
-
591
- export GEM_HOME="$rvm_ruby_gem_home"
592
- export GEM_PATH="$rvm_ruby_gem_path"
593
- export BUNDLE_PATH="$rvm_ruby_gem_home"
594
- export MY_RUBY_HOME="$rvm_ruby_home"
595
- export PATH="$rvm_ruby_gem_home/bin:$rvm_ruby_global_gems_path/bin:$rvm_ruby_home/bin:\$PATH"
596
-
597
- exec mono $rvm_ruby_home/bin/ir.exe $binary_path "\$@"
598
- RubyWrapper
599
- )
600
- files="$rvm_ruby_home/bin/$binary_name $rvm_bin_path/$binary_name-$rvm_ruby_string"
601
- for file_name in $(echo $files) ; do
602
- rm -f $file_name
603
- echo "$ruby_wrapper" > $file_name
604
- if [[ -f $file_name ]] ; then chmod +x $file_name ; fi
605
- done
606
- if [[ "$binary_name" = "ruby" ]] ; then
607
- echo "$ruby_wrapper" > $rvm_bin_path/$rvm_ruby_string
608
- fi
609
- unset file_name ruby_wrapper binary_name binary_path files prefix
610
- done
611
554
  ;;
612
555
 
613
556
  mput|shyouhei)
@@ -621,8 +564,9 @@ RubyWrapper
621
564
  builtin cd $rvm_src_path
622
565
 
623
566
  if [[ ! -d "$rvm_ruby_src_path" ]] || [[ ! -d "$rvm_ruby_src_path/.git" ]] ; then
624
- rm -rf $rvm_ruby_src_path
625
- __rvm_run "mput.repo" "git clone --depth 1 $rvm_ruby_repo_url $rvm_ruby_src_path" "Cloning $rvm_ruby_repo_url"
567
+ rm -rf $rvm_ruby_src_path $rvm_ruby_repo_path
568
+ __rvm_run "mput.repo" "git clone --depth 1 $rvm_ruby_repo_url $rvm_ruby_repo_path" "Cloning $rvm_ruby_repo_url"
569
+ __rvm_run "mput.copy" "cp -R \"$rvm_ruby_repo_path\" \"$rvm_ruby_src_path\"" "Copying from repo to source..."
626
570
  builtin cd $rvm_ruby_src_path
627
571
  else
628
572
  builtin cd $rvm_ruby_src_path
@@ -695,6 +639,10 @@ RubyWrapper
695
639
 
696
640
  esac
697
641
 
642
+
643
+ # Import the initial gemsets.
644
+ (source $rvm_scripts_path/rvm; rvm use "$rvm_ruby_string"; $rvm_scripts_path/gemsets initial)
645
+
698
646
  rvm_hook="after_install" ; source $rvm_scripts_path/hook
699
647
 
700
648
  if [[ ! -z "$ruby_options" ]] ; then RUBYOPT=$ruby_options ; export RUBYOPT ; fi
@@ -743,9 +691,10 @@ __rvm_fetch_ruby() {
743
691
  $rvm_scripts_path/log "info" "$rvm_ruby_src_path has already been extracted." ; __rvm_pushpop ; return 0
744
692
  fi
745
693
  else
694
+ mkdir -p "$rvm_repo_path"
746
695
  if [[ ! -z "$(echo $rvm_url | awk '/^git/')" ]] ; then
747
- if [[ -d "$rvm_ruby_src_path/.git" ]] ; then
748
- builtin cd $rvm_ruby_src_path
696
+ if [[ -d "$rvm_ruby_repo_path/.git" ]] ; then
697
+ builtin cd $rvm_ruby_repo_path
749
698
  if [[ -z "$rvm_ruby_revision" ]] ; then
750
699
  $rvm_scripts_path/log "info" "Pulling from $rvm_ruby_repo_url, this may take a while depending on your connection..."
751
700
  git pull origin master
@@ -764,7 +713,7 @@ __rvm_fetch_ruby() {
764
713
  fi
765
714
  else
766
715
  $rvm_scripts_path/log "info" "Cloning from $rvm_ruby_repo_url, this may take a while depending on your connection..."
767
- git clone --depth 1 $rvm_ruby_repo_url $rvm_ruby_src_path
716
+ git clone --depth 1 $rvm_ruby_repo_url $rvm_ruby_repo_path
768
717
  result=$? ; if [[ "$result" -gt 0 ]] ; then
769
718
  $rvm_scripts_path/log "error" "There has been an error while trying to fetch the repository. Aborting the installation." ; __rvm_pushpop ; return $result
770
719
  fi
@@ -792,8 +741,8 @@ __rvm_fetch_ruby() {
792
741
  rvm_rev="-$rvm_ruby_revision"
793
742
  fi
794
743
 
795
- if [[ -d "$rvm_ruby_src_path/.svn" ]] ; then
796
- builtin cd $rvm_ruby_src_path
744
+ if [[ -d "$rvm_ruby_repo_path/.svn" ]] ; then
745
+ builtin cd $rvm_ruby_repo_path
797
746
  $rvm_scripts_path/log "info" "Updating ruby from $rvm_url"
798
747
  __rvm_run "svn.switch" "svn switch $rvm_url"
799
748
  __rvm_run "svn.update" "svn update"
@@ -802,14 +751,16 @@ __rvm_fetch_ruby() {
802
751
  __rvm_run "svn.checkout" "svn update -q ${rvm_rev/-r/-r }"
803
752
  fi
804
753
  else
805
- rm -rf $rvm_ruby_src_path
806
- __rvm_run "svn.checkout" "svn checkout -q ${rvm_rev/-r/-r } $rvm_url $rvm_ruby_src_path" "Downloading source from ${rvm_url}."
754
+ rm -rf $rvm_ruby_repo_path
755
+ __rvm_run "svn.checkout" "svn checkout -q ${rvm_rev/-r/-r } $rvm_url $rvm_ruby_repo_path" "Downloading source from ${rvm_url}."
807
756
  fi
808
757
  result=$? ; if [[ "$result" -gt 0 ]] ; then
809
758
  $rvm_scripts_path/log "error" "There has been an error while trying to fetch / update the source. Aborting the installation." ; __rvm_pushpop ; return $result
810
759
  fi
811
760
 
812
761
  fi
762
+ $rvm_scripts_path/log "info" "Copying from repo to src path..."
763
+ cp -r "$rvm_ruby_repo_path" "$rvm_ruby_src_path"
813
764
  fi
814
765
  }
815
766
 
@@ -886,32 +837,7 @@ __rvm_post_install() {
886
837
  done ; unset binary binaries
887
838
  fi
888
839
 
889
- # TODO: Merge this vvv into the default gemset loading.
890
- post_install_gems="rdoc rake"
891
- $rvm_scripts_path/log "info" "Installing gems for $rvm_ruby_string ($post_install_gems)."
892
- for rvm_gem_name in $(echo $post_install_gems); do
893
- home="$GEM_HOME" ; path="$GEM_PATH" # Save
894
- for dir in $rvm_ruby_global_gems_path $rvm_ruby_gem_home ; do
895
- GEM_HOME="$dir" ; GEM_PATH="$dir" ; BUNDLE_PATH="$dir"
896
- export GEM_HOME GEM_PATH BUNDLE_PATH
897
- __rvm_run "gems.install" "$rvm_ruby_home/bin/gem install --no-rdoc --no-ri $rvm_gem_name $rvm_gem_options" "Installing $rvm_gem_name to $dir"
898
-
899
- if [[ -x $rvm_ruby_gem_home/bin/$rvm_gem_name ]] ; then
900
- if [[ "$rvm_ruby_gem_home" != "$rvm_ruby_home" ]] && [[ ! -x $rvm_ruby_home/bin/$rvm_gem_name ]] ; then
901
- ln -nfs $rvm_ruby_gem_home/bin/$rvm_gem_name $rvm_ruby_home/bin/$rvm_gem_name
902
- fi
903
- __rvm_inject_ruby_shebang "$rvm_ruby_home/bin/$rvm_gem_name"
904
- __rvm_inject_gem_env "$rvm_ruby_home/bin/$rvm_gem_name"
905
- fi
906
- done ; unset home path dir
907
- GEM_HOME="$home" ; GEM_PATH="$path" ; BUNDLE_PATH="$home"
908
- export GEM_HOME GEM_PATH BUNDLE_PATH
909
- done ; unset rvm_gem_name post_install_gems
910
- $rvm_scripts_path/log "info" "Installation of gems for $rvm_ruby_string is complete."
911
-
912
840
  __rvm_irbrc
913
- __rvm_load_gemsets
914
-
915
841
  __rvm_generate_default_docs
916
842
  }
917
843
 
@@ -922,33 +848,6 @@ __rvm_generate_default_docs() {
922
848
  fi
923
849
  }
924
850
 
925
- __rvm_load_gemsets() {
926
- # Gemset for every interpreter's global gems
927
- if [[ -s "$rvm_gemsets_path/global.gems" ]] ; then
928
- dir=$rvm_ruby_global_gems_path
929
- GEM_HOME="$dir" ; GEM_PATH="$dir" ; BUNDLE_PATH="$dir" ; export GEM_HOME GEM_PATH BUNDLE_PATH
930
-
931
- $rvm_scripts_path/gemsets "import" "$rvm_gemsets_path/global.gems"
932
-
933
- GEM_HOME="$home" ; GEM_PATH="$path" ; BUNDLE_PATH="$home" ; export GEM_HOME GEM_PATH BUNDLE_PATH
934
- fi ; unset home path dir
935
-
936
- # gemset for any installed ruby.
937
- if [[ -s "$rvm_gemsets_path/default.gems" ]] ; then
938
- $rvm_scripts_path/gemsets "import" "$rvm_gemsets_path/default.gems"
939
- fi
940
-
941
- # gemset for any installation of a given interpreter.
942
- if [[ -s "$rvm_gemsets_path/$rvm_ruby_interpreter.gems" ]] ; then
943
- $rvm_scripts_path/gemsets "import" "$rvm_gemsets_path/$rvm_ruby_interpreter.gems"
944
- fi
945
-
946
- # gemset for a specific match of the ruby string.
947
- if [[ -s "$rvm_gemsets_path/$rvm_ruby_string.gems" ]] ; then
948
- $rvm_scripts_path/gemsets "import" "$rvm_gemsets_path/$rvm_ruby_string.gems"
949
- fi
950
- }
951
-
952
851
  __rvm_rubygems_setup() {
953
852
  if [[ ! -z "$(echo $rvm_ruby_version | awk '/^1\.9/')" ]] || [[ ! -z "$(echo $rvm_ruby_interpreter | awk '/^mput/')" ]] ; then
954
853
  install=0
@@ -166,6 +166,21 @@ if [[ ! -z "$rvm_auto_flag" ]] ; then
166
166
  fi
167
167
  fi
168
168
 
169
+ #
170
+ # Initial Interpreter Gemsets.
171
+ #
172
+ spinner
173
+ mkdir -p "$rvm_gemsets_path"
174
+ for gemset_file in $(cd $install_source_path/gemsets ; find . -iname '*.gems' | sed 's/\.\///') ; do
175
+ source_path="$install_source_path/gemsets"
176
+ destination="$rvm_gemsets_path/$gemset_file"
177
+ destination_path="$(dirname "$destination")"
178
+ if [[ ! -s "$destination" ]] ; then
179
+ mkdir -p "$destination_path"
180
+ cp "$source_path/$gemset_file" "$destination"
181
+ fi
182
+ done ; unset destination destination_path source_path
183
+
169
184
  #
170
185
  # Migrate ~/.rvm/ruby-X,jruby-X,... to ~/.rvm/rubies/ for 0.1.0.
171
186
  #
@@ -202,6 +202,7 @@ __rvm_select() {
202
202
  rvm_ruby_package_name="${rvm_ruby_package_name:-$rvm_ruby_string}"
203
203
  rvm_ruby_home="$rvm_rubies_path/$rvm_ruby_string"
204
204
  rvm_ruby_log_path="$rvm_log_path/$rvm_ruby_string"
205
+ rvm_ruby_repo_path="$rvm_repo_path/$rvm_ruby_string"
205
206
  rvm_ruby_src_path="$rvm_src_path/$rvm_ruby_string"
206
207
  rvm_ruby_binary="$rvm_ruby_home/bin/ruby"
207
208
  rvm_ruby_irbrc="$rvm_ruby_home/.irbrc"
@@ -321,7 +322,7 @@ __rvm_use() {
321
322
  fi
322
323
 
323
324
  if [[ ! -z "$rvm_rvmrc_flag" ]] ; then __rvm_set_rvmrc ; fi
324
- # Export ruby string and gem set me for extrnal scripts to take advantage of them.
325
+ # Export ruby string and gem set me for extrenal scripts to take advantage of them.
325
326
  if [[ ! -z "$rvm_ruby_string" ]] ; then export rvm_ruby_string ; fi
326
327
  if [[ ! -z "$rvm_gemset_name" ]] ; then export rvm_gemset_name ; fi
327
328
  if [[ ! -z "$new_path" ]] ; then export PATH="$new_path" ; unset new_path ; fi
@@ -60,7 +60,7 @@ __rvm_ruby_do() {
60
60
  eval "$rvm_command" >> ./log/$rvm_ruby_string/$action.log 2>> ./log/$rvm_ruby_string/$action.error.log
61
61
  else
62
62
  if [[ "$rvm_verbose_flag" != "0" ]] ; then
63
- $rvm_scripts_path/log "info" "$rvm_ruby_string: $($rvm_ruby_home/bin/ruby -v $rvm_ruby_mode | tr "\n" ' ')\n"
63
+ $rvm_scripts_path/log "info" "$rvm_ruby_string: $(ruby -v $rvm_ruby_mode | tr "\n" ' ')\n"
64
64
  fi
65
65
  eval "$rvm_command"
66
66
  fi
@@ -166,6 +166,21 @@ if [[ ! -z "$rvm_auto_flag" ]] ; then
166
166
  fi
167
167
  fi
168
168
 
169
+ #
170
+ # Initial Interpreter Gemsets.
171
+ #
172
+ spinner
173
+ mkdir -p "$rvm_gemsets_path"
174
+ for gemset_file in $(cd $install_source_path/gemsets ; find . -iname '*.gems' | sed 's/\.\///') ; do
175
+ source_path="$install_source_path/gemsets"
176
+ destination="$rvm_gemsets_path/$gemset_file"
177
+ destination_path="$(dirname "$destination")"
178
+ if [[ ! -s "$destination" ]] ; then
179
+ mkdir -p "$destination_path"
180
+ cp "$source_path/$gemset_file" "$destination"
181
+ fi
182
+ done ; unset destination destination_path source_path
183
+
169
184
  #
170
185
  # Migrate ~/.rvm/ruby-X,jruby-X,... to ~/.rvm/rubies/ for 0.1.0.
171
186
  #
@@ -43,7 +43,7 @@ __rvm_db() {
43
43
  if [[ -z $variable ]] ; then
44
44
  echo $value
45
45
  else
46
- eval "$variable=$value"
46
+ eval "$variable='$value'"
47
47
  fi
48
48
  fi
49
49
  unset key value variable
@@ -120,7 +120,7 @@ __rvm_cleanup_variables() {
120
120
 
121
121
  # Unset ruby-specific variables
122
122
  __rvm_unset_ruby_variables() {
123
- unset rvm_ruby_interpreter rvm_ruby_version rvm_url rvm_ruby_repo_url rvm_ruby_package_name rvm_ruby_patch_level rvm_ruby_make rvm_ruby_make_install rvm_ruby_revision rvm_ruby_tag rvm_release_version rvm_major_version rvm_minor_version rvm_ruby_gem_home rvm_ruby_binary rvm_ruby_home rvm_ruby_log_path rvm_ruby_src_path rvm_ruby_irbrc rvm_ruby_selected_flag rvm_ruby_src_path rvm_ruby_repo_url rvm_major_version rvm_minor_version rvm_ruby_gem_home rvm_head_flag rvm_ruby_configure rvm_ruby_mode rvm_ruby_package_file rvm_ruby_package_name rvm_ruby_gem_path rvm_ruby_name rvm_ruby_alias rvm_ruby_strings
123
+ unset rvm_ruby_interpreter rvm_ruby_version rvm_url rvm_ruby_repo_url rvm_ruby_package_name rvm_ruby_patch_level rvm_ruby_make rvm_ruby_make_install rvm_ruby_revision rvm_ruby_tag rvm_release_version rvm_major_version rvm_minor_version rvm_ruby_gem_home rvm_ruby_binary rvm_ruby_home rvm_ruby_log_path rvm_ruby_src_path rvm_ruby_irbrc rvm_ruby_selected_flag rvm_ruby_src_path rvm_ruby_repo_url rvm_major_version rvm_minor_version rvm_ruby_gem_home rvm_head_flag rvm_ruby_configure rvm_ruby_mode rvm_ruby_package_file rvm_ruby_package_name rvm_ruby_gem_path rvm_ruby_name rvm_ruby_alias rvm_ruby_strings rvm_ruby_repo_path
124
124
  }
125
125
 
126
126
  __rvm_set_rvmrc() {
@@ -167,7 +167,6 @@ __rvm_benchmark() {
167
167
  $rvm_scripts_path/set $rvm_action $rvm_ruby_args
168
168
  }
169
169
 
170
-
171
170
  # Loop over the currently installed rubies and refresh their binscripts.
172
171
  __rvm_bin_scripts() {
173
172
  for rvm_ruby_binary in $rvm_rubies_path/*/bin/ruby ; do
@@ -182,25 +181,7 @@ __rvm_bin_scripts() {
182
181
  # Write the bin/ wrapper script for currently selected ruby.
183
182
  # TODO: Adjust binscript to be able to handle all rubies not just the standard interpreteres.
184
183
  __rvm_bin_script() {
185
-
186
- if [[ -z "$rvm_ruby_selected_flag" ]] ; then __rvm_select ; fi
187
-
188
- ruby_wrapper=$(cat <<RubyWrapper
189
- #!/usr/bin/env bash
190
-
191
- export GEM_HOME="$rvm_ruby_gem_home"
192
- export GEM_PATH="$rvm_ruby_gem_path"
193
- export BUNDLE_PATH="$rvm_ruby_gem_home"
194
- export MY_RUBY_HOME="$rvm_ruby_home"
195
- export PATH="$rvm_ruby_gem_home/bin:$rvm_ruby_global_gems_path/bin:$rvm_ruby_home/bin:$rvm_bin_path:\$PATH"
196
-
197
- exec "$rvm_ruby_binary" "\$@"
198
- RubyWrapper
199
- )
200
- rm -f $rvm_bin_path/$rvm_ruby_package_name
201
- echo "$ruby_wrapper" > $rvm_bin_path/$rvm_ruby_package_name
202
- unset ruby_wrapper
203
- chmod +x $rvm_bin_path/$rvm_ruby_package_name
184
+ $rvm_scripts_path/wrapper "$rvm_ruby_string"
204
185
  }
205
186
 
206
187
  # Reset any rvm gathered information about the system and its state.
@@ -273,7 +254,7 @@ __rvm_initialize() {
273
254
  PATH=$rvm_bin_path:$PATH ; export PATH
274
255
  fi
275
256
 
276
- mkdir -p $rvm_src_path $rvm_bin_path $rvm_archives_path $rvm_gems_path $rvm_tmp_path
257
+ mkdir -p $rvm_src_path $rvm_bin_path $rvm_archives_path $rvm_gems_path $rvm_tmp_path $rvm_repo_path
277
258
  }
278
259
 
279
260
  # Update rubygems or binscripts based on CLI selection.
@@ -1,6 +1,5 @@
1
1
  #!/usr/bin/env bash
2
2
 
3
- # Recursive loops, oh my!
4
3
  unset rvm_default_flag
5
4
 
6
5
  source $rvm_scripts_path/initialize
@@ -11,56 +10,90 @@ if [[ ! -z "$rvm_trace_flag" ]] ; then set -x ; export rvm_trace_flag ; fi
11
10
 
12
11
  trap "if [[ -d $rvm_tmp_path/ ]] && [[ -s $rvm_tmp_path/$$ ]] ; then rm -f $rvm_tmp_path/$$ > /dev/null 2>&1 ; fi ; exit" 0 1 2 3 15
13
12
 
13
+ full_binary_name() {
14
+ echo "$binary_name" | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//'
15
+ }
16
+
14
17
  wrap() {
15
18
  mkdir -p "$(dirname "$file_name")"
19
+ rm -f "$file_name"
16
20
  printf "#!/usr/bin/env sh\n" > "$file_name"
17
- printf ". \"${rvm_environments_path}/${environment_identifier}\"\n" >> "$file_name"
21
+ printf "source \"${rvm_environments_path}/${environment_identifier}\"\n" >> "$file_name"
18
22
  printf "exec $binary_name \"\$@\"\n" >> "$file_name"
23
+
19
24
  if [[ -f $file_name ]] ; then chmod +x $file_name ; fi
20
25
  }
21
26
 
27
+ symlink_binary() {
28
+ # Generate the default wrapper with the given binary name.
29
+ [[ ! -f "$file_name" ]] && wrap_binary
30
+ # Then symlink it into place.
31
+ ln -fs "$file_name" "${rvm_bin_path}/${prefix}_${binary_name}"
32
+ }
33
+
34
+ wrap_binary() {
35
+ # Iff the command is found in the path.
36
+ if command -v $binary_name > /dev/null; then
37
+ wrap
38
+ else
39
+ $rvm_scripts_path/log "error" "Binary '$binary_name' not found in path."
40
+ fi
41
+ }
42
+
22
43
  usage() {
23
44
  printf "Usage: 'rvm wrapper [ruby_string] [wrapper_prefix] [binary[ binary[ ...]]]'\n"
24
45
  printf " Where binary defaults to ruby, gem, rake, irb, rdoc, ri, testrb\n"
25
46
  printf " For more information, see 'rvm help wrapper'\n"
26
47
  }
27
48
 
28
- args="$*"
29
- ruby_string="$(echo "$args" | awk '{print $1}')"
30
- prefix="$(echo "$args" | awk '{print $2}')"
31
- binaries=$(echo "$args" | awk '{$1="" ; $2=""; print}' | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//')
49
+ # Empty ruby string: show usage and exit.
50
+ if [[ -z "$1" ]]; then
51
+ usage
52
+ exit 1
53
+ fi
54
+
55
+ ruby_string="$1"; shift
56
+
57
+ prefix="$1"
58
+ if [[ -n "$1" ]]; then shift; fi
32
59
 
33
- if [[ -z "$ruby_string" ]]; then
34
- usage ; exit 1
60
+ binaries="$(echo "$@" | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//')"
61
+
62
+ if [[ 'system' == '$ruby_string' ]]; then
63
+ $rvm_scripts_path/log "error" "Wrapper can't be called with system rubies - sorry!"
64
+ exit 1
35
65
  fi
36
66
 
67
+ # Default the list of binaries to those we use regularily.
37
68
  if [[ -z "$binaries" ]] ; then
38
- # TODO: Extract out into a rvm_ variable.
39
69
  binaries="ruby gem irb ri rdoc rake erb testrb"
40
70
  fi
41
71
 
72
+ # Use the correct ruby.
42
73
  rvm_ruby_string="${ruby_string}"
43
- __rvm_select &>/dev/null
44
- __rvm_use &> /dev/null
74
+ __rvm_select > /dev/null 2>&1
75
+ __rvm_use > /dev/null 2>&1
76
+
77
+ __rvm_ensure_has_enviroment_files
45
78
 
46
79
  environment_identifier="$(__rvm_environment_identifier)"
47
80
 
48
- for binary_name in $(echo $binaries); do
81
+ # For each binary, we want to generate the wrapper / symlink
82
+ # it to the existing wrapper if needed.
83
+ for binary_name in $binaries; do
84
+ file_name="${rvm_wrappers_path}/${environment_identifier}/${binary_name}"
49
85
  if [[ -z "$prefix" ]] ; then
50
- file_name="${rvm_wrappers_path}/${environment_identifier}/${binary_name}"
51
- else
52
- file_name="${rvm_bin_path}/${prefix}_${binary_name}"
53
- fi
54
-
55
- if command -v $binary_name > /dev/null; then
56
- wrap
86
+ wrap_binary
87
+ # Symlink it into place.
88
+ if [[ "$binary_name" == "ruby" ]]; then
89
+ ln -sf "$file_name" "$rvm_bin_path/$environment_identifier"
90
+ else
91
+ ln -sf "$file_name" "$rvm_bin_path/$binary_name-$environment_identifier"
92
+ fi
57
93
  else
58
- $rvm_scripts_path/log "error" "Binary '$binary_name' not found in path."
94
+ symlink_binary
59
95
  fi
60
96
  unset file_name
61
97
  done
62
98
 
63
- unset rvm_ruby_string args ruby_string prefix binaries environment_identifier
64
- __rvm_unset_ruby_variables
65
-
66
99
  exit $?
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rvm
3
3
  version: !ruby/object:Gem::Version
4
- hash: 83
4
+ hash: 81
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 36
10
- version: 0.1.36
9
+ - 37
10
+ version: 0.1.37
11
11
  platform: ruby
12
12
  authors:
13
13
  - Wayne E. Seguin
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-05-31 00:00:00 -04:00
18
+ date: 2010-06-02 00:00:00 -04:00
19
19
  default_executable: rvm-install
20
20
  dependencies: []
21
21