Class: Pod::Installer::ProjectCache::ProjectCacheVersion

Inherits:
Object
  • Object
show all
Defined in:
lib/cocoapods/installer/project_cache/project_cache_version.rb

Overview

Object that stores, loads, and holds the version of the project cache.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(version = Version.create('0')) ⇒ ProjectCacheVersion

Initialize a new instance.

Parameters:

  • version (Version) (defaults to: Version.create('0'))

    @see #version


15
16
17
# File 'lib/cocoapods/installer/project_cache/project_cache_version.rb', line 15

def initialize(version = Version.create('0'))
  @version = version
end

Instance Attribute Details

#versionVersion (readonly)

Returns The version of the project cache.

Returns:

  • (Version)

    The version of the project cache.


9
10
11
# File 'lib/cocoapods/installer/project_cache/project_cache_version.rb', line 9

def version
  @version
end

Class Method Details

.from_file(path) ⇒ ProjectCacheVersion

Constructs a ProjectCacheVersion from a file.

Parameters:

  • path (String)

    The path of the project cache

Returns:


26
27
28
29
30
# File 'lib/cocoapods/installer/project_cache/project_cache_version.rb', line 26

def self.from_file(path)
  return ProjectCacheVersion.new unless File.exist?(path)
  cached_version = Version.create(File.read(path))
  ProjectCacheVersion.new(cached_version)
end

Instance Method Details

#save_as(path) ⇒ void

This method returns an undefined value.

Parameters:

  • path (String)

    The path of the project cache to save.


37
38
39
# File 'lib/cocoapods/installer/project_cache/project_cache_version.rb', line 37

def save_as(path)
  Sandbox.update_changed_file(path, version.to_s)
end