Class: Pod::Generate::Installer

Inherits:
Object
  • Object
show all
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

Instance Method Summary collapse

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

#configurationConfiguration (readonly)

Returns the configuration to use when installing.

Returns:



22
23
24
# File 'lib/cocoapods/generate/installer.rb', line 22

def configuration
  @configuration
end

#podfilePodfile (readonly)

Returns the podfile to install.

Returns:

  • (Podfile)

    the podfile to install



32
33
34
# File 'lib/cocoapods/generate/installer.rb', line 32

def podfile
  @podfile
end

#specSpecification (readonly)

Returns the spec whose workspace is being created.

Returns:

  • (Specification)

    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.message 'Creating stub application' do
      create_app_project
    end

    UI.message '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

    print_post_install_message
  end
end

#install_directoryPathname

Returns The directory that pods will be installed into.

Returns:

  • (Pathname)

    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