1
1
namespace :test do
2
-
3
2
desc 'run all sample tests'
4
3
task :samples do
5
4
ruby './sample/suite.rb'
@@ -17,22 +16,33 @@ namespace :test do
17
16
end
18
17
19
18
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
-
28
19
desc 'run all scanner tests'
29
20
task :scanners => :update_scanner_suite do
30
21
ruby scanner_suite
31
22
end
32
23
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
36
46
end
37
47
38
48
namespace :scanner do
@@ -72,7 +82,6 @@ namespace :test do
72
82
puts "Skipping."
73
83
end
74
84
end
75
-
76
85
end
77
86
78
87
task :test => %w( test:functional test:units test:exe )
0 commit comments