asciidoctor-diagram 1.0.1-java → 1.1.0-java

Sign up to get free protection for your applications and to get access to all the features.
Files changed (38) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.adoc +22 -0
  3. data/README.adoc +7 -6
  4. data/examples/Gemfile +3 -0
  5. data/examples/README.adoc +6 -0
  6. data/examples/build_example.rb +9 -0
  7. data/examples/design.adoc +78 -0
  8. data/examples/features.adoc +164 -0
  9. data/lib/asciidoctor-diagram.rb +1 -0
  10. data/lib/asciidoctor-diagram/ditaa.rb +1 -0
  11. data/lib/asciidoctor-diagram/ditaa/extension.rb +23 -50
  12. data/lib/asciidoctor-diagram/ditaa/generator.rb +31 -0
  13. data/lib/asciidoctor-diagram/graphviz.rb +8 -0
  14. data/lib/asciidoctor-diagram/graphviz/extension.rb +41 -0
  15. data/lib/asciidoctor-diagram/plantuml.rb +1 -0
  16. data/lib/asciidoctor-diagram/plantuml/extension.rb +33 -71
  17. data/lib/asciidoctor-diagram/plantuml/generator.rb +50 -0
  18. data/lib/asciidoctor-diagram/{binaryio.rb → util/binaryio.rb} +0 -0
  19. data/lib/asciidoctor-diagram/util/diagram.rb +198 -0
  20. data/lib/asciidoctor-diagram/{java.rb → util/java.rb} +0 -0
  21. data/lib/asciidoctor-diagram/{java_jruby.rb → util/java_jruby.rb} +0 -0
  22. data/lib/asciidoctor-diagram/{java_rjb.rb → util/java_rjb.rb} +0 -0
  23. data/lib/asciidoctor-diagram/{png.rb → util/png.rb} +0 -0
  24. data/lib/asciidoctor-diagram/util/svg.rb +46 -0
  25. data/lib/asciidoctor-diagram/version.rb +1 -1
  26. data/spec/ditaa_spec.rb +65 -0
  27. data/spec/graphviz_spec.rb +134 -0
  28. data/spec/plantuml_spec.rb +38 -0
  29. data/spec/test_helper.rb +1 -0
  30. metadata +32 -26
  31. data/.gitignore +0 -19
  32. data/.travis.yml +0 -10
  33. data/Gemfile +0 -4
  34. data/asciidoctor-diagram.gemspec +0 -30
  35. data/ditaamini-license.txt +0 -165
  36. data/lib/asciidoctor-diagram/diagram.rb +0 -111
  37. data/lib/asciidoctor-diagram/svg.rb +0 -18
  38. data/plantuml-license.txt +0 -202
@@ -1,5 +1,5 @@
1
1
  module Asciidoctor
2
2
  module Diagram
3
- VERSION = "1.0.1"
3
+ VERSION = "1.1.0"
4
4
  end
5
5
  end
data/spec/ditaa_spec.rb CHANGED
@@ -1,5 +1,48 @@
1
1
  require_relative 'test_helper'
2
2
 
3
+ describe Asciidoctor::Diagram::DitaaBlockMacro do
4
+ it "should generate PNG images when format is set to 'png'" do
5
+ code = <<-eos
6
+ +--------+ +-------+ +-------+
7
+ | | --+ ditaa +--> | |
8
+ | Text | +-------+ |diagram|
9
+ |Document| |!magic!| | |
10
+ | {d}| | | | |
11
+ +---+----+ +-------+ +-------+
12
+ : ^
13
+ | Lots of work |
14
+ +-------------------------+
15
+ eos
16
+
17
+ File.write('ditaa.txt', code)
18
+
19
+ doc = <<-eos
20
+ = Hello, PlantUML!
21
+ Doc Writer <doc@example.com>
22
+
23
+ == First Section
24
+
25
+ ditaa::ditaa.txt[format="png"]
26
+ eos
27
+
28
+ d = Asciidoctor.load StringIO.new(doc)
29
+ expect(d).to_not be_nil
30
+
31
+ b = d.find { |b| b.context == :image }
32
+ expect(b).to_not be_nil
33
+
34
+ expect(b.content_model).to eq :empty
35
+
36
+ target = b.attributes['target']
37
+ expect(target).to_not be_nil
38
+ expect(target).to match /\.png$/
39
+ expect(File.exists?(target)).to be_true
40
+
41
+ expect(b.attributes['width']).to_not be_nil
42
+ expect(b.attributes['height']).to_not be_nil
43
+ end
44
+ end
45
+
3
46
  describe Asciidoctor::Diagram::DitaaBlock do
4
47
  it "should generate PNG images when format is set to 'png'" do
5
48
  doc = <<-eos
@@ -53,4 +96,26 @@ Doc Writer <doc@example.com>
53
96
 
54
97
  expect { Asciidoctor.load StringIO.new(doc) }.to raise_error /support.*format/i
55
98
  end
99
+
100
+ it "should use a default format when none was given" do
101
+ doc = <<-eos
102
+ = Hello, PlantUML!
103
+ Doc Writer <doc@example.com>
104
+
105
+ == First Section
106
+
107
+ [ditaa]
108
+ ----
109
+ ----
110
+ eos
111
+
112
+ d = Asciidoctor.load StringIO.new(doc)
113
+ expect(d).to_not be_nil
114
+
115
+ b = d.find { |b| b.context == :image }
116
+ expect(b).to_not be_nil
117
+ target = b.attributes['target']
118
+ expect(target).to match /\.png$/
119
+ expect(File.exists?(target)).to be_true
120
+ end
56
121
  end
@@ -0,0 +1,134 @@
1
+ require_relative 'test_helper'
2
+
3
+ describe Asciidoctor::Diagram::GraphvizBlockMacro do
4
+ it "should generate PNG images when format is set to 'png'" do
5
+ code = <<-eos
6
+ digraph foo {
7
+ node [style=rounded]
8
+ node1 [shape=box]
9
+ node2 [fillcolor=yellow, style="rounded,filled", shape=diamond]
10
+ node3 [shape=record, label="{ a | b | c }"]
11
+
12
+ node1 -> node2 -> node3
13
+ }
14
+ eos
15
+
16
+ File.write('graphviz.txt', code)
17
+
18
+ doc = <<-eos
19
+ = Hello, graphviz!
20
+ Doc Writer <doc@example.com>
21
+
22
+ == First Section
23
+
24
+ graphviz::graphviz.txt[format="png"]
25
+ eos
26
+
27
+ d = Asciidoctor.load StringIO.new(doc)
28
+ expect(d).to_not be_nil
29
+
30
+ b = d.find { |b| b.context == :image }
31
+ expect(b).to_not be_nil
32
+
33
+ expect(b.content_model).to eq :empty
34
+
35
+ target = b.attributes['target']
36
+ expect(target).to_not be_nil
37
+ expect(target).to match /\.png$/
38
+ expect(File.exists?(target)).to be_true
39
+
40
+ expect(b.attributes['width']).to_not be_nil
41
+ expect(b.attributes['height']).to_not be_nil
42
+ end
43
+ end
44
+
45
+ describe Asciidoctor::Diagram::GraphvizBlock do
46
+ it "should generate PNG images when format is set to 'png'" do
47
+ doc = <<-eos
48
+ = Hello, graphviz!
49
+ Doc Writer <doc@example.com>
50
+
51
+ == First Section
52
+
53
+ [graphviz, format="png"]
54
+ ----
55
+ digraph foo {
56
+ node [style=rounded]
57
+ node1 [shape=box]
58
+ node2 [fillcolor=yellow, style="rounded,filled", shape=diamond]
59
+ node3 [shape=record, label="{ a | b | c }"]
60
+
61
+ node1 -> node2 -> node3
62
+ }
63
+ ----
64
+ eos
65
+
66
+ d = Asciidoctor.load StringIO.new(doc)
67
+ expect(d).to_not be_nil
68
+
69
+ b = d.find { |b| b.context == :image }
70
+ expect(b).to_not be_nil
71
+
72
+ expect(b.content_model).to eq :empty
73
+
74
+ target = b.attributes['target']
75
+ expect(target).to_not be_nil
76
+ expect(target).to match /\.png$/
77
+ expect(File.exists?(target)).to be_true
78
+
79
+ expect(b.attributes['width']).to_not be_nil
80
+ expect(b.attributes['height']).to_not be_nil
81
+ end
82
+
83
+ it "should generate SVG images when format is set to 'svg'" do
84
+ doc = <<-eos
85
+ = Hello, graphviz!
86
+ Doc Writer <doc@example.com>
87
+
88
+ == First Section
89
+
90
+ [graphviz, format="svg"]
91
+ ----
92
+ digraph foo {
93
+ node [style=rounded]
94
+ node1 [shape=box]
95
+ node2 [fillcolor=yellow, style="rounded,filled", shape=diamond]
96
+ node3 [shape=record, label="{ a | b | c }"]
97
+
98
+ node1 -> node2 -> node3
99
+ }
100
+ ----
101
+ eos
102
+
103
+ d = Asciidoctor.load StringIO.new(doc)
104
+ expect(d).to_not be_nil
105
+
106
+ b = d.find { |b| b.context == :image }
107
+ expect(b).to_not be_nil
108
+
109
+ expect(b.content_model).to eq :empty
110
+
111
+ target = b.attributes['target']
112
+ expect(target).to_not be_nil
113
+ expect(target).to match /\.svg$/
114
+ expect(File.exists?(target)).to be_true
115
+
116
+ expect(b.attributes['width']).to_not be_nil
117
+ expect(b.attributes['height']).to_not be_nil
118
+ end
119
+
120
+ it "should raise an error when when format is set to an invalid value" do
121
+ doc = <<-eos
122
+ = Hello, graphviz!
123
+ Doc Writer <doc@example.com>
124
+
125
+ == First Section
126
+
127
+ [graphviz, format="foobar"]
128
+ ----
129
+ ----
130
+ eos
131
+
132
+ expect { Asciidoctor.load StringIO.new(doc) }.to raise_error /support.*format/i
133
+ end
134
+ end
@@ -1,5 +1,43 @@
1
1
  require_relative 'test_helper'
2
2
 
3
+ describe Asciidoctor::Diagram::PlantUmlBlockMacro do
4
+ it "should generate PNG images when format is set to 'png'" do
5
+ code = <<-eos
6
+ User -> (Start)
7
+ User --> (Use the application) : Label
8
+
9
+ :Main Admin: ---> (Use the application) : Another label
10
+ eos
11
+
12
+ File.write('plantuml.txt', code)
13
+
14
+ doc = <<-eos
15
+ = Hello, PlantUML!
16
+ Doc Writer <doc@example.com>
17
+
18
+ == First Section
19
+
20
+ plantuml::plantuml.txt[format="png"]
21
+ eos
22
+
23
+ d = Asciidoctor.load StringIO.new(doc)
24
+ expect(d).to_not be_nil
25
+
26
+ b = d.find { |b| b.context == :image }
27
+ expect(b).to_not be_nil
28
+
29
+ expect(b.content_model).to eq :empty
30
+
31
+ target = b.attributes['target']
32
+ expect(target).to_not be_nil
33
+ expect(target).to match /\.png$/
34
+ expect(File.exists?(target)).to be_true
35
+
36
+ expect(b.attributes['width']).to_not be_nil
37
+ expect(b.attributes['height']).to_not be_nil
38
+ end
39
+ end
40
+
3
41
  describe Asciidoctor::Diagram::PlantUmlBlock do
4
42
  it "should generate PNG images when format is set to 'png'" do
5
43
  doc = <<-eos
data/spec/test_helper.rb CHANGED
@@ -7,6 +7,7 @@ require 'tmpdir'
7
7
 
8
8
  require_relative '../lib/asciidoctor-diagram'
9
9
  require_relative '../lib/asciidoctor-diagram/ditaa/extension'
10
+ require_relative '../lib/asciidoctor-diagram/graphviz/extension'
10
11
  require_relative '../lib/asciidoctor-diagram/plantuml/extension'
11
12
 
12
13
  module Asciidoctor
metadata CHANGED
@@ -1,69 +1,69 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: asciidoctor-diagram
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.1.0
5
5
  platform: java
6
6
  authors:
7
7
  - Pepijn Van Eeckhoudt
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-02-13 00:00:00.000000000 Z
11
+ date: 2014-02-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ~>
18
18
  - !ruby/object:Gem::Version
19
19
  version: '1.3'
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - "~>"
24
+ - - ~>
25
25
  - !ruby/object:Gem::Version
26
26
  version: '1.3'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rake
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ">="
31
+ - - '>='
32
32
  - !ruby/object:Gem::Version
33
33
  version: '0'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - ">="
38
+ - - '>='
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rspec
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - ">="
45
+ - - '>='
46
46
  - !ruby/object:Gem::Version
47
47
  version: '0'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - ">="
52
+ - - '>='
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: asciidoctor
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - "~>"
59
+ - - ~>
60
60
  - !ruby/object:Gem::Version
61
61
  version: 0.1.4
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - "~>"
66
+ - - ~>
67
67
  - !ruby/object:Gem::Version
68
68
  version: 0.1.4
69
69
  description: Asciidoctor diagramming extension
@@ -73,31 +73,36 @@ executables: []
73
73
  extensions: []
74
74
  extra_rdoc_files: []
75
75
  files:
76
- - ".gitignore"
77
- - ".travis.yml"
78
- - Gemfile
76
+ - CHANGELOG.adoc
79
77
  - LICENSE.txt
80
78
  - README.adoc
81
79
  - Rakefile
82
- - asciidoctor-diagram.gemspec
83
- - ditaamini-license.txt
80
+ - examples/Gemfile
81
+ - examples/README.adoc
82
+ - examples/build_example.rb
83
+ - examples/design.adoc
84
+ - examples/features.adoc
84
85
  - lib/asciidoctor-diagram.rb
85
- - lib/asciidoctor-diagram/binaryio.rb
86
- - lib/asciidoctor-diagram/diagram.rb
87
86
  - lib/asciidoctor-diagram/ditaa.rb
88
87
  - lib/asciidoctor-diagram/ditaa/extension.rb
89
- - lib/asciidoctor-diagram/java.rb
90
- - lib/asciidoctor-diagram/java_jruby.rb
91
- - lib/asciidoctor-diagram/java_rjb.rb
88
+ - lib/asciidoctor-diagram/ditaa/generator.rb
89
+ - lib/asciidoctor-diagram/graphviz.rb
90
+ - lib/asciidoctor-diagram/graphviz/extension.rb
92
91
  - lib/asciidoctor-diagram/plantuml.rb
93
92
  - lib/asciidoctor-diagram/plantuml/extension.rb
94
- - lib/asciidoctor-diagram/png.rb
95
- - lib/asciidoctor-diagram/svg.rb
93
+ - lib/asciidoctor-diagram/plantuml/generator.rb
94
+ - lib/asciidoctor-diagram/util/binaryio.rb
95
+ - lib/asciidoctor-diagram/util/diagram.rb
96
+ - lib/asciidoctor-diagram/util/java.rb
97
+ - lib/asciidoctor-diagram/util/java_jruby.rb
98
+ - lib/asciidoctor-diagram/util/java_rjb.rb
99
+ - lib/asciidoctor-diagram/util/png.rb
100
+ - lib/asciidoctor-diagram/util/svg.rb
96
101
  - lib/asciidoctor-diagram/version.rb
97
102
  - lib/ditaamini0_9.jar
98
103
  - lib/plantuml.jar
99
- - plantuml-license.txt
100
104
  - spec/ditaa_spec.rb
105
+ - spec/graphviz_spec.rb
101
106
  - spec/plantuml_spec.rb
102
107
  - spec/test_helper.rb
103
108
  homepage: https://github.com/asciidoctor/asciidoctor-diagram
@@ -110,22 +115,23 @@ require_paths:
110
115
  - lib
111
116
  required_ruby_version: !ruby/object:Gem::Requirement
112
117
  requirements:
113
- - - ">="
118
+ - - '>='
114
119
  - !ruby/object:Gem::Version
115
120
  version: '0'
116
121
  required_rubygems_version: !ruby/object:Gem::Requirement
117
122
  requirements:
118
- - - ">="
123
+ - - '>='
119
124
  - !ruby/object:Gem::Version
120
125
  version: '0'
121
126
  requirements: []
122
127
  rubyforge_project:
123
- rubygems_version: 2.2.0
128
+ rubygems_version: 2.0.3
124
129
  signing_key:
125
130
  specification_version: 4
126
131
  summary: An extension for asciidoctor that adds support for UML diagram generation
127
132
  using PlantUML
128
133
  test_files:
129
134
  - spec/ditaa_spec.rb
135
+ - spec/graphviz_spec.rb
130
136
  - spec/plantuml_spec.rb
131
137
  - spec/test_helper.rb
data/.gitignore DELETED
@@ -1,19 +0,0 @@
1
- *.gem
2
- *.rbc
3
- *.iml
4
- .idea
5
- .bundle
6
- .config
7
- .yardoc
8
- Gemfile.lock
9
- InstalledFiles
10
- _yardoc
11
- coverage
12
- doc/
13
- lib/bundler/man
14
- pkg
15
- rdoc
16
- spec/reports
17
- test/tmp
18
- test/version_tmp
19
- tmp