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. 
- 
  
    
      #installation_options  ⇒ Hash<Symbol, Object> 
    
    
  
  
  
  
    
      readonly
    
    
  
  
  
  
  
  
    Configured installation options. 
- 
  
    
      #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 = {}, installation_options = {})  ⇒ 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_installation_options!(installation_options) ⇒ 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 = {}, installation_options = {}) ⇒ ProjectInstallationCache
Initializes a new instance.
| 42 43 44 45 46 47 48 | # 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 = {}, = {}) @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 = 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 | 
#installation_options ⇒ Hash<Symbol, Object> (readonly)
Returns Configured installation options.
| 32 33 34 | # File 'lib/cocoapods/installer/project_cache/project_installation_cache.rb', line 32 def @installation_options 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
| 75 76 77 78 79 80 81 82 83 84 85 86 87 | # 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'] = contents['INSTALLATION_OPTIONS'] ProjectInstallationCache.new(cache_key_by_target_label, build_configurations, project_object_version, podfile_plugins, ) end | 
Instance Method Details
#save_as(path) ⇒ Object
| 70 71 72 73 | # 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 ⇒ Object
| 89 90 91 92 93 94 95 96 97 98 99 | # 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'] = if contents end | 
#update_build_configurations!(build_configurations) ⇒ Object
| 54 55 56 | # 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) ⇒ Object
| 50 51 52 | # 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) ⇒ Object
| 66 67 68 | # File 'lib/cocoapods/installer/project_cache/project_installation_cache.rb', line 66 def () @installation_options = end | 
#update_podfile_plugins!(podfile_plugins) ⇒ Object
| 62 63 64 | # 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) ⇒ Object
| 58 59 60 | # 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 |