class Bundler::Graph
def populate
def populate return if @populated # hash of name => GraphNode @nodes = {} @groups = {} # Populate @nodes @env.specs.each { |spec| @nodes[spec.name] = GraphNode.new(spec.name, spec.version) } # For gems in Gemfile, add details @env.current_dependencies.each do |dependency| node = @nodes[dependency.name] node.is_user = true dependency.groups.each do |group| if @groups.has_key? group group = @groups[group] else group = @groups[group] = [] end group << dependency end end # walk though a final time and add edges @env.specs.each do |spec| from = @nodes[spec.name] spec.runtime_dependencies.each do |dependency| from.dependencies << dependency end end @nodes.freeze @groups.freeze @populated = true end