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) ⇒ PodSourceInstaller

Initialize a new instance

Parameters:

  • sandbox (Sandbox)

    @see sandbox

  • specs_by_platform (Hash{Symbol=>Array})

    @see specs_by_platform



25
26
27
28
# File 'lib/cocoapods/installer/pod_source_installer.rb', line 25

def initialize(sandbox, specs_by_platform)
  @sandbox = sandbox
  @specs_by_platform = specs_by_platform
end

Instance Attribute Details

#sandboxSandbox (readonly)

Returns The installation target.

Returns:

  • (Sandbox)

    The installation target.



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

def sandbox
  @sandbox
end

#specific_sourceHash (readonly)

Returns @see Downloader#checkout_options.

Returns:

  • (Hash)

    @see Downloader#checkout_options



88
89
90
# File 'lib/cocoapods/installer/pod_source_installer.rb', line 88

def specific_source
  @specific_source
end

#specs_by_platformHash{Symbol=>Array} (readonly)

Returns The specifications that need to be installed grouped by platform.

Returns:

  • (Hash{Symbol=>Array})

    The specifications that need to be installed grouped by platform.



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.



64
65
66
# File 'lib/cocoapods/installer/pod_source_installer.rb', line 64

def clean!
  clean_installation unless local?
end

#inspectString

Returns A string suitable for debugging.

Returns:

  • (String)

    A string suitable for debugging.



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

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.



52
53
54
55
# File 'lib/cocoapods/installer/pod_source_installer.rb', line 52

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.



75
76
77
78
79
80
81
82
83
84
# File 'lib/cocoapods/installer/pod_source_installer.rb', line 75

def lock_files!(file_accessors)
  return if local?

  file_accessors.each do |file_accessor|
    file_accessor.source_files.each do |source_file|
      next unless source_file.exist?
      FileUtils.chmod('-w', source_file)
    end
  end
end

#nameString

Returns The name of the pod this installer is installing.

Returns:

  • (String)

    The name of the pod this installer is installing.



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

def name
  root_spec.name
end