aboutsummaryrefslogtreecommitdiffstats
path: root/railties
diff options
context:
space:
mode:
authorPratik Naik <pratiknaik@gmail.com>2009-10-19 15:06:54 -0200
committerPratik Naik <pratiknaik@gmail.com>2009-10-19 15:06:54 -0200
commit1ac5cf478825391071d34ec3d7f294fe28c0fceb (patch)
tree3f96636a58f7d3211617039fe9794e0538c49e3c /railties
parent77bb129fdb3b1da8365931a6313b5e7ef4c91de0 (diff)
downloadrails-1ac5cf478825391071d34ec3d7f294fe28c0fceb.tar.gz
rails-1ac5cf478825391071d34ec3d7f294fe28c0fceb.tar.bz2
rails-1ac5cf478825391071d34ec3d7f294fe28c0fceb.zip
Make sure boot.rb requires rubygems only when needed
Diffstat (limited to 'railties')
-rw-r--r--railties/lib/rails/generators/rails/app/templates/config/boot.rb17
1 files changed, 10 insertions, 7 deletions
diff --git a/railties/lib/rails/generators/rails/app/templates/config/boot.rb b/railties/lib/rails/generators/rails/app/templates/config/boot.rb
index 3165a4091e..44c884623e 100644
--- a/railties/lib/rails/generators/rails/app/templates/config/boot.rb
+++ b/railties/lib/rails/generators/rails/app/templates/config/boot.rb
@@ -1,15 +1,18 @@
# Package management
# Choose one
-# Use Bundler (preferred)
environment = File.expand_path('../../vendor/gems/environment', __FILE__)
-require environment if File.exist?(environment)
-
-# Use 2.x style vendor/rails directory
vendor_rails = File.expand_path('../../vendor/rails', __FILE__)
-Dir["#{vendor_rails}/*/lib"].each { |path| $:.unshift(path) } if File.exist?(vendor_rails)
-# Load Rails from traditional RubyGems
-require 'rubygems'
+if File.exist?(environment)
+ # Use Bundler (preferred)
+ require environment
+elsif File.exist?(vendor_rails)
+ # Use 2.x style vendor/rails directory
+ Dir["#{vendor_rails}/*/lib"].each { |path| $:.unshift(path) }
+else
+ # Load Rails from traditional RubyGems
+ require 'rubygems'
+end
require 'rails'