[DRE-commits] [gem2deb] 04/15: gem2deb-test-runner: set GEM_PATH when running tests

Antonio Terceiro terceiro at moszumanska.debian.org
Sat Jan 23 19:37:36 UTC 2016


This is an automated email from the git hooks/post-receive script.

terceiro pushed a commit to branch master
in repository gem2deb.

commit 76207f56a76ab0664623d7189020dfbd02a86daa
Author: Antonio Terceiro <terceiro at debian.org>
Date:   Sat Jan 23 11:25:35 2016 -0200

    gem2deb-test-runner: set GEM_PATH when running tests
---
 debian/changelog           |  2 ++
 lib/gem2deb/test_runner.rb | 16 +++++++---------
 2 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index 2f16b65..67b987d 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -5,6 +5,8 @@ gem2deb (0.25) UNRELEASED; urgency=medium
     that almost never works out of the box.
     - Note that dh_ruby still supports it, we just won't autogenerate that
       when creating new packaging from scratch anymorel.
+  * gem2deb-test-runner: also set GEM_PATH when running tests. This makes
+    tests work out of the box when using --gem-install
 
  -- Antonio Terceiro <terceiro at debian.org>  Sat, 09 Jan 2016 21:00:29 -0200
 
diff --git a/lib/gem2deb/test_runner.rb b/lib/gem2deb/test_runner.rb
index b576528..1cae0cb 100644
--- a/lib/gem2deb/test_runner.rb
+++ b/lib/gem2deb/test_runner.rb
@@ -53,13 +53,11 @@ module Gem2Deb
       dirs
     end
 
-    def env_with_gem_path
+    def gem_path
       if self.autopkgtest
-        { }
+        nil
       else
-        {
-          'GEM_PATH' => (Gem.path + Dir.glob("debian/*/usr/share/rubygems-integration/{all,#{ruby_api_version}}")).join(':')
-        }
+        (Gem.path + Dir.glob("debian/*/usr/share/rubygems-integration/{all,#{ruby_api_version}}")).join(':')
       end
     end
 
@@ -75,8 +73,8 @@ module Gem2Deb
       metadata = Gem2Deb::Metadata.new('.')
       if metadata.gemspec
         cmd = [rubyver, '-e', 'gem "%s"' % metadata.name]
-        puts "GEM_PATH=#{env_with_gem_path['GEM_PATH']} " + cmd.shelljoin
-        system(env_with_gem_path, *cmd)
+        puts "GEM_PATH=#{gem_path} " + cmd.shelljoin
+        system({ 'GEM_PATH' => gem_path }, *cmd)
         exitstatus = $?.exitstatus
         if exitstatus != 0
           system 'gem', 'list'
@@ -111,13 +109,13 @@ module Gem2Deb
       cmd = [program] + args
 
       rlib = (ENV['RUBYLIB'] ? ENV['RUBYLIB'] + ':' : '') + rubylib
-      puts "RUBYLIB=#{rubylib} " + cmd.shelljoin
+      puts "RUBYLIB=#{rubylib} GEM_PATH=#{gem_path} " + cmd.shelljoin
 
       if autopkgtest
         move_away 'lib'
         move_away 'ext'
       end
-      system({ 'RUBYLIB' => rlib }, *cmd)
+      system({ 'RUBYLIB' => rlib, 'GEM_PATH' => gem_path }, *cmd)
       exitstatus = $?.exitstatus
       if autopkgtest
         restore 'lib'

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-ruby-extras/gem2deb.git



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