From 55bbfa19b6ed97ec16ea5859a2e35a48ccd960a1 Mon Sep 17 00:00:00 2001 From: Jean-Philippe Lang Date: Thu, 1 Mar 2012 21:01:37 +0000 Subject: [PATCH] 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 --- lib/tasks/testing.rake | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/lib/tasks/testing.rake b/lib/tasks/testing.rake index 933962e10..513d2be8b 100644 --- a/lib/tasks/testing.rake +++ b/lib/tasks/testing.rake @@ -36,23 +36,29 @@ namespace :test do desc "Creates a test subversion repository" task :subversion => :create_dir do repo_path = "tmp/test/subversion_repository" - system "svnadmin create #{repo_path}" - system "gunzip < test/fixtures/repositories/subversion_repository.dump.gz | svnadmin load #{repo_path}" + unless File.exists?(repo_path) + system "svnadmin create #{repo_path}" + system "gunzip < test/fixtures/repositories/subversion_repository.dump.gz | svnadmin load #{repo_path}" + end end desc "Creates a test mercurial repository" task :mercurial => :create_dir do repo_path = "tmp/test/mercurial_repository" - bundle_path = "test/fixtures/repositories/mercurial_repository.hg" - system "hg init #{repo_path}" - system "hg -R #{repo_path} pull #{bundle_path}" + unless File.exists?(repo_path) + bundle_path = "test/fixtures/repositories/mercurial_repository.hg" + system "hg init #{repo_path}" + system "hg -R #{repo_path} pull #{bundle_path}" + end end (supported_scms - [:subversion, :mercurial]).each do |scm| desc "Creates a test #{scm} repository" task scm => :create_dir do - # 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" + unless File.exists?("tmp/test/#{scm}_repository") + # 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" + end end end