Prevent test:scm:setup:* task to overwrite if the test repository already exists.

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@9049 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang 2012-03-01 21:01:37 +00:00
parent f1358200d6
commit 55bbfa19b6
1 changed files with 13 additions and 7 deletions

View File

@ -36,25 +36,31 @@ namespace :test do
desc "Creates a test subversion repository" desc "Creates a test subversion repository"
task :subversion => :create_dir do task :subversion => :create_dir do
repo_path = "tmp/test/subversion_repository" repo_path = "tmp/test/subversion_repository"
unless File.exists?(repo_path)
system "svnadmin create #{repo_path}" system "svnadmin create #{repo_path}"
system "gunzip < test/fixtures/repositories/subversion_repository.dump.gz | svnadmin load #{repo_path}" system "gunzip < test/fixtures/repositories/subversion_repository.dump.gz | svnadmin load #{repo_path}"
end end
end
desc "Creates a test mercurial repository" desc "Creates a test mercurial repository"
task :mercurial => :create_dir do task :mercurial => :create_dir do
repo_path = "tmp/test/mercurial_repository" repo_path = "tmp/test/mercurial_repository"
unless File.exists?(repo_path)
bundle_path = "test/fixtures/repositories/mercurial_repository.hg" bundle_path = "test/fixtures/repositories/mercurial_repository.hg"
system "hg init #{repo_path}" system "hg init #{repo_path}"
system "hg -R #{repo_path} pull #{bundle_path}" system "hg -R #{repo_path} pull #{bundle_path}"
end end
end
(supported_scms - [:subversion, :mercurial]).each do |scm| (supported_scms - [:subversion, :mercurial]).each do |scm|
desc "Creates a test #{scm} repository" desc "Creates a test #{scm} repository"
task scm => :create_dir do task scm => :create_dir do
unless File.exists?("tmp/test/#{scm}_repository")
# system "gunzip < test/fixtures/repositories/#{scm}_repository.tar.gz | tar -xv -C tmp/test" # system "gunzip < test/fixtures/repositories/#{scm}_repository.tar.gz | tar -xv -C tmp/test"
system "tar -xvz -C tmp/test -f test/fixtures/repositories/#{scm}_repository.tar.gz" system "tar -xvz -C tmp/test -f test/fixtures/repositories/#{scm}_repository.tar.gz"
end end
end end
end
desc "Creates all test repositories" desc "Creates all test repositories"
task :all => supported_scms task :all => supported_scms