deltacloud-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mfoj...@redhat.com
Subject [PATCH core 1/8] Core: Fix rake mock:fixtures:reset tasks to cleanup correct dir
Date Mon, 18 Feb 2013 13:41:11 GMT
From: Michal Fojtik <mfojtik@redhat.com>


Signed-off-by: Michal fojtik <mfojtik@redhat.com>
---
 server/Rakefile | 23 ++++++-----------------
 1 file changed, 6 insertions(+), 17 deletions(-)

diff --git a/server/Rakefile b/server/Rakefile
index 5494148..4be72ba 100644
--- a/server/Rakefile
+++ b/server/Rakefile
@@ -46,32 +46,21 @@ Gem::PackageTask.new(spec) do |pkg|
   pkg.need_tar = true
 end
 
+require 'require_relative' if RUBY_VERSION < '1.9'
+require_relative 'lib/initializers/mock_initialize'
+
 namespace :mock do
   namespace :fixtures do
     desc "Setup Mock driver fixtures"
     task 'setup' do
-      if ENV["DELTACLOUD_MOCK_STORAGE"]
-        storage_root = ENV["DELTACLOUD_MOCK_STORAGE"]
-      elsif ENV["USER"]
-        storage_root = File::join("/var/tmp", "deltacloud-mock-#{ENV["USER"]}")
-      else
-        raise "Please set either the DELTACLOUD_MOCK_STORAGE or USER environment variable"
-      end
       data = Dir::glob(File::join(File::dirname(__FILE__), "lib", "deltacloud", "drivers",
"mock", "data", "*"))
-      FileUtils::mkdir_p(storage_root, :verbose => true)
-      FileUtils::cp_r(data, storage_root, :verbose => true)
+      FileUtils::mkdir_p(MOCK_STORAGE_DIR, :verbose => true)
+      FileUtils::cp_r(data, MOCK_STORAGE_DIR, :verbose => true)
     end
 
     desc "Remove Mock driver fixtures"
     task 'clean' do
-      if ENV["DELTACLOUD_MOCK_STORAGE"]
-        storage_root = ENV["DELTACLOUD_MOCK_STORAGE"]
-      elsif ENV["USER"]
-        storage_root = File::join("/var/tmp", "deltacloud-mock-#{ENV["USER"]}")
-      else
-        raise "Please set either the DELTACLOUD_MOCK_STORAGE or USER environment variable"
-      end
-      FileUtils::rm_rf(storage_root, :verbose => true)
+      FileUtils::rm_rf(MOCK_STORAGE_DIR, :verbose => true)
     end
 
     desc "Reset Mock driver fixtures"
-- 
1.8.1.2


Mime
View raw message