@@ -30,16 +30,16 namespace :test do | |||||
30 | task :create_dir do |
|
30 | task :create_dir do | |
31 | FileUtils.mkdir_p Rails.root + '/tmp/test' |
|
31 | FileUtils.mkdir_p Rails.root + '/tmp/test' | |
32 | end |
|
32 | end | |
33 |
|
33 | |||
34 | supported_scms = [:subversion, :cvs, :bazaar, :mercurial, :git, :darcs, :filesystem] |
|
34 | supported_scms = [:subversion, :cvs, :bazaar, :mercurial, :git, :darcs, :filesystem] | |
35 |
|
35 | |||
36 | desc "Creates a test subversion repository" |
|
36 | desc "Creates a test subversion repository" | |
37 | task :subversion => :create_dir do |
|
37 | task :subversion => :create_dir do | |
38 | repo_path = "tmp/test/subversion_repository" |
|
38 | repo_path = "tmp/test/subversion_repository" | |
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 |
|
42 | |||
43 | desc "Creates a test mercurial repository" |
|
43 | desc "Creates a test mercurial repository" | |
44 | task :mercurial => :create_dir do |
|
44 | task :mercurial => :create_dir do | |
45 | repo_path = "tmp/test/mercurial_repository" |
|
45 | repo_path = "tmp/test/mercurial_repository" | |
@@ -47,7 +47,7 namespace :test do | |||||
47 | system "hg init #{repo_path}" |
|
47 | system "hg init #{repo_path}" | |
48 | system "hg -R #{repo_path} pull #{bundle_path}" |
|
48 | system "hg -R #{repo_path} pull #{bundle_path}" | |
49 | end |
|
49 | end | |
50 |
|
50 | |||
51 | (supported_scms - [:subversion, :mercurial]).each do |scm| |
|
51 | (supported_scms - [:subversion, :mercurial]).each do |scm| | |
52 | desc "Creates a test #{scm} repository" |
|
52 | desc "Creates a test #{scm} repository" | |
53 | task scm => :create_dir do |
|
53 | task scm => :create_dir do | |
@@ -55,11 +55,11 namespace :test do | |||||
55 | system "tar -xvz -C tmp/test -f test/fixtures/repositories/#{scm}_repository.tar.gz" |
|
55 | system "tar -xvz -C tmp/test -f test/fixtures/repositories/#{scm}_repository.tar.gz" | |
56 | end |
|
56 | end | |
57 | end |
|
57 | end | |
58 |
|
58 | |||
59 | desc "Creates all test repositories" |
|
59 | desc "Creates all test repositories" | |
60 | task :all => supported_scms |
|
60 | task :all => supported_scms | |
61 | end |
|
61 | end | |
62 |
|
62 | |||
63 | desc "Updates installed test repositories" |
|
63 | desc "Updates installed test repositories" | |
64 | task :update do |
|
64 | task :update do | |
65 | require 'fileutils' |
|
65 | require 'fileutils' | |
@@ -68,19 +68,19 namespace :test do | |||||
68 | scm = $1 |
|
68 | scm = $1 | |
69 | next unless fixture = Dir.glob("test/fixtures/repositories/#{scm}_repository.*").first |
|
69 | next unless fixture = Dir.glob("test/fixtures/repositories/#{scm}_repository.*").first | |
70 | next if File.stat(dir).ctime > File.stat(fixture).mtime |
|
70 | next if File.stat(dir).ctime > File.stat(fixture).mtime | |
71 |
|
71 | |||
72 | FileUtils.rm_rf dir |
|
72 | FileUtils.rm_rf dir | |
73 | Rake::Task["test:scm:setup:#{scm}"].execute |
|
73 | Rake::Task["test:scm:setup:#{scm}"].execute | |
74 | end |
|
74 | end | |
75 | end |
|
75 | end | |
76 |
|
76 | |||
77 | Rake::TestTask.new(:units => "db:test:prepare") do |t| |
|
77 | Rake::TestTask.new(:units => "db:test:prepare") do |t| | |
78 | t.libs << "test" |
|
78 | t.libs << "test" | |
79 | t.verbose = true |
|
79 | t.verbose = true | |
80 | t.test_files = FileList['test/unit/repository*_test.rb'] + FileList['test/unit/lib/redmine/scm/**/*_test.rb'] |
|
80 | t.test_files = FileList['test/unit/repository*_test.rb'] + FileList['test/unit/lib/redmine/scm/**/*_test.rb'] | |
81 | end |
|
81 | end | |
82 | Rake::Task['test:scm:units'].comment = "Run the scm unit tests" |
|
82 | Rake::Task['test:scm:units'].comment = "Run the scm unit tests" | |
83 |
|
83 | |||
84 | Rake::TestTask.new(:functionals => "db:test:prepare") do |t| |
|
84 | Rake::TestTask.new(:functionals => "db:test:prepare") do |t| | |
85 | t.libs << "test" |
|
85 | t.libs << "test" | |
86 | t.verbose = true |
|
86 | t.verbose = true |
General Comments 0
You need to be logged in to leave comments.
Login now