##// END OF EJS Templates
fix "test:routing" rake task comment changed by r13604...
Toshi MARUYAMA -
r13231:5d4ab52a665d
parent child
Show More
@@ -1,114 +1,114
1 ### From http://svn.geekdaily.org/public/rails/plugins/generally_useful/tasks/coverage_via_rcov.rake
1 ### From http://svn.geekdaily.org/public/rails/plugins/generally_useful/tasks/coverage_via_rcov.rake
2
2
3 namespace :test do
3 namespace :test do
4 desc 'Measures test coverage'
4 desc 'Measures test coverage'
5 task :coverage do
5 task :coverage do
6 rm_f "coverage"
6 rm_f "coverage"
7 rm_f "coverage.data"
7 rm_f "coverage.data"
8 rcov = "rcov --rails --aggregate coverage.data --text-summary -Ilib --html --exclude gems/"
8 rcov = "rcov --rails --aggregate coverage.data --text-summary -Ilib --html --exclude gems/"
9 files = %w(unit functional integration).map {|dir| Dir.glob("test/#{dir}/**/*_test.rb")}.flatten.join(" ")
9 files = %w(unit functional integration).map {|dir| Dir.glob("test/#{dir}/**/*_test.rb")}.flatten.join(" ")
10 system("#{rcov} #{files}")
10 system("#{rcov} #{files}")
11 end
11 end
12
12
13 desc 'Run unit and functional scm tests'
13 desc 'Run unit and functional scm tests'
14 task :scm do
14 task :scm do
15 errors = %w(test:scm:units test:scm:functionals).collect do |task|
15 errors = %w(test:scm:units test:scm:functionals).collect do |task|
16 begin
16 begin
17 Rake::Task[task].invoke
17 Rake::Task[task].invoke
18 nil
18 nil
19 rescue => e
19 rescue => e
20 task
20 task
21 end
21 end
22 end.compact
22 end.compact
23 abort "Errors running #{errors.to_sentence(:locale => :en)}!" if errors.any?
23 abort "Errors running #{errors.to_sentence(:locale => :en)}!" if errors.any?
24 end
24 end
25
25
26 namespace :scm do
26 namespace :scm do
27 namespace :setup do
27 namespace :setup do
28 desc "Creates directory for test repositories"
28 desc "Creates directory for test repositories"
29 task :create_dir => :environment do
29 task :create_dir => :environment do
30 FileUtils.mkdir_p Rails.root + '/tmp/test'
30 FileUtils.mkdir_p Rails.root + '/tmp/test'
31 end
31 end
32
32
33 supported_scms = [:subversion, :cvs, :bazaar, :mercurial, :git, :darcs, :filesystem]
33 supported_scms = [:subversion, :cvs, :bazaar, :mercurial, :git, :darcs, :filesystem]
34
34
35 desc "Creates a test subversion repository"
35 desc "Creates a test subversion repository"
36 task :subversion => :create_dir do
36 task :subversion => :create_dir do
37 repo_path = "tmp/test/subversion_repository"
37 repo_path = "tmp/test/subversion_repository"
38 unless File.exists?(repo_path)
38 unless File.exists?(repo_path)
39 system "svnadmin create #{repo_path}"
39 system "svnadmin create #{repo_path}"
40 system "gunzip < test/fixtures/repositories/subversion_repository.dump.gz | svnadmin load #{repo_path}"
40 system "gunzip < test/fixtures/repositories/subversion_repository.dump.gz | svnadmin load #{repo_path}"
41 end
41 end
42 end
42 end
43
43
44 desc "Creates a test mercurial repository"
44 desc "Creates a test mercurial repository"
45 task :mercurial => :create_dir do
45 task :mercurial => :create_dir do
46 repo_path = "tmp/test/mercurial_repository"
46 repo_path = "tmp/test/mercurial_repository"
47 unless File.exists?(repo_path)
47 unless File.exists?(repo_path)
48 bundle_path = "test/fixtures/repositories/mercurial_repository.hg"
48 bundle_path = "test/fixtures/repositories/mercurial_repository.hg"
49 system "hg init #{repo_path}"
49 system "hg init #{repo_path}"
50 system "hg -R #{repo_path} pull #{bundle_path}"
50 system "hg -R #{repo_path} pull #{bundle_path}"
51 end
51 end
52 end
52 end
53
53
54 def extract_tar_gz(prefix)
54 def extract_tar_gz(prefix)
55 unless File.exists?("tmp/test/#{prefix}_repository")
55 unless File.exists?("tmp/test/#{prefix}_repository")
56 # system "gunzip < test/fixtures/repositories/#{prefix}_repository.tar.gz | tar -xv -C tmp/test"
56 # system "gunzip < test/fixtures/repositories/#{prefix}_repository.tar.gz | tar -xv -C tmp/test"
57 system "tar -xvz -C tmp/test -f test/fixtures/repositories/#{prefix}_repository.tar.gz"
57 system "tar -xvz -C tmp/test -f test/fixtures/repositories/#{prefix}_repository.tar.gz"
58 end
58 end
59 end
59 end
60
60
61 (supported_scms - [:subversion, :mercurial]).each do |scm|
61 (supported_scms - [:subversion, :mercurial]).each do |scm|
62 desc "Creates a test #{scm} repository"
62 desc "Creates a test #{scm} repository"
63 task scm => :create_dir do
63 task scm => :create_dir do
64 extract_tar_gz(scm)
64 extract_tar_gz(scm)
65 end
65 end
66 end
66 end
67
67
68 desc "Creates all test repositories"
68 desc "Creates all test repositories"
69 task :all => supported_scms
69 task :all => supported_scms
70 end
70 end
71
71
72 desc "Updates installed test repositories"
72 desc "Updates installed test repositories"
73 task :update => :environment do
73 task :update => :environment do
74 require 'fileutils'
74 require 'fileutils'
75 Dir.glob("tmp/test/*_repository").each do |dir|
75 Dir.glob("tmp/test/*_repository").each do |dir|
76 next unless File.basename(dir) =~ %r{^(.+)_repository$} && File.directory?(dir)
76 next unless File.basename(dir) =~ %r{^(.+)_repository$} && File.directory?(dir)
77 scm = $1
77 scm = $1
78 next unless fixture = Dir.glob("test/fixtures/repositories/#{scm}_repository.*").first
78 next unless fixture = Dir.glob("test/fixtures/repositories/#{scm}_repository.*").first
79 next if File.stat(dir).ctime > File.stat(fixture).mtime
79 next if File.stat(dir).ctime > File.stat(fixture).mtime
80
80
81 FileUtils.rm_rf dir
81 FileUtils.rm_rf dir
82 Rake::Task["test:scm:setup:#{scm}"].execute
82 Rake::Task["test:scm:setup:#{scm}"].execute
83 end
83 end
84 end
84 end
85
85
86 Rake::TestTask.new(:units => "db:test:prepare") do |t|
86 Rake::TestTask.new(:units => "db:test:prepare") do |t|
87 t.libs << "test"
87 t.libs << "test"
88 t.verbose = true
88 t.verbose = true
89 t.test_files = FileList['test/unit/repository*_test.rb'] + FileList['test/unit/lib/redmine/scm/**/*_test.rb']
89 t.test_files = FileList['test/unit/repository*_test.rb'] + FileList['test/unit/lib/redmine/scm/**/*_test.rb']
90 end
90 end
91 Rake::Task['test:scm:units'].comment = "Run the scm unit tests"
91 Rake::Task['test:scm:units'].comment = "Run the scm unit tests"
92
92
93 Rake::TestTask.new(:functionals => "db:test:prepare") do |t|
93 Rake::TestTask.new(:functionals => "db:test:prepare") do |t|
94 t.libs << "test"
94 t.libs << "test"
95 t.verbose = true
95 t.verbose = true
96 t.test_files = FileList['test/functional/repositories*_test.rb']
96 t.test_files = FileList['test/functional/repositories*_test.rb']
97 end
97 end
98 Rake::Task['test:scm:functionals'].comment = "Run the scm functional tests"
98 Rake::Task['test:scm:functionals'].comment = "Run the scm functional tests"
99 end
99 end
100
100
101 Rake::TestTask.new(:routing) do |t|
101 Rake::TestTask.new(:routing) do |t|
102 t.libs << "test"
102 t.libs << "test"
103 t.verbose = true
103 t.verbose = true
104 t.test_files = FileList['test/integration/routing/*_test.rb'] + FileList['test/integration/api_test/*_routing_test.rb']
104 t.test_files = FileList['test/integration/routing/*_test.rb'] + FileList['test/integration/api_test/*_routing_test.rb']
105 end
105 end
106 Rake::Task['test:rdm_routing'].comment = "Run the routing tests"
106 Rake::Task['test:routing'].comment = "Run the routing tests"
107
107
108 Rake::TestTask.new(:ui => "db:test:prepare") do |t|
108 Rake::TestTask.new(:ui => "db:test:prepare") do |t|
109 t.libs << "test"
109 t.libs << "test"
110 t.verbose = true
110 t.verbose = true
111 t.test_files = FileList['test/ui/**/*_test.rb']
111 t.test_files = FileList['test/ui/**/*_test.rb']
112 end
112 end
113 Rake::Task['test:ui'].comment = "Run the UI tests with Capybara (PhantomJS listening on port 4444 is required)"
113 Rake::Task['test:ui'].comment = "Run the UI tests with Capybara (PhantomJS listening on port 4444 is required)"
114 end
114 end
General Comments 0
You need to be logged in to leave comments. Login now