Class: Pod::Command::Install

Inherits:
Pod::Command show all
Includes:
ProjectDirectory, RepoUpdate
Defined in:
lib/cocoapods-modularization/command/install.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(argv) ⇒ Install

Returns a new instance of Install.



44
45
46
47
48
49
50
# File 'lib/cocoapods-modularization/command/install.rb', line 44

def initialize(argv)
  super
  @deployment = argv.flag?('deployment', false)
  @clean_install = argv.flag?('clean-install', false)
  @enable_branch = argv.flag?('enable-branch', false)
  @original = argv.flag?('original', false)
end

Class Method Details

.optionsObject



33
34
35
36
37
38
39
40
41
42
# File 'lib/cocoapods-modularization/command/install.rb', line 33

def self.options
  [
    ['--repo-update', 'Force running `pod repo update` before install'],
    ['--deployment', 'Disallow any changes to the Podfile or the Podfile.lock during installation'],
    ['--clean-install', 'Ignore the contents of the project cache and force a full pod installation. This only ' \
      'applies to projects that have enabled incremental installation'],
    ['--enable-branch', 'Enable branch dependency'],
    ['--original', 'Run pod install ignore cocoapods-modularization']
  ].concat(super).reject { |(name, _)| name == '--no-repo-update' }
end

Instance Method Details

#runObject



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
# File 'lib/cocoapods-modularization/command/install.rb', line 52

def run
  # encode podfile
  unless @original
    begin
      Meta::MetaReference.encode_podfile(@enable_branch)
    rescue Exception => e
      UI.puts "pod install error: #{e}"
    end
  end

  # install
  verify_podfile_exists!
  installer = installer_for_config
  installer.repo_update = repo_update?(:default => false)
  installer.update = false
  installer.deployment = @deployment
  installer.clean_install = @clean_install
  installer.install!

  unless @original
    begin
      add_modularization_into_xcode_reference
    rescue Exception => e
      UI.puts e
    end
  end
end