From 5f68c9ea12c731aaf93ff46ec8233ff9126378bf Mon Sep 17 00:00:00 2001 From: 7rans Date: Thu, 20 Dec 2012 16:08:30 -0500 Subject: [PATCH] Testing files are .setup/test.rb or test.sh, no others. [major] --- .setup/{testrc.rb => test.rb} | 0 Metadata => Index.yml | 0 lib/setup/tester.rb | 25 +++++++++++++++++-------- 3 files changed, 17 insertions(+), 8 deletions(-) rename .setup/{testrc.rb => test.rb} (100%) rename Metadata => Index.yml (100%) diff --git a/.setup/testrc.rb b/.setup/test.rb similarity index 100% rename from .setup/testrc.rb rename to .setup/test.rb diff --git a/Metadata b/Index.yml similarity index 100% rename from Metadata rename to Index.yml diff --git a/lib/setup/tester.rb b/lib/setup/tester.rb index 497c24d..53da028 100644 --- a/lib/setup/tester.rb +++ b/lib/setup/tester.rb @@ -4,18 +4,24 @@ module Setup # Complexities arise in trying to figure out what test framework # is used, and how to run tests. To simplify the process, this - # class simply looks for a special script, this can be a shell - # script at script/test, or a ruby script that - # .setup/testrc.rb will be used instead if it exists. - + # class simply looks for a special Ruby script at either + # `.setup/test.rb` or a shell script at `.setup/test.sh` and runs + # the such script accordingly. The Ruby script has priority if both exist. + # class Tester < Base - RUBYSCRIPT = META_EXTENSION_DIR + '/testrc.rb' + RUBYSCRIPT = META_EXTENSION_DIR + '/test.rb' + + SHELLSCRIPT = META_EXTENSION_DIR + '/test.sh' - SHELLSCRIPT = 'script/test' + DEPRECATED_RUBYSCRIPT = META_EXTENSION_DIR + '/testrc.rb' # def testable? + if File.exist?(DEPRECATED_RUBYSCRIPT) + warn "Must use `.setup/test.rb' instead or `.setup/testrc.rb' to support testing." + end + return false if config.no_test return true if File.exist?(RUBYSCRIPT) return true if File.exist?(SHELLSCRIPT) @@ -24,11 +30,14 @@ def testable? # def test - return true if !testable? + return true unless testable? + if File.exist?(RUBYSCRIPT) test_rubyscript elsif File.exist?(SHELLSCRIPT) test_shellscript + else + true end end @@ -43,7 +52,7 @@ def test_rubyscript end - # DEPRECATED + # DEPRECATED: Since 0.5.0 #def test #runner = config.testrunner #case runner