Class: Pod::Tdfire::BinaryCacheCleaner
- Inherits:
-
Object
- Object
- Pod::Tdfire::BinaryCacheCleaner
- Defined in:
- lib/cocoapods-tdfire-binary/binary_cache_cleaner.rb
Instance Attribute Summary collapse
-
#use_binary_specs ⇒ Object
readonly
Returns the value of attribute use_binary_specs.
Instance Method Summary collapse
- #clean! ⇒ Object
-
#initialize(analysis_result) ⇒ BinaryCacheCleaner
constructor
A new instance of BinaryCacheCleaner.
- #no_binary_specs ⇒ Object
Constructor Details
#initialize(analysis_result) ⇒ BinaryCacheCleaner
Returns a new instance of BinaryCacheCleaner.
30 31 32 33 |
# File 'lib/cocoapods-tdfire-binary/binary_cache_cleaner.rb', line 30 def initialize(analysis_result) @analysis_result = analysis_result @use_binary_specs = analysis_result.specifications.uniq { |s| s.root.name }.reject(&:tdfire_use_source?) end |
Instance Attribute Details
#use_binary_specs ⇒ Object (readonly)
Returns the value of attribute use_binary_specs.
28 29 30 |
# File 'lib/cocoapods-tdfire-binary/binary_cache_cleaner.rb', line 28 def use_binary_specs @use_binary_specs end |
Instance Method Details
#clean! ⇒ Object
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/cocoapods-tdfire-binary/binary_cache_cleaner.rb', line 35 def clean! # 判断有效组件的 cache 中是否有二进制,没有的话,删除组件缓存 specs = use_binary_specs - no_binary_specs return if specs.empty? UI.section 'Tdfire: 处理没有二进制版本的组件' do specs.each do |s| # 处理 cache clean_pod_cache(s) # 处理 Pods clean_local_cache(s) end end end |
#no_binary_specs ⇒ Object
52 53 54 55 56 57 58 59 60 61 |
# File 'lib/cocoapods-tdfire-binary/binary_cache_cleaner.rb', line 52 def no_binary_specs @invalid_specs ||= begin use_binary_specs.reject do |s| json_string = Pod::Tdfire::BinaryUrlManager.search_binary(s.root.name) pod = JSON.parse(json_string, object_class: OpenStruct) versions = pod.versions || [] versions.include?(s.version.to_s) end end end |