Clean Temp directories after deploys

This commit is contained in:
ViViDboarder 2013-11-11 14:30:09 -08:00
parent a06a150c09
commit ba855216c7
1 changed files with 42 additions and 13 deletions

View File

@ -35,11 +35,26 @@ module AbuseTheForce
# Get path to temp project directory
temp_path = File.join(Atf_Config.root_dir, TEMP_DIR)
puts "Config path #{temp_path}"
# Clear temp dir
if Dir.exists? temp_path
FileUtils.rm_r temp_path
end
end
# Builds temp path
def self.build_temp
# Get path to temp project directory
temp_path = File.join(Atf_Config.root_dir, TEMP_DIR)
# If a temp dir exists, clear it
if Dir.exists? temp_path
self.clean_temp
end
# Make the directory
FileUtils.mkdir_p temp_path
@ -91,6 +106,11 @@ module AbuseTheForce
# Get path to temp project directory
temp_path = File.join(Atf_Config.root_dir, TEMP_DIR)
# If temp dir doesn't exist make it
unless Dir.exists? temp_path
self.build_temp
end
# Get the metadata directory right before filename
mdir = File.basename(File.dirname(fpath))
@ -261,6 +281,9 @@ module AbuseTheForce
if options[:target] != nil
AbuseTheForce.temp_switch_target
end
# We're done, so clean the path
AbuseTheForce.clean_temp
end
desc "test <path to file>", "Deploy and execute a test class"
@ -292,6 +315,9 @@ module AbuseTheForce
if options[:target] != nil
AbuseTheForce.temp_switch_target
end
# We're done, so clean the path
AbuseTheForce.clean_temp
end
desc "list <path to list>", "Deploy a list of files"
@ -361,6 +387,9 @@ module AbuseTheForce
AbuseTheForce.temp_switch_target
end
end
# We're done, so clean the path
AbuseTheForce.clean_temp
end
desc "project", "Deploy a whole project"