Class: Pod::Installer::PodSourceDownloader

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

Overview

Note:

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

Controller class responsible for downloading the activated specifications of a single Pod.

Constant Summary collapse

UNENCRYPTED_PROTOCOLS =
%w(http git).freeze

Instance Attribute Summary collapse

Downloading collapse

Instance Method Summary collapse

Constructor Details

#initialize(sandbox, podfile, specs_by_platform, can_cache: true) ⇒ PodSourceDownloader

Initialize a new instance

Parameters:

  • sandbox (Sandbox)

    @see #sandbox

  • podfile (Podfile)

    @see #podfile

  • specs_by_platform (Hash{Symbol=>Array})

    @see #specs_by_platform

  • can_cache (Boolean) (defaults to: true)

    @see #can_cache



38
39
40
41
42
43
# File 'lib/cocoapods/installer/pod_source_downloader.rb', line 38

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

Instance Attribute Details

#can_cacheBoolean (readonly) Also known as: can_cache?

Returns Whether the installer is allowed to touch the cache.

Returns:

  • (Boolean)

    Whether the installer is allowed to touch the cache.



28
29
30
# File 'lib/cocoapods/installer/pod_source_downloader.rb', line 28

def can_cache
  @can_cache
end

#podfilePodfile (readonly)

Returns the podfile that should be integrated with the user projects.

Returns:

  • (Podfile)

    the podfile that should be integrated with the user projects.



19
20
21
# File 'lib/cocoapods/installer/pod_source_downloader.rb', line 19

def podfile
  @podfile
end

#sandboxSandbox (readonly)

Returns The installation target.

Returns:

  • (Sandbox)

    The installation target.



14
15
16
# File 'lib/cocoapods/installer/pod_source_downloader.rb', line 14

def sandbox
  @sandbox
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.



24
25
26
# File 'lib/cocoapods/installer/pod_source_downloader.rb', line 24

def specs_by_platform
  @specs_by_platform
end

Instance Method Details

#download!void

This method returns an undefined value.

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



67
68
69
70
71
72
73
74
75
76
# File 'lib/cocoapods/installer/pod_source_downloader.rb', line 67

def download!
  verify_source_is_secure(root_spec)
  download_result = Downloader.download(download_request, root, :can_cache => can_cache?)

  if (specific_source = download_result.checkout_options) && specific_source != root_spec.source
    sandbox.store_checkout_source(root_spec.name, specific_source)
  end

  sandbox.store_downloaded_pod(root_spec.name)
end

#inspectString

Returns A string suitable for debugging.

Returns:

  • (String)

    A string suitable for debugging.



47
48
49
# File 'lib/cocoapods/installer/pod_source_downloader.rb', line 47

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

#nameString

Returns The name of the pod this downloader is downloading.

Returns:

  • (String)

    The name of the pod this downloader is downloading.



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

def name
  root_spec.name
end