Class: Everywhere::Commands::Clean
- Inherits:
-
Dry::CLI::Command
- Object
- Dry::CLI::Command
- Everywhere::Commands::Clean
- Defined in:
- lib/everywhere/commands/clean.rb
Overview
Wipes the shared build caches under ~/.rubyeverywhere (or
$RUBYEVERYWHERE_HOME): the cargo shell cache plus the iOS DerivedData /
SPM / stamped-project dirs. Safe to run any time: only compiled shell
output lives there, so the next every dev/every build recompiles cold.
Instance Method Summary collapse
Instance Method Details
#call ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/everywhere/commands/clean.rb', line 15 def call(**) caches = [Everywhere::Paths.cargo_target_dir, Everywhere::Paths.ios_derived_data_dir, Everywhere::Paths.ios_packages_dir, File.join(Everywhere::Paths.cache_dir, "ios")].select { |d| File.exist?(d) } return UI.step("nothing to clean #{UI.dim("(no build caches under #{Everywhere::Paths.cache_dir})")}") if caches.empty? freed = 0 caches.each do |dir| bytes = dir_bytes(dir) freed += bytes FileUtils.rm_rf(dir) UI.ok("removed #{dir} #{UI.dim("(#{human_size(bytes)})")}") end UI.success("#{human_size(freed)} freed — the next build recompiles the shells cold") end |