Class: Pod::Installer::Analyzer
- Inherits:
-
Object
- Object
- Pod::Installer::Analyzer
- Includes:
- Config::Mixin
- Defined in:
- lib/cocoapods/installer/analyzer.rb,
lib/cocoapods/installer/analyzer/sandbox_analyzer.rb
Overview
Analyzes the Podfile, the Lockfile, and the sandbox manifest to generate the information relative to a CocoaPods installation.
Defined Under Namespace
Classes: AnalysisResult, SandboxAnalyzer, SpecsState
Configuration collapse
-
#allow_pre_downloads ⇒ Bool
(also: #allow_pre_downloads?)
Whether the analysis allows pre-downloads and thus modifications to the sandbox.
-
#update_mode ⇒ Bool
(also: #update_mode?)
Whether the version of the dependencies which did non change in the Podfile should be locked.
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.
-
#result ⇒ Object
Returns the value of attribute result.
-
#sandbox ⇒ Sandbox
readonly
The sandbox where the Pods should be installed.
Instance Method Summary collapse
-
#analyze(allow_fetches = true) ⇒ AnalysisResult
Performs the analysis.
-
#initialize(sandbox, podfile, lockfile = nil) ⇒ Analyzer
constructor
A new instance of Analyzer.
-
#needs_install? ⇒ Bool
Whether an installation should be performed or this CocoaPods project is already up to date.
-
#podfile_needs_install?(analysis_result) ⇒ Bool
Whether the podfile has changes respect to the lockfile.
-
#sandbox_needs_install?(analysis_result) ⇒ Bool
Whether the sandbox is in synch with the lockfile.
Methods included from Config::Mixin
Constructor Details
#initialize(sandbox, podfile, lockfile = nil) ⇒ Analyzer
Returns a new instance of Analyzer.
31 32 33 34 35 36 37 38 |
# File 'lib/cocoapods/installer/analyzer.rb', line 31 def initialize(sandbox, podfile, lockfile = nil) @sandbox = sandbox @podfile = podfile @lockfile = lockfile @update_mode = false @allow_pre_downloads = true end |
Instance Attribute Details
#allow_pre_downloads ⇒ Bool Also known as: allow_pre_downloads?
This flag should not be used in installations.
This is used by the ‘pod outdated` command to prevent modification of the sandbox in the resolution process.
Returns Whether the analysis allows pre-downloads and thus modifications to the sandbox.
106 107 108 |
# File 'lib/cocoapods/installer/analyzer.rb', line 106 def allow_pre_downloads @allow_pre_downloads end |
#lockfile ⇒ Lockfile (readonly)
Returns The Lockfile that stores the information about the Pods previously installed on any machine.
25 26 27 |
# File 'lib/cocoapods/installer/analyzer.rb', line 25 def lockfile @lockfile end |
#podfile ⇒ Podfile (readonly)
Returns The Podfile specification that contains the information of the Pods that should be installed.
20 21 22 |
# File 'lib/cocoapods/installer/analyzer.rb', line 20 def podfile @podfile end |
#result ⇒ Object
Returns the value of attribute result.
62 63 64 |
# File 'lib/cocoapods/installer/analyzer.rb', line 62 def result @result end |
#sandbox ⇒ Sandbox (readonly)
Returns The sandbox where the Pods should be installed.
15 16 17 |
# File 'lib/cocoapods/installer/analyzer.rb', line 15 def sandbox @sandbox end |
#update_mode ⇒ Bool Also known as: update_mode?
Returns Whether the version of the dependencies which did non change in the Podfile should be locked.
95 96 97 |
# File 'lib/cocoapods/installer/analyzer.rb', line 95 def update_mode @update_mode end |
Instance Method Details
#analyze(allow_fetches = true) ⇒ AnalysisResult
Performs the analysis.
The Podfile and the Lockfile provide the information necessary to compute which specification should be installed. The manifest of the sandbox returns which specifications are installed.
48 49 50 51 52 53 54 55 56 57 58 59 60 |
# File 'lib/cocoapods/installer/analyzer.rb', line 48 def analyze(allow_fetches = true) update_repositories_if_needed if allow_fetches @result = AnalysisResult.new @result.podfile_state = generate_podfile_state @locked_dependencies = generate_version_locking_dependencies @result.libraries = generated_libraries fetch_external_sources if allow_fetches @result.specs_by_target = resolve_dependencies @result.specifications = generate_specifications @result.sandbox_state = generate_sandbox_state @result end |
#needs_install? ⇒ Bool
Returns Whether an installation should be performed or this CocoaPods project is already up to date.
67 68 69 70 |
# File 'lib/cocoapods/installer/analyzer.rb', line 67 def needs_install? analysis_result = analyze(false) podfile_needs_install?(analysis_result) || sandbox_needs_install?(analysis_result) end |
#podfile_needs_install?(analysis_result) ⇒ Bool
Returns Whether the podfile has changes respect to the lockfile.
74 75 76 77 78 |
# File 'lib/cocoapods/installer/analyzer.rb', line 74 def podfile_needs_install?(analysis_result) state = analysis_result.podfile_state needing_install = state.added + state.changed + state.deleted !needing_install.empty? end |
#sandbox_needs_install?(analysis_result) ⇒ Bool
Returns Whether the sandbox is in synch with the lockfile.
82 83 84 85 86 |
# File 'lib/cocoapods/installer/analyzer.rb', line 82 def sandbox_needs_install?(analysis_result) state = analysis_result.sandbox_state needing_install = state.added + state.changed + state.deleted !needing_install.empty? end |