[DRE-commits] [SCM] gem2deb.git branch, master, updated. debian/0.2.3-7-gd3d8bc5

Antonio Terceiro terceiro at softwarelivre.org
Wed Jun 1 01:02:33 UTC 2011


The following commit has been merged in the master branch:
commit d3d8bc5299c143bef9ab62b9d4daea7ebaf73dbb
Author: Vincent Fourmond <fourmond at debian.org>
Date:   Tue May 31 17:56:07 2011 -0700

    Use installed directories in $LOAD_PATH
    
    This way the tests will run agains exactly the same code that will end
    up in the package.
    
    Signed-off-by: Antonio Terceiro <terceiro at softwarelivre.org>

diff --git a/lib/gem2deb/testrunner.rb b/lib/gem2deb/testrunner.rb
index c7f9f76..670fdc0 100644
--- a/lib/gem2deb/testrunner.rb
+++ b/lib/gem2deb/testrunner.rb
@@ -16,24 +16,26 @@
 require 'gem2deb'
 require 'yaml'
 
+require 'rbconfig'
+
 module Gem2Deb
   class TestRunner
     def initialize
       @test_files = YAML.load_file('debian/ruby-test-files.yaml')
 
-      $: << File::expand_path('lib')
-      if File::directory?('ext')
-        $: << File::expand_path('ext')
-        # also add subdirs of ext/
-        (Dir::entries('ext') - ['.', '..']).each do |e|
-          if File::directory?(File.join('ext', e))
-            $: << File::expand_path(File.join('ext',e))
-          end
-        end
-      end
-      $: << File::expand_path('test') if File::directory?('test')
-      $: << File::expand_path('spec') if File::directory?('spec')
-      $: << File::expand_path('.')
+      # We should only use installation paths for the current Ruby
+      # version.
+      #
+      # We assume that installation has already proceeded into
+      # subdirectories of the debian/ directory.
+
+      dirs = Dir["debian/*/usr/lib/ruby/vendor_ruby"]
+      dirs += Dir["debian/*" + RbConfig::CONFIG['vendorarchdir']]
+
+      $:.concat(dirs)
+
+      # And we add the current directory:
+      $: << "."
 
       @test_files.each do |f|
         require f
diff --git a/test/sample/simpleextension/pkg/simpleextension-1.2.3.gem b/test/sample/simpleextension/pkg/simpleextension-1.2.3.gem
index dfdbe9f..db5fc26 100644
Binary files a/test/sample/simpleextension/pkg/simpleextension-1.2.3.gem and b/test/sample/simpleextension/pkg/simpleextension-1.2.3.gem differ
diff --git a/test/sample/simpleextension/test/test_simpleextension.rb b/test/sample/simpleextension/test/test_simpleextension.rb
index b41b079..ac56fa7 100644
--- a/test/sample/simpleextension/test/test_simpleextension.rb
+++ b/test/sample/simpleextension/test/test_simpleextension.rb
@@ -1,5 +1,5 @@
 require 'test/unit'
-require 'simpleextension/simpleextension'
+require 'simpleextension'
 
 class SimpleExtensionTest < Test::Unit::TestCase
   def test_answer

-- 
gem2deb.git



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