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.
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/pod_builder/analyze.rb', line 7 def self.installer_at(path, repo_update = false) CLAide::Command::PluginManager.load_plugins("cocoapods") current_dir = Dir.pwd Dir.chdir(path) 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 Dir.chdir(current_dir) return installer, analyzer end |
.podfile_items(installer, analyzer) ⇒ Array<PodfileItem>
Returns The PodfileItem in the Podfile (including subspecs) and dependencies.
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
# File 'lib/pod_builder/analyze.rb', line 29 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, 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 all_podfile_specs = all_specs.select { |x| all_podfile_pods.map(&:name).include?(x.name) } deps_names = all_podfile_specs.map { |x| x.recursive_dep_names(all_specs) }.flatten.uniq all_podfile_specs += all_specs.select { |x| deps_names.include?(x.name) } all_podfile_specs.uniq! return all_podfile_specs.map { |spec| PodfileItem.new(spec, all_specs, ) } end |