From: Michal Fojtik <mfoj...@redhat.com>
Signed-off-by: Michal fojtik <mfoj...@redhat.com> --- server/Rakefile | 23 ++++++----------------- 1 file changed, 6 insertions(+), 17 deletions(-) diff --git a/server/Rakefile b/server/Rakefile index 5938b9e..2a52ec2 100644 --- a/server/Rakefile +++ b/server/Rakefile @@ -56,32 +56,21 @@ namespace :db do end 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