drawio_dsl 0.3.0 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (72) hide show
  1. checksums.yaml +4 -4
  2. data/.builders/.data/shapes.json +218 -0
  3. data/.builders/.templates/basic/configuration_shapes.rb +27 -0
  4. data/.builders/.templates/basic/dom_builder_shapes.rb +16 -0
  5. data/.builders/.templates/basic/drawio_shapes.rb +23 -0
  6. data/.builders/.templates/basic/schema_require.rb +16 -0
  7. data/.builders/.templates/basic/schema_shape.rb +9 -0
  8. data/.builders/.templates/basic/schema_shape_spec.rb +13 -0
  9. data/.builders/blueprint/shapes.rb +48 -0
  10. data/.builders/boot.rb +6 -0
  11. data/.builders/generators/02-generate-app.rb +43 -0
  12. data/.builders/generators/{10-page-margin.rb → sample_diagrams/10-page-margin.rb} +0 -0
  13. data/.builders/generators/{15-grid-direction.rb → sample_diagrams/15-grid-direction.rb} +0 -0
  14. data/.builders/generators/{16-grid-alignment.rb → sample_diagrams/16-grid-alignment.rb} +0 -0
  15. data/.builders/generators/{20-styles.rb → sample_diagrams/20-styles.rb} +0 -0
  16. data/.builders/generators/{25-themes.rb → sample_diagrams/25-themes.rb} +5 -2
  17. data/.builders/generators/sample_diagrams/30-shapes.rb +23 -0
  18. data/.rubocop.yml +20 -3
  19. data/CHANGELOG.md +21 -0
  20. data/README.md +4 -0
  21. data/lib/drawio_dsl/configuration.rb +7 -94
  22. data/lib/drawio_dsl/configuration_extension.rb +13 -0
  23. data/lib/drawio_dsl/configuration_shapes.rb +75 -0
  24. data/lib/drawio_dsl/configuration_themes.rb +63 -0
  25. data/lib/drawio_dsl/dom_builder.rb +4 -35
  26. data/lib/drawio_dsl/dom_builder_shapes.rb +143 -0
  27. data/lib/drawio_dsl/drawio.rb +1 -73
  28. data/lib/drawio_dsl/drawio_shapes.rb +175 -0
  29. data/lib/drawio_dsl/layout_engine.rb +1 -1
  30. data/lib/drawio_dsl/schema/_.rb +40 -0
  31. data/lib/drawio_dsl/schema/common_style.rb +42 -0
  32. data/lib/drawio_dsl/schema/default_palette.rb +31 -0
  33. data/lib/drawio_dsl/schema/diagram.rb +57 -0
  34. data/lib/drawio_dsl/schema/layouts/flex_layout.rb +87 -0
  35. data/lib/drawio_dsl/schema/layouts/grid_layout.rb +102 -0
  36. data/lib/drawio_dsl/schema/layouts/layout.rb +41 -0
  37. data/lib/drawio_dsl/schema/node.rb +53 -0
  38. data/lib/drawio_dsl/schema/page.rb +135 -0
  39. data/lib/drawio_dsl/schema/shapes/actor.rb +9 -0
  40. data/lib/drawio_dsl/schema/shapes/actor2.rb +9 -0
  41. data/lib/drawio_dsl/schema/shapes/callout.rb +9 -0
  42. data/lib/drawio_dsl/schema/shapes/callout2.rb +9 -0
  43. data/lib/drawio_dsl/schema/shapes/callout3.rb +9 -0
  44. data/lib/drawio_dsl/schema/shapes/callout4.rb +9 -0
  45. data/lib/drawio_dsl/schema/shapes/circle.rb +9 -0
  46. data/lib/drawio_dsl/schema/shapes/cloud.rb +9 -0
  47. data/lib/drawio_dsl/schema/shapes/container.rb +9 -0
  48. data/lib/drawio_dsl/schema/shapes/container2.rb +9 -0
  49. data/lib/drawio_dsl/schema/shapes/container3.rb +9 -0
  50. data/lib/drawio_dsl/schema/shapes/container4.rb +9 -0
  51. data/lib/drawio_dsl/schema/shapes/cross.rb +9 -0
  52. data/lib/drawio_dsl/schema/shapes/diamond.rb +9 -0
  53. data/lib/drawio_dsl/schema/shapes/document.rb +9 -0
  54. data/lib/drawio_dsl/schema/shapes/ellipse.rb +9 -0
  55. data/lib/drawio_dsl/schema/shapes/envelop.rb +9 -0
  56. data/lib/drawio_dsl/schema/shapes/face.rb +9 -0
  57. data/lib/drawio_dsl/schema/shapes/hexagon.rb +9 -0
  58. data/lib/drawio_dsl/schema/shapes/note.rb +9 -0
  59. data/lib/drawio_dsl/schema/shapes/process.rb +9 -0
  60. data/lib/drawio_dsl/schema/shapes/rectangle.rb +9 -0
  61. data/lib/drawio_dsl/schema/shapes/rectangle2.rb +9 -0
  62. data/lib/drawio_dsl/schema/shapes/shape.rb +123 -0
  63. data/lib/drawio_dsl/schema/shapes/square.rb +9 -0
  64. data/lib/drawio_dsl/schema/shapes/step.rb +9 -0
  65. data/lib/drawio_dsl/schema/shapes/tick.rb +9 -0
  66. data/lib/drawio_dsl/schema/shapes/triangle.rb +9 -0
  67. data/lib/drawio_dsl/version.rb +1 -1
  68. data/lib/drawio_dsl.rb +6 -1
  69. data/package-lock.json +2 -2
  70. data/package.json +1 -1
  71. metadata +59 -8
  72. data/lib/drawio_dsl/schema.rb +0 -617
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 874e60205978452d6b06bd53855edff255b5b168fb7a80693ac109279381c880
4
- data.tar.gz: f5073b3be534353987969a4c96c563a1ed5d9dedcb52c09355ef013db0c5a382
3
+ metadata.gz: b4cd7150000e0bd48916f7c5605f1da32d91d5fa20cb221253a9acbaa8538e06
4
+ data.tar.gz: 84355154d1847979120f71315f9cd1b9f79965e652184255bb849e24e6c54832
5
5
  SHA512:
6
- metadata.gz: 50178f5c6728de3571a1effb263d62b4676f9685e05a59b4b31fb88a1f3b1d3fc4583f13a976c8d67202c3dc4981470073855f10b2c69196051984ae70d06c8a
7
- data.tar.gz: 5ad8beb7a169b7d3c0b44e887dfb71b6a966d63023986efe319007e0f4fcaf397edd688cfbd3c98f5dc8a6760d55af1eaea3d7b646ed8658fda765c2dd129d0d
6
+ metadata.gz: b36ecdb34dcbcd5efc9309671650526590a98c41d7f7fb762349c401cd977284d33346ef8517b3dde60f827013f85b088dd839560e0d03b7c9dda1384e0816fa
7
+ data.tar.gz: 58eacb1d2c4eee64d09380cc9e1c9c7c9c9e6b105377494df083c3a1895d70e78b92a8309caeb7582e706e09c72f51625aa1fec852522c4b48af34d2fef88817
@@ -0,0 +1,218 @@
1
+ [
2
+ {
3
+ "type": "actor",
4
+ "x": 0,
5
+ "y": 0,
6
+ "w": 40,
7
+ "h": 50,
8
+ "style_modifiers": "shape=actor"
9
+ },
10
+ {
11
+ "type": "actor2",
12
+ "x": 0,
13
+ "y": 0,
14
+ "w": 30,
15
+ "h": 50,
16
+ "style_modifiers": "shape=umlActor;verticalLabelPosition=bottom;outlineConnect=1"
17
+ },
18
+ {
19
+ "type": "callout",
20
+ "x": 0,
21
+ "y": 0,
22
+ "w": 160,
23
+ "h": 120,
24
+ "style_modifiers": "shape=callout"
25
+ },
26
+ {
27
+ "type": "callout2",
28
+ "x": 0,
29
+ "y": 0,
30
+ "w": 160,
31
+ "h": 160,
32
+ "style_modifiers": "shape=mxgraph.basic.oval_callout"
33
+ },
34
+ {
35
+ "type": "callout3",
36
+ "x": 0,
37
+ "y": 0,
38
+ "w": 160,
39
+ "h": 160,
40
+ "style_modifiers": "shape=mxgraph.basic.cloud_callout"
41
+ },
42
+ {
43
+ "type": "callout4",
44
+ "x": 0,
45
+ "y": 0,
46
+ "w": 160,
47
+ "h": 120,
48
+ "style_modifiers": "shape=mxgraph.basic.roundRectCallout;dx=30;dy=15;size=5;boundedLbl=1;"
49
+ },
50
+ {
51
+ "type": "circle",
52
+ "x": 0,
53
+ "y": 0,
54
+ "w": 160,
55
+ "h": 160,
56
+ "style_modifiers": "ellipse"
57
+ },
58
+ {
59
+ "type": "cloud",
60
+ "x": 0,
61
+ "y": 0,
62
+ "w": 160,
63
+ "h": 160,
64
+ "style_modifiers": "shape=cloud"
65
+ },
66
+ {
67
+ "type": "cross",
68
+ "x": 0,
69
+ "y": 0,
70
+ "w": 50,
71
+ "h": 50,
72
+ "style_modifiers": "verticalLabelPosition=bottom;verticalAlign=top;html=1;shape=mxgraph.basic.x"
73
+ },
74
+ {
75
+ "type": "envelop",
76
+ "x": 0,
77
+ "y": 0,
78
+ "w": 160,
79
+ "h": 100,
80
+ "style_modifiers": "shape=message"
81
+ },
82
+ {
83
+ "type": "diamond",
84
+ "x": 0,
85
+ "y": 0,
86
+ "w": 100,
87
+ "h": 100,
88
+ "style_modifiers": "rhombus"
89
+ },
90
+ {
91
+ "type": "document",
92
+ "x": 0,
93
+ "y": 0,
94
+ "w": 160,
95
+ "h": 160,
96
+ "style_modifiers": "shape=mxgraph.basic.document"
97
+ },
98
+ {
99
+ "type": "ellipse",
100
+ "x": 0,
101
+ "y": 0,
102
+ "w": 200,
103
+ "h": 120,
104
+ "style_modifiers": "ellipse"
105
+ },
106
+ {
107
+ "type": "hexagon",
108
+ "x": 0,
109
+ "y": 0,
110
+ "w": 200,
111
+ "h": 120,
112
+ "style_modifiers": "shape=hexagon"
113
+ },
114
+ {
115
+ "type": "container",
116
+ "x": 0,
117
+ "y": 0,
118
+ "w": 160,
119
+ "h": 160,
120
+ "style_modifiers": "swimlane;horizontal=0"
121
+ },
122
+ {
123
+ "type": "container2",
124
+ "x": 0,
125
+ "y": 0,
126
+ "w": 160,
127
+ "h": 160,
128
+ "style_modifiers": "swimlane"
129
+ },
130
+ {
131
+ "type": "container3",
132
+ "x": 0,
133
+ "y": 0,
134
+ "w": 160,
135
+ "h": 160,
136
+ "style_modifiers": "swimlane;startSize=50"
137
+ },
138
+ {
139
+ "type": "container4",
140
+ "x": 0,
141
+ "y": 0,
142
+ "w": 160,
143
+ "h": 160,
144
+ "style_modifiers": "swimlane;resizable=0"
145
+ },
146
+ {
147
+ "type": "note",
148
+ "x": 0,
149
+ "y": 0,
150
+ "w": 160,
151
+ "h": 160,
152
+ "style_modifiers": "shape=note"
153
+ },
154
+ {
155
+ "type": "process",
156
+ "x": 0,
157
+ "y": 0,
158
+ "w": 200,
159
+ "h": 120,
160
+ "style_modifiers": "shape=process"
161
+ },
162
+ {
163
+ "type": "rectangle",
164
+ "x": 0,
165
+ "y": 0,
166
+ "w": 200,
167
+ "h": 120,
168
+ "style_modifiers": ""
169
+ },
170
+ {
171
+ "type": "rectangle2",
172
+ "x": 0,
173
+ "y": 0,
174
+ "w": 200,
175
+ "h": 120,
176
+ "style_modifiers": "shape=mxgraph.basic.cloud_rect"
177
+ },
178
+ {
179
+ "type": "square",
180
+ "x": 0,
181
+ "y": 0,
182
+ "w": 160,
183
+ "h": 160,
184
+ "style_modifiers": ""
185
+ },
186
+ {
187
+ "type": "step",
188
+ "x": 0,
189
+ "y": 0,
190
+ "w": 120,
191
+ "h": 80,
192
+ "style_modifiers": "shape=step;perimeter=stepPerimeter;fixedSize=1"
193
+ },
194
+ {
195
+ "type": "tick",
196
+ "x": 0,
197
+ "y": 0,
198
+ "w": 50,
199
+ "h": 50,
200
+ "style_modifiers": "verticalLabelPosition=bottom;verticalAlign=top;shape=mxgraph.basic.tick"
201
+ },
202
+ {
203
+ "type": "face",
204
+ "x": 0,
205
+ "y": 0,
206
+ "w": 100,
207
+ "h": 100,
208
+ "style_modifiers": "verticalLabelPosition=bottom;verticalAlign=top;shape=mxgraph.basic.smiley"
209
+ },
210
+ {
211
+ "type": "triangle",
212
+ "x": 0,
213
+ "y": 0,
214
+ "w": 100,
215
+ "h": 100,
216
+ "style_modifiers": "triangle"
217
+ }
218
+ ]
@@ -0,0 +1,27 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Attach configuration to the DrawIO DSL module
4
+ # :nocov:
5
+ module DrawioDsl
6
+ # Used to attach configuration to KConfig module
7
+ module ConfigurationShapes
8
+ ShapeDefaults = Struct.new(:type, :x, :y, :w, :h, :style_modifiers, keyword_init: true)
9
+ Shapes = Struct.new(
10
+ :shape,
11
+ {{#each shapes}}
12
+ :{{snake ./type}},
13
+ {{/each}}
14
+ keyword_init: true
15
+ )
16
+
17
+ def add_shapes
18
+ @shapes = Shapes.new(
19
+ shape: ShapeDefaults.new(type: :shape, x: 0, y: 0, w: 20, h: 20, style_modifiers: ''),
20
+ {{#each shapes}}
21
+ {{snake ./type}}: ShapeDefaults.new(type: :{{snake ./type}}, x: {{./x}}, y: {{./y}}, w: {{./w}}, h: {{./h}}, style_modifiers: '{{{./style_modifiers}}}'){{#if @last}}{{^}},{{/if}}
22
+ {{/each}}
23
+ )
24
+ end
25
+ end
26
+ end
27
+ # :nocov:
@@ -0,0 +1,16 @@
1
+ # frozen_string_literal: true
2
+
3
+ # :nocov:
4
+ module DrawioDsl
5
+ # DrawioDsl is a DSL for draw-io diagrams.
6
+ module DomBuilderShapes
7
+ {{#each shapes}}
8
+
9
+ def add_{{snake ./type}}(**opts)
10
+ {{snake ./type}} = DrawioDsl::Schema::{{camel ./type}}.new(current_page, **opts)
11
+ add_shape({{snake ./type}})
12
+ end
13
+ {{/each}}
14
+ end
15
+ end
16
+ # :nocov:
@@ -0,0 +1,23 @@
1
+ # frozen_string_literal: true
2
+
3
+ module DrawioDsl
4
+ # DrawioDsl::Shapes is a list of DSL methods (one per shape)
5
+ # :nocov:
6
+ module DrawioShapes
7
+ def random(**opts)
8
+ case rand({{shape_length}})
9
+ {{#each shapes}}
10
+ when {{@index}}
11
+ {{snake ./type}}(**opts)
12
+ {{/each}}
13
+ end
14
+ end
15
+ {{#each shapes}}
16
+
17
+ def {{snake ./type}}(**opts)
18
+ builder.add_{{snake ./type}}(**opts)
19
+ end
20
+ {{/each}}
21
+ end
22
+ # :nocov:
23
+ end
@@ -0,0 +1,16 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative 'common_style'
4
+ require_relative 'default_palette'
5
+ require_relative 'diagram'
6
+ require_relative 'node'
7
+ require_relative 'page'
8
+
9
+ require_relative 'layouts/layout'
10
+ require_relative 'layouts/flex_layout'
11
+ require_relative 'layouts/grid_layout'
12
+
13
+ require_relative 'shapes/shape'
14
+ {{#each shapes}}
15
+ require_relative 'shapes/{{snake ./type}}'
16
+ {{/each}}
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ module DrawioDsl
4
+ module Schema
5
+ class {{camel shape.type}} < Shape
6
+ configure_shape(:{{snake shape.type}})
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+
3
+ RSpec.describe DrawioDsl::Schema::{{camel shape.type}} do
4
+ include_context :node_dependencies
5
+
6
+ subject { instance }
7
+
8
+ let(:instance) { described_class.new(diagram, **args) }
9
+ let(:args) { { id: 1 } }
10
+ let(:default) { KConfig.configuration.drawio.shapes.{{snake shape.type}} }
11
+
12
+ it_behaves_like :basic_shape_attributes
13
+ end
@@ -0,0 +1,48 @@
1
+ KManager.model :shapes, namespace: %i[domain] do
2
+ # microapp = import(:handlebars_helpers, :microapp)
3
+
4
+ table :shapes do
5
+ fields [:type, :x, :y, :w, :h, :style_modifiers]
6
+
7
+ # shape is a custom object
8
+ # row :shape , 0, 0, 20, 20, ''
9
+
10
+ row :actor , 0, 0, 40, 50, 'shape=actor'
11
+ row :actor2 , 0, 0, 30, 50, 'shape=umlActor;verticalLabelPosition=bottom;outlineConnect=1'
12
+ row :callout , 0, 0, 160, 120, 'shape=callout'
13
+ row :callout2 , 0, 0, 160, 160, 'shape=mxgraph.basic.oval_callout'
14
+ row :callout3 , 0, 0, 160, 160, 'shape=mxgraph.basic.cloud_callout'
15
+ row :callout4 , 0, 0, 160, 120, 'shape=mxgraph.basic.roundRectCallout;dx=30;dy=15;size=5;boundedLbl=1;'
16
+ row :circle , 0, 0, 160, 160, 'ellipse'
17
+ row :cloud , 0, 0, 160, 160, 'shape=cloud'
18
+ row :cross , 0, 0, 50, 50, 'verticalLabelPosition=bottom;verticalAlign=top;html=1;shape=mxgraph.basic.x'
19
+ row :envelop , 0, 0, 160, 100, 'shape=message'
20
+ row :diamond , 0, 0, 100, 100, 'rhombus'
21
+ row :document , 0, 0, 160, 160, 'shape=mxgraph.basic.document'
22
+ row :ellipse , 0, 0, 200, 120, 'ellipse'
23
+ row :hexagon , 0, 0, 200, 120, 'shape=hexagon'
24
+ row :container , 0, 0, 160, 160, 'swimlane;horizontal=0'
25
+ row :container2 , 0, 0, 160, 160, 'swimlane'
26
+ row :container3 , 0, 0, 160, 160, 'swimlane;startSize=50'
27
+ row :container4 , 0, 0, 160, 160, 'swimlane;resizable=0'
28
+ row :note , 0, 0, 160, 160, 'shape=note'
29
+ row :process , 0, 0, 200, 120, 'shape=process'
30
+ row :rectangle , 0, 0, 200, 120, ''
31
+ row :rectangle2 , 0, 0, 200, 120, 'shape=mxgraph.basic.cloud_rect'
32
+ row :square , 0, 0, 160, 160, ''
33
+ row :step , 0, 0, 120, 80, 'shape=step;perimeter=stepPerimeter;fixedSize=1'
34
+ row :tick , 0, 0, 50, 50, 'verticalLabelPosition=bottom;verticalAlign=top;shape=mxgraph.basic.tick'
35
+ row :face , 0, 0, 100, 100, 'verticalLabelPosition=bottom;verticalAlign=top;shape=mxgraph.basic.smiley'
36
+ row :triangle , 0, 0, 100, 100, 'triangle'
37
+
38
+ end
39
+
40
+ action do
41
+ data = self.raw_data
42
+ shapes = JSON.pretty_generate(data['shapes'])
43
+
44
+ k_builder
45
+ .cd(:data)
46
+ .add_file('shapes.json', content: shapes, on_exist: :write)
47
+ end
48
+ end
data/.builders/boot.rb CHANGED
@@ -45,11 +45,16 @@ KConfig.configure(CONFIG_KEY) do |config|
45
45
  base_folder = File.expand_path('../', builder_folder)
46
46
  global_template = File.expand_path('~/dev/kgems/k_templates/templates')
47
47
 
48
+ # Templates
48
49
  config.template_folders.add(:global_template , global_template)
49
50
  config.template_folders.add(:template , File.expand_path('.templates', Dir.pwd))
50
51
 
52
+ # Target Folders
51
53
  config.target_folders.add(:app , base_folder)
54
+ config.target_folders.add(:lib , :app, 'lib', 'drawio_dsl')
55
+ config.target_folders.add(:spec , :app, 'spec', 'drawio_dsl')
52
56
  config.target_folders.add(:builder , builder_folder)
57
+ config.target_folders.add(:data , :builder, '.data')
53
58
  end
54
59
 
55
60
  KConfig.configuration(CONFIG_KEY).debug
@@ -60,6 +65,7 @@ resource_manager
60
65
  .fileset
61
66
  .glob('*.rb', exclude: ['boot.rb'])
62
67
  .glob('generators/**/*.rb')
68
+ .glob('blueprint/**/*.rb')
63
69
  resource_manager.add_resources
64
70
 
65
71
  KManager.boot
@@ -0,0 +1,43 @@
1
+ KManager.action :requires do
2
+
3
+ action do
4
+ shapes_file = k_builder.target_folders.get_filename(:data, 'shapes.json')
5
+ shapes = JSON.parse(File.read(shapes_file))
6
+
7
+ KDirector::Dsls::BasicDsl
8
+ .init(k_builder,
9
+ on_exist: :write, # %i[skip write compare]
10
+ on_action: :execute # %i[queue execute]
11
+ )
12
+ .blueprint(
13
+ active: true,
14
+ on_exist: :write) do
15
+
16
+ cd(:lib)
17
+
18
+ add('schema/_.rb', template_file: 'schema_require.rb', shapes: shapes)
19
+
20
+ shapes.each do |shape|
21
+ add("schema/shapes/#{shape['type']}.rb",
22
+ template_file: 'schema_shape.rb',
23
+ shape: shape)
24
+ end
25
+
26
+ add("drawio_shapes.rb" , template_file: 'drawio_shapes.rb' , shapes: shapes, shape_length: shapes.length)
27
+ add("dom_builder_shapes.rb" , template_file: 'dom_builder_shapes.rb' , shapes: shapes)
28
+ add("configuration_shapes.rb" , template_file: 'configuration_shapes.rb', shapes: shapes)
29
+
30
+ cd(:spec)
31
+
32
+ shapes.each do |shape|
33
+ add("schema/shapes/#{shape['type']}_spec.rb",
34
+ template_file: 'schema_shape_spec.rb',
35
+ shape: shape)
36
+ end
37
+
38
+ cd(:app)
39
+ run_command('rubocop -a')
40
+
41
+ end
42
+ end
43
+ end
@@ -5,8 +5,11 @@ KManager.action :bootstrap do
5
5
  director = DrawioDsl::Drawio
6
6
  .init(k_builder)
7
7
  .diagram(theme: :style_06)
8
- .page('Style-Plain', margin_left: 0, margin_top: 0) do
9
- grid_layout(wrap_at: 5)
8
+ .page('Style-Plain', margin_left: 0, margin_top: 0, rounded: 1, background: '#FFEADB') do
9
+ grid_layout(wrap_at: 8)
10
+
11
+ square(title: 'The quick brown fox jumps over the lazy dog')
12
+ circle(title: 'Mary had a little lamb')
10
13
 
11
14
  KConfig.configuration.drawio.themes.keys.each do |theme|
12
15
  random(title: theme.to_s, theme: theme)
@@ -0,0 +1,23 @@
1
+ KManager.action :bootstrap do
2
+ action do
3
+
4
+ # :rounded, :shadow, :sketch, :glass
5
+ director = DrawioDsl::Drawio
6
+ .init(k_builder)
7
+ .diagram(theme: :style_06)
8
+ .page('Shapes', margin_left: 0, margin_top: 0) do
9
+ grid_layout(wrap_at: 5)
10
+
11
+ KConfig.configuration.drawio.shapes.members.each do |shape|
12
+ next if shape == :shape
13
+
14
+ send(shape, title: shape.to_s, shape: shape)
15
+ end
16
+ end
17
+
18
+ diagram = DrawioDsl::XmlBuilder.new(director.builder.diagram)
19
+
20
+ File.write('../spec/.samples/drawio/30-shapes.xml', diagram.build)
21
+ File.write('../spec/.samples/drawio/30-shapes.drawio', diagram.build)
22
+ end
23
+ end
data/.rubocop.yml CHANGED
@@ -11,6 +11,7 @@ AllCops:
11
11
  - ".builders/**/*"
12
12
  - "spec/samples/**/*"
13
13
 
14
+
14
15
  Metrics/BlockLength:
15
16
  Exclude:
16
17
  - "**/spec/**/*"
@@ -35,9 +36,6 @@ Metrics/BlockLength:
35
36
  - shared_examples_for
36
37
  - transaction
37
38
 
38
- Metrics/MethodLength:
39
- Max: 25
40
-
41
39
  Layout/LineLength:
42
40
  Max: 200
43
41
  # Ignores annotate output
@@ -58,6 +56,25 @@ Metrics/ClassLength:
58
56
  Metrics/ModuleLength:
59
57
  Exclude:
60
58
  - "**/spec/**/*"
59
+ - "lib/drawio_dsl/drawio_shapes.rb"
60
+ - "lib/drawio_dsl/schema/shapes/diagram.rb"
61
+ - "lib/drawio_dsl/dom_builder_shapes.rb"
62
+ Metrics/AbcSize:
63
+ Exclude:
64
+ - "lib/drawio_dsl/drawio_shapes.rb"
65
+ - "lib/drawio_dsl/configuration_shapes.rb"
66
+ - "lib/drawio_dsl/configuration_themes.rb"
67
+ Metrics/CyclomaticComplexity:
68
+ Exclude:
69
+ - "lib/drawio_dsl/drawio_shapes.rb"
70
+ Metrics/MethodLength:
71
+ Max: 25
72
+ Exclude:
73
+ - "lib/drawio_dsl/drawio_shapes.rb"
74
+ - "lib/drawio_dsl/schema/shapes/shape.rb"
75
+ - "lib/drawio_dsl/schema/shapes/page.rb"
76
+ - "lib/drawio_dsl/configuration_shapes.rb"
77
+ - "lib/drawio_dsl/configuration_themes.rb"
61
78
  Naming/MemoizedInstanceVariableName:
62
79
  Enabled: false
63
80
  Naming/AccessorMethodName:
data/CHANGELOG.md CHANGED
@@ -1,3 +1,24 @@
1
+ ## [0.4.1](https://github.com/klueless-io/drawio_dsl/compare/v0.4.0...v0.4.1) (2022-03-06)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * add support for generated shapes ([b52f278](https://github.com/klueless-io/drawio_dsl/commit/b52f2786281acadc32d546f0ed9c7ac2c8fc1094))
7
+
8
+ # [0.4.0](https://github.com/klueless-io/drawio_dsl/compare/v0.3.0...v0.4.0) (2022-03-05)
9
+
10
+
11
+ ### Features
12
+
13
+ * big refactor, plus 98% test coverage ([0d1075c](https://github.com/klueless-io/drawio_dsl/commit/0d1075c177ff1441246950aaa7306ef774ba6df4))
14
+
15
+ # [0.3.0](https://github.com/klueless-io/drawio_dsl/compare/v0.2.0...v0.3.0) (2022-03-04)
16
+
17
+
18
+ ### Features
19
+
20
+ * add samples for direction, alignment, themes, styles and page margin ([2e9f735](https://github.com/klueless-io/drawio_dsl/commit/2e9f735ba50c9391d7dea64c565ca9c0fb61978a))
21
+
1
22
  # [0.2.0](https://github.com/klueless-io/drawio_dsl/compare/v0.1.0...v0.2.0) (2022-03-04)
2
23
 
3
24
 
data/README.md CHANGED
@@ -2,6 +2,10 @@
2
2
 
3
3
  > DrawIO DSL can build DrawIO diagrams using a Domain Specific Language
4
4
 
5
+ ## ToDo
6
+
7
+ - Diagram needs to support background color and it needs to trickle down to pages
8
+
5
9
  ## Installation
6
10
 
7
11
  Add this line to your application's Gemfile: