Permalink
Browse files

Make sure boot.rb requires rubygems only when needed

  • Loading branch information...
1 parent 77bb129 commit 1ac5cf478825391071d34ec3d7f294fe28c0fceb @lifo lifo committed Oct 19, 2009
Showing with 10 additions and 7 deletions.
  1. +10 −7 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'

1 comment on commit 1ac5cf4

Contributor

rubys commented on 1ac5cf4 Oct 19, 2009

This breaks the vendor/rails case, as such environments also require rubygems.

I'll suggest http://pastie.org/661001 as means to address this.

Please sign in to comment.