Class: Pod::Command::Spm::Clean

Inherits:
Pod::Command::Spm show all
Defined in:
lib/cocoapods-spm/command/clean.rb

Constant Summary

Constants inherited from Pod::Command::Spm

Fetch, Prebuild

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Pod::Command::Spm

bind_command, #update_cli_config

Methods included from SPM::Config::SPMConfigMixin

#macro_pods, #spm_config

Methods included from SPM::Config::PodConfigMixin

#pod_config

Methods included from SPM::Config::ProjectConfigMixin

#project_config

Constructor Details

#initialize(argv) ⇒ Clean

Returns a new instance of Clean.



14
15
16
17
18
19
# File 'lib/cocoapods-spm/command/clean.rb', line 14

def initialize(argv)
  super
  @clean_all = argv.flag?("all")
  @clean_macros = argv.flag?("macros")
  @clean_pkgs = argv.flag?("packages")
end

Class Method Details

.optionsObject



6
7
8
9
10
11
12
# File 'lib/cocoapods-spm/command/clean.rb', line 6

def self.options
  [
    ["--all", "Clean all"],
    ["--macros", "Clean macros"],
    ["--packages", "Clean packages"],
  ].concat(super)
end

Instance Method Details

#runObject



21
22
23
24
25
26
27
# File 'lib/cocoapods-spm/command/clean.rb', line 21

def run
  to_clean = []
  to_clean << spm_config.pkg_root_dir if @clean_pkgs
  to_clean << spm_config.macro_root_dir if @clean_macros
  to_clean << spm_config.root_dir if @clean_all
  to_clean.each { |dir| dir.rmtree if dir.exist? }
end