about summary refs log tree commit homepage
diff options
context:
space:
mode:
authorzedshaw <zedshaw@19e92222-5c0b-0410-8929-a290d50e31e9>2006-03-15 03:15:48 +0000
committerzedshaw <zedshaw@19e92222-5c0b-0410-8929-a290d50e31e9>2006-03-15 03:15:48 +0000
commit511eb5d5d59fa92e6dfd58696514310180d973c0 (patch)
tree8912c29fadfeabe8c3177137ec94128b58af64a7
parent2f049babd1ac067818b20a5643f70113ec1f3a4b (diff)
downloadunicorn-511eb5d5d59fa92e6dfd58696514310180d973c0.tar.gz
git-svn-id: svn+ssh://rubyforge.org/var/svn/mongrel/trunk@110 19e92222-5c0b-0410-8929-a290d50e31e9
-rw-r--r--bin/mongrel_rails2
-rw-r--r--projects/gem_plugin/lib/gem_plugin.rb15
2 files changed, 12 insertions, 5 deletions
diff --git a/bin/mongrel_rails b/bin/mongrel_rails
index e66d99e..d66d71a 100644
--- a/bin/mongrel_rails
+++ b/bin/mongrel_rails
@@ -75,7 +75,7 @@ class Start < GemPlugin::Plugin "/commands"
     $orig_dollar_quote = $".clone
 
     ENV['RAILS_ENV'] = @environment
-    require 'config/environment'
+    require 'config/boot'
     require 'dispatcher'
     require 'mongrel/rails'
 
diff --git a/projects/gem_plugin/lib/gem_plugin.rb b/projects/gem_plugin/lib/gem_plugin.rb
index 9b501f7..27d9f28 100644
--- a/projects/gem_plugin/lib/gem_plugin.rb
+++ b/projects/gem_plugin/lib/gem_plugin.rb
@@ -93,16 +93,22 @@ module GemPlugin
     # extra thing we do is we delay loading Rails Mongrel plugins until after rails
     # is configured.  Do do this the mongrel_rails script has:
     #
-    #  GemPlugin::Manager.instance.load "mongrel" => GemPlugin::INCLUDE, "rails" => GemPlugin::EXCLUDE
+    # GemPlugin::Manager.instance.load "mongrel" => GemPlugin::INCLUDE, "rails" => GemPlugin::EXCLUDE
     # The only thing to remember is that this is saying "include a plugin if it
     # depends on gem_plugin, mongrel, but NOT rails".  If a plugin also depends on other
     # stuff then it's loaded just fine.  Only gem_plugin, mongrel, and rails are
     # ever used to determine if it should be included.
+    #
+    # NOTE: Currently RubyGems will run autorequire on gems that get required AND
+    # on their dependencies.  This really messes with people running edge rails
+    # since activerecord or other stuff gets loaded for just touching a gem plugin.
+    # To prevent this load requires the full path to the "init.rb" file, which
+    # avoids the RubyGems autorequire magic.
     def load(needs = {})
       sdir = File.join(Gem.dir, "specifications")
       gems = Gem::SourceIndex.from_installed_gems(sdir)
       needs = needs.merge({"gem_plugin" => INCLUDE})
-
+      
       gems.each do |path, gem|
         # don't load gems more than once
         next if @gems.has_key? gem.name        
@@ -120,8 +126,9 @@ module GemPlugin
         # makes them false so we'll skip this gem if any excludes are found
         if (check.select {|name,test| !test}).length == 0
           # looks like no needs were set to false, so it's good
-          require "#{gem.name}/init"
-          @gems[gem.name] = File.join(Gem.dir, "gems", "#{gem.name}-#{gem.version}")
+          gem_dir = File.join(Gem.dir, "gems", "#{gem.name}-#{gem.version}")
+          require File.join(gem_dir, "lib", gem.name, "init.rb")
+          @gems[gem.name] = gem_dir
         end
       end