Class: PodBuilder::Analyze
- Inherits:
-
Object
- Object
- PodBuilder::Analyze
- Defined in:
- lib/pod_builder/analyze.rb
Class Method Summary collapse
-
.installer_at(path, repo_update = false) ⇒ Pod::Installer
The Pod::Installer instance created by processing the Podfile.
-
.podfile_items(installer, analyzer) ⇒ Array<PodfileItem>
The PodfileItem in the Podfile (including subspecs) and dependencies.
Class Method Details
.installer_at(path, repo_update = false) ⇒ Pod::Installer
Returns The Pod::Installer instance created by processing the Podfile.
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/pod_builder/analyze.rb', line 9 def self.installer_at(path, repo_update = false) CLAide::Command::PluginManager.load_plugins("cocoapods") # Manually load inline podbuilder-rome plugin pluginspec = Gem::Specification.new("podbuilder-rome", PodBuilder::VERSION) pluginspec.activate if !CLAide::Command::PluginManager.loaded_plugins["cocoapods"].map(&:name).include?(pluginspec.name) CLAide::Command::PluginManager.loaded_plugins["cocoapods"].push(pluginspec) end installer = nil analyzer = nil Dir.chdir(path) do config = Pod::Config.new() installer = Pod::Installer.new(config.sandbox, config.podfile, config.lockfile) installer.repo_update = repo_update installer.update = false installer.prepare analyzer = installer.resolve_dependencies end return installer, analyzer end |
.podfile_items(installer, analyzer) ⇒ Array<PodfileItem>
Returns The PodfileItem in the Podfile (including subspecs) and dependencies.
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
# File 'lib/pod_builder/analyze.rb', line 38 def self.podfile_items(installer, analyzer) sandbox = installer.sandbox analysis_result = installer.analysis_result all_podfile_pods = analysis_result.podfile_dependency_cache.podfile_dependencies external_source_pods = all_podfile_pods.select(&:external_source) = external_source_pods.map { |x| [x.name.split("/").first, x.external_source] }.to_h # this adds the :commit which might be missing in checkout_options # will also overwrite :branch with :commit which is desired .merge!(analyzer.sandbox.checkout_sources) all_specs = analysis_result.specifications supported_platforms = analyzer.instance_variable_get("@result").targets.map { |t| t.platform.safe_string_name.downcase } target_definitions = installer.podfile.target_definitions.values items = all_specs.map { |spec| PodfileItem.new(spec, all_specs, target_definitions, , supported_platforms) }.sort_by(&:name) return items end |