Class: Pod::Generate::Installer
- Inherits:
-
Object
- Object
- Pod::Generate::Installer
- Defined in:
- lib/cocoapods-modularization/generate/installer.rb
Overview
Responsible for creating a workspace for a single specification, given a configuration and a generated podfile.
Instance Attribute Summary collapse
-
#configuration ⇒ Configuration
readonly
The configuration to use when installing.
-
#podfile ⇒ Podfile
readonly
The podfile to install.
-
#spec ⇒ Specification
readonly
The spec whose workspace is being created.
Instance Method Summary collapse
-
#initialize(configuration, spec, podfile) ⇒ Installer
constructor
A new instance of Installer.
-
#install! ⇒ void
Installs the #podfile into the #install_directory.
-
#install_directory ⇒ Pathname
The directory that pods will be installed into.
Constructor Details
#initialize(configuration, spec, podfile) ⇒ Installer
Returns a new instance of Installer.
22 23 24 25 26 |
# File 'lib/cocoapods-modularization/generate/installer.rb', line 22 def initialize(configuration, spec, podfile) @configuration = configuration @spec = spec @podfile = podfile end |
Instance Attribute Details
#configuration ⇒ Configuration (readonly)
Returns the configuration to use when installing.
10 11 12 |
# File 'lib/cocoapods-modularization/generate/installer.rb', line 10 def configuration @configuration end |
#podfile ⇒ Podfile (readonly)
Returns the podfile to install.
20 21 22 |
# File 'lib/cocoapods-modularization/generate/installer.rb', line 20 def podfile @podfile end |
#spec ⇒ Specification (readonly)
Returns the spec whose workspace is being created.
15 16 17 |
# File 'lib/cocoapods-modularization/generate/installer.rb', line 15 def spec @spec end |
Instance Method Details
#install! ⇒ void
This method returns an undefined value.
Installs the #podfile into the #install_directory
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 |
# File 'lib/cocoapods-modularization/generate/installer.rb', line 39 def install! UI.title "Generating #{spec.name} in #{UI.path install_directory}" do clean! if configuration.clean? install_directory.mkpath UI. 'Creating stub application' do create_app_project end UI. 'Writing Podfile' do podfile.defined_in_file.open('w') { |f| f << podfile.to_yaml } end installer = nil UI.section 'Installing...' do configuration.pod_config.with_changes(installation_root: install_directory, podfile: podfile, lockfile: configuration.lockfile, sandbox: nil, sandbox_root: install_directory + 'Pods', podfile_path: podfile.defined_in_file, silent: !configuration.pod_config.verbose?, verbose: false, lockfile_path: nil) do installer = ::Pod::Installer.new(configuration.pod_config.sandbox, podfile, configuration.lockfile) installer.use_default_plugins = configuration.use_default_plugins installer.install! end end UI.section 'Performing post-installation steps' do should_perform_post_install = if installer.respond_to?(:generated_aggregate_targets) # CocoaPods 1.7.0 !installer.generated_aggregate_targets.empty? else true end perform_post_install_steps(open_app_project, installer) if should_perform_post_install end end end |
#install_directory ⇒ Pathname
Returns The directory that pods will be installed into.
31 32 33 |
# File 'lib/cocoapods-modularization/generate/installer.rb', line 31 def install_directory @install_directory ||= podfile.defined_in_file.dirname end |