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.



47
48
49
50
51
52
53
54
# File 'lib/cocoapods-modularization/command/install.rb', line 47

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)
  @sync = argv.flag?('sync', false)
end

Class Method Details

.optionsObject



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

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'],
    ['--sync', 'Run pod install and sync all local dependencies according with branch_cache.yml']
  ].concat(super).reject { |(name, _)| name == '--no-repo-update' }
end

Instance Method Details

#runObject



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

def run
  # encode podfile
  if @enable_branch
    FileUtils.rm_rf('Podfile.lock')
  end

  if @sync
    sync_local_dependencies
  end

  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