class Dependency::Graph

Attributes

output_class_hash[RW]

Public Instance Methods

generate(umbrella_targets) click to toggle source

@param [Array<UmbrellaTargetDescription>] The list of

the CocoaPods umbrella targets generated by the installer.
# File lib/cocoapods_dependency_graph.rb, line 48
def generate(umbrella_targets)
  unless umbrella_targets.length() > 0
    puts "No target detected"
  end
  
  umbrella_targets.each { |target| 
    next if target.cocoapods_target_label.end_with?("Tests")
    generate_graph_for_target(target)
  }
end
generate_graph_for_target(umbrella_target) click to toggle source

@param [UmbrellaTargetDescription] umbrella_target

# File lib/cocoapods_dependency_graph.rb, line 60
def generate_graph_for_target(umbrella_target)
  module_spec_hash = {}
  umbrella_target.specs.each { | spec |
    module_spec_hash[spec.name] = spec
  } 
  
  init_output_hash
  output_key = Pod::Podfile::DSL.dependency_output_format
  output_key = Output::GRAPH unless output_key

  generator_string = @output_class_hash[output_key]

  unless generator_string 
    puts "The dependency_output should be one of #{Output::GRAPH}, #{Output::JSON}, and #{Output::EXCEL}"
    return 
  end

  generator_class = Object.const_get(generator_string)
  generator_class.new.generate(umbrella_target,module_spec_hash)
end
init_output_hash() click to toggle source
# File lib/cocoapods_dependency_graph.rb, line 37
def init_output_hash
  @output_class_hash = {
    :graph => 'Dependency::GraphGenerator', 
    :json => 'Dependency::JsonGenerator', 
    :excel => 'Dependency::ExcelGenerator'
  }
end