Class: Pod::Command::Kz::Repair

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

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Pod::Command::Kz

#validate!

Constructor Details

#initialize(argv) ⇒ Repair

Returns a new instance of Repair.



22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/cocoapods-kz/command/repair.rb', line 22

def initialize(argv)
  @repair_module_import = argv.flag?('module-import')
  @repair_dynamic_swift = argv.flag?('dynamic-swift')
  @repair_private_hmap = argv.flag?('private-hmap')
  banner! unless @repair_module_import || @repair_dynamic_swift || @repair_private_hmap

  if Pod.match_version?('~> 1.11')
    KZ::KZGlobalHelper.instance.kz_pod_enable = true
    KZ::KZGlobalHelper.instance.analyze_special_parameters(true, false, argv.arguments!)
    KZ::KZGlobalHelper.instance.generate_kz_pod_targets = true
  end

  super
end

Class Method Details

.optionsObject



14
15
16
17
18
19
20
# File 'lib/cocoapods-kz/command/repair.rb', line 14

def self.options
  [
    ['--module-import', "指定组件名(只针对开发组件),修复该组件所有文件头文件导入方式,壳工程使用“Main”,如果不指定,默认对所有开发组件进行修复"],
    ['--dynamic-swift', "指定组件名(只针对开发组件),将该组件中所有swift文件添加OC特性,壳工程使用“Main”,如果不指定,默认对所有开发组件进行修复"],
    ['--private-hmap', "重新生成组件私有hamp"],
  ]
end

Instance Method Details

#runObject



37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# File 'lib/cocoapods-kz/command/repair.rb', line 37

def run
  KZ::KZGlobalHelper.instance.prepare

  if KZ::KZGlobalHelper.instance.kz_pod_enable
    installer = installer_for_config
    installer.prepare
    installer.resolve_dependencies
    installer.download_dependencies

    if @repair_dynamic_swift
      KZ::KZSwiftAttachOCFeature.new.repair
    elsif @repair_module_import
      KZ::KZRepairModuleImport.new(installer.aggregate_targets.first.user_project).repair
    else @repair_private_hmap
    KZ::KZGlobalHelper.instance.kz_generator.create_hamp
    end
  end
end