class Pod::Command::Jyanalyzer::Depend

Public Class Methods

new(argv) click to toggle source
Calls superclass method
# File lib/cocoapods-jyanalyzer/command/jyanalyzer/depend.rb, line 17
def initialize(argv)
  @pods = argv.arguments!
  super
end

Public Instance Methods

recursion_dependencies(pod_targets,index) click to toggle source
# File lib/cocoapods-jyanalyzer/command/jyanalyzer/depend.rb, line 44
def recursion_dependencies(pod_targets,index)
  if index == 2 
      return ""
  end
  text = ""
  dependent_targets = Array.new

  if pod_targets.is_a? Array
      dependent_targets = pod_targets
  else
      dependent_targets = pod_targets.dependent_targets
  end

  dependent_targets.each do |item|

      $i = 0
      $num = index
      while $i < $num  do
          if $i == $num -1
              text = text + "- "
          else
              text = text + "  "
          end
          
          $i +=1
       end

      text = text + item.pod_name + "(" + item.version + ")" + "\n"
      
      if !item.dependent_targets.empty?
          text = text + recursion_dependencies(item.dependent_targets,index + 1)
      end
      if index == 0
          text = text + "\n"
      end
  end

  return text

end
run() click to toggle source
# File lib/cocoapods-jyanalyzer/command/jyanalyzer/depend.rb, line 21
def run

  verify_podfile_exists!
  installer = installer_for_config
  installer.repo_update = repo_update?(:default => true)
  UI.puts 'Update all pods'.yellow
  installer.update = true
  installer.prepare
  installer.resolve_dependencies
  pod_targets = installer.pod_targets;

  Pod::UI.puts '查看app依赖关系,pod jyanalyzer depend'

  text = recursion_dependencies(pod_targets,0)
  Pod::UI.puts text

  f=File.new("dependencies.lock","w+")
  f.puts(text)
  f.close


end