From 93937e0b3004710f172b000d5381b3a113453c65 Mon Sep 17 00:00:00 2001 From: Nathan Youngman Date: Sun, 28 Oct 2012 14:50:58 -0600 Subject: [PATCH 1/2] use github for coderay-test-scanners --- rake_tasks/test.rake | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/rake_tasks/test.rake b/rake_tasks/test.rake index f070ccc3..bf01c631 100644 --- a/rake_tasks/test.rake +++ b/rake_tasks/test.rake @@ -1,40 +1,42 @@ 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 Subversion...' - sh 'svn co http://svn.rubychan.de/coderay-scanner-tests/trunk/ test/scanners/' + 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 SVN' + + desc 'update scanner test suite from GitHub' task :update_scanner_suite => scanner_suite do - sh "svn up #{File.dirname(scanner_suite)}" + Dir.chdir(File.dirname(scanner_suite)) do + sh "git pull" + end end - + namespace :scanner do Dir['./test/scanners/*'].each do |scanner| next unless File.directory? scanner @@ -45,7 +47,7 @@ namespace :test do end end end - + desc 'clean test output files' task :clean do for file in Dir['test/scanners/**/*.actual.*'] @@ -61,7 +63,7 @@ namespace :test do rm file end end - + desc 'test the CodeRay executable' task :exe do if RUBY_VERSION >= '1.8.7' @@ -72,7 +74,7 @@ namespace :test do puts "Skipping." end end - + end task :test => %w(test:functional test:units test:exe) From 2e2eccb75838414747d50984ba4aa363914c806e Mon Sep 17 00:00:00 2001 From: Kornelius Kalnbach Date: Sun, 28 Oct 2012 22:17:17 +0100 Subject: [PATCH 2/2] cleanups, helpful message when old svn checkout is found --- rake_tasks/test.rake | 47 +++++++++++++++++++++++++------------------- 1 file changed, 27 insertions(+), 20 deletions(-) diff --git a/rake_tasks/test.rake b/rake_tasks/test.rake index bf01c631..a60699d4 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)