Class: XCCache::Command::Cache::Clean
Instance Attribute Summary
#build_options, #install_options
Class Method Summary
collapse
Instance Method Summary
collapse
#str_to_sdks
#config
Constructor Details
#initialize(argv) ⇒ Clean
14
15
16
17
18
19
|
# File 'lib/xccache/command/cache/clean.rb', line 14
def initialize(argv)
super
@all = argv.flag?("all")
@dry = argv.flag?("dry")
@targets = argv.arguments!
end
|
Class Method Details
.options ⇒ Object
7
8
9
10
11
12
|
# File 'lib/xccache/command/cache/clean.rb', line 7
def self.options
[
["--all", "Whether to remove all cache (default: false)"],
["--dry", "Dry run - don't remove cache, just show what shall be removed (default: false)"],
].concat(super)
end
|
Instance Method Details
#run ⇒ Object
21
22
23
24
25
26
27
28
|
# File 'lib/xccache/command/cache/clean.rb', line 21
def run
to_remove = @targets.flat_map { |t| config.spm_cache_dir.glob("#{t}/*") }
to_remove = config.spm_cache_dir.glob("*/*") if @all
to_remove.each do |p|
UI.info("Removing #{p.basename.to_s.yellow}")
p.rmtree unless @dry
end
end
|