asciidoctor-diagram 1.4.0 → 1.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (42) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.adoc +15 -0
  3. data/README.adoc +252 -95
  4. data/README_zh-CN.adoc +333 -0
  5. data/images/asciidoctor-diagram-classes.png +0 -0
  6. data/images/asciidoctor-diagram-process.png +0 -0
  7. data/lib/{asciidoctor-diagram-java-1.3.8.jar → asciidoctor-diagram-java-1.3.10.jar} +0 -0
  8. data/lib/asciidoctor-diagram.rb +9 -9
  9. data/lib/asciidoctor-diagram/blockdiag.rb +1 -2
  10. data/lib/asciidoctor-diagram/blockdiag/extension.rb +27 -12
  11. data/lib/asciidoctor-diagram/ditaa.rb +1 -2
  12. data/lib/asciidoctor-diagram/ditaa/extension.rb +33 -48
  13. data/lib/asciidoctor-diagram/extensions.rb +85 -18
  14. data/lib/asciidoctor-diagram/graphviz.rb +1 -2
  15. data/lib/asciidoctor-diagram/graphviz/extension.rb +14 -4
  16. data/lib/asciidoctor-diagram/meme.rb +1 -2
  17. data/lib/asciidoctor-diagram/meme/extension.rb +82 -79
  18. data/lib/asciidoctor-diagram/mermaid.rb +1 -2
  19. data/lib/asciidoctor-diagram/mermaid/extension.rb +33 -25
  20. data/lib/asciidoctor-diagram/plantuml.rb +1 -2
  21. data/lib/asciidoctor-diagram/plantuml/extension.rb +33 -22
  22. data/lib/asciidoctor-diagram/salt.rb +1 -2
  23. data/lib/asciidoctor-diagram/shaape.rb +1 -2
  24. data/lib/asciidoctor-diagram/shaape/extension.rb +10 -5
  25. data/lib/asciidoctor-diagram/util/cli_generator.rb +7 -5
  26. data/lib/asciidoctor-diagram/util/java.rb +1 -1
  27. data/lib/asciidoctor-diagram/util/platform.rb +12 -1
  28. data/lib/asciidoctor-diagram/util/which.rb +16 -7
  29. data/lib/asciidoctor-diagram/version.rb +1 -1
  30. data/lib/asciidoctor-diagram/wavedrom.rb +1 -2
  31. data/lib/asciidoctor-diagram/wavedrom/extension.rb +24 -20
  32. data/lib/plantuml.jar +0 -0
  33. data/spec/blockdiag_spec.rb +8 -8
  34. data/spec/ditaa_spec.rb +7 -7
  35. data/spec/graphviz_spec.rb +7 -7
  36. data/spec/meme_spec.rb +2 -2
  37. data/spec/mermaid_spec.rb +11 -11
  38. data/spec/plantuml_spec.rb +156 -34
  39. data/spec/shaape_spec.rb +8 -8
  40. data/spec/test_helper.rb +24 -5
  41. data/spec/wavedrom_spec.rb +11 -11
  42. metadata +6 -3
data/spec/shaape_spec.rb CHANGED
@@ -22,7 +22,7 @@ Doc Writer <doc@example.com>
22
22
  shaape::shaape.txt[format="png"]
23
23
  eos
24
24
 
25
- d = Asciidoctor.load StringIO.new(doc)
25
+ d = load_asciidoc doc
26
26
  expect(d).to_not be_nil
27
27
 
28
28
  b = d.find { |b| b.context == :image }
@@ -59,7 +59,7 @@ Doc Writer <doc@example.com>
59
59
  ----
60
60
  eos
61
61
 
62
- d = Asciidoctor.load StringIO.new(doc)
62
+ d = load_asciidoc doc
63
63
  expect(d).to_not be_nil
64
64
 
65
65
  b = d.find { |b| b.context == :image }
@@ -94,7 +94,7 @@ Doc Writer <doc@example.com>
94
94
  ----
95
95
  eos
96
96
 
97
- d = Asciidoctor.load StringIO.new(doc)
97
+ d = load_asciidoc doc
98
98
  expect(d).to_not be_nil
99
99
 
100
100
  b = d.find { |b| b.context == :image }
@@ -123,7 +123,7 @@ Doc Writer <doc@example.com>
123
123
  ----
124
124
  eos
125
125
 
126
- expect { Asciidoctor.load StringIO.new(doc) }.to raise_error /support.*format/i
126
+ expect { load_asciidoc doc }.to raise_error /support.*format/i
127
127
  end
128
128
 
129
129
  it "should not regenerate images when source has not changed" do
@@ -157,7 +157,7 @@ shaape::shaape.txt
157
157
  ----
158
158
  eos
159
159
 
160
- d = Asciidoctor.load StringIO.new(doc)
160
+ d = load_asciidoc doc
161
161
  b = d.find { |b| b.context == :image }
162
162
  expect(b).to_not be_nil
163
163
  target = b.attributes['target']
@@ -165,7 +165,7 @@ shaape::shaape.txt
165
165
 
166
166
  sleep 1
167
167
 
168
- d = Asciidoctor.load StringIO.new(doc)
168
+ d = load_asciidoc doc
169
169
 
170
170
  mtime2 = File.mtime(target)
171
171
 
@@ -194,7 +194,7 @@ shaape::shaape.txt[]
194
194
  shaape::shaape.txt[]
195
195
  eos
196
196
 
197
- Asciidoctor.load StringIO.new(doc)
197
+ load_asciidoc doc
198
198
  expect(File.exists?('shaape.png')).to be true
199
199
  end
200
200
 
@@ -220,7 +220,7 @@ shaape::shaape.txt["foobar"]
220
220
  shaape::shaape.txt["foobaz"]
221
221
  eos
222
222
 
223
- Asciidoctor.load StringIO.new(doc)
223
+ load_asciidoc doc
224
224
  expect(File.exists?('foobar.png')).to be true
225
225
  expect(File.exists?('foobaz.png')).to be true
226
226
  expect(File.exists?('shaape.png')).to be false
data/spec/test_helper.rb CHANGED
@@ -34,13 +34,32 @@ module Asciidoctor
34
34
  end
35
35
  end
36
36
 
37
- RSpec.configure do |c|
38
- if ::Asciidoctor::Diagram::Platform.os == :macosx
39
- c.filter_run_excluding :broken_on_osx => true
37
+ module Asciidoctor
38
+ module Diagram
39
+ module TestHelpers
40
+ def load_asciidoc(source, options = {})
41
+ options = options.dup
42
+ options[:trace] = true
43
+ options[:attributes] ||= {}
44
+ options[:attributes]['phantomjs_19'] = ENV['PHANTOMJS_19']
45
+ options[:attributes]['phantomjs_2'] = ENV['PHANTOMJS_2']
46
+ options[:attributes]['diagram-on-error'] = 'abort'
47
+ ::Asciidoctor.load(StringIO.new(source), options.merge({:trace => true}))
48
+ end
49
+ end
40
50
  end
51
+ end
52
+
53
+ RSpec.configure do |c|
54
+ c.formatter = :documentation
55
+
56
+ c.include ::Asciidoctor::Diagram::TestHelpers
41
57
 
42
- if ENV['TRAVIS']
43
- c.filter_run_excluding :broken_on_ci => true
58
+ case ::Asciidoctor::Diagram::Platform.os
59
+ when :macosx
60
+ c.filter_run_excluding :broken_on_osx => true
61
+ when :windows
62
+ c.filter_run_excluding :broken_on_windows => true
44
63
  end
45
64
 
46
65
  TEST_DIR = File.expand_path('testing')
@@ -8,7 +8,7 @@ code = <<-eos
8
8
  ]}
9
9
  eos
10
10
 
11
- describe Asciidoctor::Diagram::WavedromBlockMacroProcessor do
11
+ describe Asciidoctor::Diagram::WavedromBlockMacroProcessor, :broken_on_windows do
12
12
  it "should generate PNG images when format is set to 'png'" do
13
13
  File.write('wavedrom.txt', code)
14
14
 
@@ -21,7 +21,7 @@ Doc Writer <doc@example.com>
21
21
  wavedrom::wavedrom.txt[format="png"]
22
22
  eos
23
23
 
24
- d = Asciidoctor.load StringIO.new(doc)
24
+ d = load_asciidoc doc
25
25
  expect(d).to_not be_nil
26
26
 
27
27
  b = d.find { |b| b.context == :image }
@@ -50,7 +50,7 @@ Doc Writer <doc@example.com>
50
50
  wavedrom::wavedrom.txt[format="svg"]
51
51
  eos
52
52
 
53
- d = Asciidoctor.load StringIO.new(doc)
53
+ d = load_asciidoc doc
54
54
  expect(d).to_not be_nil
55
55
 
56
56
  b = d.find { |b| b.context == :image }
@@ -68,7 +68,7 @@ wavedrom::wavedrom.txt[format="svg"]
68
68
  end
69
69
  end
70
70
 
71
- describe Asciidoctor::Diagram::WavedromBlockProcessor do
71
+ describe Asciidoctor::Diagram::WavedromBlockProcessor, :broken_on_windows do
72
72
  it "should generate PNG images when format is set to 'png'" do
73
73
  doc = <<-eos
74
74
  = Hello, Wavedrom!
@@ -82,7 +82,7 @@ Doc Writer <doc@example.com>
82
82
  ----
83
83
  eos
84
84
 
85
- d = Asciidoctor.load StringIO.new(doc)
85
+ d = load_asciidoc doc
86
86
  expect(d).to_not be_nil
87
87
 
88
88
  b = d.find { |b| b.context == :image }
@@ -112,7 +112,7 @@ Doc Writer <doc@example.com>
112
112
  ----
113
113
  eos
114
114
 
115
- d = Asciidoctor.load StringIO.new(doc)
115
+ d = load_asciidoc doc
116
116
  expect(d).to_not be_nil
117
117
 
118
118
  b = d.find { |b| b.context == :image }
@@ -141,7 +141,7 @@ Doc Writer <doc@example.com>
141
141
  ----
142
142
  eos
143
143
 
144
- expect { Asciidoctor.load StringIO.new(doc) }.to raise_error /support.*format/i
144
+ expect { load_asciidoc doc }.to raise_error /support.*format/i
145
145
  end
146
146
 
147
147
  it "should not regenerate images when source has not changed" do
@@ -161,7 +161,7 @@ wavedrom::wavedrom.txt
161
161
  ----
162
162
  eos
163
163
 
164
- d = Asciidoctor.load StringIO.new(doc)
164
+ d = load_asciidoc doc
165
165
  b = d.find { |b| b.context == :image }
166
166
  expect(b).to_not be_nil
167
167
  target = b.attributes['target']
@@ -169,7 +169,7 @@ wavedrom::wavedrom.txt
169
169
 
170
170
  sleep 1
171
171
 
172
- d = Asciidoctor.load StringIO.new(doc)
172
+ d = load_asciidoc doc
173
173
 
174
174
  mtime2 = File.mtime(target)
175
175
 
@@ -189,7 +189,7 @@ wavedrom::wavedrom.txt[]
189
189
  wavedrom::wavedrom.txt[]
190
190
  eos
191
191
 
192
- Asciidoctor.load StringIO.new(doc)
192
+ load_asciidoc doc
193
193
  expect(File.exists?('wavedrom.png')).to be true
194
194
  end
195
195
 
@@ -206,7 +206,7 @@ wavedrom::wavedrom.txt["foobar"]
206
206
  wavedrom::wavedrom.txt["foobaz"]
207
207
  eos
208
208
 
209
- Asciidoctor.load StringIO.new(doc)
209
+ load_asciidoc doc
210
210
  expect(File.exists?('foobar.png')).to be true
211
211
  expect(File.exists?('foobaz.png')).to be true
212
212
  expect(File.exists?('wavedrom.png')).to be false
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: asciidoctor-diagram
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.0
4
+ version: 1.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pepijn Van Eeckhoudt
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-02-05 00:00:00.000000000 Z
11
+ date: 2016-06-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -76,12 +76,15 @@ files:
76
76
  - CHANGELOG.adoc
77
77
  - LICENSE.txt
78
78
  - README.adoc
79
+ - README_zh-CN.adoc
79
80
  - Rakefile
80
81
  - examples/Gemfile
81
82
  - examples/README.adoc
82
83
  - examples/design.adoc
83
84
  - examples/features.adoc
84
- - lib/asciidoctor-diagram-java-1.3.8.jar
85
+ - images/asciidoctor-diagram-classes.png
86
+ - images/asciidoctor-diagram-process.png
87
+ - lib/asciidoctor-diagram-java-1.3.10.jar
85
88
  - lib/asciidoctor-diagram.rb
86
89
  - lib/asciidoctor-diagram/blockdiag.rb
87
90
  - lib/asciidoctor-diagram/blockdiag/extension.rb