Class: Pod::Installer::PodSourceInstaller

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

Overview

Note:

This class needs to consider all the activated specs of a Pod.

Controller class responsible of installing the activated specifications of a single Pod.

Installation collapse

Instance Attribute Summary collapse

Installation collapse

Instance Method Summary collapse

Constructor Details

#initialize(sandbox, specs_by_platform, can_cache: true) ⇒ PodSourceInstaller

Initialize a new instance



31
32
33
34
35
# File 'lib/cocoapods/installer/pod_source_installer.rb', line 31

def initialize(sandbox, specs_by_platform, can_cache: true)
  @sandbox = sandbox
  @specs_by_platform = specs_by_platform
  @can_cache = can_cache
end

Instance Attribute Details

#can_cacheBoolean (readonly) Also known as: can_cache?



22
23
24
# File 'lib/cocoapods/installer/pod_source_installer.rb', line 22

def can_cache
  @can_cache
end

#sandboxSandbox (readonly)



13
14
15
# File 'lib/cocoapods/installer/pod_source_installer.rb', line 13

def sandbox
  @sandbox
end

#specific_sourceHash (readonly)



105
106
107
# File 'lib/cocoapods/installer/pod_source_installer.rb', line 105

def specific_source
  @specific_source
end

#specs_by_platformHash{Symbol=>Array} (readonly)



18
19
20
# File 'lib/cocoapods/installer/pod_source_installer.rb', line 18

def specs_by_platform
  @specs_by_platform
end

Instance Method Details

#clean!void

TODO:

As the pre install hooks need to run before cleaning this method should be refactored.

This method returns an undefined value.

Cleans the installations if appropriate.



71
72
73
# File 'lib/cocoapods/installer/pod_source_installer.rb', line 71

def clean!
  clean_installation unless local?
end

#inspectString



39
40
41
# File 'lib/cocoapods/installer/pod_source_installer.rb', line 39

def inspect
  "<#{self.class} sandbox=#{sandbox.root} pod=#{root_spec.name}"
end

#install!void

This method returns an undefined value.

Creates the target in the Pods project and the relative support files.



59
60
61
62
# File 'lib/cocoapods/installer/pod_source_installer.rb', line 59

def install!
  download_source unless predownloaded? || local?
  PodSourcePreparer.new(root_spec, root).prepare! if local?
end

#lock_files!(file_accessors) ⇒ void

TODO:

As the pre install hooks need to run before cleaning this method should be refactored.

This method returns an undefined value.

Locks the source files if appropriate.



82
83
84
85
86
87
# File 'lib/cocoapods/installer/pod_source_installer.rb', line 82

def lock_files!(file_accessors)
  return if local?
  each_source_file(file_accessors) do |source_file|
    FileUtils.chmod('u-w', source_file)
  end
end

#nameString



45
46
47
# File 'lib/cocoapods/installer/pod_source_installer.rb', line 45

def name
  root_spec.name
end

#unlock_files!(file_accessors) ⇒ void

TODO:

As the pre install hooks need to run before cleaning this method should be refactored.

This method returns an undefined value.

Unlocks the source files if appropriate.



96
97
98
99
100
101
# File 'lib/cocoapods/installer/pod_source_installer.rb', line 96

def unlock_files!(file_accessors)
  return if local?
  each_source_file(file_accessors) do |source_file|
    FileUtils.chmod('u+w', source_file)
  end
end