Class: TerraspaceBundler::CLI::PurgeCache
- Inherits:
-
Base
- Object
- Base
- TerraspaceBundler::CLI::PurgeCache
show all
- Includes:
- TB::Mod::Concerns::PathConcern, TB::Util::Logging, TB::Util::Sure
- Defined in:
- lib/terraspace_bundler/cli/purge_cache.rb
Instance Method Summary
collapse
Methods inherited from Base
#initialize, #set_config!
Instance Method Details
#are_you_sure?(paths) ⇒ Boolean
17
18
19
20
21
22
23
24
25
26
27
|
# File 'lib/terraspace_bundler/cli/purge_cache.rb', line 17
def are_you_sure?(paths)
pretty_paths = paths.map { |p| " #{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
7
8
9
10
11
12
13
14
15
|
# File 'lib/terraspace_bundler/cli/purge_cache.rb', line 7
def run
paths = [tmp_root]
are_you_sure?(paths)
paths.each do |path|
FileUtils.rm_rf(path)
logger.info "Removed #{path}"
end
end
|