Class: Pod::Command::Kwai::Brizo::Install

Inherits:
Pod::Command::Kwai::Brizo show all
Includes:
Kwai::Install::Lock
Defined in:
lib/cocoapods-kwai/command/brizo/install.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(argv) ⇒ Install

Returns a new instance of Install.



19
20
21
22
23
24
# File 'lib/cocoapods-kwai/command/brizo/install.rb', line 19

def initialize(argv)
  @project_directory = argv.option('project-directory', '.')
  @use_source = argv.flag?('use-source')
  @use_local = argv.option('use-local')
  super
end

Class Method Details

.optionsObject



11
12
13
14
15
16
17
# File 'lib/cocoapods-kwai/command/brizo/install.rb', line 11

def self.options
  [
    ['--project-directory=/project/dir/', 'The path to the root of the project directory'],
    ['--use-source', '是否采用源码'],
    ['--use-local=path', '是否使用本地源码'],
  ].concat(super)
end

Instance Method Details

#runObject



26
27
28
29
30
31
32
33
34
# File 'lib/cocoapods-kwai/command/brizo/install.rb', line 26

def run
  synchronized do
    cmd = "pod install --project-directory=#{@project_directory}"
    cmd = "BRIZO_DEBUG_USE_SOURCE=1 #{cmd}" if @use_source || @use_local
    cmd = "BRIZO_DEBUG_USE_LOCAL='#{@use_local}' #{cmd}" if @use_local
    system cmd
    raise "执行 pod install 失败, pwd: #{`pwd`}" unless $?.success?
  end
end