Skip to content
This repository has been archived by the owner on Dec 16, 2022. It is now read-only.

Commit

Permalink
Fixed deprecation warnings in bundle viz
Browse files Browse the repository at this point in the history
Newer versions of ruby-graphviz also warn about nil options.
So I decided to clear out the :label option if it's nil.
  • Loading branch information
koraktor committed Feb 12, 2012
1 parent 54b6240 commit c731a07
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions lib/bundler/graph.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@ def _populate_relations
@relations[dependency.name] += child_dependencies.map(&:name).to_set
tmp += child_dependencies

@node_options[dependency.name] = {:label => _make_label(dependency, :node)}
@node_options[dependency.name] = _make_label(dependency, :node)
child_dependencies.each do |c_dependency|
@edge_options["#{dependency.name}_#{c_dependency.name}"] = {:label => _make_label(c_dependency, :edge)}
@edge_options["#{dependency.name}_#{c_dependency.name}"] = _make_label(c_dependency, :edge)
end
end
parent_dependencies = tmp
Expand All @@ -58,8 +58,8 @@ def _groups
relations[group.to_s].add(dependency)
@relations[group.to_s].add(dependency.name)

@node_options[group.to_s] ||= {:label => _make_label(group, :node)}
@edge_options["#{group}_#{dependency.name}"] = {:label => _make_label(dependency, :edge)}
@node_options[group.to_s] ||= _make_label(group, :node)
@edge_options["#{group}_#{dependency.name}"] = _make_label(dependency, :edge)
end
end
@groups = relations.keys
Expand All @@ -84,7 +84,7 @@ def _make_label(symbol_or_string_or_dependency, element_type)
else
raise ArgumentError, "2nd argument is invalid"
end
label
label.nil? ? {} : { :label => label }
end

class GraphVizClient
Expand All @@ -109,7 +109,7 @@ def g

def run
@groups.each do |group|
g.add_node(
g.add_nodes(
group,
{:style => 'filled',
:fillcolor => '#B9B9D5',
Expand All @@ -121,11 +121,11 @@ def run
@relations.each do |parent, children|
children.each do |child|
if @groups.include?(parent)
g.add_node(child, {:style => 'filled', :fillcolor => '#B9B9D5'}.merge(@node_options[child]))
g.add_edge(parent, child, {:constraint => false}.merge(@edge_options["#{parent}_#{child}"]))
g.add_nodes(child, {:style => 'filled', :fillcolor => '#B9B9D5'}.merge(@node_options[child]))
g.add_edges(parent, child, {:constraint => false}.merge(@edge_options["#{parent}_#{child}"]))
else
g.add_node(child, @node_options[child])
g.add_edge(parent, child, @edge_options["#{parent}_#{child}"])
g.add_nodes(child, @node_options[child])
g.add_edges(parent, child, @edge_options["#{parent}_#{child}"])
end
end
end
Expand Down

0 comments on commit c731a07

Please sign in to comment.