class Pod::Installer::ProjectCache::ProjectInstallationCache

Represents the cache stored at Pods/.project/installation_cache

Attributes

build_configurations[R]

@return [Hash{String => Symbol}]

Build configurations stored in the cache.
cache_key_by_target_label[R]

@return [Hash{String => TargetCacheKey}]

Stored hash of target cache key objects for every pod target.
installation_options[R]

@return [Hash<Symbol, Object>]

Configured installation options
podfile_plugins[R]

@return [Hash<String, Hash>]

Podfile plugins used with a particular install.
project_object_version[R]

@return [Integer]

Project object stored in the cache.

Public Class Methods

from_file(sandbox, path) click to toggle source
# File lib/cocoapods/installer/project_cache/project_installation_cache.rb, line 75
def self.from_file(sandbox, path)
  return ProjectInstallationCache.new unless File.exist?(path)
  contents = YAMLHelper.load_file(path)
  cache_keys = contents.fetch('CACHE_KEYS', {})
  cache_key_by_target_label = Hash[cache_keys.map do |name, key_hash|
    [name, TargetCacheKey.from_cache_hash(sandbox, key_hash)]
  end]
  project_object_version = contents['OBJECT_VERSION']
  build_configurations = contents['BUILD_CONFIGURATIONS']
  podfile_plugins = contents['PLUGINS']
  installation_options = contents['INSTALLATION_OPTIONS']
  ProjectInstallationCache.new(cache_key_by_target_label, build_configurations, project_object_version, podfile_plugins, installation_options)
end
new(cache_key_by_target_label = {}, build_configurations = nil, project_object_version = nil, podfile_plugins = {}, installation_options = {}) click to toggle source

Initializes a new instance.

@param [Hash{String => TargetCacheKey}] cache_key_by_target_label @see cache_key_by_target_label @param [Hash{String => Symbol}] build_configurations @see build_configurations @param [Integer] project_object_version @see project_object_version @param [Hash<String, Hash>] podfile_plugins @see podfile_plugins @param [Hash<Symbol, Object>] installation_options @see installation_options

# File lib/cocoapods/installer/project_cache/project_installation_cache.rb, line 42
def initialize(cache_key_by_target_label = {}, build_configurations = nil, project_object_version = nil, podfile_plugins = {}, installation_options = {})
  @cache_key_by_target_label = cache_key_by_target_label
  @build_configurations = build_configurations
  @project_object_version = project_object_version
  @podfile_plugins = podfile_plugins
  @installation_options = installation_options
end

Public Instance Methods

save_as(path) click to toggle source
# File lib/cocoapods/installer/project_cache/project_installation_cache.rb, line 70
def save_as(path)
  Pathname(path).dirname.mkpath
  Sandbox.update_changed_file(path, YAMLHelper.convert(to_hash))
end
to_hash() click to toggle source
# File lib/cocoapods/installer/project_cache/project_installation_cache.rb, line 89
def to_hash
  cache_key_contents = Hash[cache_key_by_target_label.map do |label, key|
    [label, key.to_h]
  end]
  contents = { 'CACHE_KEYS' => cache_key_contents }
  contents['BUILD_CONFIGURATIONS'] = build_configurations if build_configurations
  contents['OBJECT_VERSION'] = project_object_version if project_object_version
  contents['PLUGINS'] = podfile_plugins if podfile_plugins
  contents['INSTALLATION_OPTIONS'] = installation_options if installation_options
  contents
end
update_build_configurations!(build_configurations) click to toggle source
# File lib/cocoapods/installer/project_cache/project_installation_cache.rb, line 54
def update_build_configurations!(build_configurations)
  @build_configurations = build_configurations
end
update_cache_key_by_target_label!(cache_key_by_target_label) click to toggle source
# File lib/cocoapods/installer/project_cache/project_installation_cache.rb, line 50
def update_cache_key_by_target_label!(cache_key_by_target_label)
  @cache_key_by_target_label = cache_key_by_target_label
end
update_installation_options!(installation_options) click to toggle source
# File lib/cocoapods/installer/project_cache/project_installation_cache.rb, line 66
def update_installation_options!(installation_options)
  @installation_options = installation_options
end
update_podfile_plugins!(podfile_plugins) click to toggle source
# File lib/cocoapods/installer/project_cache/project_installation_cache.rb, line 62
def update_podfile_plugins!(podfile_plugins)
  @podfile_plugins = podfile_plugins
end
update_project_object_version!(project_object_version) click to toggle source
# File lib/cocoapods/installer/project_cache/project_installation_cache.rb, line 58
def update_project_object_version!(project_object_version)
  @project_object_version = project_object_version
end