[DRE-commits] [gem2deb] 07/09: check if the test_runner isn't trivial when trying to create the test suite

Cédric Boutillier boutil at moszumanska.debian.org
Tue Aug 26 09:12:40 UTC 2014


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

boutil pushed a commit to branch master
in repository gem2deb.

commit b59753c2d1a5f4ec93a1a9ecfe615719228a1289
Author: Cédric Boutillier <boutil at debian.org>
Date:   Tue Aug 26 10:50:14 2014 +0200

    check if the test_runner isn't trivial when trying to create the test suite
---
 lib/gem2deb/dh_make_ruby.rb |  2 +-
 lib/gem2deb/test_runner.rb  | 13 +++++++++++++
 2 files changed, 14 insertions(+), 1 deletion(-)

diff --git a/lib/gem2deb/dh_make_ruby.rb b/lib/gem2deb/dh_make_ruby.rb
index b65f37b..dc7c34e 100644
--- a/lib/gem2deb/dh_make_ruby.rb
+++ b/lib/gem2deb/dh_make_ruby.rb
@@ -296,7 +296,7 @@ module Gem2Deb
     end
 
     def test_suite
-      if !Gem2Deb::TestRunner.detect
+      if !Gem2Deb::TestRunner.detect_real_runner
         test_suite_rspec or test_suite_yaml or test_suite_rb
       end
     end
diff --git a/lib/gem2deb/test_runner.rb b/lib/gem2deb/test_runner.rb
index 66844a2..3f7ba34 100644
--- a/lib/gem2deb/test_runner.rb
+++ b/lib/gem2deb/test_runner.rb
@@ -61,6 +61,11 @@ module Gem2Deb
       nil
     end
 
+    # override in subclasses if needed
+    def real_runner?
+      true
+    end
+
     def activate?
       required_file && File.exist?(required_file)
     end
@@ -113,6 +118,11 @@ module Gem2Deb
     def self.detect!
       detect || bail("E: this tool must be run from inside a Debian source package.")
     end
+    def self.detect_real_runner
+      subclasses.map(&:new).find do |runner|
+        runner.real_runner? && runner.activate?
+      end
+    end
     def self.bail(msg)
       puts msg
       exit 1
@@ -171,6 +181,9 @@ module Gem2Deb
       def run_tests
         puts "Running tests for #{rubyver}: found no way to run a test suite!"
       end
+      def real_runner?
+        false
+      end
     end
 
   end

-- 
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