lib/terraspace/cli/clean/logs.rb in terraspace-0.6.18 vs lib/terraspace/cli/clean/logs.rb in terraspace-0.6.19
- old
+ new
@@ -2,19 +2,19 @@
class Logs < Base
def run
action = @options[:truncate] ? "truncate" : "remove"
are_you_sure?(action)
@options[:truncate] ? truncate : remove
- logger.info "Logs #{action}d" # IE: Logs truncated or Logs removed
end
def truncate
log_files.each do |path|
File.open(path, "w").close # truncates files
end
end
def remove
+ return unless File.exist?(log_root)
puts "Removing all files in #{pretty_log_root}/" unless @options[:mute]
FileUtils.rm_rf(log_root)
FileUtils.mkdir_p(log_root)
end