Class: Terraspace::CLI::Clean::Cache
- Inherits:
-
Base
- Object
- Base
- Terraspace::CLI::Clean::Cache
show all
- Defined in:
- lib/terraspace/cli/clean/cache.rb
Instance Method Summary
collapse
Methods inherited from Base
#initialize, #pretty
Methods included from Util::Sure
#sure?
#logger
Instance Method Details
#are_you_sure?(paths) ⇒ Boolean
12
13
14
15
16
17
18
19
20
21
22
|
# 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) end
|
#run ⇒ Object
3
4
5
6
7
8
9
10
|
# 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
|