[DRE-commits] [SCM] gem2deb.git branch, master, updated. 0.2.17-3-g5308674

Antonio Terceiro terceiro at debian.org
Tue Jun 19 23:52:06 UTC 2012


The following commit has been merged in the master branch:
commit 836ce38456bec357393ee0edea6dc869f2656791
Author: Antonio Terceiro <terceiro at debian.org>
Date:   Tue Jun 19 20:38:49 2012 -0300

    Install gemspec for use with rubygems-integration

diff --git a/lib/gem2deb/dh_ruby.rb b/lib/gem2deb/dh_ruby.rb
index c252d72..3db17e4 100644
--- a/lib/gem2deb/dh_ruby.rb
+++ b/lib/gem2deb/dh_ruby.rb
@@ -29,6 +29,11 @@ module Gem2Deb
       'ruby1.9.1' => '/usr/bin/ruby1.9.1',
     }
 
+    RUBY_CONFIG_VERSION = {
+      'ruby1.8'   => '1.8',
+      'ruby1.9.1' => '1.9.1',
+    }
+
     RUBY_SHEBANG_CALL = '/usr/bin/env ruby'
 
     DEFAULT_RUBY_VERSION = 'ruby1.8'
@@ -97,6 +102,8 @@ module Gem2Deb
 
       install_substvars(package, supported_versions)
 
+      install_gemspec(package, supported_versions)
+
       check_rubygems
 
       puts "  Leaving dh_ruby --install" if @verbose
@@ -413,5 +420,18 @@ module Gem2Deb
         end
       end
     end
+
+    def install_gemspec(package, versions)
+      if metadata.gemspec
+        versions.each do |version|
+          target = File.join(destdir_for(package), "/usr/share/rubygems-integration/#{RUBY_CONFIG_VERSION[version]}/specifications/#{metadata.name}-#{metadata.version}.gemspec")
+          FileUtils.mkdir_p(File.dirname(target))
+          File.open(target, 'w') do |file|
+            file.write(metadata.gemspec.to_ruby)
+          end
+        end
+      end
+    end
+
   end
 end
diff --git a/test/unit/dh_ruby_test.rb b/test/unit/dh_ruby_test.rb
index ac0c34b..29476e1 100644
--- a/test/unit/dh_ruby_test.rb
+++ b/test/unit/dh_ruby_test.rb
@@ -274,6 +274,13 @@ class DhRubyTest < Gem2DebTestCase
     end
   end
 
+  context 'installing gemspec' do
+    should 'install gemspec for simplegem' do
+      assert_installed SIMPLE_GEM_DIRNAME, 'ruby-simplegem', '/usr/share/rubygems-integration/1.9.1/specifications/simplegem-0.0.1.gemspec'
+    end
+
+  end
+
   protected
 
   def read_installed_file(gem_dirname, package, path)

-- 
gem2deb.git



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