dothtml 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,34 @@
1
+ <head>
2
+ <title><%= title %></title>
3
+ <script src="<%= d3js %>" charset="utf-8"></script>
4
+ <style><%= style %></style>
5
+ </head>
6
+ <body>
7
+ <div id="diagram">
8
+ <%= body %>
9
+ </div>
10
+ <% if choices || descriptions %>
11
+ <div id="desc-wrap">
12
+ <% if descriptions %>
13
+ <div id="desc">
14
+ <div class="src-dest"></div>
15
+ <div class="active"></div>
16
+ </div>
17
+ <% end %>
18
+ <% if choices %>
19
+ <div id="choices">
20
+ <form>
21
+ <ul>
22
+ <% choices.each do |choice| %>
23
+ <li><input type="radio" name="choice" value="<%=choice%>"><%= choice %></li>
24
+ <% end %>
25
+ </ul>
26
+ </form>
27
+ </div>
28
+ <% end %>
29
+ </div>
30
+ <% end %>
31
+ <script>
32
+ <%= behavior %>
33
+ </script>
34
+ </body>
@@ -0,0 +1,113 @@
1
+ /* layout */
2
+ body {
3
+ font-family: "helvetica";
4
+ font-size: 14px;
5
+ }
6
+ #diagram, #desc-wrap {
7
+ xborder: 1px solid blue;
8
+ }
9
+ #diagram {
10
+ float: left;
11
+ }
12
+ #desc-wrap {
13
+ margin: 0px;
14
+ margin-left: 840px;
15
+ padding: 15px 4px 4px 4px;
16
+
17
+ }
18
+
19
+ #desc, #choices {
20
+ border: 1.75px solid #000000;
21
+ border-radius: 8px;
22
+ /* cluster background */
23
+ background-color: #dddddd;
24
+ padding: 5px;
25
+ margin: 8px;
26
+ font-weight: bold;
27
+ }
28
+
29
+ /* diagram */
30
+
31
+ text {
32
+ fill: #666666;
33
+ }
34
+
35
+ .node.noui path {
36
+ fill: #dddddd;
37
+ }
38
+
39
+ .node.same path {
40
+ stroke: red;
41
+ }
42
+
43
+ .node.same text {
44
+ fill: red;
45
+ }
46
+
47
+ /* cluster title */
48
+ .cluster text {
49
+ fill: #000000;
50
+ }
51
+
52
+ /* cluster background */
53
+ .cluster path {
54
+ stroke: #000000;
55
+ fill: #dddddd;
56
+ }
57
+
58
+ .node path {
59
+ stroke-width: 2px;
60
+ stroke: #000000;
61
+ fill: #ffffff;
62
+ }
63
+ .node text {
64
+ font-size: 12px;
65
+ }
66
+
67
+ .client.node path,
68
+ .client.node polygon,
69
+ .client.node polyline,
70
+ .server.node path,
71
+ .server.node polygon,
72
+ .server.node polyline {
73
+ stroke: green;
74
+ }
75
+ .client-config.node path,
76
+ .client-config.node polygon,
77
+ .client-config.node polyline,
78
+ .server-config.node path,
79
+ .server-config.node polygon,
80
+ .server-config.node polyline {
81
+ fill: #cccc00;
82
+ }
83
+
84
+ .edge.src-dest polyton, .edge.src polygon, .edge.dest polygon {
85
+ stroke: #996600;
86
+ fill: #996600;
87
+ z-index: 1;
88
+ }
89
+ .edge.src-dest path, .edge.src path, .edge.dest path {
90
+ stroke: #996600;
91
+ z-index: 1;
92
+ }
93
+
94
+ .active.node text {
95
+ fill: #000000;
96
+ }
97
+
98
+ .active.node path,
99
+ .active.node polygon,
100
+ .active.node polyline {
101
+ stroke: red;
102
+ }
103
+
104
+
105
+ /* arrow head */
106
+ .edge polygon {
107
+ stroke: #996600;
108
+ fill: #996600;
109
+ }
110
+ /* lines */
111
+ .edge path {
112
+ stroke: #996600;
113
+ }
@@ -0,0 +1,6 @@
1
+ $LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
2
+
3
+ require 'dothtml'
4
+ require "dothtml/dot_task"
5
+
6
+ require 'minitest/autorun'
@@ -0,0 +1,54 @@
1
+ require 'minitest_helper'
2
+
3
+ class TestDotHelper < Minitest::Test
4
+ def dot_helper(contents = nil)
5
+ DotHelper.new contents
6
+ end
7
+
8
+ def test_extract_id_class_with_id
9
+ assert_equal ["x1"], dot_helper.extract_id_class("x1")
10
+ end
11
+
12
+ def test_extract_id_class_with_class_eq
13
+ assert_equal ["", "x1"], dot_helper.extract_id_class("class=x1")
14
+ end
15
+
16
+ def test_extract_id_class_with_id_class_eq
17
+ assert_equal ["x1", "c1"], dot_helper.extract_id_class("x1 class=c1")
18
+ end
19
+
20
+ def test_extract_id_class_with_id_class_eq_quote
21
+ assert_equal ["x1", "c1"], dot_helper.extract_id_class("x1 class='c1'")
22
+ end
23
+
24
+ def test_extract_id_class_with_id_class_eq_dbl_quote
25
+ assert_equal ["x1", "c1"], dot_helper.extract_id_class('x1 class="c1"')
26
+ end
27
+
28
+ def test_merge_id_class_with_id_class_eq_and_class
29
+ assert_equal ["x1", "c0 c1"], dot_helper.merge_id_class('x1 class="c1"', "c0")
30
+ end
31
+
32
+ def test_merge_id_class_with_id_multi_class_eq_and_class
33
+ assert_equal ["x1", "c0 c1 c2"], dot_helper.merge_id_class('x1 class="c1 c2"', "c0")
34
+ end
35
+
36
+ def test_fix_node_id_with_id_class_eq_and_class
37
+ node = dot_helper.fix_node_id(dom(%{<x><div id="x1 class=c1"></div></x>}, "div"))
38
+ assert_equal "x1", node["id"]
39
+ assert_equal "c1", node["class"]
40
+ end
41
+
42
+ def test_fix_ids
43
+ node = dot_helper(%{<x><div id="x1 class=c1" class="c0"></div></x>}).fix_ids.dom
44
+ assert_equal "x1", node.at("div")["id"]
45
+ assert_equal "c0 c1", node.at("div")["class"]
46
+ end
47
+
48
+ private
49
+
50
+ def dom(contents, at=nil)
51
+ node = Nokogiri::XML.parse(contents)
52
+ at ? node.at(at) : node
53
+ end
54
+ end
@@ -0,0 +1,4 @@
1
+ require 'minitest_helper'
2
+
3
+ class TestDotTask < Minitest::Test
4
+ end
@@ -0,0 +1,7 @@
1
+ require 'minitest_helper'
2
+
3
+ class TestDothtml < Minitest::Test
4
+ def test_that_it_has_a_version_number
5
+ refute_nil ::Dothtml::VERSION
6
+ end
7
+ end
metadata ADDED
@@ -0,0 +1,172 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: dothtml
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.3
5
+ platform: ruby
6
+ authors:
7
+ - Keenan Brock
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-03-11 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: guard
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: guard-rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: nokogiri
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: tilt
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: bundler
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '1.7'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '1.7'
83
+ - !ruby/object:Gem::Dependency
84
+ name: rake
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: '10.0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: '10.0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: minitest
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
111
+ description: Make conversion of dot to html easier
112
+ email:
113
+ - keenan@thebrocks.net
114
+ executables:
115
+ - dothtml
116
+ extensions: []
117
+ extra_rdoc_files: []
118
+ files:
119
+ - ".gitignore"
120
+ - ".travis.yml"
121
+ - CHANGELOG.md
122
+ - Gemfile
123
+ - LICENSE.txt
124
+ - README.md
125
+ - Rakefile
126
+ - bin/dothtml
127
+ - dothtml.gemspec
128
+ - lib/dothtml.rb
129
+ - lib/dothtml/dot_helper.rb
130
+ - lib/dothtml/dot_task.rb
131
+ - lib/dothtml/version.rb
132
+ - templates/Gemfile
133
+ - templates/Guardfile
134
+ - templates/Rakefile
135
+ - templates/behavior.js
136
+ - templates/d3.v3.js
137
+ - templates/index.html.erb
138
+ - templates/style.css
139
+ - test/minitest_helper.rb
140
+ - test/test_dot_helper.rb
141
+ - test/test_dot_task.rb
142
+ - test/test_dothtml.rb
143
+ homepage: http://github.com/kbrock/dothtml
144
+ licenses:
145
+ - MIT
146
+ metadata: {}
147
+ post_install_message:
148
+ rdoc_options: []
149
+ require_paths:
150
+ - lib
151
+ required_ruby_version: !ruby/object:Gem::Requirement
152
+ requirements:
153
+ - - ">="
154
+ - !ruby/object:Gem::Version
155
+ version: '0'
156
+ required_rubygems_version: !ruby/object:Gem::Requirement
157
+ requirements:
158
+ - - ">="
159
+ - !ruby/object:Gem::Version
160
+ version: '0'
161
+ requirements: []
162
+ rubyforge_project:
163
+ rubygems_version: 2.0.14
164
+ signing_key:
165
+ specification_version: 4
166
+ summary: Make conversion of dot to html easier
167
+ test_files:
168
+ - test/minitest_helper.rb
169
+ - test/test_dot_helper.rb
170
+ - test/test_dot_task.rb
171
+ - test/test_dothtml.rb
172
+ has_rdoc: