drawio_dsl 0.8.7 → 0.8.10

Sign up to get free protection for your applications and to get access to all the features.
Files changed (58) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +1 -0
  3. data/.vscode/settings.json +2 -1
  4. data/CHANGELOG.md +22 -0
  5. data/README.md +0 -7
  6. data/{.builders/.data/shapes.json → config/configuration.json} +49 -49
  7. data/docs/domain-modal/domain_model_custom.drawio +134 -134
  8. data/docs/domain-modal/domain_model_custom.svg +1 -1
  9. data/docs/domain_model.drawio +265 -0
  10. data/docs/domain_model.json +1038 -0
  11. data/docs/domain_model.svg +3 -0
  12. data/docs/parking_app.drawio +24 -24
  13. data/docs/parking_app.svg +1 -1
  14. data/docs/printspeak-architecture-controllers-custom.drawio +93 -0
  15. data/docs/printspeak-architecture-controllers-fat.svg +1 -0
  16. data/docs/printspeak-architecture-controllers-thin.svg +1 -0
  17. data/docs/printspeak-architecture-controllers.drawio +48 -0
  18. data/docs/printspeak-architecture-generator.drawio +91 -15
  19. data/docs/printspeak-architecture-generator.svg +1 -1
  20. data/docs/project-plan/project.drawio +94 -55
  21. data/docs/project-plan/project_done.svg +1 -1
  22. data/docs/project-plan/project_in_progress.svg +1 -1
  23. data/docs/project-plan/project_todo.svg +1 -1
  24. data/lib/drawio_dsl/configuration.rb +146 -0
  25. data/lib/drawio_dsl/drawio.rb +16 -0
  26. data/lib/drawio_dsl/version.rb +1 -1
  27. data/lib/drawio_dsl.rb +2 -0
  28. data/package-lock.json +2 -2
  29. data/package.json +1 -1
  30. metadata +10 -31
  31. data/.builders/.templates/basic/configuration_shapes.rb +0 -27
  32. data/.builders/.templates/basic/dom_builder_shapes.rb +0 -17
  33. data/.builders/.templates/basic/drawio_extensions.rb +0 -58
  34. data/.builders/.templates/basic/drawio_shapes.rb +0 -23
  35. data/.builders/.templates/basic/schema_require.rb +0 -19
  36. data/.builders/.templates/basic/schema_shape.rb +0 -9
  37. data/.builders/.templates/basic/schema_shape_spec.rb +0 -13
  38. data/.builders/_.rb +0 -1
  39. data/.builders/blueprint/shapes.rb +0 -173
  40. data/.builders/boot.rb +0 -72
  41. data/.builders/generators/01-bootstrap.rb +0 -130
  42. data/.builders/generators/02-generate-app.rb +0 -47
  43. data/.builders/generators/10-transform-drawio-js.rb +0 -195
  44. data/.builders/generators/20-drawio-extensions.rb +0 -41
  45. data/.builders/generators/domain_diagram.rb +0 -473
  46. data/.builders/generators/parking-map.png +0 -0
  47. data/.builders/generators/parking_app.rb +0 -110
  48. data/.builders/generators/printspeak-architecture-generator.rb +0 -45
  49. data/.builders/generators/project-plan.rb +0 -82
  50. data/.builders/generators/sample_diagrams/05-samples.rb +0 -36
  51. data/.builders/generators/sample_diagrams/10-page-margin.rb +0 -42
  52. data/.builders/generators/sample_diagrams/15-grid-direction.rb +0 -34
  53. data/.builders/generators/sample_diagrams/16-grid-alignment.rb +0 -70
  54. data/.builders/generators/sample_diagrams/20-styles.rb +0 -61
  55. data/.builders/generators/sample_diagrams/25-themes.rb +0 -37
  56. data/.builders/generators/sample_diagrams/30-html-shapes.rb +0 -70
  57. data/.builders/generators/sample_diagrams/35-ids-and-arrows.rb +0 -28
  58. data/.builders/generators/sample_diagrams/50-willoughby-council.rb +0 -51
@@ -19,6 +19,7 @@ module DrawioDsl
19
19
 
20
20
  layout = DrawioDsl::LayoutEngine.new(builder.current_page)
21
21
  layout.call
22
+
22
23
  self
23
24
  end
24
25
 
@@ -37,6 +38,21 @@ module DrawioDsl
37
38
  save(file_name, **{ open: :write }.merge(opts))
38
39
  end
39
40
 
41
+ def save_json(file_name, **opts)
42
+ return unless last_save_file_name
43
+ return unless File.exist?(last_save_file_name)
44
+
45
+ file_name = "#{file_name}.json" unless file_name.end_with?('.json')
46
+
47
+ add(file_name, content: JSON.pretty_generate(builder.dom), **opts)
48
+
49
+ self
50
+ end
51
+
52
+ def osave_json(file_name, **opts)
53
+ save_json(file_name, **{ open: :write }.merge(opts))
54
+ end
55
+
40
56
  def export_svg(output_file_name, page: 1)
41
57
  return unless last_save_file_name
42
58
  return unless File.exist?(last_save_file_name)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module DrawioDsl
4
- VERSION = '0.8.7'
4
+ VERSION = '0.8.10'
5
5
  end
data/lib/drawio_dsl.rb CHANGED
@@ -28,6 +28,8 @@ module DrawioDsl
28
28
  # raise DrawioDsl::Error, 'Sample message'
29
29
  Error = Class.new(StandardError)
30
30
 
31
+ ROOT_PATH = File.expand_path('..', __dir__)
32
+
31
33
  # Your code goes here...
32
34
  end
33
35
 
data/package-lock.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "drawio_dsl",
3
- "version": "0.8.7",
3
+ "version": "0.8.10",
4
4
  "lockfileVersion": 2,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "drawio_dsl",
9
- "version": "0.8.7",
9
+ "version": "0.8.10",
10
10
  "devDependencies": {
11
11
  "@klueless-js/semantic-release-rubygem": "github:klueless-js/semantic-release-rubygem",
12
12
  "@semantic-release/changelog": "^6.0.1",
data/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "drawio_dsl",
3
- "version": "0.8.7",
3
+ "version": "0.8.10",
4
4
  "description": "DrawIO DSL can build DrawIO diagrams using a Domain Specific Language",
5
5
  "scripts": {
6
6
  "release": "semantic-release"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: drawio_dsl
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.7
4
+ version: 0.8.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Cruwys
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-03-20 00:00:00.000000000 Z
11
+ date: 2022-03-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: k_config
@@ -73,35 +73,6 @@ executables: []
73
73
  extensions: []
74
74
  extra_rdoc_files: []
75
75
  files:
76
- - ".builders/.data/shapes.json"
77
- - ".builders/.templates/basic/configuration_shapes.rb"
78
- - ".builders/.templates/basic/dom_builder_shapes.rb"
79
- - ".builders/.templates/basic/drawio_extensions.rb"
80
- - ".builders/.templates/basic/drawio_shapes.rb"
81
- - ".builders/.templates/basic/schema_require.rb"
82
- - ".builders/.templates/basic/schema_shape.rb"
83
- - ".builders/.templates/basic/schema_shape_spec.rb"
84
- - ".builders/_.rb"
85
- - ".builders/blueprint/shapes.rb"
86
- - ".builders/boot.rb"
87
- - ".builders/generators/01-bootstrap.rb"
88
- - ".builders/generators/02-generate-app.rb"
89
- - ".builders/generators/10-transform-drawio-js.rb"
90
- - ".builders/generators/20-drawio-extensions.rb"
91
- - ".builders/generators/domain_diagram.rb"
92
- - ".builders/generators/parking-map.png"
93
- - ".builders/generators/parking_app.rb"
94
- - ".builders/generators/printspeak-architecture-generator.rb"
95
- - ".builders/generators/project-plan.rb"
96
- - ".builders/generators/sample_diagrams/05-samples.rb"
97
- - ".builders/generators/sample_diagrams/10-page-margin.rb"
98
- - ".builders/generators/sample_diagrams/15-grid-direction.rb"
99
- - ".builders/generators/sample_diagrams/16-grid-alignment.rb"
100
- - ".builders/generators/sample_diagrams/20-styles.rb"
101
- - ".builders/generators/sample_diagrams/25-themes.rb"
102
- - ".builders/generators/sample_diagrams/30-html-shapes.rb"
103
- - ".builders/generators/sample_diagrams/35-ids-and-arrows.rb"
104
- - ".builders/generators/sample_diagrams/50-willoughby-council.rb"
105
76
  - ".releaserc.json"
106
77
  - ".rspec"
107
78
  - ".rubocop.yml"
@@ -115,11 +86,15 @@ files:
115
86
  - Rakefile
116
87
  - bin/console
117
88
  - bin/setup
89
+ - config/configuration.json
118
90
  - docs/domain-modal.md
119
91
  - docs/domain-modal/domain_model.drawio
120
92
  - docs/domain-modal/domain_model.svg
121
93
  - docs/domain-modal/domain_model_custom.drawio
122
94
  - docs/domain-modal/domain_model_custom.svg
95
+ - docs/domain_model.drawio
96
+ - docs/domain_model.json
97
+ - docs/domain_model.svg
123
98
  - docs/extensions.md
124
99
  - docs/extensions/analyti_cs.svg
125
100
  - docs/extensions/android_inputs.svg
@@ -276,6 +251,10 @@ files:
276
251
  - docs/extensions/vessels.svg
277
252
  - docs/parking_app.drawio
278
253
  - docs/parking_app.svg
254
+ - docs/printspeak-architecture-controllers-custom.drawio
255
+ - docs/printspeak-architecture-controllers-fat.svg
256
+ - docs/printspeak-architecture-controllers-thin.svg
257
+ - docs/printspeak-architecture-controllers.drawio
279
258
  - docs/printspeak-architecture-generator.drawio
280
259
  - docs/printspeak-architecture-generator.svg
281
260
  - docs/project-plan.md
@@ -1,27 +0,0 @@
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, :category, :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, category: :element, x: 0, y: 0, w: 20, h: 20, style_modifiers: ''),
20
- {{#each shapes}}
21
- {{snake ./type}}: ShapeDefaults.new(type: :{{snake ./type}}, x: {{./x}}, category: :{{./category}}, y: {{./y}}, w: {{./w}}, h: {{./h}}, style_modifiers: '{{{./style_modifiers}}}'){{#if @last}}{{^}},{{/if}}
22
- {{/each}}
23
- )
24
- end
25
- end
26
- end
27
- # :nocov:
@@ -1,17 +0,0 @@
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}}(id = nil, **opts, &block)
10
- opts = { id: id }.merge(opts) if id
11
- {{snake ./type}} = DrawioDsl::Schema::{{camel ./type}}.new(current_page, **opts, &block)
12
- add_shape({{snake ./type}})
13
- end
14
- {{/each}}
15
- end
16
- end
17
- # :nocov:
@@ -1,58 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module DrawioDsl
4
- # :nocov:
5
- # 1000's of extension shapes derived from Extensions.js that can be used via the add_shape method
6
- class DrawioExtensions
7
-
8
- attr_reader :sections
9
- attr_reader :current_section
10
-
11
- def initialize
12
- @sections = []
13
- end
14
-
15
- def section(name)
16
- @current_section = {
17
- name: name,
18
- shapes: []
19
- }
20
- @sections << current_section
21
-
22
- yield if block_given?
23
- end
24
-
25
- def shape(name, style, original_name)
26
- shape = {
27
- name: name,
28
- style: style,
29
- original_name: original_name
30
- }
31
- current_section[:shapes] << shape
32
- shape
33
- end
34
-
35
- def to_h
36
- {
37
- sections: @sections.map(&:to_h)
38
- }
39
- end
40
-
41
- # This methods was generated using Extensions.js
42
- # This generation can be improved over time and the code to do the generation
43
- # can be found in the .builders/generators/10-transform-drawio-js.rb.
44
- # original source: ~/dev/tools/drawio-desktop/drawio/src/main/webapp/js/diagramly/Extensions.js
45
- def build_extensions
46
- # Constants
47
- {{{constants}}}
48
- {{#each sections}}
49
- section :{{snake ./name}} do
50
- {{#each ./shapes}}
51
- shape :{{padr (snake ./name) 60}}, "{{{./style}}}", "{{./name}}"
52
- {{/each}}
53
- end
54
- {{/each}}
55
- end
56
- end
57
- # :nocov:
58
- end
@@ -1,23 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module DrawioDsl
4
- # List of DSL methods for each common 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}}(id = nil, **opts, &block)
18
- builder.add_{{snake ./type}}(id, **opts, &block)
19
- end
20
- {{/each}}
21
- end
22
- # :nocov:
23
- end
@@ -1,19 +0,0 @@
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 'node_list'
8
- require_relative 'page'
9
-
10
- require_relative 'layouts/layout'
11
- require_relative 'layouts/flex_layout'
12
- require_relative 'layouts/grid_layout'
13
-
14
- require_relative 'shapes/shape'
15
- {{#each shapes}}
16
- require_relative 'shapes/{{snake ./type}}'
17
- {{/each}}
18
-
19
- require_relative 'virtual/anchor'
@@ -1,9 +0,0 @@
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 +0,0 @@
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
data/.builders/_.rb DELETED
@@ -1 +0,0 @@
1
- # require_relative './path/here'
@@ -1,173 +0,0 @@
1
- m = KManager.model :shapes, namespace: %i[domain] do
2
- # microapp = import(:handlebars_helpers, :microapp)
3
-
4
- # other settings
5
- # strokeWidth: 1-n
6
- # when there is an arrow at beginning
7
- # startFill=1,0
8
- # when there is an arrow at end
9
- # endFill=1,0
10
-
11
-
12
- table :strokes do
13
- fields [:name, :style]
14
-
15
- row :dashed , 'dashed=1;fixDash=1'
16
- row :dotted , 'dashed=1;fixDash=1;dashPattern=1 4'
17
- row :dashdot , 'dashed=1;fixDash=1;dashPattern=10 5 1 5'
18
- row :dashdotdot , 'dashed=1;fixDash=1;dashPattern=10 5 1 5 1 5'
19
- row :dotdotdot , 'dashed=1;fixDash=1;dashPattern=1 2'
20
- row :longdash , 'dashed=1;fixDash=1;dashPattern=16 6'
21
- row :dashlongdash , 'dashed=1;fixDash=1;dashPattern=10 6 16 6'
22
- row :dashed24 , 'dashed=1;fixDash=1;dashPattern=3 8'
23
- row :dashed32 , 'dashed=1;fixDash=1;dashPattern=6 5'
24
- row :dashed44 , 'dashed=1;fixDash=1;dashPattern=8 8'
25
- end
26
-
27
- table :connector_compass do
28
- fields %i[name x y]
29
-
30
- row :n , x: 0.5 , y: 0 # 'exitX=0.5;exitY=0;exitDx=0;exitDy=0' 'entryX=0.5;entryY=0;entryDx=0;entryDy=0'
31
- row :ne , x: 1 , y: 0 # 'exitX=1;exitY=0;exitDx=0;exitDy=0' 'entryX=1;entryY=0;entryDx=0;entryDy=0'
32
- row :e , x: 1 , y: 0.5 # 'exitX=1;exitY=0.5;exitDx=0;exitDy=0' 'entryX=1;entryY=0.5;entryDx=0;entryDy=0'
33
- row :se , x: 1 , y: 1 # 'exitX=1;exitY=1;exitDx=0;exitDy=0' 'entryX=1;entryY=1;entryDx=0;entryDy=0'
34
- row :s , x: 0.5 , y: 1 # 'exitX=0.5;exitY=1;exitDx=0;exitDy=0' 'entryX=0.5;entryY=1;entryDx=0;entryDy=0'
35
- row :sw , x: 0 , y: 1 # 'exitX=0;exitY=1;exitDx=0;exitDy=0' 'entryX=0;entryY=1;entryDx=0;entryDy=0'
36
- row :w , x: 0 , y: 0.5 # 'exitX=0;exitY=0.5;exitDx=0;exitDy=0' 'entryX=0;entryY=0.5;entryDx=0;entryDy=0'
37
- row :nw , x: 0 , y: 0 # 'exitX=0;exitY=0;exitDx=0;exitDy=0' 'entryX=0;entryY=0;entryDx=0;entryDy=0'
38
- end
39
-
40
- table :connector_design do
41
- fields [:name, :style]
42
-
43
- row :style1, ''
44
- row :style2, 'shape=link'
45
- row :style3, 'shape=flexArrow'
46
- row :style4, 'shape=arrow'
47
- end
48
-
49
- table :connector_arrows do
50
- fields [:name, :style]
51
-
52
- row :simple , 'open'
53
- row :triangle , 'block'
54
- row :diamond , 'diamond'
55
- row :circle , 'oval'
56
- row :cross , 'cross'
57
- row :short , 'classicThin'
58
- row :default , 'classic'
59
- row :none , 'none'
60
- row :plain , 'open'
61
- row :skewed_dash , 'dash'
62
- row :concave , 'openThin'
63
- row :er_many , 'ERmany'
64
- row :er_one , 'ERone'
65
- row :er_one_optional , 'ERzeroToOne'
66
- row :er_one_mandatory , 'ERmandOne'
67
- row :er_many_optional , 'ERzeroToMany'
68
- row :er_many_mandatory , 'ERoneToMany'
69
- end
70
-
71
- table :connector_waypoints do # aka edgeStyle
72
- fields [:name, :style]
73
-
74
- row :straight , 'edgeStyle=none'
75
- row :orthogonal , 'edgeStyle=orthogonalEdgeStyle'
76
- row :elbow , 'edgeStyle=elbowEdgeStyle'
77
- row :elbow_vertical , 'edgeStyle=elbowEdgeStyle;elbow=vertical'
78
- row :isometric , 'edgeStyle=isometricEdgeStyle'
79
- row :isometric_vertical , 'edgeStyle=isometricEdgeStyle;elbow=vertical'
80
- row :orthogonal_curved , 'edgeStyle=orthogonalEdgeStyle;curved=1'
81
- row :entity_relation , 'edgeStyle=entityRelationEdgeStyle'
82
- end
83
-
84
- table :shapes do
85
- fields [:type, :category, :x, :y, :w, :h, :style_modifiers]
86
-
87
- # shape is a custom object
88
- # row :shape , 0, 0, 20, 20, ''
89
-
90
- row :line , :line , 0, 0, 50, 50, 'edgeStyle=none;exitX=1;exitY=0.5;exitDx=0;exitDy=0;entryX=0;entryY=0.5;entryDx=0;entryDy=0'
91
- # row :line , :line , 0, 0, 50, 50, 'edgeStyle=entityRelationEdgeStyle;strokeWidth=1;elbow=vertical;startArrow=none;startFill=0;endArrow=block;endFill=0;targetPerimeterSpacing=0;shape=flexArrow;endSize=6;fillStyle=zigzag;'
92
- # row :dashed , 'dashed=1;fixDash=1'
93
- # row :dotted , 'dashed=1;fixDash=1;dashPattern=1 4'
94
- # row :dashdot , 'dashed=1;fixDash=1;dashPattern=10 5 1 5'
95
- # row :dashdotdot , 'dashed=1;fixDash=1;dashPattern=10 5 1 5 1 5'
96
- # row :dotdotdot , 'dashed=1;fixDash=1;dashPattern=1 2'
97
- # row :longdash , 'dashed=1;fixDash=1;dashPattern=16 6'
98
- # row :dashlongdash , 'dashed=1;fixDash=1;dashPattern=10 6 16 6'
99
- # row :dashed24 , 'dashed=1;fixDash=1;dashPattern=3 8'
100
- # row :dashed32 , 'dashed=1;fixDash=1;dashPattern=6 5'
101
- # row :dashed44 , 'dashed=1;fixDash=1;dashPattern=8 8'
102
- # edge="1" parent="node_root_2T8" source="b" target="c"
103
-
104
- # configuration for general purpose shapes
105
- row :h1 , :text , 0, 0, 100, 50, 'text;fontSize=89;fontColor=#ffffff;fontStyle=1;fillColor=none'
106
- row :h2 , :text , 0, 0, 100, 50, 'text;fontSize=67;fontColor=#ffffff;fontStyle=1;fillColor=none'
107
- row :h3 , :text , 0, 0, 100, 50, 'text;fontSize=50;fontColor=#ffffff;fontStyle=1;fillColor=none'
108
- row :h4 , :text , 0, 0, 100, 50, 'text;fontSize=37;fontColor=#ffffff;fontStyle=1;fillColor=none'
109
- row :h5 , :text , 0, 0, 100, 50, 'text;fontSize=28;fontColor=#ffffff;fontStyle=1;fillColor=none'
110
- row :h6 , :text , 0, 0, 100, 50, 'text;fontSize=21;fontColor=#ffffff;fontStyle=1;fillColor=none'
111
- row :p , :text , 0, 0, 100, 50, 'text;fontSize=16;fontColor=#ffffff;fontStyle=1;fillColor=none'
112
-
113
- row :actor , :element, 0, 0, 40, 50, 'shape=actor'
114
- row :actor2 , :element, 0, 0, 30, 50, 'shape=umlActor;verticalLabelPosition=bottom;outlineConnect=1'
115
- row :callout , :element, 0, 0, 160, 120, 'shape=callout'
116
- row :callout2 , :element, 0, 0, 160, 160, 'shape=mxgraph.basic.oval_callout'
117
- row :callout3 , :element, 0, 0, 160, 160, 'shape=mxgraph.basic.cloud_callout'
118
- row :callout4 , :element, 0, 0, 160, 120, 'shape=mxgraph.basic.roundRectCallout;dx=30;dy=15;size=5;boundedLbl=1;'
119
- row :circle , :element, 0, 0, 160, 160, 'ellipse'
120
- row :cloud , :element, 0, 0, 160, 160, 'shape=cloud'
121
- row :container , :element, 0, 0, 160, 160, 'swimlane'
122
- row :container2 , :element, 0, 0, 160, 160, 'swimlane;horizontal=0'
123
- row :container3 , :element, 0, 0, 160, 160, 'swimlane;startSize=50'
124
- row :container4 , :element, 0, 0, 160, 160, 'swimlane;resizable=0'
125
- row :cross , :element, 0, 0, 50, 50, 'verticalLabelPosition=bottom;verticalAlign=top;html=1;shape=mxgraph.basic.x'
126
- row :envelop , :element, 0, 0, 160, 100, 'shape=message'
127
- row :database , :element, 0, 0, 160, 80, 'shape=mxgraph.flowchart.database;strokeWidth=1'
128
- row :db_json , :element, 0, 0, 160, 40, 'shape=mxgraph.flowchart.database;strokeWidth=1'
129
- row :diamond , :element, 0, 0, 100, 100, 'rhombus'
130
- row :document , :element, 0, 0, 160, 160, 'shape=mxgraph.basic.document'
131
- row :ellipse , :element, 0, 0, 200, 120, 'ellipse'
132
- row :group , :element, 0, 0, 210, 210, 'fontSize=20;verticalAlign=top'
133
- row :hexagon , :element, 0, 0, 200, 120, 'shape=hexagon'
134
- row :interface , :element, 0, 0, 160, 160, 'align=left;overflow=fill;fontSize=12;fontFamily=Helvetica'
135
- row :klass , :element, 0, 0, 160, 160, 'align=left;overflow=fill;fontSize=12;fontFamily=Helvetica'
136
- row :note , :element, 0, 0, 160, 160, 'shape=note'
137
- row :process , :element, 0, 0, 200, 120, 'shape=process'
138
- row :rectangle , :element, 0, 0, 200, 120, ''
139
- row :rectangle2 , :element, 0, 0, 200, 120, 'shape=mxgraph.basic.cloud_rect'
140
- row :square , :element, 0, 0, 160, 160, ''
141
- row :step , :element, 0, 0, 120, 80, 'shape=step;perimeter=stepPerimeter;fixedSize=1'
142
- row :tick , :element, 0, 0, 50, 50, 'verticalLabelPosition=bottom;verticalAlign=top;shape=mxgraph.basic.tick'
143
- row :todo , :element, 0, 0, 300, 60, ''
144
- row :face , :element, 0, 0, 100, 100, 'verticalLabelPosition=bottom;verticalAlign=top;shape=mxgraph.basic.smiley'
145
- row :triangle , :element, 0, 0, 100, 100, 'triangle'
146
-
147
- # configuration for embedded element shape
148
- # note that the width / height probably should be driven of parent shape
149
- row :embed_row , :element, 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'
150
- row :embed_col50 , :element, 0, 0, 50, 40, 'shape=partialRectangle;connectable=0;top=0;left=0;bottom=0;right=0;fontStyle=1;overflow=hidden'
151
- row :embed_col200 , :element, 0, 0, 150, 40, 'shape=partialRectangle;connectable=0;top=0;left=0;bottom=0;right=0;align=left;spacingLeft=6;overflow=hidden'
152
- end
153
-
154
- action do
155
- data = self.raw_data
156
- content = {
157
- strokes: data['strokes'],
158
- connector: {
159
- compass: data['connector_compass'],
160
- waypoints: data['connector_waypoints'],
161
- arrows: data['connector_arrows'],
162
- design: data['connector_design']
163
- },
164
- shapes: data['shapes'],
165
- }
166
-
167
- k_builder
168
- .cd(:data)
169
- .add_file('shapes.json', content: JSON.pretty_generate(content), on_exist: :write)
170
- end
171
- end
172
-
173
-
data/.builders/boot.rb DELETED
@@ -1,72 +0,0 @@
1
- # Boot Sequence
2
-
3
- include KLog::Logging
4
-
5
- CONFIG_KEY = :drawio_dsl
6
-
7
- log.kv 'working folder', Dir.pwd
8
-
9
- Handlebars::Helpers.configure do |config|
10
- config.helper_config_file = File.join(Gem.loaded_specs['handlebars-helpers'].full_gem_path, '.handlebars_helpers.json')
11
- config.string_formatter_config_file = File.join(Gem.loaded_specs['handlebars-helpers'].full_gem_path, '.handlebars_string_formatters.json')
12
- end
13
-
14
- def camel
15
- require 'handlebars/helpers/string_formatting/camel'
16
- Handlebars::Helpers::StringFormatting::Camel.new
17
- end
18
-
19
- def titleize
20
- require 'handlebars/helpers/string_formatting/titleize'
21
- Handlebars::Helpers::StringFormatting::Titleize.new
22
- end
23
-
24
- def pluralize
25
- require 'handlebars/helpers/inflection/pluralize'
26
- Handlebars::Helpers::Inflection::Pluralize.new
27
- end
28
-
29
- def singularize
30
- require 'handlebars/helpers/inflection/singularize'
31
- Handlebars::Helpers::Inflection::Singularize.new
32
- end
33
-
34
- def dasherize
35
- require 'handlebars/helpers/string_formatting/dasherize'
36
- Handlebars::Helpers::StringFormatting::Dasherize.new
37
- end
38
-
39
- def k_builder
40
- @k_builder ||= KBuilder::BaseBuilder.init(KConfig.configuration(CONFIG_KEY))
41
- end
42
-
43
- KConfig.configure(CONFIG_KEY) do |config|
44
- builder_folder = Dir.pwd
45
- base_folder = File.expand_path('../', builder_folder)
46
- global_template = File.expand_path('~/dev/kgems/k_templates/templates')
47
-
48
- # Templates
49
- config.template_folders.add(:global_template , global_template)
50
- config.template_folders.add(:template , File.expand_path('.templates', Dir.pwd))
51
-
52
- # Target Folders
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')
56
- config.target_folders.add(:docs , :app, 'docs')
57
- config.target_folders.add(:builder , builder_folder)
58
- config.target_folders.add(:data , :builder, '.data')
59
- end
60
-
61
- KConfig.configuration(CONFIG_KEY).debug
62
-
63
- area = KManager.add_area(CONFIG_KEY)
64
- resource_manager = area.resource_manager
65
- resource_manager
66
- .fileset
67
- .glob('*.rb', exclude: ['boot.rb'])
68
- .glob('generators/**/*.rb')
69
- .glob('blueprint/**/*.rb')
70
- resource_manager.add_resources
71
-
72
- KManager.boot