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.
Constant Summary collapse
- DEFAULT_XCODE_VERSION =
'9.3'.freeze
- XCODE_VERSION_TO_OBJECT_VERSION =
{ '12.0' => 54, '11.4' => 53, '11.0' => 52, '10.0' => 51, '9.3' => 50, '8.0' => 48, '6.3' => 47, '3.2' => 46, '3.1' => 45 }.freeze
Instance Attribute Summary collapse
-
#configuration ⇒ Configuration
readonly
The configuration to use when installing.
-
#podfile ⇒ Podfile
readonly
The podfile to install.
-
#specs ⇒ Array<Specification>
readonly
The spec whose workspace is being created.
Instance Method Summary collapse
-
#initialize(configuration, specs, 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, specs, podfile) ⇒ Installer
Returns a new instance of Installer.
36 37 38 39 40 |
# File 'lib/cocoapods/generate/installer.rb', line 36 def initialize(configuration, specs, podfile) @configuration = configuration @specs = specs @podfile = podfile end |
Instance Attribute Details
#configuration ⇒ Configuration (readonly)
Returns the configuration to use when installing.
24 25 26 |
# File 'lib/cocoapods/generate/installer.rb', line 24 def configuration @configuration end |
#podfile ⇒ Podfile (readonly)
Returns the podfile to install.
34 35 36 |
# File 'lib/cocoapods/generate/installer.rb', line 34 def podfile @podfile end |
#specs ⇒ Array<Specification> (readonly)
Returns the spec whose workspace is being created.
29 30 31 |
# File 'lib/cocoapods/generate/installer.rb', line 29 def specs @specs end |
Instance Method Details
#install! ⇒ void
This method returns an undefined value.
Installs the #podfile into the #install_directory
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 80 81 82 83 84 85 86 87 88 89 90 91 |
# File 'lib/cocoapods/generate/installer.rb', line 53 def install! UI.title "Generating workspace 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.
45 46 47 |
# File 'lib/cocoapods/generate/installer.rb', line 45 def install_directory @install_directory ||= podfile.defined_in_file.dirname end |