simple-hd-graph 0.3.0 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/simple-hd-graph/command.rb +11 -6
- data/lib/simple-hd-graph/renderer/plantuml.rb +16 -0
- data/lib/simple-hd-graph/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4c98a6c57f3e6e31d829c886f1354d0483f449a1cd683865df9e68574f2472d6
|
4
|
+
data.tar.gz: a961f75432eb08c7a72507a06eb7e10c6a498f2911910b4c174fb6f8c2938207
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8e621ce8f0f2680a5ecac741e56ec96180bc7899fd4ec2156fd9725a3f38d5377350aa27356728d59aaf4f09909c2b109b19528fbe572aa696b671b4de0ea13b
|
7
|
+
data.tar.gz: 73132da6fd3a16f0353dac3c55108e81157c4d052cddb3117c44ea40ab3e4b07d3ce6fdfb0042ce6f17f6f24dbc729434d7725ad6680a286473ae61b02911565
|
@@ -9,12 +9,12 @@ module SimpleHdGraph
|
|
9
9
|
#
|
10
10
|
# @param parser [Parser]
|
11
11
|
# @param reader [Reader]
|
12
|
-
# @param renderer [
|
12
|
+
# @param renderer [Symbol]
|
13
13
|
#
|
14
|
-
def initialize(parser: Parser.new, reader: Reader.new, renderer:
|
14
|
+
def initialize(parser: Parser.new, reader: Reader.new, renderer: :plantuml)
|
15
15
|
@parser = parser
|
16
16
|
@reader = reader
|
17
|
-
@renderer = renderer
|
17
|
+
@renderer = SimpleHdGraph::Renderer.method(renderer.to_s)
|
18
18
|
end
|
19
19
|
attr_reader :parser, :reader, :renderer
|
20
20
|
|
@@ -49,9 +49,7 @@ module SimpleHdGraph
|
|
49
49
|
def start
|
50
50
|
nodes = parser.parse(stream)
|
51
51
|
|
52
|
-
|
53
|
-
renderer.render(node)
|
54
|
-
}.join
|
52
|
+
@renderer.call(nodes)
|
55
53
|
end
|
56
54
|
|
57
55
|
#
|
@@ -74,6 +72,13 @@ module SimpleHdGraph
|
|
74
72
|
raise FileNotExist, value
|
75
73
|
end
|
76
74
|
}
|
75
|
+
opt.on('-r RENDERER', '--renderer', 'renderer') { |value|
|
76
|
+
begin
|
77
|
+
@renderer = SimpleHdGraph::Renderer.method(value)
|
78
|
+
rescue NameError
|
79
|
+
STDERR.puts "[Warining] renderer `#{value}` not found. falling back to :plantuml"
|
80
|
+
end
|
81
|
+
}
|
77
82
|
end
|
78
83
|
end
|
79
84
|
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
Dir.glob(File.join(__dir__, '**/*.rb')).each { |f| require f }
|
2
|
+
|
3
|
+
module SimpleHdGraph
|
4
|
+
module Renderer
|
5
|
+
#
|
6
|
+
# @param nodes [Array]
|
7
|
+
#
|
8
|
+
def plantuml(nodes)
|
9
|
+
context = self::PlantUML::Context.new
|
10
|
+
puts nodes.map { |node|
|
11
|
+
context.render(node)
|
12
|
+
}.join
|
13
|
+
end
|
14
|
+
module_function :plantuml
|
15
|
+
end
|
16
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: simple-hd-graph
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- wtnabe
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-04-
|
11
|
+
date: 2021-04-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: dry-inflector
|
@@ -134,6 +134,7 @@ files:
|
|
134
134
|
- lib/simple-hd-graph/node.rb
|
135
135
|
- lib/simple-hd-graph/parser.rb
|
136
136
|
- lib/simple-hd-graph/reader.rb
|
137
|
+
- lib/simple-hd-graph/renderer/plantuml.rb
|
137
138
|
- lib/simple-hd-graph/renderer/plantuml/context.rb
|
138
139
|
- lib/simple-hd-graph/renderer/plantuml/resource.rb
|
139
140
|
- lib/simple-hd-graph/resource.rb
|