about summary refs log tree commit homepage
path: root/projects/gem_plugin
diff options
context:
space:
mode:
Diffstat (limited to 'projects/gem_plugin')
-rw-r--r--projects/gem_plugin/CHANGELOG2
-rw-r--r--projects/gem_plugin/Rakefile7
-rw-r--r--projects/gem_plugin/lib/gem_plugin.rb18
3 files changed, 19 insertions, 8 deletions
diff --git a/projects/gem_plugin/CHANGELOG b/projects/gem_plugin/CHANGELOG
index 7e1103d..cf39b5b 100644
--- a/projects/gem_plugin/CHANGELOG
+++ b/projects/gem_plugin/CHANGELOG
@@ -1,2 +1,4 @@
 
+v0.3. Use Gem.path, not Gem.dir, so that local gem repositories work (rooster).
+
 v0.2.3. Signed gem.
diff --git a/projects/gem_plugin/Rakefile b/projects/gem_plugin/Rakefile
index f1bd428..b312bfe 100644
--- a/projects/gem_plugin/Rakefile
+++ b/projects/gem_plugin/Rakefile
@@ -1,8 +1,11 @@
 
+require 'rubygems'
+gem 'echoe', '>=2.7.11'
 require 'echoe'
 
 Echoe.new("gem_plugin") do |p|
-  p.author="Zed A. Shaw"
+  p.author= "Zed A. Shaw"
+  p.email = "mongrel-development@rubyforge.org"
   p.project = "mongrel"
   p.summary = "A plugin system based on rubygems that uses dependencies only"
 
@@ -15,7 +18,7 @@ Echoe.new("gem_plugin") do |p|
   p.test_pattern = "test/test_plugins.rb"
   p.clean_pattern += ["pkg", "lib/*.bundle", "*.gem", ".config"]
   p.rdoc_pattern = ['README', 'LICENSE', 'COPYING', 'lib/**/*.rb', 'doc/**/*.rdoc']
-  p.rdoc_template = `allison --path`.chomp  
+  p.rdoc_template = `#{Platform.windows? ? 'allison.bat' : 'allison'} --path`.chomp  
 end
 
 namespace :site do
diff --git a/projects/gem_plugin/lib/gem_plugin.rb b/projects/gem_plugin/lib/gem_plugin.rb
index 1996a61..782a990 100644
--- a/projects/gem_plugin/lib/gem_plugin.rb
+++ b/projects/gem_plugin/lib/gem_plugin.rb
@@ -105,8 +105,8 @@ module GemPlugin
     # 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)
+      sdirs = Gem::SourceIndex.installed_spec_directories
+      gems = Gem::SourceIndex.from_gems_in(sdirs)
       needs = needs.merge({"gem_plugin" => INCLUDE})
       
       gems.each do |path, gem|
@@ -128,11 +128,17 @@ module GemPlugin
           # looks like no needs were set to false, so it's good
           
           # Previously was set wrong, we already have the correct gem path!
-          #gem_dir = File.join(Gem.dir, "gems", "#{gem.name}-#{gem.version}")
-          gem_dir = File.join(Gem.dir, "gems", path)
+          gem_dir = ""
+          Gem.path.each do |gem_path|
+            gem_dir = File.join(gem_path, "gems", path)
+            break if File.exist?(gem_dir)
+          end
           
-          require File.join(gem_dir, "lib", gem.name, "init.rb")
-          @gems[gem.name] = gem_dir
+          gem_init = File.join(gem_dir, "lib", gem.name, "init.rb")
+          if File.exist?(gem_init)
+            require gem_init
+            @gems[gem.name] = gem_dir
+          end
         end
       end