Class: Pod::Command::Kz::Update

Inherits:
Pod::Command::Kz show all
Defined in:
lib/cocoapods-kz/command/update.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Pod::Command::Kz

#validate!

Constructor Details

#initialize(argv) ⇒ Update

Returns a new instance of Update.



30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# File 'lib/cocoapods-kz/command/update.rb', line 30

def initialize(argv)
  use_code_tag = argv.flag?('code')
  use_framework_tag = argv.flag?('framework')
  banner! unless isOptionsArgvFlag(argv.options.keys)
  banner! if (use_code_tag && use_framework_tag)

  KZ::KZGlobalHelper.instance.analyze_special_parameters(use_code_tag, use_framework_tag, argv.arguments!)
  if Pod.match_version?('~> 1.11')
    KZ::KZGlobalHelper.instance.kz_pod_enable = true
    KZ::KZGlobalHelper.instance.generate_kz_pod_targets = true
  end
  KZ::KZGlobalHelper.instance.debug = true if argv.flag?('debug')
  KZ::KZGlobalHelper.instance.arm64_simulator = true if argv.flag?('arm64-simulator')
  framework_update = argv.flag?('framework-update')
  KZ::KZGlobalHelper.instance.disable_generate_framework = true if (framework_update != nil && framework_update == false)

  super
  @additional_args = argv.remainder!
end

Class Method Details

.optionsObject



15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/cocoapods-kz/command/update.rb', line 15

def self.options
  [
    ["--sources=#{Pod::TrunkSource::TRUNK_REPO_URL}", 'The sources from which to update dependent pods. ' \
   'Multiple sources must be comma-delimited'],
    ['--exclude-pods=podName', 'Pods to exclude during update. Multiple pods must be comma-delimited'],
    ['--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'],
    ['--framework', "后面需要跟上pod名(多个pod,使用英文逗号隔开),支持追加*匹配任意内容"],
    ['--code', "后面需要跟上pod名(多个pod,使用英文逗号隔开),支持追加*匹配任意内容"],
    ['--debug', "debug模式,会打印调试日志或生成调试文件"],
    ['--no-framework-update', "build后不再生成frameowrk"],
    ['--arm64-simulator', "适配模拟器的arm64模式,会自动将只支持真机arm64的framework转成arm64模式"]
  ].concat(super)
end

Instance Method Details

#isOptionsArgvFlag(all_flags) ⇒ Object



50
51
52
53
54
# File 'lib/cocoapods-kz/command/update.rb', line 50

def isOptionsArgvFlag(all_flags)
  return true if all_flags.empty?
  supported_flags = ["sources", "exclude-pods", "clean-install", "code", "framework", "debug", "framework-update", "arm64-simulator"]
  return (all_flags & supported_flags) == all_flags
end

#runObject



56
57
58
59
60
61
# File 'lib/cocoapods-kz/command/update.rb', line 56

def run
  KZ::KZGlobalHelper.instance.prepare
  update = Pod::Command::Update.new(CLAide::ARGV.new([*@additional_args]))
  update.validate!
  update.run
end