drawio_dsl 0.8.6 → 0.8.9
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.
- checksums.yaml +4 -4
- data/.vscode/settings.json +2 -1
- data/CHANGELOG.md +22 -0
- data/README.md +0 -7
- data/{.builders/.data/shapes.json → config/configuration.json} +49 -49
- data/docs/domain-modal/domain_model_custom.drawio +134 -134
- data/docs/domain-modal/domain_model_custom.svg +1 -1
- data/docs/domain_model.drawio +265 -0
- data/docs/domain_model.json +1038 -0
- data/docs/domain_model.svg +3 -0
- data/docs/parking_app.drawio +24 -24
- data/docs/parking_app.svg +1 -1
- data/docs/printspeak-architecture-generator.drawio +42 -30
- data/docs/printspeak-architecture-generator.svg +1 -1
- data/docs/project-plan/project.drawio +78 -54
- data/docs/project-plan/project_done.svg +1 -1
- data/docs/project-plan/project_in_progress.svg +1 -1
- data/docs/project-plan/project_todo.svg +1 -1
- data/lib/drawio_dsl/configuration.rb +99 -0
- data/lib/drawio_dsl/drawio.rb +16 -0
- data/lib/drawio_dsl/formatters/base_formatter.rb +120 -0
- data/lib/drawio_dsl/formatters/html_builder.rb +39 -0
- data/lib/drawio_dsl/formatters/interface_formatter.rb +13 -1
- data/lib/drawio_dsl/formatters/klass_formatter.rb +13 -1
- data/lib/drawio_dsl/version.rb +1 -1
- data/lib/drawio_dsl.rb +2 -0
- data/package-lock.json +2 -2
- data/package.json +1 -1
- metadata +6 -31
- data/.builders/.templates/basic/configuration_shapes.rb +0 -27
- data/.builders/.templates/basic/dom_builder_shapes.rb +0 -17
- data/.builders/.templates/basic/drawio_extensions.rb +0 -58
- data/.builders/.templates/basic/drawio_shapes.rb +0 -23
- data/.builders/.templates/basic/schema_require.rb +0 -19
- data/.builders/.templates/basic/schema_shape.rb +0 -9
- data/.builders/.templates/basic/schema_shape_spec.rb +0 -13
- data/.builders/_.rb +0 -1
- data/.builders/blueprint/shapes.rb +0 -173
- data/.builders/boot.rb +0 -72
- data/.builders/generators/01-bootstrap.rb +0 -130
- data/.builders/generators/02-generate-app.rb +0 -47
- data/.builders/generators/10-transform-drawio-js.rb +0 -195
- data/.builders/generators/20-drawio-extensions.rb +0 -41
- data/.builders/generators/domain_diagram.rb +0 -473
- data/.builders/generators/parking-map.png +0 -0
- data/.builders/generators/parking_app.rb +0 -110
- data/.builders/generators/printspeak-architecture-generator.rb +0 -45
- data/.builders/generators/project-plan.rb +0 -81
- data/.builders/generators/sample_diagrams/05-samples.rb +0 -36
- data/.builders/generators/sample_diagrams/10-page-margin.rb +0 -42
- data/.builders/generators/sample_diagrams/15-grid-direction.rb +0 -34
- data/.builders/generators/sample_diagrams/16-grid-alignment.rb +0 -70
- data/.builders/generators/sample_diagrams/20-styles.rb +0 -61
- data/.builders/generators/sample_diagrams/25-themes.rb +0 -37
- data/.builders/generators/sample_diagrams/30-html-shapes.rb +0 -48
- data/.builders/generators/sample_diagrams/35-ids-and-arrows.rb +0 -28
- data/.builders/generators/sample_diagrams/50-willoughby-council.rb +0 -51
@@ -1,195 +0,0 @@
|
|
1
|
-
KManager.action :transform_drawio_js do
|
2
|
-
|
3
|
-
action do
|
4
|
-
director = KDirector::Dsls::BasicDsl
|
5
|
-
.init(k_builder,
|
6
|
-
on_exist: :write, # %i[skip write compare]
|
7
|
-
on_action: :execute # %i[queue execute]
|
8
|
-
)
|
9
|
-
.blueprint do
|
10
|
-
cd(:data)
|
11
|
-
|
12
|
-
source_file = '/Users/davidcruwys/dev/tools/drawio-desktop/drawio/src/main/webapp/js/diagramly/Extensions.js'
|
13
|
-
target_file = k_builder.target_folders.get_filename(:data, 'extensions.js')
|
14
|
-
|
15
|
-
clean = CleanExtensionsJs.new(source_file, target_file)
|
16
|
-
|
17
|
-
cd(:lib)
|
18
|
-
|
19
|
-
clean.parse
|
20
|
-
|
21
|
-
add_file('drawio_extensions.json', content: clean.build_json)
|
22
|
-
add('drawio_extensions.rb', constants: clean.constants, sections: clean.sections)
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
26
|
-
|
27
|
-
class CleanExtensionsJs
|
28
|
-
def initialize(source_file, target_file)
|
29
|
-
@source_file = source_file
|
30
|
-
@target_file = target_file
|
31
|
-
@source = File.read(@source_file)
|
32
|
-
@constants = []
|
33
|
-
@builder = ExtensionJsBuilder.new
|
34
|
-
end
|
35
|
-
|
36
|
-
def parse
|
37
|
-
split_source
|
38
|
-
end
|
39
|
-
|
40
|
-
def build_json
|
41
|
-
@builder.build_json
|
42
|
-
end
|
43
|
-
|
44
|
-
def build_ruby
|
45
|
-
@builder.build_ruby
|
46
|
-
end
|
47
|
-
|
48
|
-
def constants
|
49
|
-
@builder.constants.join("\n")
|
50
|
-
end
|
51
|
-
|
52
|
-
def sections
|
53
|
-
@builder.sections.select { |s| s[:shapes].length > 0 }
|
54
|
-
end
|
55
|
-
|
56
|
-
private
|
57
|
-
|
58
|
-
def split_source
|
59
|
-
source_lines = @source.split("\n")
|
60
|
-
section = :unknown
|
61
|
-
|
62
|
-
source_lines.each do |line|
|
63
|
-
if line.include?('// Global import transformation')
|
64
|
-
section = :constants
|
65
|
-
next
|
66
|
-
elsif line.include?('var styleMap = {') && !line.include?('var styleMap = {};')
|
67
|
-
puts '-----------------------------------'
|
68
|
-
section = :style_map
|
69
|
-
next
|
70
|
-
elsif line.include?('};') ||
|
71
|
-
line.include?('//Instead of doing a massive code refactoring, thees ugly global variables are used')
|
72
|
-
section = :unknown
|
73
|
-
end
|
74
|
-
|
75
|
-
if section == :constants
|
76
|
-
@builder.process_constant(line)
|
77
|
-
end
|
78
|
-
|
79
|
-
if section == :style_map
|
80
|
-
@builder.process_style_map(line)
|
81
|
-
end
|
82
|
-
end
|
83
|
-
end
|
84
|
-
|
85
|
-
def process_style_map(line)
|
86
|
-
line
|
87
|
-
end
|
88
|
-
end
|
89
|
-
|
90
|
-
class ExtensionJsBuilder
|
91
|
-
attr_accessor :constants
|
92
|
-
attr_accessor :shapes
|
93
|
-
attr_accessor :sections
|
94
|
-
attr_accessor :current_section
|
95
|
-
|
96
|
-
def initialize
|
97
|
-
@constants = []
|
98
|
-
@shapes = []
|
99
|
-
@sections = []
|
100
|
-
@current_section = nil
|
101
|
-
end
|
102
|
-
|
103
|
-
def process_constant(line)
|
104
|
-
line = line.gsub(' ', '').gsub('var ', '').gsub(/;$/, '')
|
105
|
-
@constants << " #{line}"
|
106
|
-
end
|
107
|
-
|
108
|
-
def process_style_map(line)
|
109
|
-
line = clean_line(line)
|
110
|
-
|
111
|
-
return if kill_line(line)
|
112
|
-
|
113
|
-
if line.start_with?('#')
|
114
|
-
set_section(line)
|
115
|
-
return
|
116
|
-
end
|
117
|
-
|
118
|
-
return unless current_section
|
119
|
-
|
120
|
-
parts = process_line(line)
|
121
|
-
|
122
|
-
if parts.length == 2
|
123
|
-
name = parts[0]
|
124
|
-
style = parts[1]
|
125
|
-
current_section[:shapes] << { name: name, style: style }
|
126
|
-
shapes << line
|
127
|
-
else
|
128
|
-
puts 'length not 2'
|
129
|
-
puts line
|
130
|
-
end
|
131
|
-
end
|
132
|
-
|
133
|
-
def process_line(line)
|
134
|
-
line.split(':').map { |s| s.strip.gsub('"', '') }
|
135
|
-
end
|
136
|
-
|
137
|
-
def clean_line(line)
|
138
|
-
line
|
139
|
-
.strip
|
140
|
-
.gsub(' ', ' ')
|
141
|
-
.gsub(' ', ' ')
|
142
|
-
.gsub(' :', ':')
|
143
|
-
.gsub("don't", 'do not')
|
144
|
-
.gsub('//TODO', '')
|
145
|
-
.gsub(/(\/\/)([^ ])/) do |_|
|
146
|
-
match = Regexp.last_match
|
147
|
-
"// #{match[2]}"
|
148
|
-
end
|
149
|
-
.gsub("'", '"')
|
150
|
-
.gsub('not all variants covered', '')
|
151
|
-
.gsub('Timeline shape', '')
|
152
|
-
.gsub('# not all variants covered', '')
|
153
|
-
.gsub('not all versions supported', '')
|
154
|
-
.gsub('ss + "', '"#{ss}')
|
155
|
-
.gsub('s + "', '"#{s}')
|
156
|
-
.gsub('cs,', '#{cs}')
|
157
|
-
.gsub(/cs$/, '#{cs}')
|
158
|
-
.gsub('" + containerStyle', '#{containerStyle}"')
|
159
|
-
.gsub('kupIcon + "', '"#{kupIcon}')
|
160
|
-
.gsub('gcpIcon + "', '"#{gcpIcon}')
|
161
|
-
.gsub('azur19 + "', '"#{azur19}')
|
162
|
-
.gsub('ssAzure + "', '"#{ssAzure}')
|
163
|
-
.gsub('" + arcSize + "', '#{arcSize}')
|
164
|
-
.gsub('//', '#')
|
165
|
-
.gsub(' ', ' ')
|
166
|
-
.gsub(', #', '')
|
167
|
-
.strip
|
168
|
-
.gsub(/,$/, '')
|
169
|
-
.strip
|
170
|
-
end
|
171
|
-
|
172
|
-
def kill_line(line)
|
173
|
-
line.end_with?('NA') ||
|
174
|
-
line.end_with?('not working properly, needs specific code)') ||
|
175
|
-
line.start_with?('Timeline shapes are postponed, this code is a work-in-progress') ||
|
176
|
-
line.start_with?('# *******') ||
|
177
|
-
line.start_with?('# 2019 mapping') ||
|
178
|
-
line.include?('# "') ||
|
179
|
-
line.include?('# "') ||
|
180
|
-
line.empty?
|
181
|
-
end
|
182
|
-
|
183
|
-
def set_section(line)
|
184
|
-
section = line.gsub('#', '').strip
|
185
|
-
@current_section = {
|
186
|
-
name: section,
|
187
|
-
shapes: []
|
188
|
-
}
|
189
|
-
@sections << current_section
|
190
|
-
end
|
191
|
-
|
192
|
-
def build_json
|
193
|
-
JSON.pretty_generate(@sections)
|
194
|
-
end
|
195
|
-
end
|
@@ -1,41 +0,0 @@
|
|
1
|
-
KManager.action :transform_drawio_js do
|
2
|
-
|
3
|
-
action do
|
4
|
-
director = DrawioDsl::Drawio
|
5
|
-
.init(k_builder, on_exist: :write, on_action: :execute)
|
6
|
-
.diagram(theme: :style_10)
|
7
|
-
|
8
|
-
ext = DrawioDsl::DrawioExtensions.new
|
9
|
-
ext.build_extensions
|
10
|
-
puts ext.sections.length
|
11
|
-
|
12
|
-
ext.sections.select { |s| s[:active] }.each do |section|
|
13
|
-
director.page(section[:name]) do
|
14
|
-
grid_layout(wrap_at: 5)
|
15
|
-
puts section[:name]
|
16
|
-
puts section[:shapes]
|
17
|
-
section[:shapes].select { |s| s[:active] }.each do |shape|
|
18
|
-
square(title: shape[:name], style_modifiers: shape[:style])
|
19
|
-
log.kv(:title, shape[:name])
|
20
|
-
log.kv(:style, shape[:style])
|
21
|
-
end
|
22
|
-
end
|
23
|
-
end
|
24
|
-
director
|
25
|
-
.cd(:spec)
|
26
|
-
.save('.samples/20-extensions.drawio')
|
27
|
-
.cd(:docs)
|
28
|
-
|
29
|
-
markdown = "# Extensions\n\n"
|
30
|
-
|
31
|
-
director.builder.diagram.pages.each_with_index do |page, index|
|
32
|
-
page_no = index+1
|
33
|
-
puts "Page #{page_no}, #{page.name}"
|
34
|
-
# director.export_svg("extensions/#{page.name}", page: page_no)
|
35
|
-
markdown += "## #{page.name}\n\n\n\n"
|
36
|
-
end
|
37
|
-
|
38
|
-
director
|
39
|
-
.add('extensions.md', content: markdown)
|
40
|
-
end
|
41
|
-
end
|