k_manager 0.0.30 → 0.0.32
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.builders/_.rb +1 -0
- data/.builders/boot.rb +66 -0
- data/.builders/generators/01-bootstrap.rb +90 -0
- data/.builders/generators/02-draw-chart.rb +37 -0
- data/.builders/graph/test.drawio +202 -0
- data/.builders/graph/xmen.drawio +10 -0
- data/.builders/graph/xmen.txt +10 -0
- data/.rubocop.yml +7 -1
- data/Gemfile +1 -0
- data/docs/flow.drawio +1 -16
- data/docs/shapes +75 -0
- data/k_manager.gemspec +2 -0
- data/lib/k_manager/manager.rb +4 -0
- data/lib/k_manager/overview/dashboard.rb +19 -0
- data/lib/k_manager/overview/models.rb +1 -0
- data/lib/k_manager/overview/queries.rb +1 -0
- data/lib/k_manager/resources/base_resource.rb +35 -10
- data/lib/k_manager/resources/resource_manager.rb +33 -0
- data/lib/k_manager/version.rb +1 -1
- data/lib/k_manager.rb +4 -3
- metadata +24 -5
- data/lib/k_manager/document_import/build_tag.rb +0 -20
- data/lib/k_manager/document_import/extension.rb +0 -20
- data/lib/k_manager/document_import/importer.rb +0 -13
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e3058f62c501f797ee6ae5e970d0a0a59d333e3ebb290dc83c0b691fa33bc0c9
|
4
|
+
data.tar.gz: b63576b8b85f8b475dea7aa6ba7df77118393bfdd9908a14a3d760e2a004bd47
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c158cd92a983e7df6d184f336118e44171fa33250511a872fba764d243c6dcf24f110d90b1e96d86ebab534dfa2450087c18f9d4466aa39a9e1d7958ee04d532
|
7
|
+
data.tar.gz: 28bd874b203cdf3d71bbcfbb029a465bad51ec71e355f42af85a50ca2e9c1366260b422b94df9f2e453db65aee90c3945d59c0db69697ef93fe91979f9f2274a
|
data/.builders/_.rb
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
# require_relative './path/here'
|
data/.builders/boot.rb
ADDED
@@ -0,0 +1,66 @@
|
|
1
|
+
# Boot Sequence
|
2
|
+
|
3
|
+
include KLog::Logging
|
4
|
+
|
5
|
+
CONFIG_KEY = :k_manager
|
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(:builder , builder_folder)
|
53
|
+
config.target_folders.add(:graph , builder_folder, 'graph')
|
54
|
+
end
|
55
|
+
|
56
|
+
KConfig.configuration(CONFIG_KEY).debug
|
57
|
+
|
58
|
+
area = KManager.add_area(CONFIG_KEY)
|
59
|
+
resource_manager = area.resource_manager
|
60
|
+
resource_manager
|
61
|
+
.fileset
|
62
|
+
.glob('*.rb', exclude: ['boot.rb'])
|
63
|
+
.glob('generators/**/*.rb')
|
64
|
+
resource_manager.add_resources
|
65
|
+
|
66
|
+
KManager.boot
|
@@ -0,0 +1,90 @@
|
|
1
|
+
KManager.action :bootstrap do
|
2
|
+
action do
|
3
|
+
application_name = :k_manager
|
4
|
+
|
5
|
+
director = KDirector::Dsls::BasicDsl
|
6
|
+
.init(k_builder,
|
7
|
+
on_exist: :skip, # %i[skip write compare]
|
8
|
+
on_action: :queue # %i[queue execute]
|
9
|
+
)
|
10
|
+
.data(
|
11
|
+
application: application_name,
|
12
|
+
application_description: 'Add draw-io graph support',
|
13
|
+
author: 'David Cruwys',
|
14
|
+
author_email: 'david@ideasmen.com.au',
|
15
|
+
initial_semver: '1.0.0',
|
16
|
+
main_story: '',
|
17
|
+
copyright_date: '2022'
|
18
|
+
)
|
19
|
+
.github(
|
20
|
+
active: false,
|
21
|
+
repo_name: application_name
|
22
|
+
) do
|
23
|
+
create_repository
|
24
|
+
# delete_repository
|
25
|
+
# list_repositories
|
26
|
+
open_repository
|
27
|
+
# run_command('git init')
|
28
|
+
end
|
29
|
+
.blueprint(
|
30
|
+
active: false,
|
31
|
+
name: :bin_hook,
|
32
|
+
description: 'initialize repository',
|
33
|
+
on_exist: :write) do
|
34
|
+
|
35
|
+
cd(:app)
|
36
|
+
|
37
|
+
run_command('git init')
|
38
|
+
add('.gitignore')
|
39
|
+
|
40
|
+
run_template_script('.git-setup.sh', dom: dom)
|
41
|
+
|
42
|
+
run_command("git add .; git commit -m 'chore: #{self.options.description.downcase}'; git push")
|
43
|
+
run_command("gh repo edit -d \"#{dom[:application_description]}\"")
|
44
|
+
end
|
45
|
+
.package_json(
|
46
|
+
active: false,
|
47
|
+
name: :package_json,
|
48
|
+
description: 'Set up the package.json file for semantic versioning'
|
49
|
+
) do
|
50
|
+
self
|
51
|
+
.add('package.json', dom: dom)
|
52
|
+
.play_actions
|
53
|
+
|
54
|
+
# self
|
55
|
+
# .add_script('xxx', 'xxx')
|
56
|
+
# .sort
|
57
|
+
# .development
|
58
|
+
# .npm_add_group('xxx')
|
59
|
+
|
60
|
+
# run_command("git add .; git commit -m 'chore: #{self.options.description.downcase}'; git push")
|
61
|
+
end
|
62
|
+
.blueprint(
|
63
|
+
active: false,
|
64
|
+
name: :opinionated,
|
65
|
+
description: 'opinionated files',
|
66
|
+
on_exist: :write) do
|
67
|
+
|
68
|
+
cd(:app)
|
69
|
+
|
70
|
+
add('README.md' , dom: dom)
|
71
|
+
|
72
|
+
# add('index.html', dom: dom)
|
73
|
+
# add('main.css' , dom: dom)
|
74
|
+
# add('main.js' , dom: dom)
|
75
|
+
|
76
|
+
# run_command("git add .; git commit -m 'chore: #{self.options.description.downcase}'; git push")
|
77
|
+
end
|
78
|
+
|
79
|
+
director.play_actions
|
80
|
+
end
|
81
|
+
end
|
82
|
+
|
83
|
+
KManager.opts.app_name = 'k_manager'
|
84
|
+
KManager.opts.sleep = 2
|
85
|
+
KManager.opts.reboot_on_kill = 0
|
86
|
+
KManager.opts.reboot_sleep = 4
|
87
|
+
KManager.opts.exception_style = :short
|
88
|
+
KManager.opts.show.time_taken = true
|
89
|
+
KManager.opts.show.finished = true
|
90
|
+
KManager.opts.show.finished_message = 'FINISHED :)'
|
@@ -0,0 +1,37 @@
|
|
1
|
+
KManager.action :bootstrap do
|
2
|
+
action do
|
3
|
+
director = KDirector::Dsls::BasicDsl
|
4
|
+
.init(k_builder,
|
5
|
+
template_base_folder: 'drawio',
|
6
|
+
on_exist: :skip, # %i[skip write compare]
|
7
|
+
on_action: :queue # %i[queue execute]
|
8
|
+
)
|
9
|
+
.data(
|
10
|
+
)
|
11
|
+
.blueprint(
|
12
|
+
active: true,
|
13
|
+
name: :build_graph,
|
14
|
+
description: 'build a graph',
|
15
|
+
on_exist: :write) do
|
16
|
+
|
17
|
+
cd(:graph)
|
18
|
+
|
19
|
+
debug
|
20
|
+
add('xmen.txt', template_file: 'main.drawio')
|
21
|
+
add('xmen.drawio', template_file: 'main.drawio')
|
22
|
+
oadd('test.drawio', template_file: 'main.drawio')
|
23
|
+
|
24
|
+
end
|
25
|
+
|
26
|
+
director.play_actions
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
KManager.opts.app_name = 'k_manager'
|
31
|
+
KManager.opts.sleep = 2
|
32
|
+
KManager.opts.reboot_on_kill = 0
|
33
|
+
KManager.opts.reboot_sleep = 4
|
34
|
+
KManager.opts.exception_style = :short
|
35
|
+
KManager.opts.show.time_taken = true
|
36
|
+
KManager.opts.show.finished = true
|
37
|
+
KManager.opts.show.finished_message = 'FINISHED :)'
|
@@ -0,0 +1,202 @@
|
|
1
|
+
<mxfile host="65bd71144e">
|
2
|
+
<diagram id="Sk36w1yPGO5rhA4B0xN7" name="Page-1">
|
3
|
+
<mxGraphModel dx="926" dy="583" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="1169" pageHeight="827" math="0" shadow="0">
|
4
|
+
<root>
|
5
|
+
<mxCell id="0"/>
|
6
|
+
<mxCell id="1" parent="0"/>
|
7
|
+
<mxCell id="3" value="" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
|
8
|
+
<mxGeometry x="40" y="40" width="120" height="60" as="geometry"/>
|
9
|
+
</mxCell>
|
10
|
+
<mxCell id="4" value="" style="rounded=1;whiteSpace=wrap;html=1;" vertex="1" parent="1">
|
11
|
+
<mxGeometry x="40" y="120" width="120" height="60" as="geometry"/>
|
12
|
+
</mxCell>
|
13
|
+
<mxCell id="EIdmhRiufcmdx8XjM1u1-19" value="" style="ellipse;whiteSpace=wrap;html=1;" vertex="1" parent="1">
|
14
|
+
<mxGeometry x="40" y="210" width="120" height="80" as="geometry"/>
|
15
|
+
</mxCell>
|
16
|
+
<mxCell id="EIdmhRiufcmdx8XjM1u1-20" value="" style="whiteSpace=wrap;html=1;aspect=fixed;" vertex="1" parent="1">
|
17
|
+
<mxGeometry x="40" y="320" width="80" height="80" as="geometry"/>
|
18
|
+
</mxCell>
|
19
|
+
<mxCell id="EIdmhRiufcmdx8XjM1u1-21" value="" style="ellipse;whiteSpace=wrap;html=1;aspect=fixed;" vertex="1" parent="1">
|
20
|
+
<mxGeometry x="40" y="440" width="80" height="80" as="geometry"/>
|
21
|
+
</mxCell>
|
22
|
+
<mxCell id="EIdmhRiufcmdx8XjM1u1-22" value="" style="rhombus;whiteSpace=wrap;html=1;" vertex="1" parent="1">
|
23
|
+
<mxGeometry x="40" y="560" width="80" height="80" as="geometry"/>
|
24
|
+
</mxCell>
|
25
|
+
<mxCell id="EIdmhRiufcmdx8XjM1u1-23" value="" style="shape=parallelogram;perimeter=parallelogramPerimeter;whiteSpace=wrap;html=1;fixedSize=1;" vertex="1" parent="1">
|
26
|
+
<mxGeometry x="40" y="670" width="120" height="60" as="geometry"/>
|
27
|
+
</mxCell>
|
28
|
+
<mxCell id="EIdmhRiufcmdx8XjM1u1-24" value="" style="shape=hexagon;perimeter=hexagonPerimeter2;whiteSpace=wrap;html=1;fixedSize=1;" vertex="1" parent="1">
|
29
|
+
<mxGeometry x="240" y="40" width="120" height="80" as="geometry"/>
|
30
|
+
</mxCell>
|
31
|
+
<mxCell id="EIdmhRiufcmdx8XjM1u1-25" value="" style="triangle;whiteSpace=wrap;html=1;" vertex="1" parent="1">
|
32
|
+
<mxGeometry x="240" y="150" width="60" height="80" as="geometry"/>
|
33
|
+
</mxCell>
|
34
|
+
<mxCell id="EIdmhRiufcmdx8XjM1u1-26" value="" style="shape=cylinder3;whiteSpace=wrap;html=1;boundedLbl=1;backgroundOutline=1;size=15;" vertex="1" parent="1">
|
35
|
+
<mxGeometry x="240" y="280" width="60" height="80" as="geometry"/>
|
36
|
+
</mxCell>
|
37
|
+
<mxCell id="EIdmhRiufcmdx8XjM1u1-27" value="" style="ellipse;shape=cloud;whiteSpace=wrap;html=1;" vertex="1" parent="1">
|
38
|
+
<mxGeometry x="240" y="420" width="120" height="80" as="geometry"/>
|
39
|
+
</mxCell>
|
40
|
+
<mxCell id="EIdmhRiufcmdx8XjM1u1-28" value="" style="shape=document;whiteSpace=wrap;html=1;boundedLbl=1;" vertex="1" parent="1">
|
41
|
+
<mxGeometry x="240" y="540" width="120" height="80" as="geometry"/>
|
42
|
+
</mxCell>
|
43
|
+
<mxCell id="EIdmhRiufcmdx8XjM1u1-29" value="" style="shape=internalStorage;whiteSpace=wrap;html=1;backgroundOutline=1;" vertex="1" parent="1">
|
44
|
+
<mxGeometry x="240" y="670" width="80" height="80" as="geometry"/>
|
45
|
+
</mxCell>
|
46
|
+
<mxCell id="EIdmhRiufcmdx8XjM1u1-30" value="" style="shape=cube;whiteSpace=wrap;html=1;boundedLbl=1;backgroundOutline=1;darkOpacity=0.05;darkOpacity2=0.1;" vertex="1" parent="1">
|
47
|
+
<mxGeometry x="430" y="140" width="120" height="80" as="geometry"/>
|
48
|
+
</mxCell>
|
49
|
+
<mxCell id="EIdmhRiufcmdx8XjM1u1-31" value="" style="shape=process;whiteSpace=wrap;html=1;backgroundOutline=1;" vertex="1" parent="1">
|
50
|
+
<mxGeometry x="430" y="40" width="120" height="60" as="geometry"/>
|
51
|
+
</mxCell>
|
52
|
+
<mxCell id="EIdmhRiufcmdx8XjM1u1-32" value="" style="shape=step;perimeter=stepPerimeter;whiteSpace=wrap;html=1;fixedSize=1;" vertex="1" parent="1">
|
53
|
+
<mxGeometry x="430" y="270" width="120" height="80" as="geometry"/>
|
54
|
+
</mxCell>
|
55
|
+
<mxCell id="EIdmhRiufcmdx8XjM1u1-33" value="" style="shape=trapezoid;perimeter=trapezoidPerimeter;whiteSpace=wrap;html=1;fixedSize=1;" vertex="1" parent="1">
|
56
|
+
<mxGeometry x="430" y="390" width="120" height="60" as="geometry"/>
|
57
|
+
</mxCell>
|
58
|
+
<mxCell id="EIdmhRiufcmdx8XjM1u1-34" value="" style="shape=tape;whiteSpace=wrap;html=1;" vertex="1" parent="1">
|
59
|
+
<mxGeometry x="430" y="490" width="120" height="100" as="geometry"/>
|
60
|
+
</mxCell>
|
61
|
+
<mxCell id="EIdmhRiufcmdx8XjM1u1-35" value="" style="shape=note;whiteSpace=wrap;html=1;backgroundOutline=1;darkOpacity=0.05;" vertex="1" parent="1">
|
62
|
+
<mxGeometry x="430" y="620" width="80" height="100" as="geometry"/>
|
63
|
+
</mxCell>
|
64
|
+
<mxCell id="EIdmhRiufcmdx8XjM1u1-36" value="" style="shape=card;whiteSpace=wrap;html=1;" vertex="1" parent="1">
|
65
|
+
<mxGeometry x="610" y="40" width="80" height="100" as="geometry"/>
|
66
|
+
</mxCell>
|
67
|
+
<mxCell id="EIdmhRiufcmdx8XjM1u1-37" value="" style="shape=callout;whiteSpace=wrap;html=1;perimeter=calloutPerimeter;" vertex="1" parent="1">
|
68
|
+
<mxGeometry x="610" y="180" width="120" height="80" as="geometry"/>
|
69
|
+
</mxCell>
|
70
|
+
<mxCell id="EIdmhRiufcmdx8XjM1u1-38" value="Actor" style="shape=umlActor;verticalLabelPosition=bottom;verticalAlign=top;html=1;outlineConnect=0;" vertex="1" parent="1">
|
71
|
+
<mxGeometry x="610" y="300" width="30" height="60" as="geometry"/>
|
72
|
+
</mxCell>
|
73
|
+
<mxCell id="EIdmhRiufcmdx8XjM1u1-39" value="Vertical Container" style="swimlane;" vertex="1" parent="1">
|
74
|
+
<mxGeometry x="600" y="414" width="200" height="200" as="geometry"/>
|
75
|
+
</mxCell>
|
76
|
+
<mxCell id="EIdmhRiufcmdx8XjM1u1-40" value="Horizontal Container" style="swimlane;horizontal=0;" vertex="1" parent="1">
|
77
|
+
<mxGeometry x="600" y="640" width="200" height="200" as="geometry"/>
|
78
|
+
</mxCell>
|
79
|
+
<mxCell id="EIdmhRiufcmdx8XjM1u1-41" value="List" style="swimlane;fontStyle=0;childLayout=stackLayout;horizontal=1;startSize=30;horizontalStack=0;resizeParent=1;resizeParentMax=0;resizeLast=0;collapsible=1;marginBottom=0;" vertex="1" parent="1">
|
80
|
+
<mxGeometry x="30" y="850" width="140" height="120" as="geometry"/>
|
81
|
+
</mxCell>
|
82
|
+
<mxCell id="EIdmhRiufcmdx8XjM1u1-42" value="Item 1" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;spacingLeft=4;spacingRight=4;overflow=hidden;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;rotatable=0;" vertex="1" parent="EIdmhRiufcmdx8XjM1u1-41">
|
83
|
+
<mxGeometry y="30" width="140" height="30" as="geometry"/>
|
84
|
+
</mxCell>
|
85
|
+
<mxCell id="EIdmhRiufcmdx8XjM1u1-43" value="Item 2" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;spacingLeft=4;spacingRight=4;overflow=hidden;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;rotatable=0;" vertex="1" parent="EIdmhRiufcmdx8XjM1u1-41">
|
86
|
+
<mxGeometry y="60" width="140" height="30" as="geometry"/>
|
87
|
+
</mxCell>
|
88
|
+
<mxCell id="EIdmhRiufcmdx8XjM1u1-44" value="Item 3" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;spacingLeft=4;spacingRight=4;overflow=hidden;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;rotatable=0;" vertex="1" parent="EIdmhRiufcmdx8XjM1u1-41">
|
89
|
+
<mxGeometry y="90" width="140" height="30" as="geometry"/>
|
90
|
+
</mxCell>
|
91
|
+
<mxCell id="EIdmhRiufcmdx8XjM1u1-45" value="List Item" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;spacingLeft=4;spacingRight=4;overflow=hidden;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;rotatable=0;" vertex="1" parent="1">
|
92
|
+
<mxGeometry x="210" y="850" width="80" height="30" as="geometry"/>
|
93
|
+
</mxCell>
|
94
|
+
<mxCell id="EIdmhRiufcmdx8XjM1u1-46" value="" style="curved=1;endArrow=classic;html=1;" edge="1" parent="1">
|
95
|
+
<mxGeometry width="50" height="50" relative="1" as="geometry">
|
96
|
+
<mxPoint x="330" y="900" as="sourcePoint"/>
|
97
|
+
<mxPoint x="380" y="850" as="targetPoint"/>
|
98
|
+
<Array as="points">
|
99
|
+
<mxPoint x="380" y="900"/>
|
100
|
+
<mxPoint x="330" y="850"/>
|
101
|
+
</Array>
|
102
|
+
</mxGeometry>
|
103
|
+
</mxCell>
|
104
|
+
<mxCell id="EIdmhRiufcmdx8XjM1u1-47" value="" style="shape=flexArrow;endArrow=classic;startArrow=classic;html=1;" edge="1" parent="1">
|
105
|
+
<mxGeometry width="100" height="100" relative="1" as="geometry">
|
106
|
+
<mxPoint x="460" y="910" as="sourcePoint"/>
|
107
|
+
<mxPoint x="510" y="850" as="targetPoint"/>
|
108
|
+
</mxGeometry>
|
109
|
+
</mxCell>
|
110
|
+
<mxCell id="EIdmhRiufcmdx8XjM1u1-48" value="" style="shape=flexArrow;endArrow=classic;html=1;" edge="1" parent="1">
|
111
|
+
<mxGeometry width="50" height="50" relative="1" as="geometry">
|
112
|
+
<mxPoint x="560" y="900" as="sourcePoint"/>
|
113
|
+
<mxPoint x="610" y="850" as="targetPoint"/>
|
114
|
+
</mxGeometry>
|
115
|
+
</mxCell>
|
116
|
+
<mxCell id="EIdmhRiufcmdx8XjM1u1-49" value="" style="endArrow=none;dashed=1;html=1;" edge="1" parent="1">
|
117
|
+
<mxGeometry width="50" height="50" relative="1" as="geometry">
|
118
|
+
<mxPoint x="660" y="910" as="sourcePoint"/>
|
119
|
+
<mxPoint x="710" y="860" as="targetPoint"/>
|
120
|
+
</mxGeometry>
|
121
|
+
</mxCell>
|
122
|
+
<mxCell id="EIdmhRiufcmdx8XjM1u1-50" value="" style="endArrow=none;dashed=1;html=1;dashPattern=1 3;strokeWidth=2;" edge="1" parent="1">
|
123
|
+
<mxGeometry width="50" height="50" relative="1" as="geometry">
|
124
|
+
<mxPoint x="760" y="910" as="sourcePoint"/>
|
125
|
+
<mxPoint x="810" y="860" as="targetPoint"/>
|
126
|
+
</mxGeometry>
|
127
|
+
</mxCell>
|
128
|
+
<mxCell id="EIdmhRiufcmdx8XjM1u1-51" value="" style="endArrow=none;html=1;" edge="1" parent="1">
|
129
|
+
<mxGeometry width="50" height="50" relative="1" as="geometry">
|
130
|
+
<mxPoint x="220" y="970" as="sourcePoint"/>
|
131
|
+
<mxPoint x="270" y="920" as="targetPoint"/>
|
132
|
+
</mxGeometry>
|
133
|
+
</mxCell>
|
134
|
+
<mxCell id="EIdmhRiufcmdx8XjM1u1-52" value="" style="endArrow=classic;startArrow=classic;html=1;" edge="1" parent="1">
|
135
|
+
<mxGeometry width="50" height="50" relative="1" as="geometry">
|
136
|
+
<mxPoint x="320" y="970" as="sourcePoint"/>
|
137
|
+
<mxPoint x="370" y="920" as="targetPoint"/>
|
138
|
+
</mxGeometry>
|
139
|
+
</mxCell>
|
140
|
+
<mxCell id="EIdmhRiufcmdx8XjM1u1-53" value="" style="endArrow=classic;html=1;" edge="1" parent="1">
|
141
|
+
<mxGeometry width="50" height="50" relative="1" as="geometry">
|
142
|
+
<mxPoint x="420" y="970" as="sourcePoint"/>
|
143
|
+
<mxPoint x="470" y="920" as="targetPoint"/>
|
144
|
+
</mxGeometry>
|
145
|
+
</mxCell>
|
146
|
+
<mxCell id="EIdmhRiufcmdx8XjM1u1-54" value="" style="shape=link;html=1;" edge="1" parent="1">
|
147
|
+
<mxGeometry width="100" relative="1" as="geometry">
|
148
|
+
<mxPoint x="30" y="1030" as="sourcePoint"/>
|
149
|
+
<mxPoint x="130" y="1030" as="targetPoint"/>
|
150
|
+
</mxGeometry>
|
151
|
+
</mxCell>
|
152
|
+
<mxCell id="EIdmhRiufcmdx8XjM1u1-55" value="" style="endArrow=classic;html=1;" edge="1" parent="1">
|
153
|
+
<mxGeometry relative="1" as="geometry">
|
154
|
+
<mxPoint x="190" y="1030" as="sourcePoint"/>
|
155
|
+
<mxPoint x="290" y="1030" as="targetPoint"/>
|
156
|
+
</mxGeometry>
|
157
|
+
</mxCell>
|
158
|
+
<mxCell id="EIdmhRiufcmdx8XjM1u1-56" value="Label" style="edgeLabel;resizable=0;html=1;align=center;verticalAlign=middle;" connectable="0" vertex="1" parent="EIdmhRiufcmdx8XjM1u1-55">
|
159
|
+
<mxGeometry relative="1" as="geometry"/>
|
160
|
+
</mxCell>
|
161
|
+
<mxCell id="EIdmhRiufcmdx8XjM1u1-57" value="" style="endArrow=classic;html=1;" edge="1" parent="1">
|
162
|
+
<mxGeometry relative="1" as="geometry">
|
163
|
+
<mxPoint x="340" y="1030" as="sourcePoint"/>
|
164
|
+
<mxPoint x="500" y="1030" as="targetPoint"/>
|
165
|
+
</mxGeometry>
|
166
|
+
</mxCell>
|
167
|
+
<mxCell id="EIdmhRiufcmdx8XjM1u1-58" value="Label" style="edgeLabel;resizable=0;html=1;align=center;verticalAlign=middle;" connectable="0" vertex="1" parent="EIdmhRiufcmdx8XjM1u1-57">
|
168
|
+
<mxGeometry relative="1" as="geometry"/>
|
169
|
+
</mxCell>
|
170
|
+
<mxCell id="EIdmhRiufcmdx8XjM1u1-59" value="Source" style="edgeLabel;resizable=0;html=1;align=left;verticalAlign=bottom;" connectable="0" vertex="1" parent="EIdmhRiufcmdx8XjM1u1-57">
|
171
|
+
<mxGeometry x="-1" relative="1" as="geometry"/>
|
172
|
+
</mxCell>
|
173
|
+
<mxCell id="EIdmhRiufcmdx8XjM1u1-60" value="" style="endArrow=classic;html=1;" edge="1" parent="1">
|
174
|
+
<mxGeometry relative="1" as="geometry">
|
175
|
+
<mxPoint x="560" y="1030" as="sourcePoint"/>
|
176
|
+
<mxPoint x="720" y="1030" as="targetPoint"/>
|
177
|
+
</mxGeometry>
|
178
|
+
</mxCell>
|
179
|
+
<mxCell id="EIdmhRiufcmdx8XjM1u1-61" value="Label" style="edgeLabel;resizable=0;html=1;align=center;verticalAlign=middle;" connectable="0" vertex="1" parent="EIdmhRiufcmdx8XjM1u1-60">
|
180
|
+
<mxGeometry relative="1" as="geometry"/>
|
181
|
+
</mxCell>
|
182
|
+
<mxCell id="EIdmhRiufcmdx8XjM1u1-62" value="Source" style="edgeLabel;resizable=0;html=1;align=left;verticalAlign=bottom;" connectable="0" vertex="1" parent="EIdmhRiufcmdx8XjM1u1-60">
|
183
|
+
<mxGeometry x="-1" relative="1" as="geometry"/>
|
184
|
+
</mxCell>
|
185
|
+
<mxCell id="EIdmhRiufcmdx8XjM1u1-63" value="Target" style="edgeLabel;resizable=0;html=1;align=right;verticalAlign=bottom;" connectable="0" vertex="1" parent="EIdmhRiufcmdx8XjM1u1-60">
|
186
|
+
<mxGeometry x="1" relative="1" as="geometry"/>
|
187
|
+
</mxCell>
|
188
|
+
<mxCell id="EIdmhRiufcmdx8XjM1u1-64" value="" style="endArrow=classic;html=1;" edge="1" parent="1">
|
189
|
+
<mxGeometry relative="1" as="geometry">
|
190
|
+
<mxPoint x="570" y="1070" as="sourcePoint"/>
|
191
|
+
<mxPoint x="670" y="1070" as="targetPoint"/>
|
192
|
+
</mxGeometry>
|
193
|
+
</mxCell>
|
194
|
+
<mxCell id="EIdmhRiufcmdx8XjM1u1-65" value="" style="shape=message;html=1;outlineConnect=0;" vertex="1" parent="EIdmhRiufcmdx8XjM1u1-64">
|
195
|
+
<mxGeometry width="20" height="14" relative="1" as="geometry">
|
196
|
+
<mxPoint x="-10" y="-7" as="offset"/>
|
197
|
+
</mxGeometry>
|
198
|
+
</mxCell>
|
199
|
+
</root>
|
200
|
+
</mxGraphModel>
|
201
|
+
</diagram>
|
202
|
+
</mxfile>
|
@@ -0,0 +1,10 @@
|
|
1
|
+
<mxfile host="65bd71144e">
|
2
|
+
<diagram id="Sk36w1yPGO5rhA4B0xN7" name="Page-1">
|
3
|
+
<mxGraphModel dx="416" dy="572" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="1169" pageHeight="827" math="0" shadow="0">
|
4
|
+
<root>
|
5
|
+
<mxCell id="0"/>
|
6
|
+
<mxCell id="1" parent="0"/>
|
7
|
+
</root>
|
8
|
+
</mxGraphModel>
|
9
|
+
</diagram>
|
10
|
+
</mxfile>
|
@@ -0,0 +1,10 @@
|
|
1
|
+
<mxfile host="65bd71144e">
|
2
|
+
<diagram id="Sk36w1yPGO5rhA4B0xN7" name="Page-1">
|
3
|
+
<mxGraphModel dx="416" dy="572" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="1169" pageHeight="827" math="0" shadow="0">
|
4
|
+
<root>
|
5
|
+
<mxCell id="0"/>
|
6
|
+
<mxCell id="1" parent="0"/>
|
7
|
+
</root>
|
8
|
+
</mxGraphModel>
|
9
|
+
</diagram>
|
10
|
+
</mxfile>
|
data/.rubocop.yml
CHANGED
@@ -1,4 +1,8 @@
|
|
1
1
|
require: rubocop-rake
|
2
|
+
inherit_mode:
|
3
|
+
merge:
|
4
|
+
- Exclude # see: https://stackoverflow.com/a/70818366/473923
|
5
|
+
- AllowedNames
|
2
6
|
AllCops:
|
3
7
|
TargetRubyVersion: 2.5
|
4
8
|
DisplayCopNames: true
|
@@ -8,7 +12,6 @@ AllCops:
|
|
8
12
|
- "_/**/*"
|
9
13
|
- "spec/samples/**/*"
|
10
14
|
- "spec/k_manager/scenarios/**/*"
|
11
|
-
|
12
15
|
Metrics/BlockLength:
|
13
16
|
Exclude:
|
14
17
|
- "**/spec/**/*"
|
@@ -64,6 +67,9 @@ Naming/MemoizedInstanceVariableName:
|
|
64
67
|
Naming/VariableNumber:
|
65
68
|
Exclude:
|
66
69
|
- "**/spec/**/*"
|
70
|
+
Naming/MethodParameterName:
|
71
|
+
AllowedNames:
|
72
|
+
- as
|
67
73
|
Style/EmptyMethod:
|
68
74
|
Exclude:
|
69
75
|
- "**/spec/**/*"
|
data/Gemfile
CHANGED
@@ -32,6 +32,7 @@ if ENV['KLUE_LOCAL_GEMS']&.to_s&.downcase == 'true'
|
|
32
32
|
gem 'k_builder' , path: '../k_builder'
|
33
33
|
gem 'k_builder-dotnet' , path: '../k_builder-dotnet'
|
34
34
|
# gem 'k_builder-package_json' , path: '../k_builder-package_json'
|
35
|
+
gem 'drawio_dsl' , path: '../drawio_dsl'
|
35
36
|
gem 'k_builder-webpack5' , path: '../k_builder-webpack5'
|
36
37
|
gem 'k_config' , path: '../k_config'
|
37
38
|
gem 'k_decor' , path: '../k_decor'
|
data/docs/flow.drawio
CHANGED
@@ -1,16 +1 @@
|
|
1
|
-
<mxfile host="
|
2
|
-
<diagram id="AE9tsI4e_FXgj975v7li" name="Page-1">
|
3
|
-
<mxGraphModel dx="1087" dy="583" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="1169" pageHeight="827" background="#ffffff" math="0" shadow="0">
|
4
|
-
<root>
|
5
|
-
<mxCell id="0"/>
|
6
|
-
<mxCell id="1" parent="0"/>
|
7
|
-
<mxCell id="2" value="KManager" style="rounded=1;whiteSpace=wrap;html=1;" vertex="1" parent="1">
|
8
|
-
<mxGeometry x="200" y="70" width="120" height="60" as="geometry"/>
|
9
|
-
</mxCell>
|
10
|
-
<mxCell id="3" value="" style="rounded=1;whiteSpace=wrap;html=1;" vertex="1" parent="1">
|
11
|
-
<mxGeometry x="390" y="210" width="120" height="60" as="geometry"/>
|
12
|
-
</mxCell>
|
13
|
-
</root>
|
14
|
-
</mxGraphModel>
|
15
|
-
</diagram>
|
16
|
-
</mxfile>
|
1
|
+
<mxfile host="Electron" modified="2022-03-15T20:30:15.594Z" agent="5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) draw.io/16.5.1 Chrome/96.0.4664.110 Electron/16.0.7 Safari/537.36" version="16.5.1" etag="y7uUaI553n6FR_Tt1bNI" type="device"><diagram id="iz_p9EhzHe2lvTp9jl-W" name="Page-1">5VfbcpswEP0aP6YDEmD8mDrX3qadTCdt3xRYQLaMGCHbkK+vAGFucpq2TqYzxQ9mz2p1OWclLTO83BTXgmTJRx4CmyErLGb4YoaQbVue+quQskEWi3kDxIKGulEH3NFH0KCl0S0NIR80lJwzSbMhGPA0hUAOMCIE3w+bRZwNR81IDBPgLiBsit7TUCbturxF57gBGid6aB/p9T2QYB0Lvk31eDOEo/pp3BvS9qUXmick5PsehC9neCk4l83bplgCq7htaWviro54D/MWkMrnBDy+P7sqpFVE/vm7tZvdfvnhbM+0eLksWz4gVPRoM+Wp+ntbLxKqbixlcSETHvOUsA+cZwq0FbgCKUstLtlKrqBEbpj2QkHltyr8zdzV5vee66LQXddGqQ3FV1Z1FzEoziuhFRZRxpaccVHPFYcE/Cio2krB19DzeIEPD5HyNOurFnWUNg3lfCsC3QrpRCQiBvkEfc5BR7U/gG9AilLFCWBE0t1wSKITNT6068RSL1ovs3Z6PjvCttBm20i3oUj7hEq4y0i9oL3auUNB8jXIINHGiNTIrX5GUutHR7Q5knNWzfJtxFPZa9s8jYxN2tsHNQzk70BIKHrQlFTt9fR20seNo819t3fRQmNJb9vaLfg3MljFqkw+WSt7Z4v8+iu9dVdekwNPa6N6UccZPEOXPlkTkSaUj4RTj++bhMMeXuDwNPz7aCgAmgpgz00CeC8lgP+vCKBuBD/EJgEQdhz3RALYzkiA+VQB3yCA/1L8L/4v/p0x/97r8T89ay7ITjmRda+6RdYNCJiQ316katWEMWA8FmSjuMhAUDUDEGPf587xK70iWkBb1J3ogHfxkF8bG04YZCD4FAeM8ZZ3X7lIQv0i6VAXGYskRbMomyi3NQ+lVWV0YbXVxv1ZWXS8BhrWSuiVyqKn5nOyWulI/hrIOprSyB0VLYZLE1mmS9P9/ZxWZvdRUft6X2748ic=</diagram></mxfile>
|
data/docs/shapes
ADDED
@@ -0,0 +1,75 @@
|
|
1
|
+
tableLine
|
2
|
+
table
|
3
|
+
tableRow
|
4
|
+
cube
|
5
|
+
isoRectangle
|
6
|
+
waypoint
|
7
|
+
isoRectangle
|
8
|
+
isoCube
|
9
|
+
datastore
|
10
|
+
note
|
11
|
+
note2
|
12
|
+
isoCube2
|
13
|
+
cylinder2
|
14
|
+
cylinder3
|
15
|
+
switch
|
16
|
+
folder
|
17
|
+
umlState
|
18
|
+
card
|
19
|
+
tape
|
20
|
+
document
|
21
|
+
parallelogram
|
22
|
+
trapezoid
|
23
|
+
curlyBracket
|
24
|
+
parallelMarker
|
25
|
+
process
|
26
|
+
process2
|
27
|
+
transparent
|
28
|
+
callout
|
29
|
+
step
|
30
|
+
hexagon
|
31
|
+
plus
|
32
|
+
ext
|
33
|
+
message
|
34
|
+
umlActor
|
35
|
+
umlBoundary
|
36
|
+
umlEntity
|
37
|
+
umlDestroy
|
38
|
+
umlControl
|
39
|
+
umlLifeline
|
40
|
+
umlFrame
|
41
|
+
lollipop
|
42
|
+
requires
|
43
|
+
requiredInterface
|
44
|
+
providedRequiredInterface
|
45
|
+
module
|
46
|
+
component
|
47
|
+
associativeEntity
|
48
|
+
endState
|
49
|
+
startState
|
50
|
+
link
|
51
|
+
flexArrow
|
52
|
+
manualInput
|
53
|
+
internalStorage
|
54
|
+
corner
|
55
|
+
crossbar
|
56
|
+
tee
|
57
|
+
singleArrow
|
58
|
+
doubleArrow
|
59
|
+
dataStorage
|
60
|
+
or
|
61
|
+
xor
|
62
|
+
loopLimit
|
63
|
+
offPageConnector
|
64
|
+
tapeData
|
65
|
+
orEllipse
|
66
|
+
sumEllipse
|
67
|
+
sortShape
|
68
|
+
collate
|
69
|
+
dimension
|
70
|
+
partialRectangle
|
71
|
+
lineEllipse
|
72
|
+
delay
|
73
|
+
cross
|
74
|
+
display
|
75
|
+
filledEdge
|
data/k_manager.gemspec
CHANGED
@@ -38,6 +38,7 @@ Gem::Specification.new do |spec|
|
|
38
38
|
spec.require_paths = ['lib']
|
39
39
|
# spec.extensions = ['ext/k_manager/extconf.rb']
|
40
40
|
|
41
|
+
spec.add_dependency 'drawio_dsl', '~> 0.1'
|
41
42
|
spec.add_dependency 'dry-struct', '~> 1'
|
42
43
|
spec.add_dependency 'filewatcher', '~> 2.0.0.beta5'
|
43
44
|
spec.add_dependency 'k_builder', '~> 0.0.0'
|
@@ -47,6 +48,7 @@ Gem::Specification.new do |spec|
|
|
47
48
|
spec.add_dependency 'k_ext-github', '~> 0.0.0'
|
48
49
|
spec.add_dependency 'k_fileset', '~> 0.0.0'
|
49
50
|
spec.add_dependency 'k_log', '~> 0.0.0'
|
51
|
+
|
50
52
|
# spec.add_dependency 'k_type' , '~> 0.0.0'
|
51
53
|
# spec.add_dependency 'k_util' , '~> 0.0.0'
|
52
54
|
spec.add_dependency 'dry-cli', '~> 0.7.0'
|
data/lib/k_manager/manager.rb
CHANGED
@@ -5,6 +5,10 @@ module KManager
|
|
5
5
|
# Generate dashboard information on the console
|
6
6
|
#
|
7
7
|
# TODO: ConsoleDashboard and HtmlConsole
|
8
|
+
# dashboard = KManager::Overview::Dashboard.new(KManager.manager)
|
9
|
+
# dashboard.areas
|
10
|
+
# dashboard.resources
|
11
|
+
# dashboard.documents
|
8
12
|
class Dashboard
|
9
13
|
include KLog::Logging
|
10
14
|
|
@@ -83,6 +87,7 @@ module KManager
|
|
83
87
|
# # { path: { display_method: -> (row) { row.resource_path } } },
|
84
88
|
# { exist: { display_method: -> (row) { row.resource_exist } } },
|
85
89
|
{ document_id: { display_method: ->(row) { blank_zero(row.document_id) } } },
|
90
|
+
{ state: { display_method: ->(row) { document_state(row.document_state) } } },
|
86
91
|
{ data: { display_method: ->(row) { row.document_data } } },
|
87
92
|
{ error_count: { display_method: ->(row) { blank_zero(row.document_errors.length) } } },
|
88
93
|
{ key: { display_method: ->(row) { row.document_key } } },
|
@@ -134,6 +139,20 @@ module KManager
|
|
134
139
|
value
|
135
140
|
end
|
136
141
|
|
142
|
+
# Valid states are:
|
143
|
+
# :new
|
144
|
+
# :evaluated
|
145
|
+
# :initialized
|
146
|
+
# :children_evaluated
|
147
|
+
# :actioned
|
148
|
+
def document_state(state)
|
149
|
+
return 'unknown' if state.nil?
|
150
|
+
return 'loaded (partially)' if state == :evaluated # probably has unmet dependency
|
151
|
+
return 'loaded' if state == :children_evaluated
|
152
|
+
|
153
|
+
state.to_s
|
154
|
+
end
|
155
|
+
|
137
156
|
def lpad(size, value)
|
138
157
|
value.to_s.rjust(size)
|
139
158
|
end
|
@@ -62,6 +62,7 @@ module KManager
|
|
62
62
|
attribute :resource_relative_path , Types::Strict::String.optional.default(nil)
|
63
63
|
attribute :resource_exist? , Types::Strict::Bool
|
64
64
|
attribute :document_id , Types::Strict::Integer
|
65
|
+
attribute :document_state , Types::Strict::String | Types::Strict::Symbol
|
65
66
|
attribute :document_data , Types::Strict::Any.optional.default # Hash.optional.default(nil) | Types::Strict::Array.of(Types::Strict::Hash).optional.default(nil)
|
66
67
|
attribute :document_key , Types::Strict::String | Types::Strict::Symbol
|
67
68
|
attribute :document_namespace , Types::Strict::String | Types::Strict::Symbol |
|
@@ -35,6 +35,7 @@ module KManager
|
|
35
35
|
**area.attribute_values('area_'),
|
36
36
|
**resource.attribute_values('resource_'),
|
37
37
|
document_id: document.object_id,
|
38
|
+
document_state: document.block_state,
|
38
39
|
document_data: document.data,
|
39
40
|
document_key: document.key,
|
40
41
|
document_namespace: document.namespace,
|
@@ -25,7 +25,7 @@ module KManager
|
|
25
25
|
include KLog::Logging
|
26
26
|
include KDoc::Guarded
|
27
27
|
|
28
|
-
ACTIONS = %i[load_content register_document load_document].freeze
|
28
|
+
ACTIONS = %i[load_content register_document preload_document load_document].freeze
|
29
29
|
|
30
30
|
class << self
|
31
31
|
def valid_action?(action)
|
@@ -42,6 +42,8 @@ module KManager
|
|
42
42
|
# - :content_loaded
|
43
43
|
# - :documents_registering
|
44
44
|
# - :documents_registered
|
45
|
+
# - :documents_preloading
|
46
|
+
# - :documents_preloaded
|
45
47
|
# - :documents_loading
|
46
48
|
# - :documents_loaded
|
47
49
|
attr_reader :status
|
@@ -102,9 +104,9 @@ module KManager
|
|
102
104
|
end
|
103
105
|
|
104
106
|
# TODO: Is this really needed?
|
105
|
-
def document
|
106
|
-
|
107
|
-
end
|
107
|
+
# def document
|
108
|
+
# @document ||= documents&.first
|
109
|
+
# end
|
108
110
|
|
109
111
|
def activated?
|
110
112
|
# log.section_heading("Am I activated?")
|
@@ -120,7 +122,8 @@ module KManager
|
|
120
122
|
# @param [Symbol] action what action is to be fired
|
121
123
|
# - :load_content for loading text content
|
122
124
|
# - :register_document for registering 1 or more documents (name and namespace) against the resource
|
123
|
-
# - :
|
125
|
+
# - :preload_document for parsing the content into a document
|
126
|
+
# - :load_document for finalizing the document load with met dependencies and action execution if applicable
|
124
127
|
# rubocop:disable Metrics/CyclomaticComplexity
|
125
128
|
def fire_action(action)
|
126
129
|
# TODO: Write test for valid
|
@@ -131,20 +134,25 @@ module KManager
|
|
131
134
|
load_content_action if alive?
|
132
135
|
when :register_document
|
133
136
|
register_document_action if content_loaded?
|
137
|
+
when :preload_document
|
138
|
+
preload_document_action if documents_registered?
|
134
139
|
when :load_document
|
135
|
-
load_document_action if
|
140
|
+
load_document_action if documents_preloaded?
|
136
141
|
else
|
137
142
|
log.warn "Action: '#{action}' is invalid for status: '#{status}'"
|
138
143
|
end
|
139
144
|
end
|
140
145
|
# rubocop:enable Metrics/CyclomaticComplexity
|
141
146
|
|
147
|
+
# I don't think this is needed, it is never really used
|
142
148
|
def fire_next_action
|
143
149
|
if alive?
|
144
150
|
fire_action(:load_content)
|
145
151
|
elsif content_loaded?
|
146
152
|
fire_action(:register_document)
|
147
153
|
elsif documents_registered?
|
154
|
+
fire_action(:preload_document)
|
155
|
+
elsif documents_preloaded?
|
148
156
|
fire_action(:load_document)
|
149
157
|
end
|
150
158
|
end
|
@@ -162,13 +170,22 @@ module KManager
|
|
162
170
|
end
|
163
171
|
|
164
172
|
def register_document
|
165
|
-
# log.warn 'you need to implement register_document'
|
166
173
|
KManager::Resources::ResourceDocumentFactory.create_documents(self)
|
167
174
|
end
|
168
175
|
|
176
|
+
# rubocop:disable Lint/RescueException
|
177
|
+
def preload_document
|
178
|
+
documents.each(&:execute_block)
|
179
|
+
rescue Exception => e
|
180
|
+
guard(e.message)
|
181
|
+
debug
|
182
|
+
log.exception(e, style: KManager.opts.exception_style)
|
183
|
+
# log.exception(e, style: :short)
|
184
|
+
end
|
185
|
+
# rubocop:enable Lint/RescueException
|
186
|
+
|
169
187
|
# rubocop:disable Lint/RescueException
|
170
188
|
def load_document
|
171
|
-
# log.warn 'you need to implement register_document'
|
172
189
|
documents.each do |document|
|
173
190
|
document.execute_block(run_actions: activated?)
|
174
191
|
end
|
@@ -240,6 +257,10 @@ module KManager
|
|
240
257
|
@status == :documents_registered
|
241
258
|
end
|
242
259
|
|
260
|
+
def documents_preloaded?
|
261
|
+
@status == :documents_preloaded
|
262
|
+
end
|
263
|
+
|
243
264
|
def documents_loaded?
|
244
265
|
@status == :documents_loaded
|
245
266
|
end
|
@@ -318,14 +339,18 @@ module KManager
|
|
318
339
|
def register_document_action
|
319
340
|
@status = :documents_registering
|
320
341
|
register_document
|
321
|
-
# document_factory.create_documents
|
322
342
|
@status = :documents_registered
|
323
343
|
end
|
324
344
|
|
345
|
+
def preload_document_action
|
346
|
+
@status = :documents_preloading
|
347
|
+
preload_document
|
348
|
+
@status = :documents_preloaded
|
349
|
+
end
|
350
|
+
|
325
351
|
def load_document_action
|
326
352
|
@status = :documents_loading
|
327
353
|
load_document
|
328
|
-
# document_factory.parse_content
|
329
354
|
@status = :documents_loaded
|
330
355
|
end
|
331
356
|
end
|
@@ -93,8 +93,13 @@ module KManager
|
|
93
93
|
replace_resource = resource.recreate(resource)
|
94
94
|
replace_resource.fire_action(:load_content)
|
95
95
|
replace_resource.fire_action(:register_document)
|
96
|
+
replace_resource.fire_action(:preload_document)
|
96
97
|
replace_resource.fire_action(:load_document)
|
97
98
|
resource_set.replace(replace_resource)
|
99
|
+
|
100
|
+
# This is a bit of a hack, but it works for now
|
101
|
+
# TODO: I don't think is actually working.
|
102
|
+
attach_dependencies
|
98
103
|
end
|
99
104
|
|
100
105
|
def delete_resource(resource_uri)
|
@@ -146,6 +151,7 @@ module KManager
|
|
146
151
|
|
147
152
|
load_content if actions.include?(:load_content)
|
148
153
|
register_documents if actions.include?(:register_document)
|
154
|
+
preload_documents if actions.include?(:preload_document)
|
149
155
|
load_documents if actions.include?(:load_document)
|
150
156
|
end
|
151
157
|
|
@@ -167,18 +173,45 @@ module KManager
|
|
167
173
|
end
|
168
174
|
end
|
169
175
|
|
176
|
+
def preload_documents
|
177
|
+
# first pass will attempt to load every document, if a document has dependencies
|
178
|
+
# it will be loaded in a second pass after dependencies are available
|
179
|
+
resources.each do |resource|
|
180
|
+
resource.fire_action(:preload_document)
|
181
|
+
end
|
182
|
+
|
183
|
+
attach_dependencies
|
184
|
+
end
|
185
|
+
|
170
186
|
def load_documents
|
187
|
+
# second pass will finalize any documents that were partially load due to dependencies
|
171
188
|
resources.each do |resource|
|
172
189
|
resource.fire_action(:load_document)
|
173
190
|
end
|
174
191
|
end
|
175
192
|
|
193
|
+
def find_document(tag)
|
194
|
+
resources.flat_map(&:documents).find { |d| d.tag == tag }
|
195
|
+
end
|
196
|
+
|
176
197
|
def debug
|
177
198
|
resources.each(&:debug)
|
199
|
+
nil
|
178
200
|
end
|
179
201
|
|
180
202
|
private
|
181
203
|
|
204
|
+
def attach_dependencies
|
205
|
+
documents_with_unmet_dependencies = resources.flat_map(&:documents).reject(&:dependencies_met?)
|
206
|
+
|
207
|
+
documents_with_unmet_dependencies.each do |document|
|
208
|
+
document.depend_on_tags.each do |tag|
|
209
|
+
dependant_document = find_document(tag)
|
210
|
+
document.resolve_dependency(dependant_document) if dependant_document
|
211
|
+
end
|
212
|
+
end
|
213
|
+
end
|
214
|
+
|
182
215
|
def parse_uri(uri)
|
183
216
|
return uri if uri.is_a?(URI)
|
184
217
|
return URI.parse(uri) if uri =~ URI::ABS_URI # https://stackoverflow.com/questions/1805761/how-to-check-if-a-url-is-valid
|
data/lib/k_manager/version.rb
CHANGED
data/lib/k_manager.rb
CHANGED
@@ -11,6 +11,7 @@ require 'k_director'
|
|
11
11
|
require 'k_fileset'
|
12
12
|
require 'k_builder'
|
13
13
|
require 'k_ext/github'
|
14
|
+
require 'drawio_dsl'
|
14
15
|
|
15
16
|
# IS THIS NEEDED? this was used for infer_key
|
16
17
|
require 'handlebars/helpers/string_formatting/dasherize'
|
@@ -29,9 +30,6 @@ require 'k_manager/resources/mem_resource'
|
|
29
30
|
require 'k_manager/resources/resource_document_factory'
|
30
31
|
require 'k_manager/resources/resource_factory'
|
31
32
|
require 'k_manager/resources/resource_manager'
|
32
|
-
require 'k_manager/document_import/build_tag'
|
33
|
-
require 'k_manager/document_import/importer'
|
34
|
-
require 'k_manager/document_import/extension'
|
35
33
|
require 'k_manager/document_factory'
|
36
34
|
require 'k_manager/manager'
|
37
35
|
require 'k_manager/area'
|
@@ -104,10 +102,13 @@ module KManager
|
|
104
102
|
def_delegators :manager,
|
105
103
|
:opts,
|
106
104
|
:areas,
|
105
|
+
:area_resources,
|
106
|
+
:area_documents,
|
107
107
|
:add_area,
|
108
108
|
:find_document,
|
109
109
|
:fire_actions,
|
110
110
|
:resource_changed,
|
111
|
+
:boot,
|
111
112
|
:reboot,
|
112
113
|
:debug
|
113
114
|
|
metadata
CHANGED
@@ -1,15 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: k_manager
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.32
|
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-
|
11
|
+
date: 2022-04-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: drawio_dsl
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0.1'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0.1'
|
13
27
|
- !ruby/object:Gem::Dependency
|
14
28
|
name: dry-struct
|
15
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -159,6 +173,13 @@ executables:
|
|
159
173
|
extensions: []
|
160
174
|
extra_rdoc_files: []
|
161
175
|
files:
|
176
|
+
- ".builders/_.rb"
|
177
|
+
- ".builders/boot.rb"
|
178
|
+
- ".builders/generators/01-bootstrap.rb"
|
179
|
+
- ".builders/generators/02-draw-chart.rb"
|
180
|
+
- ".builders/graph/test.drawio"
|
181
|
+
- ".builders/graph/xmen.drawio"
|
182
|
+
- ".builders/graph/xmen.txt"
|
162
183
|
- ".github/workflows/main.yml"
|
163
184
|
- ".gitignore"
|
164
185
|
- ".rspec"
|
@@ -178,6 +199,7 @@ files:
|
|
178
199
|
- bin/khotfix
|
179
200
|
- bin/setup
|
180
201
|
- docs/flow.drawio
|
202
|
+
- docs/shapes
|
181
203
|
- exe/k_manager
|
182
204
|
- hooks/pre-commit
|
183
205
|
- hooks/update-version
|
@@ -191,9 +213,6 @@ files:
|
|
191
213
|
- lib/k_manager/cli/version.rb
|
192
214
|
- lib/k_manager/cli/watch.rb
|
193
215
|
- lib/k_manager/document_factory.rb
|
194
|
-
- lib/k_manager/document_import/build_tag.rb
|
195
|
-
- lib/k_manager/document_import/extension.rb
|
196
|
-
- lib/k_manager/document_import/importer.rb
|
197
216
|
- lib/k_manager/manager.rb
|
198
217
|
- lib/k_manager/overview/dashboard.rb
|
199
218
|
- lib/k_manager/overview/dump_json.rb
|
@@ -1,20 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module KManager
|
4
|
-
# Allow existing documents from KDoc and other sources to be imported using the resource manager
|
5
|
-
module DocumentImport
|
6
|
-
class BuildTag
|
7
|
-
include KDoc::Taggable
|
8
|
-
|
9
|
-
def initialize(key:, type: :container, namespace: nil)
|
10
|
-
opts = {
|
11
|
-
key: key,
|
12
|
-
type: type,
|
13
|
-
namespace: namespace
|
14
|
-
}
|
15
|
-
|
16
|
-
initialize_tag(opts)
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|
@@ -1,20 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module KManager
|
4
|
-
# Alow existing documents from KDoc and other sources to be imported using the resource manager
|
5
|
-
module DocumentImport
|
6
|
-
module Extension
|
7
|
-
include KLog::Logging
|
8
|
-
|
9
|
-
def import(tag)
|
10
|
-
# KManager.find_document(tag)
|
11
|
-
end
|
12
|
-
end
|
13
|
-
end
|
14
|
-
end
|
15
|
-
|
16
|
-
KDoc::Action.include(KManager::DocumentImport::Extension)
|
17
|
-
KDoc::Model.include(KManager::DocumentImport::Extension)
|
18
|
-
KDoc::CsvDoc.include(KManager::DocumentImport::Extension)
|
19
|
-
KDoc::JsonDoc.include(KManager::DocumentImport::Extension)
|
20
|
-
KDoc::YamlDoc.include(KManager::DocumentImport::Extension)
|
@@ -1,13 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module KManager
|
4
|
-
# Allow existing documents from KDoc and other sources to be imported using the resource manager
|
5
|
-
module DocumentImport
|
6
|
-
# Find a document by tag for importing
|
7
|
-
class Importer
|
8
|
-
def import(tag, area: nil)
|
9
|
-
KManager.find_document(tag, area: area)
|
10
|
-
end
|
11
|
-
end
|
12
|
-
end
|
13
|
-
end
|