Class: Pod::Generate::Installer
- Inherits:
-
Object
- Object
- Pod::Generate::Installer
- Defined in:
- lib/cocoapods/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.
34 35 36 37 38 |
# File 'lib/cocoapods/generate/installer.rb', line 34 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.
22 23 24 |
# File 'lib/cocoapods/generate/installer.rb', line 22 def configuration @configuration end |
#podfile ⇒ Podfile (readonly)
Returns the podfile to install.
32 33 34 |
# File 'lib/cocoapods/generate/installer.rb', line 32 def podfile @podfile end |
#spec ⇒ Specification (readonly)
Returns the spec whose workspace is being created.
27 28 29 |
# File 'lib/cocoapods/generate/installer.rb', line 27 def spec @spec end |
Instance Method Details
#install! ⇒ void
This method returns an undefined value.
Installs the #podfile into the #install_directory
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 78 79 |
# File 'lib/cocoapods/generate/installer.rb', line 51 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, podfile_path: podfile.defined_in_file, silent: !configuration.pod_config.verbose?, verbose: false, lockfile_path: nil) do installer = InstallerNoValidatePodfile.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 perform_post_install_steps(open_app_project, installer) end end end |
#install_directory ⇒ Pathname
Returns The directory that pods will be installed into.
43 44 45 |
# File 'lib/cocoapods/generate/installer.rb', line 43 def install_directory @install_directory ||= podfile.defined_in_file.dirname end |