diff options
author | Kornelius Kalnbach <murphy@rubychan.de> | 2012-10-28 22:17:17 +0100 |
---|---|---|
committer | Kornelius Kalnbach <murphy@rubychan.de> | 2012-10-28 22:17:17 +0100 |
commit | 2e2eccb75838414747d50984ba4aa363914c806e (patch) | |
tree | 1fba5985c1dce7b54507469f5a0b158b1bc62683 | |
parent | 93937e0b3004710f172b000d5381b3a113453c65 (diff) | |
download | coderay-2e2eccb75838414747d50984ba4aa363914c806e.tar.gz |
cleanups, helpful message when old svn checkout is found
-rw-r--r-- | rake_tasks/test.rake | 47 |
1 files changed, 27 insertions, 20 deletions
diff --git a/rake_tasks/test.rake b/rake_tasks/test.rake index bf01c63..a60699d 100644 --- a/rake_tasks/test.rake +++ b/rake_tasks/test.rake @@ -1,42 +1,50 @@ namespace :test do - desc 'run all sample tests' task :samples do ruby './sample/suite.rb' end - + desc 'run functional tests' task :functional do ruby './test/functional/suite.rb' ruby './test/functional/for_redcloth.rb' end - + desc 'run unit tests' task :units do ruby './test/unit/suite.rb' end - + scanner_suite = 'test/scanners/suite.rb' - task scanner_suite do - unless File.exist? scanner_suite - puts 'Scanner tests not found; downloading from GitHub...' - sh 'git clone https://github.com/rubychan/coderay-scanner-tests.git test/scanners/' - puts 'Finished.' - end - end - desc 'run all scanner tests' task :scanners => :update_scanner_suite do ruby scanner_suite end - + desc 'update scanner test suite from GitHub' - task :update_scanner_suite => scanner_suite do - Dir.chdir(File.dirname(scanner_suite)) do - sh "git pull" + task :update_scanner_suite do + if File.exist? scanner_suite + Dir.chdir File.dirname(scanner_suite) do + if File.directory? '.git' + puts 'Updating scanner test suite...' + sh 'git pull' + elsif File.directory? '.svn' + raise <<-ERROR +Found the deprecated Subversion scanner test suite in ./#{File.dirname(scanner_suite)}. +Please rename or remove it and run again to use the GitHub repository: + + mv test/scanners test/scanners-old + ERROR + else + raise 'No scanner test suite found.' + end + end + else + puts 'Downloading scanner test suite...' + sh 'git clone https://github.com/rubychan/coderay-scanner-tests.git test/scanners/' end end - + namespace :scanner do Dir['./test/scanners/*'].each do |scanner| next unless File.directory? scanner @@ -47,7 +55,7 @@ namespace :test do end end end - + desc 'clean test output files' task :clean do for file in Dir['test/scanners/**/*.actual.*'] @@ -63,7 +71,7 @@ namespace :test do rm file end end - + desc 'test the CodeRay executable' task :exe do if RUBY_VERSION >= '1.8.7' @@ -74,7 +82,6 @@ namespace :test do puts "Skipping." end end - end task :test => %w(test:functional test:units test:exe) |