[DRE-commits] r2424 - in packages/libgemplugin-ruby/trunk/debian: . patches

sharky at alioth.debian.org sharky at alioth.debian.org
Tue Jan 15 08:36:20 UTC 2008


Author: sharky
Date: 2008-01-15 08:36:19 +0000 (Tue, 15 Jan 2008)
New Revision: 2424

Added:
   packages/libgemplugin-ruby/trunk/debian/patches/03-support_packaged_plugins.diff
Modified:
   packages/libgemplugin-ruby/trunk/debian/changelog
Log:
Add patch for packaged gem plugins (Closes: #459882).


Modified: packages/libgemplugin-ruby/trunk/debian/changelog
===================================================================
--- packages/libgemplugin-ruby/trunk/debian/changelog	2008-01-14 16:34:27 UTC (rev 2423)
+++ packages/libgemplugin-ruby/trunk/debian/changelog	2008-01-15 08:36:19 UTC (rev 2424)
@@ -10,6 +10,9 @@
   * Added new control field 'Dm-Upload-Allowed: yes'
   * Added rdoc as dependency to generate documentation for this package.
 
+  [ Jeremy Lainé ]
+  * Add patch for packaged gem plugins (Closes: #459882).
+
  -- Filipe Lautert <filipe at icewall.org>  Thu, 22 Nov 2007 01:41:19 -0200
 
 libgemplugin-ruby (0.2.2-1) unstable; urgency=low

Added: packages/libgemplugin-ruby/trunk/debian/patches/03-support_packaged_plugins.diff
===================================================================
--- packages/libgemplugin-ruby/trunk/debian/patches/03-support_packaged_plugins.diff	                        (rev 0)
+++ packages/libgemplugin-ruby/trunk/debian/patches/03-support_packaged_plugins.diff	2008-01-15 08:36:19 UTC (rev 2424)
@@ -0,0 +1,57 @@
+diff -urN libgemplugin-ruby-0.2.2.orig/lib/gem_plugin.rb libgemplugin-ruby-0.2.2/lib/gem_plugin.rb
+--- libgemplugin-ruby-0.2.2.orig/lib/gem_plugin.rb	2007-05-12 22:21:38.000000000 +0200
++++ libgemplugin-ruby-0.2.2/lib/gem_plugin.rb	2008-01-10 00:18:37.000000000 +0100
+@@ -51,6 +51,7 @@
+ 
+   EXCLUDE = true
+   INCLUDE = false
++  SITE_GEMPLUGINS = '/usr/share/gemplugins/' + Config::CONFIG['ruby_version']
+ 
+   class PluginNotLoaded < StandardError; end
+ 
+@@ -105,9 +106,24 @@
+     # 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)
++      gems = Gem::SourceIndex.from_installed_gems
+       needs = needs.merge({"gem_plugin" => INCLUDE})
++
++      # add packaged gem plugins
++      Dir.glob(File.join(SITE_GEMPLUGINS, "*.gemspec")).each do |file_name|
++        gemspec = Gem::SourceIndex.load_specification(file_name.untaint)
++        if gemspec
++          class << gemspec
++            def full_gem_path
++              File.join(File::dirname(@loaded_from), name)
++            end
++            def full_init_path
++              File.join(Config::CONFIG['rubylibdir'], name, "init.rb")
++            end
++          end
++          gems.add_spec(gemspec)
++        end
++      end
+       
+       gems.each do |path, gem|
+         # don't load gems more than once
+@@ -129,9 +145,16 @@
+           
+           # 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.full_gem_path
++
++          # Load correct init.rb, according to whether this is a 
++          # packaged gem plugin or not
++          if gem.respond_to?("full_init_path")
++            require gem.full_init_path
++          else
++            require File.join(gem_dir, "lib", gem.name, "init.rb")
++          end
+           
+-          require File.join(gem_dir, "lib", gem.name, "init.rb")
+           @gems[gem.name] = gem_dir
+         end
+       end




More information about the Pkg-ruby-extras-commits mailing list