Skip to content

Commit cab119c

Browse files
committed
Merge pull request #95 from rubychan/suite-git
use github for coderay-test-scanners
2 parents 3effca8 + 2e2eccb commit cab119c

File tree

1 file changed

+22
-13
lines changed

1 file changed

+22
-13
lines changed

rake_tasks/test.rake

+22-13
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
namespace :test do
2-
32
desc 'run all sample tests'
43
task :samples do
54
ruby './sample/suite.rb'
@@ -17,22 +16,33 @@ namespace :test do
1716
end
1817

1918
scanner_suite = 'test/scanners/suite.rb'
20-
task scanner_suite do
21-
unless File.exist? scanner_suite
22-
puts 'Scanner tests not found; downloading from Subversion...'
23-
sh 'svn co http://svn.rubychan.de/coderay-scanner-tests/trunk/ test/scanners/'
24-
puts 'Finished.'
25-
end
26-
end
27-
2819
desc 'run all scanner tests'
2920
task :scanners => :update_scanner_suite do
3021
ruby scanner_suite
3122
end
3223

33-
desc 'update scanner test suite from SVN'
34-
task :update_scanner_suite => scanner_suite do
35-
sh "svn up #{File.dirname(scanner_suite)}"
24+
desc 'update scanner test suite from GitHub'
25+
task :update_scanner_suite do
26+
if File.exist? scanner_suite
27+
Dir.chdir File.dirname(scanner_suite) do
28+
if File.directory? '.git'
29+
puts 'Updating scanner test suite...'
30+
sh 'git pull'
31+
elsif File.directory? '.svn'
32+
raise <<-ERROR
33+
Found the deprecated Subversion scanner test suite in ./#{File.dirname(scanner_suite)}.
34+
Please rename or remove it and run again to use the GitHub repository:
35+
36+
mv test/scanners test/scanners-old
37+
ERROR
38+
else
39+
raise 'No scanner test suite found.'
40+
end
41+
end
42+
else
43+
puts 'Downloading scanner test suite...'
44+
sh 'git clone https://github.com/rubychan/coderay-scanner-tests.git test/scanners/'
45+
end
3646
end
3747

3848
namespace :scanner do
@@ -72,7 +82,6 @@ namespace :test do
7282
puts "Skipping."
7383
end
7484
end
75-
7685
end
7786

7887
task :test => %w(test:functional test:units test:exe)

0 commit comments

Comments
 (0)