jekyll-diagrams 0.10.0 → 0.11.0.pre

Sign up to get free protection for your applications and to get access to all the features.
Files changed (76) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +26 -411
  3. data/features/{blockdiag/block.feature → blockdiag_block.feature} +0 -0
  4. data/features/{graphviz/block.feature → graphviz_block.feature} +0 -0
  5. data/features/{graphviz/config.feature → graphviz_config.feature} +0 -0
  6. data/features/{mermaid/block.feature → mermaid_block.feature} +0 -0
  7. data/features/{nomnoml/block.feature → nomnoml_block.feature} +0 -0
  8. data/features/{plantuml/block.feature → plantuml_block.feature} +0 -0
  9. data/features/{smcat/block.feature → smcat_block.feature} +0 -0
  10. data/features/step_definitions/{jekyll-diagrams.rb → diagrams.rb} +0 -0
  11. data/features/support/env.rb +4 -1
  12. data/features/{syntrax/block.feature → syntrax_block.feature} +0 -0
  13. data/features/{vega/block.feature → vega_block.feature} +0 -0
  14. data/features/{wavedrom/block.feature → wavedrom_block.feature} +0 -0
  15. data/lib/jekyll-diagrams.rb +1 -38
  16. data/lib/jekyll_diagrams.rb +85 -0
  17. data/lib/jekyll_diagrams/version.rb +5 -0
  18. data/spec/{utils_spec.rb → jekyll_diagrams_spec.rb} +18 -70
  19. data/spec/spec_helper.rb +10 -8
  20. metadata +85 -129
  21. data/lib/jekyll-diagrams/basic_block.rb +0 -28
  22. data/lib/jekyll-diagrams/basic_renderer.rb +0 -38
  23. data/lib/jekyll-diagrams/blockdiag.rb +0 -12
  24. data/lib/jekyll-diagrams/blockdiag/block.rb +0 -9
  25. data/lib/jekyll-diagrams/blockdiag/renderer.rb +0 -40
  26. data/lib/jekyll-diagrams/erd.rb +0 -10
  27. data/lib/jekyll-diagrams/erd/block.rb +0 -8
  28. data/lib/jekyll-diagrams/erd/renderer.rb +0 -34
  29. data/lib/jekyll-diagrams/errors.rb +0 -24
  30. data/lib/jekyll-diagrams/graphviz.rb +0 -10
  31. data/lib/jekyll-diagrams/graphviz/block.rb +0 -8
  32. data/lib/jekyll-diagrams/graphviz/renderer.rb +0 -40
  33. data/lib/jekyll-diagrams/mermaid.rb +0 -10
  34. data/lib/jekyll-diagrams/mermaid/block.rb +0 -8
  35. data/lib/jekyll-diagrams/mermaid/renderer.rb +0 -29
  36. data/lib/jekyll-diagrams/nomnoml.rb +0 -10
  37. data/lib/jekyll-diagrams/nomnoml/block.rb +0 -8
  38. data/lib/jekyll-diagrams/nomnoml/renderer.rb +0 -19
  39. data/lib/jekyll-diagrams/plantuml.rb +0 -10
  40. data/lib/jekyll-diagrams/plantuml/block.rb +0 -8
  41. data/lib/jekyll-diagrams/plantuml/renderer.rb +0 -23
  42. data/lib/jekyll-diagrams/rendering.rb +0 -67
  43. data/lib/jekyll-diagrams/smcat.rb +0 -10
  44. data/lib/jekyll-diagrams/smcat/block.rb +0 -8
  45. data/lib/jekyll-diagrams/smcat/renderer.rb +0 -30
  46. data/lib/jekyll-diagrams/svgbob.rb +0 -10
  47. data/lib/jekyll-diagrams/svgbob/block.rb +0 -8
  48. data/lib/jekyll-diagrams/svgbob/renderer.rb +0 -25
  49. data/lib/jekyll-diagrams/syntrax.rb +0 -10
  50. data/lib/jekyll-diagrams/syntrax/block.rb +0 -8
  51. data/lib/jekyll-diagrams/syntrax/renderer.rb +0 -27
  52. data/lib/jekyll-diagrams/utils.rb +0 -85
  53. data/lib/jekyll-diagrams/vega.rb +0 -12
  54. data/lib/jekyll-diagrams/vega/block.rb +0 -9
  55. data/lib/jekyll-diagrams/vega/renderer.rb +0 -33
  56. data/lib/jekyll-diagrams/version.rb +0 -7
  57. data/lib/jekyll-diagrams/wavedrom.rb +0 -10
  58. data/lib/jekyll-diagrams/wavedrom/block.rb +0 -8
  59. data/lib/jekyll-diagrams/wavedrom/renderer.rb +0 -19
  60. data/spec/basic_block_spec.rb +0 -70
  61. data/spec/basic_renderer_spec.rb +0 -69
  62. data/spec/blockdiag_renderer_spec.rb +0 -43
  63. data/spec/erd_renderer_spec.rb +0 -43
  64. data/spec/graphviz_renderer_spec.rb +0 -19
  65. data/spec/jekyll-diagrams_spec.rb +0 -23
  66. data/spec/mermaid_renderer_spec.rb +0 -19
  67. data/spec/nomnoml_renderer_spec.rb +0 -19
  68. data/spec/plantuml_renderer_spec.rb +0 -20
  69. data/spec/rendering_spec.rb +0 -111
  70. data/spec/smcat_renderer_spec.rb +0 -19
  71. data/spec/svgbob_renderer_spec.rb +0 -27
  72. data/spec/syntrax_renderer_spec.rb +0 -19
  73. data/spec/vega_renderer_spec.rb +0 -19
  74. data/spec/wavedrom_renderer_spec.rb +0 -19
  75. data/vendor/mermaid_puppeteer_config.json +0 -3
  76. data/vendor/plantuml.1.2020.1.jar +0 -0
@@ -1,43 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'spec_helper'
4
-
5
- RSpec.describe Jekyll::Diagrams::BlockdiagRenderer do
6
- subject(:renderer) do
7
- described_class.new(Liquid::ParseContext.new, '')
8
- end
9
-
10
- describe '#build_command' do
11
- context 'when config is empty' do
12
- let(:config) { {} }
13
-
14
- it 'build command' do
15
- expect(renderer.build_command(config)).to match '-T svg --nodoctype'
16
- end
17
- end
18
-
19
- context 'when switch is true' do
20
- let(:config) { { 'antialias' => true } }
21
-
22
- it 'build command' do
23
- expect(renderer.build_command(config)).to match '--antialias'
24
- end
25
- end
26
-
27
- context 'when switch is false' do
28
- let(:config) { { 'antialias' => false } }
29
-
30
- it 'build command' do
31
- expect(renderer.build_command(config)).not_to match '--antialias'
32
- end
33
- end
34
-
35
- context 'when options with value' do
36
- let(:config) { { 'size' => 3 } }
37
-
38
- it 'build command' do
39
- expect(renderer.build_command(config)).to match '--size=3'
40
- end
41
- end
42
- end
43
- end
@@ -1,43 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'spec_helper'
4
-
5
- RSpec.describe Jekyll::Diagrams::ErdRenderer do
6
- subject(:renderer) do
7
- described_class.new(Liquid::ParseContext.new, '')
8
- end
9
-
10
- describe '#build_command' do
11
- context 'when config is empty' do
12
- let(:config) { {} }
13
-
14
- it 'build command' do
15
- expect(renderer.build_command(config)).to eq 'erd --fmt=svg'
16
- end
17
- end
18
-
19
- context 'when switch is true' do
20
- let(:config) { { 'dot-entity' => true } }
21
-
22
- it 'build command' do
23
- expect(renderer.build_command(config)).to match '--dot-entity'
24
- end
25
- end
26
-
27
- context 'when switch is false' do
28
- let(:config) { { 'dot-entity' => false } }
29
-
30
- it 'build command' do
31
- expect(renderer.build_command(config)).not_to match '--dot-entity'
32
- end
33
- end
34
-
35
- context 'when options with value' do
36
- let(:config) { { 'edge' => 'compound' } }
37
-
38
- it 'build command' do
39
- expect(renderer.build_command(config)).to match '--edge'
40
- end
41
- end
42
- end
43
- end
@@ -1,19 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'spec_helper'
4
-
5
- RSpec.describe Jekyll::Diagrams::GraphvizRenderer do
6
- subject(:renderer) do
7
- described_class.new(Liquid::ParseContext.new, '')
8
- end
9
-
10
- describe '#build_command' do
11
- context 'when config is empty' do
12
- subject { renderer.build_command(config) }
13
-
14
- let(:config) { {} }
15
-
16
- it { is_expected.to eq 'dot -Tsvg' }
17
- end
18
- end
19
- end
@@ -1,23 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'spec_helper'
4
-
5
- RSpec.describe Jekyll::Diagrams do
6
- describe '.config_name' do
7
- subject { described_class.config_name }
8
-
9
- it { is_expected.to eq 'jekyll-diagrams' }
10
- end
11
-
12
- describe '.logger_topic' do
13
- subject { described_class.logger_topic }
14
-
15
- it { is_expected.to eq 'Jekyll Diagrams:' }
16
- end
17
-
18
- describe '.defaut_error_mode' do
19
- subject { described_class.default_error_mode }
20
-
21
- it { is_expected.to eq :warn }
22
- end
23
- end
@@ -1,19 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'spec_helper'
4
-
5
- RSpec.describe Jekyll::Diagrams::MermaidRenderer do
6
- subject(:renderer) do
7
- described_class.new(Liquid::ParseContext.new, '')
8
- end
9
-
10
- describe '#build_command' do
11
- context 'when config is empty' do
12
- subject { renderer.build_command(config) }
13
-
14
- let(:config) { {} }
15
-
16
- it { is_expected.to match 'mmdc --puppeteerConfigFile' }
17
- end
18
- end
19
- end
@@ -1,19 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'spec_helper'
4
-
5
- RSpec.describe Jekyll::Diagrams::NomnomlRenderer do
6
- subject(:renderer) do
7
- described_class.new(Liquid::ParseContext.new, '')
8
- end
9
-
10
- describe '#build_command' do
11
- context 'when config is empty' do
12
- subject { renderer.build_command(config) }
13
-
14
- let(:config) { {} }
15
-
16
- it { is_expected.to eq 'nomnoml' }
17
- end
18
- end
19
- end
@@ -1,20 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'spec_helper'
4
-
5
- RSpec.describe Jekyll::Diagrams::PlantUMLRenderer do
6
- subject(:renderer) do
7
- described_class.new(Liquid::ParseContext.new, '')
8
- end
9
-
10
- describe '#build_command' do
11
- context 'when config is empty' do
12
- subject { renderer.build_command(config) }
13
-
14
- let(:config) { {} }
15
-
16
- it { is_expected.to match 'plantuml' }
17
- it { is_expected.to match '-tsvg -pipe' }
18
- end
19
- end
20
- end
@@ -1,111 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'spec_helper'
4
-
5
- RSpec.describe Jekyll::Diagrams::Rendering do
6
- describe '.render_with_stdin_stdout' do
7
- it 'call render_with_command' do
8
- allow(described_class).to receive(:render_with_command)
9
-
10
- described_class.render_with_stdin_stdout('command', 'content')
11
-
12
- expect(described_class).to have_received(:render_with_command).with(
13
- 'command', :stdout, stdin_data: 'content'
14
- )
15
- end
16
- end
17
-
18
- describe '.render_with_tempfile' do
19
- before do
20
- allow(described_class).to receive(:render_with_command)
21
-
22
- allow(Dir).to receive(:mktmpdir).and_yield('/tmp')
23
- allow(File).to receive(:write)
24
- allow(Tempfile).to receive_message_chain(:new, :close!)
25
- allow(Tempfile).to receive_message_chain(:new, :path)
26
- end
27
-
28
- it 'call Dir.mktmpdir to create a direcory' do
29
- allow(Dir).to receive(:mktmpdir)
30
-
31
- described_class.render_with_tempfile('command', 'content')
32
-
33
- expect(Dir).to have_received(:mktmpdir)
34
- end
35
-
36
- it 'call Tempfile.new twice to create temp file' do
37
- described_class.render_with_tempfile('command', 'content') {}
38
-
39
- expect(Tempfile).to have_received(:new).twice
40
- end
41
-
42
- it 'call render_with_command' do
43
- described_class.render_with_tempfile('command', 'content') {}
44
-
45
- expect(described_class).to have_received(:render_with_command)
46
- end
47
- end
48
-
49
- describe '.render_with_command' do
50
- it 'call Open3.capture3 to render' do
51
- status = Object.new
52
- allow(status).to receive(:success?).and_return(true)
53
- allow(Open3).to receive(:capture3).and_return(['o', 'e', status])
54
-
55
- described_class.render_with_command('command')
56
-
57
- expect(Open3).to have_received(:capture3)
58
- end
59
-
60
- context 'when command not found' do
61
- it 'raise a command not found error' do
62
- allow(Open3).to receive(:capture3).and_raise(Errno::ENOENT)
63
-
64
- expect do
65
- described_class.render_with_command('command_that_is_not_exist')
66
- end.to raise_error Jekyll::Diagrams::Errors::CommandNotFoundError
67
- end
68
- end
69
-
70
- context 'when rendering failed' do
71
- before do
72
- status = Object.new
73
- allow(status).to receive(:success?).and_return(false)
74
- allow(Open3).to receive(:capture3).and_return(['o', 'e', status])
75
- end
76
-
77
- it 'raise a rendering failed error' do
78
- expect do
79
- described_class.render_with_command('command_that_will_failed')
80
- end.to raise_error Jekyll::Diagrams::Errors::RenderingFailedError
81
- end
82
- end
83
-
84
- context 'when output is stdout' do
85
- before do
86
- status = Object.new
87
- allow(status).to receive(:success?).and_return(true)
88
- allow(Open3).to receive(:capture3).and_return(['o', 'e', status])
89
- end
90
-
91
- it 'read output from stdout' do
92
- expect(described_class.render_with_command('cmd', :stdout)).to eq 'o'
93
- end
94
- end
95
-
96
- context 'when output is a file' do
97
- before do
98
- status = Object.new
99
- allow(status).to receive(:success?).and_return(true)
100
- allow(Open3).to receive(:capture3).and_return(['o', 'e', status])
101
- allow(File).to receive(:read)
102
- end
103
-
104
- it 'read output from the file' do
105
- described_class.render_with_command('cmd', 'a_file')
106
-
107
- expect(File).to have_received(:read).with('a_file')
108
- end
109
- end
110
- end
111
- end
@@ -1,19 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'spec_helper'
4
-
5
- RSpec.describe Jekyll::Diagrams::SMCatRenderer do
6
- subject(:renderer) do
7
- described_class.new(Liquid::ParseContext.new, '')
8
- end
9
-
10
- describe '#build_command' do
11
- context 'when config is empty' do
12
- subject { renderer.build_command(config) }
13
-
14
- let(:config) { {} }
15
-
16
- it { is_expected.to eq 'smcat' }
17
- end
18
- end
19
- end
@@ -1,27 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'spec_helper'
4
-
5
- RSpec.describe Jekyll::Diagrams::SvgbobRenderer do
6
- subject(:renderer) do
7
- described_class.new(Liquid::ParseContext.new, '')
8
- end
9
-
10
- describe '#build_command' do
11
- context 'when config is empty' do
12
- let(:config) { {} }
13
-
14
- it 'build command' do
15
- expect(renderer.build_command(config)).to eq 'svgbob'
16
- end
17
- end
18
-
19
- context 'when options with value' do
20
- let(:config) { { 'scale' => '2' } }
21
-
22
- it 'build command' do
23
- expect(renderer.build_command(config)).to match '--scale 2'
24
- end
25
- end
26
- end
27
- end
@@ -1,19 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'spec_helper'
4
-
5
- RSpec.describe Jekyll::Diagrams::SyntraxRenderer do
6
- subject(:renderer) do
7
- described_class.new(Liquid::ParseContext.new, '')
8
- end
9
-
10
- describe '#build_command' do
11
- context 'when config is empty' do
12
- subject { renderer.build_command(config) }
13
-
14
- let(:config) { {} }
15
-
16
- it { is_expected.to eq 'syntrax' }
17
- end
18
- end
19
- end
@@ -1,19 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'spec_helper'
4
-
5
- RSpec.describe Jekyll::Diagrams::VegaRenderer do
6
- subject(:renderer) do
7
- described_class.new(Liquid::ParseContext.new, '')
8
- end
9
-
10
- describe '#build_command' do
11
- context 'when config is empty' do
12
- subject { renderer.build_command(config) }
13
-
14
- let(:config) { {} }
15
-
16
- it { is_expected.to eq 'vg2svg' }
17
- end
18
- end
19
- end
@@ -1,19 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'spec_helper'
4
-
5
- RSpec.describe Jekyll::Diagrams::WavedromRenderer do
6
- subject(:renderer) do
7
- described_class.new(Liquid::ParseContext.new, '')
8
- end
9
-
10
- describe '#build_command' do
11
- context 'when config is empty' do
12
- subject { renderer.build_command(config) }
13
-
14
- let(:config) { {} }
15
-
16
- it { is_expected.to eq 'wavedrom-cli' }
17
- end
18
- end
19
- end
@@ -1,3 +0,0 @@
1
- {
2
- "args": ["--no-sandbox"]
3
- }
Binary file