git-dag 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- git-dag (0.0.2)
4
+ git-dag (0.0.3)
5
5
  grit (~> 2.5.0)
6
6
 
7
7
  GEM
@@ -3,3 +3,5 @@ require 'git-dag/git_graph'
3
3
  require 'git-dag/node'
4
4
  require 'git-dag/commit_node'
5
5
  require 'git-dag/fake_head'
6
+ require 'git-dag/tag_node'
7
+ require 'git-dag/legend'
@@ -9,6 +9,7 @@ module GitDag
9
9
 
10
10
  def output_dot_file
11
11
  all_commits = build_entire_graph
12
+ add_tag_nodes(all_commits)
12
13
  get_dot_str(all_commits)
13
14
  end
14
15
 
@@ -21,6 +22,8 @@ module GitDag
21
22
  end
22
23
  dot_str << %Q(#{node.dot_node} #{node.label};\n)
23
24
  end
25
+ dot_str << Legend.dot_output
26
+
24
27
  dot_str << "}\n"
25
28
  end
26
29
 
@@ -46,6 +49,18 @@ module GitDag
46
49
  all_commits
47
50
  end
48
51
 
52
+ def add_tag_nodes(all_commits)
53
+ @repo.tags.each do |tag|
54
+ commit = tag.commit
55
+ parent_commit = all_commits.find {|id, c| id == commit.id}[1]
56
+ id = tag.name
57
+ dot_node = %Q("#{tag.name}")
58
+ label = %Q([color="green" shape=circle])
59
+ tag_node = TagNode.new(id, dot_node, label, [parent_commit])
60
+ all_commits[tag_node.id] = tag_node
61
+ end
62
+ end
63
+
49
64
  def create_fake_commit_for_head(branch_name, parent)
50
65
  id = branch_name
51
66
  dot_node = %Q("#{branch_name}")
@@ -0,0 +1,34 @@
1
+ TEMPLATE = <<HERE
2
+ { rank = same;
3
+ Legend [shape=none, margin=0, label=<
4
+ <TABLE BORDER="0" CELLBORDER="1" CELLSPACING="0" CELLPADDING="4">
5
+ <TR>
6
+ <TD COLSPAN="2" BGCOLOR="grey"><B>Legend</B></TD>
7
+ </TR>
8
+ <TR>
9
+ <TD><FONT COLOR="black">ellipse</FONT></TD>
10
+ <TD>regular commit</TD>
11
+ </TR>
12
+ <TR>
13
+ <TD><FONT COLOR="red">ellipse</FONT></TD>
14
+ <TD>merge commit</TD>
15
+ </TR>
16
+ <TR>
17
+ <TD><FONT COLOR="blue">box</FONT></TD>
18
+ <TD>branch</TD>
19
+ </TR>
20
+ <TR>
21
+ <TD><FONT COLOR="green">circle</FONT></TD>
22
+ <TD>tag</TD>
23
+ </TR>
24
+ </TABLE>
25
+ >];
26
+ }
27
+ HERE
28
+ module GitDag
29
+ module Legend
30
+ def self.dot_output
31
+ TEMPLATE
32
+ end
33
+ end
34
+ end
@@ -0,0 +1,10 @@
1
+ module GitDag
2
+ class TagNode < Node
3
+ def initialize(id, dot_node, label, parents)
4
+ @id = id
5
+ @dot_node = dot_node
6
+ @label = label
7
+ @parents = parents
8
+ end
9
+ end
10
+ end
@@ -1,3 +1,3 @@
1
1
  module GitDag
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.4"
3
3
  end
@@ -32,6 +32,35 @@ digraph G {
32
32
  "dev" [color="blue" shape=box];
33
33
  "master" -> "8b61ae";
34
34
  "master" [color="blue" shape=box];
35
+ "0.0.1" -> "c554da";
36
+ "0.0.1" [color="green" shape=circle];
37
+ "0.0.2" -> "37f6a9";
38
+ "0.0.2" [color="green" shape=circle];
39
+ { rank = same;
40
+ Legend [shape=none, margin=0, label=<
41
+ <TABLE BORDER="0" CELLBORDER="1" CELLSPACING="0" CELLPADDING="4">
42
+ <TR>
43
+ <TD COLSPAN="2" BGCOLOR="grey"><B>Legend</B></TD>
44
+ </TR>
45
+ <TR>
46
+ <TD><FONT COLOR="black">ellipse</FONT></TD>
47
+ <TD>regular commit</TD>
48
+ </TR>
49
+ <TR>
50
+ <TD><FONT COLOR="red">ellipse</FONT></TD>
51
+ <TD>merge commit</TD>
52
+ </TR>
53
+ <TR>
54
+ <TD><FONT COLOR="blue">box</FONT></TD>
55
+ <TD>branch</TD>
56
+ </TR>
57
+ <TR>
58
+ <TD><FONT COLOR="green">circle</FONT></TD>
59
+ <TD>tag</TD>
60
+ </TR>
61
+ </TABLE>
62
+ >];
63
+ }
35
64
  }
36
65
  HERE
37
66
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: git-dag
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-08-05 00:00:00.000000000 Z
12
+ date: 2012-08-06 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: grit
@@ -48,7 +48,9 @@ files:
48
48
  - lib/git-dag/commit_node.rb
49
49
  - lib/git-dag/fake_head.rb
50
50
  - lib/git-dag/git_graph.rb
51
+ - lib/git-dag/legend.rb
51
52
  - lib/git-dag/node.rb
53
+ - lib/git-dag/tag_node.rb
52
54
  - lib/git-dag/version.rb
53
55
  - test/integ/git_graph_test.rb
54
56
  - test/test_helper.rb