Class: Pod::Installer::ProjectCache::ProjectInstallationCache
- Inherits:
-
Object
- Object
- Pod::Installer::ProjectCache::ProjectInstallationCache
- Defined in:
- lib/cocoapods/installer/project_cache/project_installation_cache.rb
Overview
Represents the cache stored at Pods/.project/installation_cache
Instance Attribute Summary collapse
-
#build_configurations ⇒ Hash{String => Symbol}
readonly
Build configurations stored in the cache.
-
#cache_key_by_target_label ⇒ Hash{String => TargetCacheKey}
readonly
Stored hash of target cache key objects for every pod target.
-
#podfile_plugins ⇒ Hash<String, Hash>
readonly
Podfile plugins used with a particular install.
-
#project_object_version ⇒ Integer
readonly
Project object stored in the cache.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(cache_key_by_target_label = {}, build_configurations = nil, project_object_version = nil, podfile_plugins = {}) ⇒ ProjectInstallationCache
constructor
Initializes a new instance.
- #save_as(path) ⇒ Object
- #to_hash ⇒ Object
- #update_build_configurations!(build_configurations) ⇒ Object
- #update_cache_key_by_target_label!(cache_key_by_target_label) ⇒ Object
- #update_podfile_plugins!(podfile_plugins) ⇒ Object
- #update_project_object_version!(project_object_version) ⇒ Object
Constructor Details
#initialize(cache_key_by_target_label = {}, build_configurations = nil, project_object_version = nil, podfile_plugins = {}) ⇒ ProjectInstallationCache
Initializes a new instance.
36 37 38 39 40 41 |
# File 'lib/cocoapods/installer/project_cache/project_installation_cache.rb', line 36 def initialize(cache_key_by_target_label = {}, build_configurations = nil, project_object_version = nil, podfile_plugins = {}) @cache_key_by_target_label = cache_key_by_target_label @build_configurations = build_configurations @project_object_version = project_object_version @podfile_plugins = podfile_plugins end |
Instance Attribute Details
#build_configurations ⇒ Hash{String => Symbol} (readonly)
Returns Build configurations stored in the cache.
17 18 19 |
# File 'lib/cocoapods/installer/project_cache/project_installation_cache.rb', line 17 def build_configurations @build_configurations end |
#cache_key_by_target_label ⇒ Hash{String => TargetCacheKey} (readonly)
Returns Stored hash of target cache key objects for every pod target.
12 13 14 |
# File 'lib/cocoapods/installer/project_cache/project_installation_cache.rb', line 12 def cache_key_by_target_label @cache_key_by_target_label end |
#podfile_plugins ⇒ Hash<String, Hash> (readonly)
Returns Podfile plugins used with a particular install.
27 28 29 |
# File 'lib/cocoapods/installer/project_cache/project_installation_cache.rb', line 27 def podfile_plugins @podfile_plugins end |
#project_object_version ⇒ Integer (readonly)
Returns Project object stored in the cache.
22 23 24 |
# File 'lib/cocoapods/installer/project_cache/project_installation_cache.rb', line 22 def project_object_version @project_object_version end |
Class Method Details
.from_file(sandbox, path) ⇒ Object
64 65 66 67 68 69 70 71 72 73 74 75 |
# File 'lib/cocoapods/installer/project_cache/project_installation_cache.rb', line 64 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'] ProjectInstallationCache.new(cache_key_by_target_label, build_configurations, project_object_version, podfile_plugins) end |
Instance Method Details
#save_as(path) ⇒ Object
59 60 61 62 |
# File 'lib/cocoapods/installer/project_cache/project_installation_cache.rb', line 59 def save_as(path) Pathname(path).dirname.mkpath Sandbox.update_changed_file(path, YAMLHelper.convert(to_hash)) end |
#to_hash ⇒ Object
77 78 79 80 81 82 83 84 85 86 |
# File 'lib/cocoapods/installer/project_cache/project_installation_cache.rb', line 77 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 end |
#update_build_configurations!(build_configurations) ⇒ Object
47 48 49 |
# File 'lib/cocoapods/installer/project_cache/project_installation_cache.rb', line 47 def update_build_configurations!(build_configurations) @build_configurations = build_configurations end |
#update_cache_key_by_target_label!(cache_key_by_target_label) ⇒ Object
43 44 45 |
# File 'lib/cocoapods/installer/project_cache/project_installation_cache.rb', line 43 def update_cache_key_by_target_label!(cache_key_by_target_label) @cache_key_by_target_label = cache_key_by_target_label end |
#update_podfile_plugins!(podfile_plugins) ⇒ Object
55 56 57 |
# File 'lib/cocoapods/installer/project_cache/project_installation_cache.rb', line 55 def update_podfile_plugins!(podfile_plugins) @podfile_plugins = podfile_plugins end |
#update_project_object_version!(project_object_version) ⇒ Object
51 52 53 |
# File 'lib/cocoapods/installer/project_cache/project_installation_cache.rb', line 51 def update_project_object_version!(project_object_version) @project_object_version = project_object_version end |