Class: Pod::Installer
- Inherits:
-
Object
- Object
- Pod::Installer
- Includes:
- Config::Mixin
- Defined in:
- lib/cocoapods/installer.rb,
lib/cocoapods/installer/analyzer.rb,
lib/cocoapods/installer/migrator.rb,
lib/cocoapods/installer/target_installer.rb,
lib/cocoapods/installer/podfile_validator.rb,
lib/cocoapods/installer/pod_source_preparer.rb,
lib/cocoapods/installer/analyzer/specs_state.rb,
lib/cocoapods/installer/pod_source_installer.rb,
lib/cocoapods/installer/user_project_integrator.rb,
lib/cocoapods/installer/analyzer/analysis_result.rb,
lib/cocoapods/installer/analyzer/sandbox_analyzer.rb,
lib/cocoapods/installer/analyzer/target_inspector.rb,
lib/cocoapods/installer/file_references_installer.rb,
lib/cocoapods/installer/pre_install_hooks_context.rb,
lib/cocoapods/installer/post_install_hooks_context.rb,
lib/cocoapods/installer/analyzer/target_inspection_result.rb,
lib/cocoapods/installer/analyzer/locking_dependency_analyzer.rb,
lib/cocoapods/installer/target_installer/pod_target_installer.rb,
lib/cocoapods/installer/user_project_integrator/target_integrator.rb,
lib/cocoapods/installer/target_installer/aggregate_target_installer.rb,
lib/cocoapods/installer/user_project_integrator/target_integrator/xcconfig_integrator.rb
Overview
The Installer is responsible of taking a Podfile and transform it in the Pods libraries. It also integrates the user project so the Pods libraries can be used out of the box.
The Installer is capable of doing incremental updates to an existing Pod installation.
The Installer gets the information that it needs mainly from 3 files:
- Podfile: The specification written by the user that contains
information about targets and Pods.
- Podfile.lock: Contains information about the pods that were previously
installed and in concert with the Podfile provides information about
which specific version of a Pod should be installed. This file is
ignored in update mode.
- Manifest.lock: A file contained in the Pods folder that keeps track of
the pods installed in the local machine. This files is used once the
exact versions of the Pods has been computed to detect if that version
is already installed. This file is not intended to be kept under source
control and is a copy of the Podfile.lock.
The Installer is designed to work in environments where the Podfile folder is under source control and environments where it is not. The rest of the files, like the user project and the workspace are assumed to be under source control.
Defined Under Namespace
Classes: AggregateTargetInstaller, Analyzer, FileReferencesInstaller, Migrator, PodSourceInstaller, PodSourcePreparer, PodTargetInstaller, PodfileValidator, PostInstallHooksContext, PreInstallHooksContext, TargetInstaller, UserProjectIntegrator
Installation results collapse
-
#aggregate_targets ⇒ Array<AggregateTarget>
readonly
The model representations of an aggregation of pod targets generated for a target definition in the Podfile as result of the analyzer.
-
#analysis_result ⇒ Analyzer
readonly
The analyzer which provides the information about what needs to be installed.
-
#installed_specs ⇒ Array<Specification>
The specifications that where installed.
-
#names_of_pods_to_install ⇒ Array<String>
readonly
The Pods that should be installed.
-
#pods_project ⇒ Pod::Project
readonly
The ‘Pods/Pods.xcodeproj` project.
Instance Attribute Summary collapse
-
#lockfile ⇒ Lockfile
readonly
The Lockfile that stores the information about the Pods previously installed on any machine.
-
#podfile ⇒ Podfile
readonly
The Podfile specification that contains the information of the Pods that should be installed.
-
#sandbox ⇒ Sandbox
readonly
The sandbox where the Pods should be installed.
-
#update ⇒ Hash, ...
Pods that have been requested to be updated or true if all Pods should be updated.
-
#use_default_plugins ⇒ Boolean
(also: #use_default_plugins?)
Whether default plugins should be used during installation.
Installation results collapse
-
#pod_targets ⇒ Array<PodTarget>
The model representations of pod targets generated as result of the analyzer.
Hooks collapse
-
#development_pod_targets ⇒ Array<Library>
The targets of the development pods generated by the installation process.
Instance Method Summary collapse
- #download_dependencies ⇒ Object
- #generate_pods_project ⇒ Object
-
#initialize(sandbox, podfile, lockfile = nil) ⇒ Installer
constructor
Initialize a new instance.
-
#install! ⇒ void
Installs the Pods.
- #prepare ⇒ Object
- #resolve_dependencies ⇒ Object
Methods included from Config::Mixin
Constructor Details
#initialize(sandbox, podfile, lockfile = nil) ⇒ Installer
Initialize a new instance
66 67 68 69 70 71 72 |
# File 'lib/cocoapods/installer.rb', line 66 def initialize(sandbox, podfile, lockfile = nil) @sandbox = sandbox @podfile = podfile @lockfile = lockfile @use_default_plugins = true end |
Instance Attribute Details
#aggregate_targets ⇒ Array<AggregateTarget> (readonly)
Returns The model representations of an aggregation of pod targets generated for a target definition in the Podfile as result of the analyzer.
184 185 186 |
# File 'lib/cocoapods/installer.rb', line 184 def aggregate_targets @aggregate_targets end |
#analysis_result ⇒ Analyzer (readonly)
Returns the analyzer which provides the information about what needs to be installed.
170 171 172 |
# File 'lib/cocoapods/installer.rb', line 170 def analysis_result @analysis_result end |
#installed_specs ⇒ Array<Specification>
Returns The specifications that where installed.
195 196 197 |
# File 'lib/cocoapods/installer.rb', line 195 def installed_specs @installed_specs end |
#lockfile ⇒ Lockfile (readonly)
Returns The Lockfile that stores the information about the Pods previously installed on any machine.
58 59 60 |
# File 'lib/cocoapods/installer.rb', line 58 def lockfile @lockfile end |
#names_of_pods_to_install ⇒ Array<String> (readonly)
Returns The Pods that should be installed.
178 179 180 |
# File 'lib/cocoapods/installer.rb', line 178 def names_of_pods_to_install @names_of_pods_to_install end |
#podfile ⇒ Podfile (readonly)
Returns The Podfile specification that contains the information of the Pods that should be installed.
53 54 55 |
# File 'lib/cocoapods/installer.rb', line 53 def podfile @podfile end |
#pods_project ⇒ Pod::Project (readonly)
Returns the ‘Pods/Pods.xcodeproj` project.
174 175 176 |
# File 'lib/cocoapods/installer.rb', line 174 def pods_project @pods_project end |
#sandbox ⇒ Sandbox (readonly)
Returns The sandbox where the Pods should be installed.
48 49 50 |
# File 'lib/cocoapods/installer.rb', line 48 def sandbox @sandbox end |
#update ⇒ Hash, ...
Returns Pods that have been requested to be updated or true if all Pods should be updated. If all Pods should been updated the contents of the Lockfile are not taken into account for deciding what Pods to install.
79 80 81 |
# File 'lib/cocoapods/installer.rb', line 79 def update @update end |
#use_default_plugins ⇒ Boolean Also known as: use_default_plugins?
Returns Whether default plugins should be used during installation. Defaults to true.
84 85 86 |
# File 'lib/cocoapods/installer.rb', line 84 def use_default_plugins @use_default_plugins end |
Instance Method Details
#development_pod_targets ⇒ Array<Library>
Returns The targets of the development pods generated by the installation process.
773 774 775 776 777 |
# File 'lib/cocoapods/installer.rb', line 773 def development_pod_targets pod_targets.select do |pod_target| sandbox.development_pods.keys.include?(pod_target.pod_name) end end |
#download_dependencies ⇒ Object
138 139 140 141 142 143 144 145 146 |
# File 'lib/cocoapods/installer.rb', line 138 def download_dependencies UI.section 'Downloading dependencies' do create_file_accessors install_pod_sources run_podfile_pre_install_hooks clean_pod_sources lock_pod_sources end end |
#generate_pods_project ⇒ Object
148 149 150 151 152 153 154 155 156 157 158 159 |
# File 'lib/cocoapods/installer.rb', line 148 def generate_pods_project UI.section 'Generating Pods project' do prepare_pods_project install_file_references install_libraries set_target_dependencies run_podfile_post_install_hooks write_pod_project share_development_pod_schemes write_lockfiles end end |
#install! ⇒ void
This method returns an undefined value.
Installs the Pods.
The installation process is mostly linear with a few minor complications to keep in mind:
-
The stored podspecs need to be cleaned before the resolution step otherwise the sandbox might return an old podspec and not download the new one from an external source.
-
The resolver might trigger the download of Pods from external sources necessary to retrieve their podspec (unless it is instructed not to do it).
101 102 103 104 105 106 107 108 109 110 111 112 |
# File 'lib/cocoapods/installer.rb', line 101 def install! prepare resolve_dependencies download_dependencies determine_dependency_product_types verify_no_duplicate_framework_names verify_no_static_framework_transitive_dependencies verify_framework_usage generate_pods_project integrate_user_project if config.integrate_targets? perform_post_install_actions end |
#pod_targets ⇒ Array<PodTarget>
Returns The model representations of pod targets generated as result of the analyzer.
189 190 191 |
# File 'lib/cocoapods/installer.rb', line 189 def pod_targets aggregate_targets.map(&:pod_targets).flatten.uniq end |
#prepare ⇒ Object
114 115 116 117 118 119 120 121 |
# File 'lib/cocoapods/installer.rb', line 114 def prepare UI. 'Preparing' do sandbox.prepare ensure_plugins_are_installed! Migrator.migrate(sandbox) run_plugins_pre_install_hooks end end |
#resolve_dependencies ⇒ Object
123 124 125 126 127 128 129 130 131 132 133 134 135 136 |
# File 'lib/cocoapods/installer.rb', line 123 def resolve_dependencies analyzer = create_analyzer UI.section 'Updating local specs repositories' do analyzer.update_repositories end unless config.skip_repo_update? UI.section 'Analyzing dependencies' do analyze(analyzer) validate_build_configurations prepare_for_legacy_compatibility clean_sandbox end end |