Class: Pod::Command::Jsource::List

Inherits:
Pod::Command::Jsource show all
Defined in:
lib/cocoapods-jsource/command/jsource/list.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(argv) ⇒ List

Returns a new instance of List.



26
27
28
29
30
31
32
33
# File 'lib/cocoapods-jsource/command/jsource/list.rb', line 26

def initialize(argv)
  @pod_name = argv.shift_argument
  @short_output = argv.flag?('short')
  @pod_cache = argv.flag?('cache')
  @cache_dict = cache_object
  @manager = XcodeManager.new(argv)
  super
end

Class Method Details

.optionsObject



19
20
21
22
23
24
# File 'lib/cocoapods-jsource/command/jsource/list.rb', line 19

def self.options
  [
      ['--short', 'Only print the path relative to the cache root'],
      ['--cache', 'Only print the cached pods']
  ].concat(super)
end

Instance Method Details

#runObject



35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# File 'lib/cocoapods-jsource/command/jsource/list.rb', line 35

def run
  return if @cache_dict.nil?
  result = ""
  if @pod_name
    if @pod_cache
      result = @cache_dict[@pod_name] if @cache_dict.has_key? @pod_name
    else
      # 获取debug里 这个pod_name 的关键信息
      result = @manager.component_in_debug @pod_name
    end
  else
    if @pod_cache
      result = @cache_dict
    else
      # 获取debug里所有的group信息。
      result = @manager.all_components_in_debug
    end
  end
  if @short_output
    result = result.keys
  end
  output_pipe.puts result.to_yaml unless result.nil? or result.length == 0
end