Class: Pod::Command::HMapGen

Inherits:
Pod::Command show all
Defined in:
lib/hmap/command/hmap_gen.rb

Overview

hmap file gen cmd

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(argv) ⇒ HMapGen

Returns a new instance of HMapGen.



16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/hmap/command/hmap_gen.rb', line 16

def initialize(argv)
  super
  project_directory = argv.option('project-directory')
  targets = argv.option('allow-targets') || ''
  @allow_targets = targets.split(%r{,\s*})
  @no_use_build_in_headermap = !argv.flag?('fno-use-origin-headermap', false)
  @save_origin_build_setting = !argv.flag?('fno-save-origin', false)
  @clean_hmap = argv.flag?('clean-hmap', false)
  return if project_directory.nil?

  @project_directory = Pathname.new(project_directory).expand_path
  config.installation_root = @project_directory
end

Class Method Details

.optionsObject

help



36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/hmap/command/hmap_gen.rb', line 36

def self.options
  [
    ['--project-directory=/project/dir/', 'The path to the root of the project directory'],
    ['--allow-targets=target, target1, target2', 'If we set --fno-use-origin-headermap and ' \
      '--fno-save-origin, we can use this option to decide which targets to use hmap file while keeping the initial settings'],
    ['--fno-save-origin',
     'This option will not save xcconfig origin [HEADER_SEARCH_PATHS] and put hmap file first'],
    ['--fno-use-origin-headermap',
     'This option will use  Xcode built-in options Use Header Maps and not use this code gen hmap file'],
    ['--clean-hmap', 'This option will clean up all hmap-gen setup for hmap.']
  ].concat(super)
end

Instance Method Details

#runObject



49
50
51
52
53
54
55
56
57
# File 'lib/hmap/command/hmap_gen.rb', line 49

def run
  UI.section "\n[hmap-gen] start.............." do
    HMap::MapFileWriter.new(@save_origin_build_setting,
                            @clean_hmap,
                            @allow_targets,
                            use_build_in_headermap: @no_use_build_in_headermap)
  end
  UI.puts('[hmap-gen] finish..............')
end

#validate!Object



30
31
32
33
# File 'lib/hmap/command/hmap_gen.rb', line 30

def validate!
  super
  verify_podfile_exists!
end