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.

Configuration collapse

Installation collapse

Instance Attribute Summary collapse

Installation collapse

Dependencies collapse

Instance Method Summary collapse

Constructor Details

#initialize(sandbox, specs_by_platform) ⇒ PodSourceInstaller

Returns a new instance of PodSourceInstaller.

Parameters:

  • sandbox (Sandbox)

    @see sandbox

  • specs_by_platform (Hash{Symbol=>Array})

    @see specs_by_platform



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

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

  @aggressive_cache = false
end

Instance Attribute Details

#aggressive_cacheBool Also known as: aggressive_cache?

Note:

This might be removed in future.

Returns whether the downloader should always check against the remote if issues might be generated (mostly useful to speed up testing).

Returns:

  • (Bool)

    whether the downloader should always check against the remote if issues might be generated (mostly useful to speed up testing).



48
49
50
# File 'lib/cocoapods/installer/pod_source_installer.rb', line 48

def aggressive_cache
  @aggressive_cache
end

#sandboxSandbox (readonly)

Returns:



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

def sandbox
  @sandbox
end

#specific_sourceHash (readonly)

Returns:

  • (Hash)


78
79
80
# File 'lib/cocoapods/installer/pod_source_installer.rb', line 78

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.



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

def clean!
  clean_installation  if !local?
end

#downloaderDownloader

Returns The downloader to use for the retrieving the source.

Returns:

  • (Downloader)

    The downloader to use for the retrieving the source.



127
128
129
130
131
132
133
134
# File 'lib/cocoapods/installer/pod_source_installer.rb', line 127

def downloader
  return @downloader if @downloader
  @downloader = Downloader.for_target(root, root_spec.source.dup)
  @downloader.cache_root = CACHE_ROOT.to_s
  @downloader.max_cache_size = MAX_CACHE_SIZE
  @downloader.aggressive_cache = aggressive_cache?
  @downloader
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.



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

def install!
  download_source unless predownloaded? || local?
end