drawio_dsl 0.4.1 → 0.5.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (57) hide show
  1. checksums.yaml +4 -4
  2. data/.builders/.data/shapes.json +168 -8
  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_shape.rb +9 -0
  7. data/.builders/.templates/{schema_shape_spec.rb → basic/schema_shape_spec.rb} +2 -2
  8. data/.builders/blueprint/shapes.rb +37 -12
  9. data/.builders/boot.rb +1 -0
  10. data/.builders/generators/02-generate-app.rb +43 -0
  11. data/.builders/generators/sample_diagrams/25-themes.rb +2 -2
  12. data/.builders/generators/sample_diagrams/30-shapes.rb +23 -0
  13. data/.builders/generators/sample_diagrams/50-willoughby-council.rb +38 -0
  14. data/.rubocop.yml +22 -3
  15. data/CHANGELOG.md +23 -0
  16. data/README.md +4 -0
  17. data/lib/drawio_dsl/configuration.rb +5 -101
  18. data/lib/drawio_dsl/configuration_extension.rb +13 -0
  19. data/lib/drawio_dsl/configuration_shapes.rb +83 -0
  20. data/lib/drawio_dsl/configuration_themes.rb +63 -0
  21. data/lib/drawio_dsl/dom_builder.rb +9 -55
  22. data/lib/drawio_dsl/dom_builder_shapes.rb +158 -0
  23. data/lib/drawio_dsl/drawio.rb +1 -91
  24. data/lib/drawio_dsl/drawio_shapes.rb +193 -0
  25. data/lib/drawio_dsl/layout_engine.rb +1 -8
  26. data/lib/drawio_dsl/schema/_.rb +21 -0
  27. data/lib/drawio_dsl/schema/layouts/grid_layout.rb +17 -10
  28. data/lib/drawio_dsl/schema/node_list.rb +37 -0
  29. data/lib/drawio_dsl/schema/page.rb +5 -5
  30. data/{.builders/.templates/schema_shape.rb → lib/drawio_dsl/schema/shapes/actor.rb} +2 -2
  31. data/lib/drawio_dsl/schema/shapes/actor2.rb +9 -0
  32. data/lib/drawio_dsl/schema/shapes/callout2.rb +9 -0
  33. data/lib/drawio_dsl/schema/shapes/callout3.rb +9 -0
  34. data/lib/drawio_dsl/schema/shapes/callout4.rb +9 -0
  35. data/lib/drawio_dsl/schema/shapes/container.rb +9 -0
  36. data/lib/drawio_dsl/schema/shapes/container2.rb +9 -0
  37. data/lib/drawio_dsl/schema/shapes/container3.rb +9 -0
  38. data/lib/drawio_dsl/schema/shapes/container4.rb +9 -0
  39. data/lib/drawio_dsl/schema/shapes/cross.rb +9 -0
  40. data/lib/drawio_dsl/schema/shapes/document.rb +9 -0
  41. data/lib/drawio_dsl/schema/shapes/embed_col200.rb +9 -0
  42. data/lib/drawio_dsl/schema/shapes/embed_col50.rb +9 -0
  43. data/lib/drawio_dsl/schema/shapes/embed_row.rb +9 -0
  44. data/lib/drawio_dsl/schema/shapes/envelop.rb +9 -0
  45. data/lib/drawio_dsl/schema/shapes/face.rb +9 -0
  46. data/lib/drawio_dsl/schema/shapes/rectangle2.rb +9 -0
  47. data/lib/drawio_dsl/schema/shapes/shape.rb +10 -6
  48. data/lib/drawio_dsl/schema/shapes/step.rb +9 -0
  49. data/lib/drawio_dsl/schema/shapes/tick.rb +9 -0
  50. data/lib/drawio_dsl/schema/shapes/triangle.rb +9 -0
  51. data/lib/drawio_dsl/version.rb +1 -1
  52. data/lib/drawio_dsl/xml_builder.rb +2 -12
  53. data/lib/drawio_dsl.rb +5 -0
  54. data/package-lock.json +2 -2
  55. data/package.json +1 -1
  56. metadata +36 -5
  57. data/.builders/generators/90-requires.rb +0 -35
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 43e99df9f899e7c7ebeb6618d9b2018cad1a17abf786cf047d918c1eed513f77
4
- data.tar.gz: 2b251a9fa966d5447cc8130b1a1b9a2ac90e7f229b5b1aa0d182a233179ec88e
3
+ metadata.gz: bc020dbec3ff4115cab4aa60206f9e7321670c6337c6621134b592695f2f8037
4
+ data.tar.gz: 42f7bab79c6318c124cf457f1f2cabfd3738eff6ba3d8c8066bb486901cb0021
5
5
  SHA512:
6
- metadata.gz: d0da48b1461fa48072af5674a689dd9beac83fee630cb2cd656c22a3495fdffd062ec3fffa80dfca57478a240557ac70c456c14adc87b31d6dd2d4930d77dc2e
7
- data.tar.gz: 6376e89f6e55ff96b644cbdf23f26000facdad358791f9bfa66eeee4bc7193389cc75c6601c3f5a8cc7a51f24c5717f1985dbcdd86214efbb1cadf5eff991b1e
6
+ metadata.gz: 62b9fa5927e15b638fe9e135fd90b5a304c248f9328a2c42d43079a15b06e839c309ebfa3a356d824fd29fe85bdcf2c02ccbe262dbd1a62aaa8a60ea2cca055d
7
+ data.tar.gz: 402641432dd415ff7694a3204ba2c5180910bb1f8642ce238c6374b4b2e3d930a93ea5ed4e6a04350cfa98f7c0fb5d7d5b49002022997e77e8c200ce242cfba9
@@ -1,11 +1,51 @@
1
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
+ },
2
18
  {
3
19
  "type": "callout",
4
20
  "x": 0,
5
21
  "y": 0,
6
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,
7
39
  "h": 160,
8
- "style_modifiers": "double=1;shape=callout"
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;"
9
49
  },
10
50
  {
11
51
  "type": "circle",
@@ -13,7 +53,7 @@
13
53
  "y": 0,
14
54
  "w": 160,
15
55
  "h": 160,
16
- "style_modifiers": "double=1;ellipse"
56
+ "style_modifiers": "ellipse"
17
57
  },
18
58
  {
19
59
  "type": "cloud",
@@ -21,15 +61,39 @@
21
61
  "y": 0,
22
62
  "w": 160,
23
63
  "h": 160,
24
- "style_modifiers": "double=1;shape=cloud"
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"
25
81
  },
26
82
  {
27
83
  "type": "diamond",
28
84
  "x": 0,
29
85
  "y": 0,
86
+ "w": 100,
87
+ "h": 100,
88
+ "style_modifiers": "rhombus"
89
+ },
90
+ {
91
+ "type": "document",
92
+ "x": 0,
93
+ "y": 0,
30
94
  "w": 160,
31
95
  "h": 160,
32
- "style_modifiers": "double=1;rhombus"
96
+ "style_modifiers": "shape=mxgraph.basic.document"
33
97
  },
34
98
  {
35
99
  "type": "ellipse",
@@ -37,7 +101,7 @@
37
101
  "y": 0,
38
102
  "w": 200,
39
103
  "h": 120,
40
- "style_modifiers": "double=1;ellipse"
104
+ "style_modifiers": "ellipse"
41
105
  },
42
106
  {
43
107
  "type": "hexagon",
@@ -45,7 +109,39 @@
45
109
  "y": 0,
46
110
  "w": 200,
47
111
  "h": 120,
48
- "style_modifiers": "double=1;shape=hexagon"
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"
121
+ },
122
+ {
123
+ "type": "container2",
124
+ "x": 0,
125
+ "y": 0,
126
+ "w": 160,
127
+ "h": 160,
128
+ "style_modifiers": "swimlane;horizontal=0"
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"
49
145
  },
50
146
  {
51
147
  "type": "note",
@@ -53,7 +149,7 @@
53
149
  "y": 0,
54
150
  "w": 160,
55
151
  "h": 160,
56
- "style_modifiers": "double=1;shape=note"
152
+ "style_modifiers": "shape=note"
57
153
  },
58
154
  {
59
155
  "type": "process",
@@ -61,7 +157,7 @@
61
157
  "y": 0,
62
158
  "w": 200,
63
159
  "h": 120,
64
- "style_modifiers": "double=1;shape=process"
160
+ "style_modifiers": "shape=process"
65
161
  },
66
162
  {
67
163
  "type": "rectangle",
@@ -71,6 +167,14 @@
71
167
  "h": 120,
72
168
  "style_modifiers": ""
73
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
+ },
74
178
  {
75
179
  "type": "square",
76
180
  "x": 0,
@@ -78,5 +182,61 @@
78
182
  "w": 160,
79
183
  "h": 160,
80
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
+ {
219
+ "type": "embed_row",
220
+ "x": 0,
221
+ "y": 0,
222
+ "w": 200,
223
+ "h": 40,
224
+ "style_modifiers": "shape=partialRectangle;collapsible=0;dropTarget=0;pointerEvents=0;top=0;left=0;bottom=1;right=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest"
225
+ },
226
+ {
227
+ "type": "embed_col50",
228
+ "x": 0,
229
+ "y": 0,
230
+ "w": 50,
231
+ "h": 40,
232
+ "style_modifiers": "shape=partialRectangle;connectable=0;top=0;left=0;bottom=0;right=0;fontStyle=1;overflow=hidden"
233
+ },
234
+ {
235
+ "type": "embed_col200",
236
+ "x": 0,
237
+ "y": 0,
238
+ "w": 150,
239
+ "h": 40,
240
+ "style_modifiers": "shape=partialRectangle;connectable=0;top=0;left=0;bottom=0;right=0;align=left;spacingLeft=6;overflow=hidden"
81
241
  }
82
242
  ]
@@ -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,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
@@ -1,13 +1,13 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- RSpec.describe DrawioDsl::Schema::{{camle type}} do
3
+ RSpec.describe DrawioDsl::Schema::{{camel shape.type}} do
4
4
  include_context :node_dependencies
5
5
 
6
6
  subject { instance }
7
7
 
8
8
  let(:instance) { described_class.new(diagram, **args) }
9
9
  let(:args) { { id: 1 } }
10
- let(:default) { KConfig.configuration.drawio.shapes.{{snake type}} }
10
+ let(:default) { KConfig.configuration.drawio.shapes.{{snake shape.type}} }
11
11
 
12
12
  it_behaves_like :basic_shape_attributes
13
13
  end
@@ -4,18 +4,43 @@ KManager.model :shapes, namespace: %i[domain] do
4
4
  table :shapes do
5
5
  fields [:type, :x, :y, :w, :h, :style_modifiers]
6
6
 
7
- # row :shape , x: 0, y: 0, w: 20, h: 20, style_modifiers: ''
8
- row :callout , x: 0, y: 0, w: 160, h: 160, style_modifiers: 'double=1;shape=callout'
9
- row :circle , x: 0, y: 0, w: 160, h: 160, style_modifiers: 'double=1;ellipse'
10
- row :cloud , x: 0, y: 0, w: 160, h: 160, style_modifiers: 'double=1;shape=cloud'
11
- row :diamond , x: 0, y: 0, w: 160, h: 160, style_modifiers: 'double=1;rhombus'
12
- row :ellipse , x: 0, y: 0, w: 200, h: 120, style_modifiers: 'double=1;ellipse'
13
- row :hexagon , x: 0, y: 0, w: 200, h: 120, style_modifiers: 'double=1;shape=hexagon'
14
- row :note , x: 0, y: 0, w: 160, h: 160, style_modifiers: 'double=1;shape=note'
15
- row :process , x: 0, y: 0, w: 200, h: 120, style_modifiers: 'double=1;shape=process'
16
- row :rectangle , x: 0, y: 0, w: 200, h: 120, style_modifiers: ''
17
- row :square , 0, 0, 160, 160, ''
18
-
7
+ # shape is a custom object
8
+ # row :shape , 0, 0, 20, 20, ''
9
+
10
+ # configuration for general purpose shapes
11
+ row :actor , 0, 0, 40, 50, 'shape=actor'
12
+ row :actor2 , 0, 0, 30, 50, 'shape=umlActor;verticalLabelPosition=bottom;outlineConnect=1'
13
+ row :callout , 0, 0, 160, 120, 'shape=callout'
14
+ row :callout2 , 0, 0, 160, 160, 'shape=mxgraph.basic.oval_callout'
15
+ row :callout3 , 0, 0, 160, 160, 'shape=mxgraph.basic.cloud_callout'
16
+ row :callout4 , 0, 0, 160, 120, 'shape=mxgraph.basic.roundRectCallout;dx=30;dy=15;size=5;boundedLbl=1;'
17
+ row :circle , 0, 0, 160, 160, 'ellipse'
18
+ row :cloud , 0, 0, 160, 160, 'shape=cloud'
19
+ row :cross , 0, 0, 50, 50, 'verticalLabelPosition=bottom;verticalAlign=top;html=1;shape=mxgraph.basic.x'
20
+ row :envelop , 0, 0, 160, 100, 'shape=message'
21
+ row :diamond , 0, 0, 100, 100, 'rhombus'
22
+ row :document , 0, 0, 160, 160, 'shape=mxgraph.basic.document'
23
+ row :ellipse , 0, 0, 200, 120, 'ellipse'
24
+ row :hexagon , 0, 0, 200, 120, 'shape=hexagon'
25
+ row :container , 0, 0, 160, 160, 'swimlane'
26
+ row :container2 , 0, 0, 160, 160, 'swimlane;horizontal=0'
27
+ row :container3 , 0, 0, 160, 160, 'swimlane;startSize=50'
28
+ row :container4 , 0, 0, 160, 160, 'swimlane;resizable=0'
29
+ row :note , 0, 0, 160, 160, 'shape=note'
30
+ row :process , 0, 0, 200, 120, 'shape=process'
31
+ row :rectangle , 0, 0, 200, 120, ''
32
+ row :rectangle2 , 0, 0, 200, 120, 'shape=mxgraph.basic.cloud_rect'
33
+ row :square , 0, 0, 160, 160, ''
34
+ row :step , 0, 0, 120, 80, 'shape=step;perimeter=stepPerimeter;fixedSize=1'
35
+ row :tick , 0, 0, 50, 50, 'verticalLabelPosition=bottom;verticalAlign=top;shape=mxgraph.basic.tick'
36
+ row :face , 0, 0, 100, 100, 'verticalLabelPosition=bottom;verticalAlign=top;shape=mxgraph.basic.smiley'
37
+ row :triangle , 0, 0, 100, 100, 'triangle'
38
+
39
+ # configuration for embedded element shape
40
+ # note that the width / height probably should be driven of parent shape
41
+ row :embed_row , 0, 0, 200, 40, 'shape=partialRectangle;collapsible=0;dropTarget=0;pointerEvents=0;top=0;left=0;bottom=1;right=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest'
42
+ row :embed_col50 , 0, 0, 50, 40, 'shape=partialRectangle;connectable=0;top=0;left=0;bottom=0;right=0;fontStyle=1;overflow=hidden'
43
+ row :embed_col200 , 0, 0, 150, 40, 'shape=partialRectangle;connectable=0;top=0;left=0;bottom=0;right=0;align=left;spacingLeft=6;overflow=hidden'
19
44
  end
20
45
 
21
46
  action do
data/.builders/boot.rb CHANGED
@@ -52,6 +52,7 @@ KConfig.configure(CONFIG_KEY) do |config|
52
52
  # Target Folders
53
53
  config.target_folders.add(:app , base_folder)
54
54
  config.target_folders.add(:lib , :app, 'lib', 'drawio_dsl')
55
+ config.target_folders.add(:spec , :app, 'spec', 'drawio_dsl')
55
56
  config.target_folders.add(:builder , builder_folder)
56
57
  config.target_folders.add(:data , :builder, '.data')
57
58
  end
@@ -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,8 @@ 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
10
 
11
11
  square(title: 'The quick brown fox jumps over the lazy dog')
12
12
  circle(title: 'Mary had a little lamb')
@@ -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
@@ -0,0 +1,38 @@
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, rounded: 1) do
9
+ grid_layout(wrap_at: 40, direction: :vertical, )
10
+
11
+ square(w: 300, h: 100, title: 'PREPARATION FOR INVESTIGATION ')
12
+ square(w: 300, h: 100, title: '(source: Hunter & Central Coast Regional Environmental Management Strategy – Investigations guideline) ')
13
+ square(w: 300, h: 100, title: 'Enter report into system')
14
+ square(w: 300, h: 100, title: 'Preliminary Review ')
15
+ square(w: 300, h: 100, title: 'Insufficient Information ')
16
+ square(w: 300, h: 100, title: 'Seek Additional Information ')
17
+ square(w: 300, h: 100, title: 'Identify Possible Breach ')
18
+ square(w: 300, h: 100, title: 'Insufficient evidence or no breach detected ')
19
+ square(w: 300, h: 100, title: 'Plan follow up action ')
20
+ square(w: 300, h: 100, title: 'Establish Jurisdiction - Council or other agency? ')
21
+ square(w: 300, h: 100, title: 'Refer to other agency ')
22
+ square(w: 300, h: 100, title: 'Council Responsibility ')
23
+ square(w: 300, h: 100, title: 'Plan investigation ')
24
+ square(w: 300, h: 100, title: 'Conduct investigation Gather and manage evidence (Evidence Gathering Guideline) ')
25
+ square(w: 300, h: 100, title: 'Prepare recommendations report ')
26
+ square(w: 300, h: 100, title: 'Make decision ')
27
+ square(w: 300, h: 100, title: 'Take action (Enforcement Options Guideline) ')
28
+ square(w: 300, h: 100, title: 'Review investigation ')
29
+ square(w: 300, h: 100, title: 'Close case ')
30
+ square(w: 300, h: 100, title: 'Feedback to complainant ')
31
+ end
32
+
33
+ diagram = DrawioDsl::XmlBuilder.new(director.builder.diagram)
34
+
35
+ File.write('../spec/.samples/drawio/50-willoughby-council.xml', diagram.build)
36
+ File.write('../spec/.samples/drawio/50-willoughby-council.drawio', diagram.build)
37
+ end
38
+ 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,14 +36,13 @@ 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
44
42
  IgnoredPatterns: ['\A# \*\*']
45
43
  IgnoreCopDirectives: true
44
+ Exclude:
45
+ - "lib/drawio_dsl/configuration_shapes.rb"
46
46
 
47
47
  Lint/UnusedMethodArgument:
48
48
  AllowUnusedKeywordArguments: true
@@ -58,6 +58,25 @@ Metrics/ClassLength:
58
58
  Metrics/ModuleLength:
59
59
  Exclude:
60
60
  - "**/spec/**/*"
61
+ - "lib/drawio_dsl/drawio_shapes.rb"
62
+ - "lib/drawio_dsl/schema/shapes/diagram.rb"
63
+ - "lib/drawio_dsl/dom_builder_shapes.rb"
64
+ Metrics/AbcSize:
65
+ Exclude:
66
+ - "lib/drawio_dsl/drawio_shapes.rb"
67
+ - "lib/drawio_dsl/configuration_shapes.rb"
68
+ - "lib/drawio_dsl/configuration_themes.rb"
69
+ Metrics/CyclomaticComplexity:
70
+ Exclude:
71
+ - "lib/drawio_dsl/drawio_shapes.rb"
72
+ Metrics/MethodLength:
73
+ Max: 25
74
+ Exclude:
75
+ - "lib/drawio_dsl/drawio_shapes.rb"
76
+ - "lib/drawio_dsl/schema/shapes/shape.rb"
77
+ - "lib/drawio_dsl/schema/shapes/page.rb"
78
+ - "lib/drawio_dsl/configuration_shapes.rb"
79
+ - "lib/drawio_dsl/configuration_themes.rb"
61
80
  Naming/MemoizedInstanceVariableName:
62
81
  Enabled: false
63
82
  Naming/AccessorMethodName:
data/CHANGELOG.md CHANGED
@@ -1,3 +1,26 @@
1
+ ## [0.5.1](https://github.com/klueless-io/drawio_dsl/compare/v0.5.0...v0.5.1) (2022-03-07)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * refactor nodes array to nodelist object ([10372a5](https://github.com/klueless-io/drawio_dsl/commit/10372a529e6274bae451dae15626dfbac4b9cccb))
7
+
8
+ # [0.5.0](https://github.com/klueless-io/drawio_dsl/compare/v0.4.1...v0.5.0) (2022-03-07)
9
+
10
+
11
+ ### Features
12
+
13
+ * add new and update older shapes ([64a0d83](https://github.com/klueless-io/drawio_dsl/commit/64a0d83dda6181183c0980914b7b2ee1520b84e6))
14
+ * final code generation in place for shapes ([ac4ed3c](https://github.com/klueless-io/drawio_dsl/commit/ac4ed3cace4e1794d38306e14d3cee60529add4b))
15
+ * final code generation in place for shapes ([4c2a6fb](https://github.com/klueless-io/drawio_dsl/commit/4c2a6fb376fe61cfd44a699677f7781c9e2b215c))
16
+
17
+ ## [0.4.1](https://github.com/klueless-io/drawio_dsl/compare/v0.4.0...v0.4.1) (2022-03-06)
18
+
19
+
20
+ ### Bug Fixes
21
+
22
+ * add support for generated shapes ([b52f278](https://github.com/klueless-io/drawio_dsl/commit/b52f2786281acadc32d546f0ed9c7ac2c8fc1094))
23
+
1
24
  # [0.4.0](https://github.com/klueless-io/drawio_dsl/compare/v0.3.0...v0.4.0) (2022-03-05)
2
25
 
3
26
 
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: