class PodPrebuild::CacheValidationResult
Attributes
hit[R]
missed_with_reasons[R]
Public Class Methods
new(missed_with_reasons = {}, hit = Set.new)
click to toggle source
# File lib/cocoapods-binary-cache/cache/validation_result.rb, line 5 def initialize(missed_with_reasons = {}, hit = Set.new) @missed_with_reasons = missed_with_reasons @hit = hit.to_set - missed_with_reasons.keys end
Public Instance Methods
all()
click to toggle source
# File lib/cocoapods-binary-cache/cache/validation_result.rb, line 10 def all (hit + missed).to_set end
discard(names)
click to toggle source
# File lib/cocoapods-binary-cache/cache/validation_result.rb, line 50 def discard(names) base_names = names.map { |name| name.split("/")[0] }.to_set reject { |name| base_names.include?(name.split("/")[0]) } end
hit?(name)
click to toggle source
# File lib/cocoapods-binary-cache/cache/validation_result.rb, line 22 def hit?(name) @hit.include?(name) end
include?(name)
click to toggle source
# File lib/cocoapods-binary-cache/cache/validation_result.rb, line 26 def include?(name) missed?(name) || hit?(name) end
keep(names)
click to toggle source
# File lib/cocoapods-binary-cache/cache/validation_result.rb, line 45 def keep(names) base_names = names.map { |name| name.split("/")[0] }.to_set select { |name| base_names.include?(name.split("/")[0]) } end
merge(other)
click to toggle source
# File lib/cocoapods-binary-cache/cache/validation_result.rb, line 30 def merge(other) PodPrebuild::CacheValidationResult.new( @missed_with_reasons.merge(other.missed_with_reasons), @hit + other.hit ) end
missed()
click to toggle source
# File lib/cocoapods-binary-cache/cache/validation_result.rb, line 14 def missed @missed_with_reasons.keys.to_set end
missed?(name)
click to toggle source
# File lib/cocoapods-binary-cache/cache/validation_result.rb, line 18 def missed?(name) @missed_with_reasons.key?(name) end
print_summary()
click to toggle source
# File lib/cocoapods-binary-cache/cache/validation_result.rb, line 66 def print_summary Pod::UI.puts "Cache validation: hit (#{@hit.count}) #{@hit.to_a}" @missed_with_reasons.each do |name, reason| Pod::UI.puts "Cache validation: missed #{name}. Reason: #{reason}".yellow end end
reject(&predicate)
click to toggle source
# File lib/cocoapods-binary-cache/cache/validation_result.rb, line 62 def reject(&predicate) select { |name| !predicate.call(name) } end
select(&predicate)
click to toggle source
# File lib/cocoapods-binary-cache/cache/validation_result.rb, line 55 def select(&predicate) PodPrebuild::CacheValidationResult.new( @missed_with_reasons.select { |name, _| predicate.call(name) }, @hit.select(&predicate) ) end
update_to(path)
click to toggle source
# File lib/cocoapods-binary-cache/cache/validation_result.rb, line 37 def update_to(path) FileUtils.mkdir_p(File.dirname(path)) json_file = PodPrebuild::JSONFile.new(path) json_file["cache_missed"] = missed.to_a json_file["cache_hit"] = hit.to_a json_file.save! end