Class: DependenciesGraph

Inherits:
Object
  • Object
show all
Defined in:
lib/cocoapods-binary-ht/dependencies_graph/dependencies_graph.rb

Overview

Using RGL graph because GraphViz doesn’t store adjacent of a node/vertex but we need to traverse a substree from any node github.com/monora/rgl/blob/master/lib/rgl/adjacency.rb

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ DependenciesGraph

Returns a new instance of DependenciesGraph.



13
14
15
16
17
18
19
# File 'lib/cocoapods-binary-ht/dependencies_graph/dependencies_graph.rb', line 13

def initialize(options)
  @lockfile = options[:lockfile]
  @devpod_only = options[:devpod_only]
  @max_deps = options[:max_deps].to_i if options[:max_deps]
  # A normal edge is an edge (one direction) from library A to library B which is a dependency of A.
  @invert_edge = options[:invert_edge] || false
end

Instance Method Details

#get_clients(libnames) ⇒ Object

Input : a list of library names. Output: a set of library names which are clients (directly and indirectly) of those input libraries.



23
24
25
26
27
28
29
30
31
32
33
# File 'lib/cocoapods-binary-ht/dependencies_graph/dependencies_graph.rb', line 23

def get_clients(libnames)
  result = Set.new
  libnames.each do |lib|
    if graph.has_vertex?(lib)
      result.merge(traverse_sub_tree(graph, lib))
    else
      Pod::UI.puts "Warning: cannot find lib: #{lib}"
    end
  end
  result
end

#write_graphic_file(options) ⇒ Object



35
36
37
# File 'lib/cocoapods-binary-ht/dependencies_graph/dependencies_graph.rb', line 35

def write_graphic_file(options)
  graph.write_to_graphic_file(options)
end