handlebarsjs 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.builders/_.rb +1 -0
- data/.builders/boot.rb +68 -0
- data/.builders/generators/01-bootstrap.rb +130 -0
- data/.builders/generators/domain_model.rb +474 -0
- data/.builders/generators/project-plan.rb +41 -0
- data/.releaserc.json +40 -0
- data/.rspec +3 -0
- data/.rubocop.yml +89 -0
- data/CHANGELOG.md +5 -0
- data/CODE_OF_CONDUCT.md +74 -0
- data/Gemfile +21 -0
- data/Guardfile +30 -0
- data/LICENSE.txt +21 -0
- data/README.md +82 -0
- data/Rakefile +34 -0
- data/bin/console +16 -0
- data/bin/setup +11 -0
- data/docs/project-plan/project.drawio +41 -0
- data/docs/project-plan/project_in_progress.svg +3 -0
- data/lib/handlebarsjs/version.rb +5 -0
- data/lib/handlebarsjs.rb +17 -0
- data/package-lock.json +10637 -0
- data/package.json +14 -0
- data/sig/handlebarsjs.rbs +4 -0
- metadata +84 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: bf7edc4bc2b73dc650191c1ed0d5bed62247eee5dac4a11adaea49994e97cb37
|
4
|
+
data.tar.gz: 887e5647e54f683387dd1267828c3fcdb8137b3fb7d754d1370809bef7f42e25
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 3026da3fd166235e97eb4a7679b1173be9cba49300b02f925cca8dbe360799f1f5612e5c4060b96d1611ae1a322e6dea693524b8eedd54075e96f507dda7e8fd
|
7
|
+
data.tar.gz: 3a36a4a7e0d39e8e7e430b119a109077478e5ef43c623e8b6ba359c8a851205aa76668343063aea57620e378bd79580e920efd7c6ffcdfd83758b04bea1da1dc
|
data/.builders/_.rb
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
# require_relative './path/here'
|
data/.builders/boot.rb
ADDED
@@ -0,0 +1,68 @@
|
|
1
|
+
# Boot Sequence
|
2
|
+
|
3
|
+
include KLog::Logging
|
4
|
+
|
5
|
+
CONFIG_KEY = :handlebarsjs
|
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
|
+
config.template_folders.add(:global_template , global_template)
|
49
|
+
config.template_folders.add(:template , File.expand_path('.templates', Dir.pwd))
|
50
|
+
|
51
|
+
config.target_folders.add(:app , base_folder)
|
52
|
+
config.target_folders.add(:lib , :app, 'lib', 'drawio_dsl')
|
53
|
+
config.target_folders.add(:spec , :app, 'spec', 'drawio_dsl')
|
54
|
+
config.target_folders.add(:docs , :app, 'docs')
|
55
|
+
config.target_folders.add(:builder , builder_folder)
|
56
|
+
end
|
57
|
+
|
58
|
+
KConfig.configuration(CONFIG_KEY).debug
|
59
|
+
|
60
|
+
area = KManager.add_area(CONFIG_KEY)
|
61
|
+
resource_manager = area.resource_manager
|
62
|
+
resource_manager
|
63
|
+
.fileset
|
64
|
+
.glob('*.rb', exclude: ['boot.rb'])
|
65
|
+
.glob('generators/**/*.rb')
|
66
|
+
resource_manager.add_resources
|
67
|
+
|
68
|
+
KManager.boot
|
@@ -0,0 +1,130 @@
|
|
1
|
+
KManager.action :bootstrap do
|
2
|
+
action do
|
3
|
+
application_name = :handlebarsjs
|
4
|
+
director = KDirector::Dsls::RubyGemDsl
|
5
|
+
.init(k_builder,
|
6
|
+
on_exist: :skip, # %i[skip write compare]
|
7
|
+
on_action: :queue # %i[queue execute]
|
8
|
+
)
|
9
|
+
.data(
|
10
|
+
ruby_version: '2.7',
|
11
|
+
application: application_name,
|
12
|
+
application_description: 'handlebarsjs GEM wraps the handlebars.js library and provides ruby/javascript interoperability',
|
13
|
+
application_lib_path: application_name.to_s,
|
14
|
+
application_lib_namespace: 'Handlebarsjs',
|
15
|
+
namespaces: ['Handlebarsjs'],
|
16
|
+
author: 'David Cruwys',
|
17
|
+
author_email: 'david@ideasmen.com.au',
|
18
|
+
initial_semver: '0.0.1',
|
19
|
+
main_story: 'As a Ruby Developer, I want to use handlebarsjs from my ruby applications, so that I can easily access javascript templating',
|
20
|
+
copyright_date: '2022',
|
21
|
+
website: 'http://appydave.com/gems/handlebarsjs'
|
22
|
+
)
|
23
|
+
.github(
|
24
|
+
active: false,
|
25
|
+
repo_name: application_name
|
26
|
+
) do
|
27
|
+
create_repository
|
28
|
+
# delete_repository
|
29
|
+
# list_repositories
|
30
|
+
open_repository
|
31
|
+
# run_command('git init')
|
32
|
+
end
|
33
|
+
.blueprint(
|
34
|
+
active: false,
|
35
|
+
name: :bin_hook,
|
36
|
+
description: 'initialize repository',
|
37
|
+
on_exist: :write) do
|
38
|
+
|
39
|
+
cd(:app)
|
40
|
+
|
41
|
+
run_template_script('bin/runonce/git-setup.sh', dom: dom)
|
42
|
+
|
43
|
+
add('.githooks/commit-msg').run_command('chmod +x .githooks/commit-msg')
|
44
|
+
add('.githooks/pre-commit').run_command('chmod +x .githooks/pre-commit')
|
45
|
+
|
46
|
+
add('.gitignore')
|
47
|
+
|
48
|
+
run_command('git config core.hooksPath .githooks') # enable sharable githooks (developer needs to turn this on before editing rep)
|
49
|
+
|
50
|
+
run_command("git add .; git commit -m 'chore: #{self.options.description.downcase}'; git push")
|
51
|
+
run_command("gh repo edit -d \"#{dom[:application_description]}\"")
|
52
|
+
end
|
53
|
+
.package_json(
|
54
|
+
active: false,
|
55
|
+
name: :package_json,
|
56
|
+
description: 'Set up the package.json file for semantic versioning'
|
57
|
+
) do
|
58
|
+
self
|
59
|
+
.add('package.json', dom: dom)
|
60
|
+
.play_actions
|
61
|
+
|
62
|
+
self
|
63
|
+
.add_script('release', 'semantic-release')
|
64
|
+
.sort
|
65
|
+
.development
|
66
|
+
.npm_add_group('semver-ruby')
|
67
|
+
|
68
|
+
run_command("git add .; git commit -m 'chore: #{self.options.description.downcase}'; git push")
|
69
|
+
end
|
70
|
+
.blueprint(
|
71
|
+
active: false,
|
72
|
+
name: :opinionated,
|
73
|
+
description: 'opinionated GEM files',
|
74
|
+
on_exist: :write) do
|
75
|
+
|
76
|
+
cd(:app)
|
77
|
+
|
78
|
+
add('bin/setup')
|
79
|
+
add('bin/console')
|
80
|
+
|
81
|
+
add("lib/#{typed_dom.application}.rb" , template_file: 'lib/applet_name.rb' , dom: dom)
|
82
|
+
add("lib/#{typed_dom.application}/version.rb" , template_file: 'lib/applet_name/version.rb' , dom: dom)
|
83
|
+
|
84
|
+
add('spec/spec_helper.rb')
|
85
|
+
add("spec/#{typed_dom.application}_spec.rb" , template_file: 'spec/applet_name_spec.rb', dom: dom)
|
86
|
+
|
87
|
+
add("#{typed_dom.application}.gemspec" , template_file: 'applet_name.gemspec', dom: dom)
|
88
|
+
add('Gemfile', dom: dom)
|
89
|
+
add('Guardfile', dom: dom)
|
90
|
+
add('Rakefile', dom: dom)
|
91
|
+
add('.rspec', dom: dom)
|
92
|
+
add('.rubocop.yml', dom: dom)
|
93
|
+
add('README.md', dom: dom)
|
94
|
+
add('CODE_OF_CONDUCT.md', dom: dom)
|
95
|
+
add('LICENSE.txt', dom: dom)
|
96
|
+
|
97
|
+
run_command("rubocop -a")
|
98
|
+
|
99
|
+
run_command("git add .; git commit -m 'chore: #{self.options.description.downcase}'; git push")
|
100
|
+
end
|
101
|
+
.blueprint(
|
102
|
+
active: true,
|
103
|
+
name: :ci_cd,
|
104
|
+
description: 'github actions (CI/CD)',
|
105
|
+
on_exist: :write) do
|
106
|
+
|
107
|
+
cd(:app)
|
108
|
+
|
109
|
+
run_command("gh secret set SLACK_WEBHOOK --body \"$SLACK_REPO_WEBHOOK\"")
|
110
|
+
run_command("gh secret set GEM_HOST_API_KEY --body \"$GEM_HOST_API_KEY\"")
|
111
|
+
|
112
|
+
add('.github/workflows/main.yml')
|
113
|
+
add('.releaserc.json')
|
114
|
+
|
115
|
+
run_command("git add .; git commit -m 'chore: #{self.options.description.downcase}'; git push")
|
116
|
+
end
|
117
|
+
|
118
|
+
director.play_actions
|
119
|
+
# director.builder.logit
|
120
|
+
end
|
121
|
+
end
|
122
|
+
|
123
|
+
KManager.opts.app_name = 'handlebarsjs'
|
124
|
+
KManager.opts.sleep = 2
|
125
|
+
KManager.opts.reboot_on_kill = 0
|
126
|
+
KManager.opts.reboot_sleep = 4
|
127
|
+
KManager.opts.exception_style = :short
|
128
|
+
KManager.opts.show.time_taken = true
|
129
|
+
KManager.opts.show.finished = true
|
130
|
+
KManager.opts.show.finished_message = 'FINISHED :)'
|
@@ -0,0 +1,474 @@
|
|
1
|
+
KManager.action :domain_model do
|
2
|
+
action do
|
3
|
+
|
4
|
+
DrawioDsl::Drawio
|
5
|
+
.init(k_builder, on_exist: :write, on_action: :execute)
|
6
|
+
.diagram(theme: :style_04)
|
7
|
+
.page('Domain Modal', margin_left: 0, margin_top: 0, rounded: 0, background: '#fafafa') do
|
8
|
+
grid_layout(wrap_at: 6, grid_w: 180, grid_h: 180)
|
9
|
+
|
10
|
+
shape_element = :rectangle2 # hexagon, diamond, ellipse
|
11
|
+
shape_element_w = 75
|
12
|
+
shape_element_h = 50
|
13
|
+
shape_element_theme = :style_03
|
14
|
+
|
15
|
+
# need a blank
|
16
|
+
# square(fill_color: '#fafafa', stroke_color: '#fafafa', font_color: '#333333')
|
17
|
+
|
18
|
+
square(title: 'Configuration', theme: :style_01)
|
19
|
+
|
20
|
+
klass(description: '') do
|
21
|
+
format
|
22
|
+
.header('ShapeDefaults')
|
23
|
+
.field(:type, type: :symbol)
|
24
|
+
.field(:category, type: :symbol)
|
25
|
+
.field(:x, type: :integer)
|
26
|
+
.field(:y, type: :integer)
|
27
|
+
.field(:w, type: :integer)
|
28
|
+
.field(:h, type: :integer)
|
29
|
+
.field(:style_modifiers, type: :string)
|
30
|
+
end
|
31
|
+
|
32
|
+
klass(description: '') do
|
33
|
+
format
|
34
|
+
.header('ShapeThemeStyle')
|
35
|
+
.field(:theme, type: :symbol)
|
36
|
+
.field(:fill_color, type: :string)
|
37
|
+
.field(:stroke_color, type: :string)
|
38
|
+
.field(:font_color, type: :string)
|
39
|
+
end
|
40
|
+
|
41
|
+
klass(description: 'Configuration container for the DrawIO DSL') do
|
42
|
+
format
|
43
|
+
.header('Configuration')
|
44
|
+
.field(:base_style, type: :Struct)
|
45
|
+
.field(:shapes, type: 'Hash<Struct>')
|
46
|
+
.field(:themes, type: :Hash)
|
47
|
+
.method('+ <ConfigurationThemes>')
|
48
|
+
.method('+ <ConfigurationShapes>')
|
49
|
+
end
|
50
|
+
|
51
|
+
interface(description: 'Used to attach configuration to KConfig module', theme: :style_02) do
|
52
|
+
format
|
53
|
+
.header('ConfigurationExtension', interface_type: 'MixIn')
|
54
|
+
.field(:drawio, type: :Configuration)
|
55
|
+
end
|
56
|
+
|
57
|
+
interface(description: 'Attach predefined DrawIO shapes to KConfig module', theme: :style_02) do
|
58
|
+
format
|
59
|
+
.header('ConfigurationShapes', interface_type: 'MixIn')
|
60
|
+
.method(:add_shapes)
|
61
|
+
end
|
62
|
+
|
63
|
+
interface(description: 'Configuration for each theme', theme: :style_02) do
|
64
|
+
format
|
65
|
+
.header('ConfigurationThemes', interface_type: 'MixIn')
|
66
|
+
.method(:add_theme)
|
67
|
+
.method(:add_themes)
|
68
|
+
end
|
69
|
+
|
70
|
+
square(title: 'DOM Builder', theme: :style_01)
|
71
|
+
|
72
|
+
klass(description: 'Build Document object model to represent DrawioDsl output file.') do
|
73
|
+
format
|
74
|
+
.header('DomBuilder')
|
75
|
+
.field(:actions, type: :Array)
|
76
|
+
.field(:last_action, type: :Hash)
|
77
|
+
.field(:focus_node, type: :Anchor)
|
78
|
+
.field(:current_page, type: :Page)
|
79
|
+
.field(:dom)
|
80
|
+
.method(:reset)
|
81
|
+
.method(:queue_action)
|
82
|
+
.method(:set_diagram)
|
83
|
+
.method(:diagram)
|
84
|
+
.method(:add_page)
|
85
|
+
.method(:add_grid_layout)
|
86
|
+
.method(:add_flex_layout)
|
87
|
+
.method(:add_layout)
|
88
|
+
.method(:add_shape)
|
89
|
+
.method('+ <DomBuilderShapes>')
|
90
|
+
end
|
91
|
+
|
92
|
+
interface(description: 'Builder methods for each shape, line and text element to attach to DomBuilder.', theme: :style_02) do
|
93
|
+
format
|
94
|
+
.header('DomBuilderShapes', interface_type: 'MixIn')
|
95
|
+
.method('add_* (for each shape)')
|
96
|
+
end
|
97
|
+
|
98
|
+
square(title: 'DrawIO DSL', theme: :style_01)
|
99
|
+
|
100
|
+
klass(description: 'DSL for draw-io diagrams') do
|
101
|
+
format
|
102
|
+
.header('Drawio')
|
103
|
+
.method(:diagram)
|
104
|
+
.method(:page)
|
105
|
+
.method(:save)
|
106
|
+
.method(:osave)
|
107
|
+
.method(:export_svg)
|
108
|
+
.method(:export_png)
|
109
|
+
end
|
110
|
+
|
111
|
+
klass(description: 'DSL for draw-io diagrams') do
|
112
|
+
format
|
113
|
+
.header('DrawioPage')
|
114
|
+
.method(:grid_layout)
|
115
|
+
.method(:flex_layout)
|
116
|
+
.method('+ <DrawioShapes>')
|
117
|
+
end
|
118
|
+
|
119
|
+
interface(description: 'List of DSL methods for each common shape', theme: :style_02) do
|
120
|
+
format
|
121
|
+
.header('DrawioShapes', interface_type: 'MixIn')
|
122
|
+
.method(:random)
|
123
|
+
.method('* (for each shape)')
|
124
|
+
end
|
125
|
+
|
126
|
+
square(title: '1000 Extension Shapes', theme: :style_01)
|
127
|
+
|
128
|
+
klass(description: '1000s of extension shapes derived from Extensions.js that can be used via the add_shape method') do
|
129
|
+
format
|
130
|
+
.header('DrawioExtensions')
|
131
|
+
.field(:sections, type: :Array)
|
132
|
+
.field(:current_section, type: :Hash)
|
133
|
+
.method(:section)
|
134
|
+
.method(:shape)
|
135
|
+
.method(:to_h)
|
136
|
+
.method(:build_extensions)
|
137
|
+
.method(:configure_extensions)
|
138
|
+
.method('+ <DrawioExtensionsActive>')
|
139
|
+
end
|
140
|
+
|
141
|
+
interface(description: 'Mark shapes as active or not, based on incomplete style being made inactive', theme: :style_02) do
|
142
|
+
format
|
143
|
+
.header('DrawioExtensionsActive', interface_type: 'MixIn')
|
144
|
+
.method(:apply_active_flags)
|
145
|
+
.method(:check_if_active)
|
146
|
+
end
|
147
|
+
|
148
|
+
klass(description: 'Layout engine is responsible for laying out the elements on the page') do
|
149
|
+
format
|
150
|
+
.header('LayoutEngine')
|
151
|
+
.field(:page, type: :Page)
|
152
|
+
.field(:current_page, type: :Page)
|
153
|
+
.field(:current_layout, type: :Layout)
|
154
|
+
.method(:call)
|
155
|
+
.method(:traverse_node)
|
156
|
+
.method(:process_node)
|
157
|
+
end
|
158
|
+
|
159
|
+
klass(description: 'Build the DrawioDsl XML file that is the basis of any draw-io diagrams.') do
|
160
|
+
format
|
161
|
+
.header('XmlBuilder')
|
162
|
+
.field(:diagram)
|
163
|
+
.method(:build)
|
164
|
+
end
|
165
|
+
|
166
|
+
square(title: 'Formatters', theme: :style_01)
|
167
|
+
|
168
|
+
klass(description: 'HTML builder has methods for common HTML elements that get written sequentially') do
|
169
|
+
format
|
170
|
+
.header('HtmlBuilder')
|
171
|
+
.field(:element_style_defaults, type: :Hash)
|
172
|
+
.method(:default_for)
|
173
|
+
.method(:style_for)
|
174
|
+
.method(:empty?)
|
175
|
+
.method(:exist?)
|
176
|
+
.method(:as_html)
|
177
|
+
.method(:hr)
|
178
|
+
.method(:b)
|
179
|
+
.method(:p)
|
180
|
+
.method(:add_line)
|
181
|
+
.method(:add_placeholder)
|
182
|
+
.method(:group)
|
183
|
+
.method(:build_lines)
|
184
|
+
.method(:lines)
|
185
|
+
.method(:groups)
|
186
|
+
end
|
187
|
+
|
188
|
+
interface(description: 'Create an instance of a HTML formatter on the shape', theme: :style_02) do
|
189
|
+
format
|
190
|
+
.header('Factory', interface_type: 'MixIn')
|
191
|
+
.method(:formatter)
|
192
|
+
.method(:format_instance)
|
193
|
+
end
|
194
|
+
|
195
|
+
klass(description: 'Base for any HTML formatter') do
|
196
|
+
format
|
197
|
+
.header('BaseFormatter')
|
198
|
+
.field(:html, type: :String)
|
199
|
+
.method(:empty?)
|
200
|
+
.method(:as_html)
|
201
|
+
end
|
202
|
+
|
203
|
+
klass(description: 'Format the HTML to display an interface on a class diagram') do
|
204
|
+
format
|
205
|
+
.header('InterfaceFormatter')
|
206
|
+
.method(:header)
|
207
|
+
.method(:field)
|
208
|
+
.method(:method)
|
209
|
+
.method(:as_html)
|
210
|
+
end
|
211
|
+
|
212
|
+
klass(description: 'Format the HTML to display an class on a class diagram') do
|
213
|
+
format
|
214
|
+
.header('KlassFormatter')
|
215
|
+
.method(:header)
|
216
|
+
.method(:field)
|
217
|
+
.method(:method)
|
218
|
+
.method(:as_html)
|
219
|
+
end
|
220
|
+
|
221
|
+
klass(description: 'style_builder') do
|
222
|
+
format
|
223
|
+
.header('StyleBuilder')
|
224
|
+
.field(:defaults, type: :Hash)
|
225
|
+
.field(:custom, type: :Hash)
|
226
|
+
.method(:customize)
|
227
|
+
.method(:style)
|
228
|
+
.method(:style_attribute)
|
229
|
+
.method(:build)
|
230
|
+
end
|
231
|
+
|
232
|
+
square(title: 'Schema', theme: :style_01)
|
233
|
+
|
234
|
+
klass(description: 'Shape is a graphical element, it can be a shape, a text, or a group') do
|
235
|
+
format
|
236
|
+
.header('Shape')
|
237
|
+
.field(:category, type: :Symbol)
|
238
|
+
.field(:theme, type: :Symbol)
|
239
|
+
.field(:title, type: :String)
|
240
|
+
.field(:value, type: :String)
|
241
|
+
.field(:white_space, type: :int)
|
242
|
+
.field(:html, type: :int)
|
243
|
+
.field(:rounded, type: :int)
|
244
|
+
.field(:shadow, type: :int)
|
245
|
+
.field(:glass, type: :int)
|
246
|
+
.field(:sketch, type: :int)
|
247
|
+
.field(:fill_color, type: :String)
|
248
|
+
.field(:stroke_color, type: :String)
|
249
|
+
.field(:font_color, type: :String)
|
250
|
+
.field(:gradient, type: :String)
|
251
|
+
.field(:x, type: :int)
|
252
|
+
.field(:y, type: :int)
|
253
|
+
.field(:w, type: :int)
|
254
|
+
.field(:h, type: :int)
|
255
|
+
.field(:style_modifiers, type: :Hash)
|
256
|
+
.field(:source, type: 'Symbol (id)')
|
257
|
+
.field(:target, type: 'Symbol (id)')
|
258
|
+
.method('> configure_shape')
|
259
|
+
.method(:initialize)
|
260
|
+
.method(:shape_defaults)
|
261
|
+
.method(:apply_defaults)
|
262
|
+
.method(:format)
|
263
|
+
.method(:style)
|
264
|
+
.method(:as_xml)
|
265
|
+
.method(:draw_element)
|
266
|
+
.method(:draw_line)
|
267
|
+
.method(:to_h)
|
268
|
+
end
|
269
|
+
|
270
|
+
klass(description: 'common_style') do
|
271
|
+
format
|
272
|
+
.header('CommonStyle')
|
273
|
+
.field(:white_space, type: :int)
|
274
|
+
.field(:html, type: :int)
|
275
|
+
.field(:rounded, type: :int)
|
276
|
+
.field(:shadow, type: :int)
|
277
|
+
.field(:glass, type: :int)
|
278
|
+
.field(:sketch, type: :int)
|
279
|
+
.method(:to_h)
|
280
|
+
end
|
281
|
+
|
282
|
+
klass(description: 'default_palette') do
|
283
|
+
format
|
284
|
+
.header('DefaultPalette')
|
285
|
+
.field(:fill_color, type: :String)
|
286
|
+
.field(:stroke_color, type: :String)
|
287
|
+
.field(:font_color, type: :String)
|
288
|
+
.field(:gradient, type: :String)
|
289
|
+
.method(:to_h)
|
290
|
+
end
|
291
|
+
|
292
|
+
klass(description: 'diagram') do
|
293
|
+
format
|
294
|
+
.header('Diagram')
|
295
|
+
.field(:host, type: :String)
|
296
|
+
.field(:theme, type: :String)
|
297
|
+
.field(:style, type: :CommonStyle)
|
298
|
+
.field(:palette, type: :DefaultPalette)
|
299
|
+
.field(:pages, type: :Array)
|
300
|
+
.method(:to_h)
|
301
|
+
end
|
302
|
+
klass(description: 'node') do
|
303
|
+
format
|
304
|
+
.header('Node')
|
305
|
+
.field(:id, type: :String)
|
306
|
+
.field(:page, type: :Page)
|
307
|
+
.field(:parent, type: :Node)
|
308
|
+
.field(:classification, type: :String)
|
309
|
+
.field(:type, type: :String)
|
310
|
+
.field(:nodes, type: :Array)
|
311
|
+
.method(:initialize)
|
312
|
+
.method(:to_h)
|
313
|
+
.method(:root?)
|
314
|
+
.method(:add_node)
|
315
|
+
end
|
316
|
+
|
317
|
+
klass(description: 'node_list') do
|
318
|
+
format
|
319
|
+
.header('NodeList')
|
320
|
+
.field(:nodes, type: :Array)
|
321
|
+
.method(:add)
|
322
|
+
.method(:all)
|
323
|
+
.method(:shapes)
|
324
|
+
.method(:layouts)
|
325
|
+
.method(:length)
|
326
|
+
.method(:empty?)
|
327
|
+
.method(:any?)
|
328
|
+
.method(:first)
|
329
|
+
.method(:as_xml)
|
330
|
+
.method(:to_h)
|
331
|
+
end
|
332
|
+
|
333
|
+
klass(description: 'page') do
|
334
|
+
format
|
335
|
+
.header('Page')
|
336
|
+
.field(:diagram, type: :Diagram)
|
337
|
+
.field(:position_x, type: :int)
|
338
|
+
.field(:position_y, type: :int)
|
339
|
+
.field(:id, type: :String)
|
340
|
+
.field(:active, type: :bool)
|
341
|
+
.field(:name, type: :String)
|
342
|
+
.field(:theme, type: :Symbol)
|
343
|
+
.field(:style, type: :CommonStyle)
|
344
|
+
.field(:palette, type: :DefaultPalette)
|
345
|
+
.field(:margin_left, type: :int)
|
346
|
+
.field(:margin_top, type: :int)
|
347
|
+
.field(:nodes, type: :Array)
|
348
|
+
.field(:grid, type: :String)
|
349
|
+
.field(:grid_size, type: :int)
|
350
|
+
.field(:guides, type: :String)
|
351
|
+
.field(:tooltips, type: :String)
|
352
|
+
.field(:connect, type: :String)
|
353
|
+
.field(:arrows, type: :String)
|
354
|
+
.field(:fold, type: :String)
|
355
|
+
.field(:page_no, type: :String)
|
356
|
+
.field(:page_scale, type: :String)
|
357
|
+
.field(:page_width, type: :String)
|
358
|
+
.field(:page_height, type: :String)
|
359
|
+
.field(:background, type: :String)
|
360
|
+
.field(:page_shadow, type: :String)
|
361
|
+
.field(:math, type: :String)
|
362
|
+
.field(:active?, type: :Boolean)
|
363
|
+
.method(:add_node)
|
364
|
+
.method(:as_xml)
|
365
|
+
.method(:to_h)
|
366
|
+
.method(:settings)
|
367
|
+
end
|
368
|
+
|
369
|
+
square(title: 'Schema/Layouts', theme: :style_01)
|
370
|
+
|
371
|
+
klass(description: 'flex_layout') do
|
372
|
+
format
|
373
|
+
.header('FlexLayout')
|
374
|
+
.field(:direction, type: :String)
|
375
|
+
.field(:wrap_at, type: :int)
|
376
|
+
.field(:gap, type: :int)
|
377
|
+
.field(:perpendicular_max, type: :int)
|
378
|
+
.method(:position_shape)
|
379
|
+
.method(:to_h)
|
380
|
+
end
|
381
|
+
|
382
|
+
klass(description: 'grid_layout') do
|
383
|
+
format
|
384
|
+
.header('GridLayout')
|
385
|
+
.field(:direction, type: :String)
|
386
|
+
.field(:wrap_at, type: :int)
|
387
|
+
.field(:grid_size, type: :int)
|
388
|
+
.field(:grid_w, type: :int)
|
389
|
+
.field(:grid_h, type: :int)
|
390
|
+
.field(:cell_no, type: :int)
|
391
|
+
.field(:h_align, type: :String)
|
392
|
+
.field(:v_align, type: :String)
|
393
|
+
.method(:position_shape)
|
394
|
+
.method(:to_h)
|
395
|
+
end
|
396
|
+
|
397
|
+
klass(description: 'layout') do
|
398
|
+
format
|
399
|
+
.header('Layout')
|
400
|
+
.field(:anchor_x, type: :String)
|
401
|
+
.field(:anchor_y, type: :String)
|
402
|
+
.method(:fire_after_init)
|
403
|
+
.method(:after_init)
|
404
|
+
.method(:to_h)
|
405
|
+
end
|
406
|
+
|
407
|
+
|
408
|
+
square(title: 'Schema/virtual', theme: :style_01)
|
409
|
+
send(shape_element, title: 'anchor' , w: shape_element_w, h: shape_element_h, theme: shape_element_theme)
|
410
|
+
square(title: 'Schema/shapes', theme: :style_01)
|
411
|
+
|
412
|
+
grid_layout(wrap_at: 12, grid_w: 90, grid_h: 70)
|
413
|
+
|
414
|
+
send(shape_element, title: 'actor' , w: shape_element_w, h: shape_element_h, theme: shape_element_theme)
|
415
|
+
send(shape_element, title: 'actor2' , w: shape_element_w, h: shape_element_h, theme: shape_element_theme)
|
416
|
+
send(shape_element, title: 'callout' , w: shape_element_w, h: shape_element_h, theme: shape_element_theme)
|
417
|
+
send(shape_element, title: 'callout2' , w: shape_element_w, h: shape_element_h, theme: shape_element_theme)
|
418
|
+
send(shape_element, title: 'callout3' , w: shape_element_w, h: shape_element_h, theme: shape_element_theme)
|
419
|
+
send(shape_element, title: 'callout4' , w: shape_element_w, h: shape_element_h, theme: shape_element_theme)
|
420
|
+
send(shape_element, title: 'circle' , w: shape_element_w, h: shape_element_h, theme: shape_element_theme)
|
421
|
+
send(shape_element, title: 'cloud' , w: shape_element_w, h: shape_element_h, theme: shape_element_theme)
|
422
|
+
send(shape_element, title: 'container' , w: shape_element_w, h: shape_element_h, theme: shape_element_theme)
|
423
|
+
send(shape_element, title: 'container2' , w: shape_element_w, h: shape_element_h, theme: shape_element_theme)
|
424
|
+
send(shape_element, title: 'container3' , w: shape_element_w, h: shape_element_h, theme: shape_element_theme)
|
425
|
+
send(shape_element, title: 'container4' , w: shape_element_w, h: shape_element_h, theme: shape_element_theme)
|
426
|
+
send(shape_element, title: 'cross' , w: shape_element_w, h: shape_element_h, theme: shape_element_theme)
|
427
|
+
send(shape_element, title: 'database' , w: shape_element_w, h: shape_element_h, theme: shape_element_theme)
|
428
|
+
send(shape_element, title: 'db_json' , w: shape_element_w, h: shape_element_h, theme: shape_element_theme)
|
429
|
+
send(shape_element, title: 'diamond' , w: shape_element_w, h: shape_element_h, theme: shape_element_theme)
|
430
|
+
send(shape_element, title: 'document' , w: shape_element_w, h: shape_element_h, theme: shape_element_theme)
|
431
|
+
send(shape_element, title: 'ellipse' , w: shape_element_w, h: shape_element_h, theme: shape_element_theme)
|
432
|
+
send(shape_element, title: 'embed_col200' , w: shape_element_w, h: shape_element_h, theme: shape_element_theme)
|
433
|
+
send(shape_element, title: 'embed_col50' , w: shape_element_w, h: shape_element_h, theme: shape_element_theme)
|
434
|
+
send(shape_element, title: 'embed_row' , w: shape_element_w, h: shape_element_h, theme: shape_element_theme)
|
435
|
+
send(shape_element, title: 'envelop' , w: shape_element_w, h: shape_element_h, theme: shape_element_theme)
|
436
|
+
send(shape_element, title: 'face' , w: shape_element_w, h: shape_element_h, theme: shape_element_theme)
|
437
|
+
send(shape_element, title: 'h1' , w: shape_element_w, h: shape_element_h, theme: shape_element_theme)
|
438
|
+
send(shape_element, title: 'h2' , w: shape_element_w, h: shape_element_h, theme: shape_element_theme)
|
439
|
+
send(shape_element, title: 'h3' , w: shape_element_w, h: shape_element_h, theme: shape_element_theme)
|
440
|
+
send(shape_element, title: 'h4' , w: shape_element_w, h: shape_element_h, theme: shape_element_theme)
|
441
|
+
send(shape_element, title: 'h5' , w: shape_element_w, h: shape_element_h, theme: shape_element_theme)
|
442
|
+
send(shape_element, title: 'h6' , w: shape_element_w, h: shape_element_h, theme: shape_element_theme)
|
443
|
+
send(shape_element, title: 'hexagon' , w: shape_element_w, h: shape_element_h, theme: shape_element_theme)
|
444
|
+
send(shape_element, title: 'interface' , w: shape_element_w, h: shape_element_h, theme: shape_element_theme)
|
445
|
+
send(shape_element, title: 'klass' , w: shape_element_w, h: shape_element_h, theme: shape_element_theme)
|
446
|
+
send(shape_element, title: 'line' , w: shape_element_w, h: shape_element_h, theme: shape_element_theme)
|
447
|
+
send(shape_element, title: 'note' , w: shape_element_w, h: shape_element_h, theme: shape_element_theme)
|
448
|
+
send(shape_element, title: 'p' , w: shape_element_w, h: shape_element_h, theme: shape_element_theme)
|
449
|
+
send(shape_element, title: 'process' , w: shape_element_w, h: shape_element_h, theme: shape_element_theme)
|
450
|
+
send(shape_element, title: 'rectangle' , w: shape_element_w, h: shape_element_h, theme: shape_element_theme)
|
451
|
+
send(shape_element, title: 'rectangle2' , w: shape_element_w, h: shape_element_h, theme: shape_element_theme)
|
452
|
+
send(shape_element, title: 'shape' , w: shape_element_w, h: shape_element_h, theme: shape_element_theme)
|
453
|
+
send(shape_element, title: 'square' , w: shape_element_w, h: shape_element_h, theme: shape_element_theme)
|
454
|
+
send(shape_element, title: 'step' , w: shape_element_w, h: shape_element_h, theme: shape_element_theme)
|
455
|
+
send(shape_element, title: 'tick' , w: shape_element_w, h: shape_element_h, theme: shape_element_theme)
|
456
|
+
send(shape_element, title: 'todo' , w: shape_element_w, h: shape_element_h, theme: shape_element_theme)
|
457
|
+
send(shape_element, title: 'triangle' , w: shape_element_w, h: shape_element_h, theme: shape_element_theme)
|
458
|
+
|
459
|
+
end
|
460
|
+
.cd(:docs)
|
461
|
+
.osave('domain_model.drawio')
|
462
|
+
.save_json('domain_model')
|
463
|
+
.export_svg('domain_model', page: 1)
|
464
|
+
end
|
465
|
+
end
|
466
|
+
|
467
|
+
KManager.opts.app_name = 'domain_model'
|
468
|
+
KManager.opts.sleep = 2
|
469
|
+
KManager.opts.reboot_on_kill = 0
|
470
|
+
KManager.opts.reboot_sleep = 4
|
471
|
+
KManager.opts.exception_style = :short
|
472
|
+
KManager.opts.show.time_taken = true
|
473
|
+
KManager.opts.show.finished = true
|
474
|
+
KManager.opts.show.finished_message = 'FINISHED :)'
|