class Terraspace::CLI::Clean::Cache

Public Instance Methods

are_you_sure?(paths) click to toggle source
# File lib/terraspace/cli/clean/cache.rb, line 12
    def are_you_sure?(paths)
      pretty_paths = paths.map { |p| "    #{pretty(p)}" }.join("\n")
      message = <<~EOL.chomp
        Will remove these folders and all their files:

        #{pretty_paths}

        Are you sure?
      EOL
      sure?(message) # from Util::Sure
    end
run() click to toggle source
# File lib/terraspace/cli/clean/cache.rb, line 3
def run
  paths = [Terraspace.cache_root, Terraspace.tmp_root]
  are_you_sure?(paths)
  paths.each do |path|
    FileUtils.rm_rf(path)
    puts "Removed #{pretty(path)}"
  end
end