Class: Pod::Command::Bin::Clean
- Inherits:
-
Pod::Command::Bin
- Object
- Pod::Command
- Pod::Command::Bin
- Pod::Command::Bin::Clean
- Defined in:
- lib/cocoapods-meitu-bin/native/clean.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(argv) ⇒ Clean
constructor
A new instance of Clean.
- #run ⇒ Object
Methods included from CBin::SpecFilesHelper
#binary_spec, #binary_spec_files, #binary_template_spec, #binary_template_spec_file, #binary_template_spec_files, #clear_binary_spec_file_if_needed, #code_spec, #code_spec_files, #create_binary_spec_file, #find_spec_file, #spec_files
Methods included from CBin::SourcesHelper
#binary_source, #code_source_list, #sources_manager, #sources_option, #valid_sources
Constructor Details
#initialize(argv) ⇒ Clean
Returns a new instance of Clean.
20 21 22 23 24 |
# File 'lib/cocoapods-meitu-bin/native/clean.rb', line 20 def initialize(argv) @all = argv.flag?('all', false) # @no_need = argv.flag?('no-need', false) super end |
Class Method Details
.options ⇒ Object
13 14 15 16 17 18 |
# File 'lib/cocoapods-meitu-bin/native/clean.rb', line 13 def self. [ %w[--all 移除全部二进制版本缓存], # %w[--no-need 移除除了当前需要的版本外的其他版本二进制版本缓存] ].concat(super).uniq end |
Instance Method Details
#run ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/cocoapods-meitu-bin/native/clean.rb', line 26 def run cache = Downloader::Cache.new(Pod::Config.instance.cache_root + 'Pods') all_del_cache_size=0 cache.cache_descriptors_per_pod.each do |pod_name, cache_descriptors| del_cache_descriptors = [] del_cache_versions = [] current_pod_name_del_cache_size=0 cache_descriptors.each do |desc| # version 包含 bin if desc[:version].to_s.include?('bin') if @all current_pod_name_del_cache_size += folder_size(desc[:slug]) del_cache_descriptors << desc del_cache_versions << desc[:version] end end end all_del_cache_size+=current_pod_name_del_cache_size size = format_size(current_pod_name_del_cache_size) Pod::UI.puts "#{pod_name}删除#{del_cache_versions}共#{size}" remove_caches(del_cache_descriptors) end size = format_size(all_del_cache_size) Pod::UI.puts "共删除#{size}二进制版本pod缓存".red end |