draw_uml 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +4 -4
- data/config.ru +1 -1
- data/example/doc/diagrams/uml/sequence.uml +7 -0
- data/lib/draw_uml.rb +1 -0
- data/lib/draw_uml/configure.rb +5 -1
- data/lib/draw_uml/default.rb +1 -1
- data/lib/draw_uml/engine.rb +8 -3
- data/lib/draw_uml/tree.rb +10 -0
- data/lib/draw_uml/tree/branch.rb +32 -0
- data/lib/draw_uml/tree/leaf.rb +12 -0
- data/lib/draw_uml/version.rb +1 -1
- data/lib/templates/layouts/application.html.erb +20 -6
- metadata +6 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 86908c27699847e4e49ecd3e0f4f76c25bc9d929
|
4
|
+
data.tar.gz: 98c770b3c7a3a49698f775b693033c3503e2a2e1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8342d7334734b458e48e566614b1a78c94928b723cd3b3a1f8dfaaee46bf433d125d7c10e6f1e574c743517b53762e8f7e4772cf12b076c9b72e5ac41efcf21e
|
7
|
+
data.tar.gz: 459c443e3e93b395e3268cd107868a848d04f12691f9ccf646126129f105f033603f01a0f21a4f8f1708f379d1eb60a2c34b8c549c7e98c3349eeb82efd9c504
|
data/.gitignore
CHANGED
data/config.ru
CHANGED
data/lib/draw_uml.rb
CHANGED
data/lib/draw_uml/configure.rb
CHANGED
@@ -13,8 +13,12 @@ module DrawUml
|
|
13
13
|
@keys ||= %i[diagram_extension diagram_path static_path image_path]
|
14
14
|
end
|
15
15
|
|
16
|
+
def source_path
|
17
|
+
File.expand_path(self.diagram_path)
|
18
|
+
end
|
19
|
+
|
16
20
|
def source_file
|
17
|
-
Dir[File.
|
21
|
+
Dir[File.join(self.source_path, '**/*.' + self.diagram_extension)]
|
18
22
|
end
|
19
23
|
|
20
24
|
def dest_path
|
data/lib/draw_uml/default.rb
CHANGED
data/lib/draw_uml/engine.rb
CHANGED
@@ -1,18 +1,23 @@
|
|
1
1
|
require 'rack'
|
2
2
|
require 'erb'
|
3
|
+
require 'pp'
|
3
4
|
|
4
5
|
module DrawUml
|
5
6
|
class Engine
|
6
7
|
class << self
|
7
8
|
def call(env)
|
8
|
-
|
9
|
-
id = params['id'].to_i ||= 0
|
9
|
+
request = Rack::Request.new(env)
|
10
|
+
id = request.params['id'].to_i ||= 0
|
11
|
+
|
12
|
+
# root = DrawUml::Tree.create(DrawUml::Configure.source_path)
|
13
|
+
# root.each do |node|
|
14
|
+
# end
|
10
15
|
|
11
16
|
diagram = DrawUml::Diagram.new(DrawUml::Configure.dest_path)
|
12
17
|
diagram.create(DrawUml::Configure.source_file[id])
|
13
18
|
|
14
19
|
files = DrawUml::Configure.source_file.map { |file| File.basename(file, '.*') }
|
15
|
-
|
20
|
+
image_path = File.join(DrawUml::Configure.image_path, files[id] + '.png')
|
16
21
|
|
17
22
|
erb = ERB.new(DrawUml::Configure.application_template)
|
18
23
|
body = erb.result(binding)
|
@@ -0,0 +1,32 @@
|
|
1
|
+
module DrawUml
|
2
|
+
module Tree
|
3
|
+
class Branch < DrawUml::Tree::Leaf
|
4
|
+
attr_reader :entries
|
5
|
+
|
6
|
+
def initialize(name)
|
7
|
+
@entries = []
|
8
|
+
super
|
9
|
+
node
|
10
|
+
end
|
11
|
+
|
12
|
+
def each(&block)
|
13
|
+
entries.each do |entry|
|
14
|
+
block.call(entry)
|
15
|
+
entry.each(&block) if entry.is_a?(DrawUml::Tree::Branch)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
private
|
20
|
+
def node
|
21
|
+
Dir[File.join(path, '*')].each do |path|
|
22
|
+
if File.directory?(path)
|
23
|
+
entries << DrawUml::Tree::Branch.new(path)
|
24
|
+
else
|
25
|
+
entries << DrawUml::Tree::Leaf.new(path)
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
# end private
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
data/lib/draw_uml/version.rb
CHANGED
@@ -1,15 +1,29 @@
|
|
1
1
|
<!DOCTYPE html>
|
2
2
|
<html>
|
3
|
-
<head>
|
4
|
-
|
3
|
+
<head><title>Diagrams</title>
|
4
|
+
<style type="text/css">
|
5
|
+
div.diagrams {
|
6
|
+
padding-top: 20px;
|
7
|
+
float:left;
|
8
|
+
}
|
9
|
+
|
10
|
+
div.draw img {
|
11
|
+
padding-top: 40px;
|
12
|
+
padding-left: 80px;
|
13
|
+
}
|
14
|
+
</style>
|
5
15
|
</head>
|
6
16
|
<body>
|
7
17
|
|
8
|
-
|
9
|
-
|
10
|
-
|
18
|
+
<div class='diagrams'>
|
19
|
+
<% files.each_with_index do |item, idx| %>
|
20
|
+
<a href="<%= request.path %>?id=<%= idx %>"><%= item %></a><br>
|
21
|
+
<% end %>
|
22
|
+
</div>
|
11
23
|
|
12
|
-
<
|
24
|
+
<div class='draw'>
|
25
|
+
<img src=<%= image_path %>>
|
26
|
+
</div>
|
13
27
|
|
14
28
|
</body>
|
15
29
|
</html>
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: draw_uml
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- ogom
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-09-
|
11
|
+
date: 2014-09-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rack
|
@@ -68,11 +68,15 @@ files:
|
|
68
68
|
- config.ru
|
69
69
|
- draw_uml.gemspec
|
70
70
|
- example/bin/draw_uml
|
71
|
+
- example/doc/diagrams/uml/sequence.uml
|
71
72
|
- lib/draw_uml.rb
|
72
73
|
- lib/draw_uml/configure.rb
|
73
74
|
- lib/draw_uml/default.rb
|
74
75
|
- lib/draw_uml/diagram.rb
|
75
76
|
- lib/draw_uml/engine.rb
|
77
|
+
- lib/draw_uml/tree.rb
|
78
|
+
- lib/draw_uml/tree/branch.rb
|
79
|
+
- lib/draw_uml/tree/leaf.rb
|
76
80
|
- lib/draw_uml/version.rb
|
77
81
|
- lib/templates/layouts/application.html.erb
|
78
82
|
- spec/lib/version_spec.rb
|