Class: Pod::Installer::ProjectCache::TargetMetadata

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

Overview

Metadata used to reconstruct a PBXTargetDependency.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(target_label, native_target_uuid, container_project_path) ⇒ TargetMetadata

Initialize a new instance.

Parameters:

  • target_label (String)

    @see #target_label

  • native_target_uuid (String)

    @see #native_target_uuid

  • container_project_path (String)

    @see #container_project_path



28
29
30
31
32
# File 'lib/cocoapods/installer/project_cache/target_metadata.rb', line 28

def initialize(target_label, native_target_uuid, container_project_path)
  @target_label = target_label
  @native_target_uuid = native_target_uuid
  @container_project_path = container_project_path
end

Instance Attribute Details

#container_project_pathString (readonly)

Returns The path of the container project the native target was installed into.

Returns:

  • (String)

    The path of the container project the native target was installed into.



20
21
22
# File 'lib/cocoapods/installer/project_cache/target_metadata.rb', line 20

def container_project_path
  @container_project_path
end

#native_target_uuidString (readonly)

Returns The UUID of the native target installed.

Returns:

  • (String)

    The UUID of the native target installed.



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

def native_target_uuid
  @native_target_uuid
end

#target_labelString (readonly)

Returns The label of the native target.

Returns:

  • (String)

    The label of the native target.



10
11
12
# File 'lib/cocoapods/installer/project_cache/target_metadata.rb', line 10

def target_label
  @target_label
end

Class Method Details

.from_hash(hash) ⇒ TargetMetadata

Constructs a TargetMetadata instance from a hash.

Parameters:

  • hash (Hash)

    The hash used to construct a new TargetMetadata instance.

Returns:



53
54
55
# File 'lib/cocoapods/installer/project_cache/target_metadata.rb', line 53

def self.from_hash(hash)
  TargetMetadata.new(hash['LABEL'], hash['UUID'], hash['PROJECT_PATH'])
end

.from_native_target(sandbox, native_target) ⇒ TargetMetadata

Constructs a TargetMetadata instance from a native target.

Parameters:

  • sandbox (Sandbox)

    The sandbox used for this installation.

  • native_target (PBXNativeTarget)

    The native target used to construct a TargetMetadata instance.

Returns:



67
68
69
70
# File 'lib/cocoapods/installer/project_cache/target_metadata.rb', line 67

def self.from_native_target(sandbox, native_target)
  TargetMetadata.new(native_target.name, native_target.uuid,
                     native_target.project.path.relative_path_from(sandbox.root).to_s)
end

Instance Method Details

#to_hashObject



34
35
36
37
38
39
40
# File 'lib/cocoapods/installer/project_cache/target_metadata.rb', line 34

def to_hash
  {
    'LABEL' => target_label,
    'UUID' => native_target_uuid,
    'PROJECT_PATH' => container_project_path,
  }
end

#to_sObject



42
43
44
# File 'lib/cocoapods/installer/project_cache/target_metadata.rb', line 42

def to_s
  "#{target_label} : #{native_target_uuid} : #{container_project_path}"
end