<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -1,6 +1,5 @@
 *Edge*
 
-
 * Wrapped Rails.env in StringQuestioneer so you can do Rails.env.development? [DHH]
 
 * Add the gem load paths before the framework is loaded, so certain gems like RedCloth and BlueCloth can be frozen.</diff>
      <filename>railties/CHANGELOG</filename>
    </modified>
    <modified>
      <diff>@@ -23,9 +23,13 @@ module Rails
       @unpack_directory = nil
     end
 
+    def unpacked_paths
+      Dir[File.join(self.class.unpacked_path, &quot;#{@name}-#{@version || &quot;*&quot;}&quot;)]
+    end
+
     def add_load_paths
       return if @loaded || @load_paths_added
-      unpacked_paths = Dir[File.join(self.class.unpacked_path, &quot;#{@name}-#{@version || &quot;*&quot;}&quot;)]
+      unpacked_paths = self.unpacked_paths
       if unpacked_paths.empty?
         args = [@name]
         args &lt;&lt; @requirement.to_s if @requirement</diff>
      <filename>railties/lib/rails/gem_dependency.rb</filename>
    </modified>
    <modified>
      <diff>@@ -87,14 +87,14 @@ module Rails
       end
 
       def evaluate_init_rb(initializer)
-         if has_init_file?
-           silence_warnings do
-             # Allow plugins to reference the current configuration object
-             config = initializer.configuration
-             
-             eval(IO.read(init_path), binding, init_path)
-           end
-         end
+        if has_init_file?
+          silence_warnings do
+            # Allow plugins to reference the current configuration object
+            config = initializer.configuration
+            
+            eval(IO.read(init_path), binding, init_path)
+          end
+        end
       end               
   end
 
@@ -103,8 +103,9 @@ module Rails
   # to Dependencies.load_paths.
   class GemPlugin &lt; Plugin
     # Initialize this plugin from a Gem::Specification.
-    def initialize(spec)
-      super(File.join(spec.full_gem_path))
+    def initialize(spec, gem)
+      directory = (gem.frozen? &amp;&amp; gem.unpacked_paths.first) || File.join(spec.full_gem_path)
+      super(directory)
       @name = spec.name
     end
 </diff>
      <filename>railties/lib/rails/plugin.rb</filename>
    </modified>
    <modified>
      <diff>@@ -78,8 +78,9 @@ module Rails
     # a &lt;tt&gt;rails/init.rb&lt;/tt&gt; file.
     class GemLocator &lt; Locator
       def plugins
-        specs  = initializer.configuration.gems.map(&amp;:specification)
-        specs += Gem.loaded_specs.values.select do |spec|
+        gem_index = initializer.configuration.gems.inject({}) { |memo, gem| memo.update gem.specification =&gt; gem }
+        specs     = gem_index.keys
+        specs    += Gem.loaded_specs.values.select do |spec|
           spec.loaded_from &amp;&amp; # prune stubs
             File.exist?(File.join(spec.full_gem_path, &quot;rails&quot;, &quot;init.rb&quot;))
         end
@@ -91,7 +92,7 @@ module Rails
         deps.add(*specs) unless specs.empty?
 
         deps.dependency_order.collect do |spec|
-          Rails::GemPlugin.new(spec)
+          Rails::GemPlugin.new(spec, gem_index[spec])
         end
       end
     end</diff>
      <filename>railties/lib/rails/plugin/locator.rb</filename>
    </modified>
    <modified>
      <diff>@@ -94,7 +94,7 @@ uses_mocha &quot;Plugin Loader Tests&quot; do
 
     def test_should_add_plugin_load_paths_to_global_LOAD_PATH_array
       only_load_the_following_plugins! [:stubby, :acts_as_chunky_bacon]
-      stubbed_application_lib_index_in_LOAD_PATHS = 5
+      stubbed_application_lib_index_in_LOAD_PATHS = 4
       @loader.stubs(:application_lib_index).returns(stubbed_application_lib_index_in_LOAD_PATHS)
 
       @loader.add_plugin_load_paths</diff>
      <filename>railties/test/plugin_loader_test.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>924244bf5cfb3d359fbc58d935d33adebf571fd6</id>
    </parent>
  </parents>
  <author>
    <name>rick</name>
    <email>technoweenie@gmail.com</email>
  </author>
  <url>http://github.com/rails/rails/commit/e1bd75a92285c29269270e708e49d7cd5fabac36</url>
  <id>e1bd75a92285c29269270e708e49d7cd5fabac36</id>
  <committed-date>2008-06-19T10:11:45-07:00</committed-date>
  <authored-date>2008-06-08T11:04:04-07:00</authored-date>
  <message>Fix discrepancies with loading rails/init.rb from gems. [#324 state:resolved]</message>
  <tree>cf1602958c09ae5d072da4d020f24eb439373726</tree>
  <committer>
    <name>rick</name>
    <email>technoweenie@gmail.com</email>
  </committer>
</commit>
