Class: Pod::Command::Build

Inherits:
Pod::Command show all
Defined in:
lib/cocoapods-aqarahome/command/build.rb

Instance Method Summary collapse

Constructor Details

#initialize(argv) ⇒ Build

Returns a new instance of Build.



8
9
10
11
12
13
14
# File 'lib/cocoapods-aqarahome/command/build.rb', line 8

def initialize(argv)
  @envs = []
  while (arg = argv.shift_argument)
    @envs << "#{arg}=1"
  end
  super
end

Instance Method Details

#runObject



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/cocoapods-aqarahome/command/build.rb', line 16

def run
  # 设置环境变量
  @envs.each do |env|
    key, val = env.split('=')
    ENV[key] = val
    UI.puts "当前环境变量 #{key}=#{val}"
  end

  podfile = Pod::Config.instance.podfile

  if podfile.plugins.key?('cocoapods-aqara-localzedLoader')
    UI.puts "跳过多语言下载和更新过程".yellow
    podfile.plugins.delete('cocoapods-aqara-localzedLoader')
  end

  install_cmd = Pod::Command::Install.new(CLAide::ARGV.new([]))
  install_cmd.run

  podfile.plugins['cocoapods-aqara-localzedLoader'] = {}
end