Class: Cs_Sln_Graph
- Inherits:
-
Object
- Object
- Cs_Sln_Graph
- Defined in:
- lib/cs_sln_graph.rb
Instance Method Summary collapse
- #format_graph ⇒ Object
- #graph ⇒ Object
-
#initialize(input, output, format) ⇒ Cs_Sln_Graph
constructor
A new instance of Cs_Sln_Graph.
Constructor Details
#initialize(input, output, format) ⇒ Cs_Sln_Graph
Returns a new instance of Cs_Sln_Graph.
7 8 9 10 11 12 13 |
# File 'lib/cs_sln_graph.rb', line 7 def initialize(input, output, format) @input_path = input @output_path = output @format = format @graph = GraphViz.new("G") format_graph end |
Instance Method Details
#format_graph ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/cs_sln_graph.rb', line 15 def format_graph #@graph[:rankdir] = "LR" # set global node options @graph.node[:color] = "#ddaa66" @graph.node[:style] = "filled" @graph.node[:shape] = "box" @graph.node[:penwidth] = "1" @graph.node[:fontname] = "Trebuchet MS" @graph.node[:fontsize] = "8" @graph.node[:fillcolor]= "#ffeecc" @graph.node[:fontcolor]= "#666666" @graph.node[:margin] = "0.0" # set global edge options @graph.edge[:color] = "#999999" @graph.edge[:weight] = "1" @graph.edge[:fontsize] = "6" @graph.edge[:fontcolor]= "#444444" @graph.edge[:fontname] = "Verdana" @graph.edge[:dir] = "forward" @graph.edge[:arrowsize]= "0.5" end |
#graph ⇒ Object
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 |
# File 'lib/cs_sln_graph.rb', line 39 def graph projects = VSFile_Reader.read_sln(@input_path) projects.each do |project| p_node = @graph.add_node(project.name) path = File.join(File.dirname(@input_path), project.path) dependencies = VSFile_Reader.read_proj(path) dependencies.each do |dep| if dep.class == Project d_node = @graph.get_node(dep.name) if d_node.nil? d_node = @graph.add_node(dep.name) end @graph.add_edge(d_node, p_node) else if not dep.start_with?("System") d_node = @graph.get_node(dep) if d_node.nil? d_node = @graph.add_node(dep) d_node[:color] = "#66ddaa" d_node[:fillcolor] = "#ccffee" end @graph.add_edge(d_node, p_node) end end end end @graph.output(@format => @output_path) end |