k_manager 0.0.13 → 0.0.22
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/.rubocop.yml +1 -0
- data/Gemfile +18 -0
- data/Rakefile +2 -0
- data/docs/flow.drawio +16 -0
- data/exe/k_manager +20 -0
- data/k_manager.gemspec +6 -0
- data/lib/k_manager/area.rb +47 -0
- data/lib/k_manager/document_factory.rb +74 -0
- data/lib/k_manager/manager.rb +58 -0
- data/lib/k_manager/overview/dashboard.rb +187 -0
- data/lib/k_manager/overview/dump_json.rb +35 -0
- data/lib/k_manager/overview/models.rb +76 -0
- data/lib/k_manager/overview/queries.rb +53 -0
- data/lib/k_manager/resources/base_resource.rb +189 -52
- data/lib/k_manager/resources/file_resource.rb +80 -58
- data/lib/k_manager/resources/{ruby_file_resource.rb → file_resources/ruby_file_resource.rb} +0 -0
- data/lib/k_manager/resources/{unknown_file_resource.rb → file_resources/unknown_file_resource.rb} +0 -0
- data/lib/k_manager/resources/mem_resource.rb +17 -0
- data/lib/k_manager/resources/resource_document_factory.rb +119 -0
- data/lib/k_manager/resources/resource_factory.rb +28 -0
- data/lib/k_manager/resources/resource_manager.rb +216 -0
- data/lib/k_manager/resources/resource_set.rb +90 -0
- data/lib/k_manager/resources/web_resource.rb +113 -0
- data/lib/k_manager/version.rb +1 -1
- data/lib/k_manager/watcher.rb +75 -0
- data/lib/k_manager/{x_project.rb → x_resource_documents/x_project.rb} +0 -0
- data/lib/k_manager/{x_project_manager.rb → x_resource_documents/x_project_manager.rb} +0 -0
- data/lib/k_manager/{x_register.rb → x_resource_documents/x_register.rb} +0 -0
- data/lib/k_manager.rb +93 -20
- data/tasks/watch.rake +113 -0
- metadata +70 -24
- data/Assessment1.md +0 -127
- data/Assessment2.md +0 -88
- data/lib/k_manager/create_document.rb +0 -31
- data/lib/k_manager/documents/basic_document.rb +0 -21
- data/lib/k_manager/documents/builder_document.rb +0 -18
- data/lib/k_manager/documents/document_taggable.rb +0 -94
- data/lib/k_manager/documents/model_document.rb +0 -19
- data/lib/k_manager/project.rb +0 -50
- data/lib/k_manager/resources/csv_file_resource.rb +0 -27
- data/lib/k_manager/resources/factories/document_factory.rb +0 -52
- data/lib/k_manager/resources/json_file_resource.rb +0 -22
- data/lib/k_manager/resources/yaml_file_resource.rb +0 -21
data/tasks/watch.rake
ADDED
@@ -0,0 +1,113 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'pry'
|
4
|
+
require 'k_manager'
|
5
|
+
# require 'filewatcher'
|
6
|
+
# require 'io/console'
|
7
|
+
|
8
|
+
namespace :k_manager do
|
9
|
+
desc 'Create CSV Files for Models'
|
10
|
+
task :watch do
|
11
|
+
target_folder = 'spec/k_manager/scenarios'
|
12
|
+
watch_folder = File.join(Dir.pwd, target_folder)
|
13
|
+
boot_file = File.join(watch_folder, 'simple/boot.rb')
|
14
|
+
|
15
|
+
watcher = Watcher.new(watch_folder, boot_file)
|
16
|
+
watcher.start
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
# require 'pry'
|
21
|
+
# require 'k_manager'
|
22
|
+
# require 'filewatcher'
|
23
|
+
# require 'io/console'
|
24
|
+
|
25
|
+
# class Watcher
|
26
|
+
# include KLog::Logging
|
27
|
+
|
28
|
+
# attr_reader :watch_folder
|
29
|
+
# attr_reader :boot_file
|
30
|
+
|
31
|
+
# def initialize(watch_folder, boot_file)
|
32
|
+
# @watch_folder = watch_folder
|
33
|
+
# @boot_file = boot_file
|
34
|
+
# end
|
35
|
+
|
36
|
+
# # rubocop:disable Lint/RescueException
|
37
|
+
# def start
|
38
|
+
# boot(boot_file)
|
39
|
+
# update_dashboard
|
40
|
+
|
41
|
+
# Filewatcher.new(watch_folder).watch do |changes|
|
42
|
+
# changes.each do |filename, event|
|
43
|
+
# $stdout.clear_screen
|
44
|
+
# puts "File #{event}: #{filename}"
|
45
|
+
|
46
|
+
# uri = URI::File.build(host: nil, path: filename)
|
47
|
+
# KManager.resource_changed(uri, event)
|
48
|
+
|
49
|
+
# # process_created_file(filename) if event == :created
|
50
|
+
# # process_updated_file(filename) if event == :updated # || event == :created
|
51
|
+
# # process_deleted_file(filename) if event == :deleted
|
52
|
+
# update_dashboard
|
53
|
+
# end
|
54
|
+
# end
|
55
|
+
# rescue Exception => e
|
56
|
+
# # TODO: Make style a setting: :message, :short, (whatever the last one is)
|
57
|
+
# log.exception(e, style: :short)
|
58
|
+
# end
|
59
|
+
# # rubocop:enable Lint/RescueException
|
60
|
+
|
61
|
+
# private
|
62
|
+
|
63
|
+
# def boot(boot_file)
|
64
|
+
# clear_screen
|
65
|
+
|
66
|
+
# content = File.read(boot_file)
|
67
|
+
# Object.class_eval(content, boot_file)
|
68
|
+
# end
|
69
|
+
|
70
|
+
# # rubocop:disable Lint/RescueException
|
71
|
+
# def process_updated_file(filename)
|
72
|
+
# clear_screen
|
73
|
+
# update_load_path(filename)
|
74
|
+
|
75
|
+
# puts "File updated: #{filename}"
|
76
|
+
# rescue Exception => e
|
77
|
+
# # TODO: Make style a setting: :message, :short, (whatever the last one is)
|
78
|
+
# log.exception(e, style: :short)
|
79
|
+
# end
|
80
|
+
|
81
|
+
# def process_updated_file_old(filename)
|
82
|
+
# clear_screen
|
83
|
+
# update_load_path(filename)
|
84
|
+
|
85
|
+
# puts "File updated: #{filename}"
|
86
|
+
|
87
|
+
# content = File.read(filename)
|
88
|
+
# Object.class_eval(content, filename)
|
89
|
+
# rescue Exception => e
|
90
|
+
# # TODO: Make style a setting: :message, :short, (whatever the last one is)
|
91
|
+
# log.exception(e, style: :short)
|
92
|
+
# end
|
93
|
+
# # rubocop:enable Lint/RescueException
|
94
|
+
|
95
|
+
# def update_dashboard
|
96
|
+
# dashboard = KManager::Overview::Dashboard.new(KManager.manager)
|
97
|
+
# dashboard.areas
|
98
|
+
# dashboard.resources
|
99
|
+
# dashboard.documents
|
100
|
+
# end
|
101
|
+
|
102
|
+
# def update_load_path(filename)
|
103
|
+
# dirname = File.dirname(filename)
|
104
|
+
|
105
|
+
# # This needs to be in detailed logging
|
106
|
+
# $LOAD_PATH.unshift(dirname) unless $LOAD_PATH.find { |path| path.start_with?(dirname) }
|
107
|
+
# end
|
108
|
+
|
109
|
+
# def clear_screen
|
110
|
+
# puts "\n" * 70
|
111
|
+
# $stdout.clear_screen
|
112
|
+
# end
|
113
|
+
# end
|
metadata
CHANGED
@@ -1,15 +1,43 @@
|
|
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.22
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Cruwys
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-12-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: dry-struct
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: filewatcher
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 2.0.0.beta5
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 2.0.0.beta5
|
13
41
|
- !ruby/object:Gem::Dependency
|
14
42
|
name: k_builder
|
15
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -52,6 +80,20 @@ dependencies:
|
|
52
80
|
- - "~>"
|
53
81
|
- !ruby/object:Gem::Version
|
54
82
|
version: 0.0.0
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: k_fileset
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: 0.0.0
|
90
|
+
type: :runtime
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: 0.0.0
|
55
97
|
- !ruby/object:Gem::Dependency
|
56
98
|
name: k_log
|
57
99
|
requirement: !ruby/object:Gem::Requirement
|
@@ -70,7 +112,8 @@ description: " K Manager provides a managed host for documents, resources and
|
|
70
112
|
generator execution\n"
|
71
113
|
email:
|
72
114
|
- david@ideasmen.com.au
|
73
|
-
executables:
|
115
|
+
executables:
|
116
|
+
- k_manager
|
74
117
|
extensions: []
|
75
118
|
extra_rdoc_files: []
|
76
119
|
files:
|
@@ -78,8 +121,6 @@ files:
|
|
78
121
|
- ".gitignore"
|
79
122
|
- ".rspec"
|
80
123
|
- ".rubocop.yml"
|
81
|
-
- Assessment1.md
|
82
|
-
- Assessment2.md
|
83
124
|
- CODE_OF_CONDUCT.md
|
84
125
|
- Gemfile
|
85
126
|
- Guardfile
|
@@ -94,39 +135,44 @@ files:
|
|
94
135
|
- bin/kgitsync
|
95
136
|
- bin/khotfix
|
96
137
|
- bin/setup
|
138
|
+
- docs/flow.drawio
|
139
|
+
- exe/k_manager
|
97
140
|
- hooks/pre-commit
|
98
141
|
- hooks/update-version
|
99
142
|
- k_manager.gemspec
|
100
143
|
- lib/k_manager.rb
|
144
|
+
- lib/k_manager/area.rb
|
101
145
|
- lib/k_manager/configuration/project_config.rb
|
102
|
-
- lib/k_manager/
|
103
|
-
- lib/k_manager/
|
104
|
-
- lib/k_manager/
|
105
|
-
- lib/k_manager/
|
106
|
-
- lib/k_manager/
|
107
|
-
- lib/k_manager/
|
146
|
+
- lib/k_manager/document_factory.rb
|
147
|
+
- lib/k_manager/manager.rb
|
148
|
+
- lib/k_manager/overview/dashboard.rb
|
149
|
+
- lib/k_manager/overview/dump_json.rb
|
150
|
+
- lib/k_manager/overview/models.rb
|
151
|
+
- lib/k_manager/overview/queries.rb
|
108
152
|
- lib/k_manager/resources/base_resource.rb
|
109
|
-
- lib/k_manager/resources/csv_file_resource.rb
|
110
|
-
- lib/k_manager/resources/factories/document_factory.rb
|
111
153
|
- lib/k_manager/resources/factories/ruby_document_factory.rb
|
112
154
|
- lib/k_manager/resources/file_resource.rb
|
113
|
-
- lib/k_manager/resources/
|
114
|
-
- lib/k_manager/resources/
|
115
|
-
- lib/k_manager/resources/
|
155
|
+
- lib/k_manager/resources/file_resources/ruby_file_resource.rb
|
156
|
+
- lib/k_manager/resources/file_resources/unknown_file_resource.rb
|
157
|
+
- lib/k_manager/resources/mem_resource.rb
|
158
|
+
- lib/k_manager/resources/resource_document_factory.rb
|
159
|
+
- lib/k_manager/resources/resource_factory.rb
|
160
|
+
- lib/k_manager/resources/resource_manager.rb
|
161
|
+
- lib/k_manager/resources/resource_set.rb
|
162
|
+
- lib/k_manager/resources/web_resource.rb
|
116
163
|
- lib/k_manager/resources/x_resource.rb
|
117
|
-
- lib/k_manager/resources/yaml_file_resource.rb
|
118
164
|
- lib/k_manager/version.rb
|
119
|
-
- lib/k_manager/
|
120
|
-
- lib/k_manager/x_project_manager.rb
|
121
|
-
- lib/k_manager/x_register.rb
|
165
|
+
- lib/k_manager/watcher.rb
|
122
166
|
- lib/k_manager/x_resource_documents/resource_document.rb
|
167
|
+
- lib/k_manager/x_resource_documents/x_project.rb
|
168
|
+
- lib/k_manager/x_resource_documents/x_project_manager.rb
|
169
|
+
- lib/k_manager/x_resource_documents/x_register.rb
|
170
|
+
- tasks/watch.rake
|
123
171
|
homepage: http://appydave.com/gems/k-manager
|
124
172
|
licenses:
|
125
173
|
- MIT
|
126
174
|
metadata:
|
127
|
-
|
128
|
-
source_code_uri: https://github.com/klueless-io/k_manager
|
129
|
-
changelog_uri: https://github.com/klueless-io/k_manager/commits/master
|
175
|
+
rubygems_mfa_required: 'true'
|
130
176
|
post_install_message:
|
131
177
|
rdoc_options: []
|
132
178
|
require_paths:
|
@@ -142,7 +188,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
142
188
|
- !ruby/object:Gem::Version
|
143
189
|
version: '0'
|
144
190
|
requirements: []
|
145
|
-
rubygems_version: 3.2.
|
191
|
+
rubygems_version: 3.2.33
|
146
192
|
signing_key:
|
147
193
|
specification_version: 4
|
148
194
|
summary: K Manager provides a managed host for documents, resources and code generator
|
data/Assessment1.md
DELETED
@@ -1,127 +0,0 @@
|
|
1
|
-
1. Business modelling tools and Technical modelling tools
|
2
|
-
|
3
|
-
Technical modelling tools
|
4
|
-
ERD
|
5
|
-
|
6
|
-
- Entity Relationship Diagram used for Databases
|
7
|
-
|
8
|
-
Tools: Gliffy, Lucid Charts,
|
9
|
-
|
10
|
-
2. Software development methodologies
|
11
|
-
- Agile/
|
12
|
-
- Waterflow
|
13
|
-
- RAD
|
14
|
-
- Extreme XP
|
15
|
-
- Feature Driven
|
16
|
-
- Scrum
|
17
|
-
|
18
|
-
3. Application architecture diagram
|
19
|
-
- N-Tier (Layered) vs - Microservices
|
20
|
-
- Application Architecture Diagram
|
21
|
-
- Integration Architecture Diagram
|
22
|
-
- Deployment Architecture Diagram
|
23
|
-
- DevOps Architecture Diagram
|
24
|
-
- Data Architecture Diagram
|
25
|
-
|
26
|
-
4. Software risk analysis
|
27
|
-
- Estimates, Scope Creep, Stake holder expectations, Low Stake holder engagement,
|
28
|
-
- Requirements / Use Cases
|
29
|
-
- Abuse or security analysis
|
30
|
-
- Unproven Technology
|
31
|
-
- Choice of Infrustruction
|
32
|
-
|
33
|
-
- Cloud, Server/On-Premise/Integrations
|
34
|
-
- UX Design
|
35
|
-
|
36
|
-
- Framwork, Accesibility
|
37
|
-
- Risk analysis
|
38
|
-
|
39
|
-
- Code Quality
|
40
|
-
|
41
|
-
- Anti Patterns,
|
42
|
-
|
43
|
-
- Poor Architecture
|
44
|
-
- Test Design
|
45
|
-
|
46
|
-
- Data edge cases
|
47
|
-
- Static Analysis tools
|
48
|
-
|
49
|
-
- Linters
|
50
|
-
- Pen Testing
|
51
|
-
|
52
|
-
5. Database diagram processes and steps
|
53
|
-
- ERD
|
54
|
-
- Conceptual model
|
55
|
-
- Purpose of database
|
56
|
-
- Monolith vs Microservice
|
57
|
-
- Relational, Object/JSON/NoSql Store, Key/Value Store, Event Sourced
|
58
|
-
6. Design database process and steps
|
59
|
-
- Normalized tables
|
60
|
-
- Entities
|
61
|
-
- Attributes
|
62
|
-
- Relationships, (1-1, 1-m, m-m)
|
63
|
-
- Define cardinality, maximum number of values
|
64
|
-
- Define ordinality, minimum number of values
|
65
|
-
- Lhs can be zero or one or many
|
66
|
-
- Rhs can be zero, one or many
|
67
|
-
- Referential integrity, constraints, indexes
|
68
|
-
7. Implement database database processes and steps
|
69
|
-
- DDL
|
70
|
-
- create database
|
71
|
-
- create table
|
72
|
-
- primary key
|
73
|
-
- attributes
|
74
|
-
- create index and constraints
|
75
|
-
- create foreign key references
|
76
|
-
- create views
|
77
|
-
8. Principles of database-management systems.
|
78
|
-
|
79
|
-
- Shared collection of related data
|
80
|
-
- Data Modeling
|
81
|
-
- Data Storage
|
82
|
-
- Structured Data
|
83
|
-
- Unstructured Data
|
84
|
-
- Transactions (Local or Distributed)
|
85
|
-
- Referential Integrity
|
86
|
-
- Cardinatlity/Ordinality
|
87
|
-
- Distributed Data
|
88
|
-
- Data Warehouses / Big Data
|
89
|
-
- Relational, Object/JSON Store, Key/Value Stores, Event Sourced
|
90
|
-
|
91
|
-
9. Object-oriented programming concepts
|
92
|
-
- Encapsulation, Inheritance, Abstraction, Polymorphism
|
93
|
-
|
94
|
-
10. Characteristics of a programming language (C#)
|
95
|
-
- Object Oriented
|
96
|
-
- Memory Management
|
97
|
-
- Garbage Collection
|
98
|
-
- Type Safe
|
99
|
-
- Compiled to Byte Code
|
100
|
-
- Cross Platform
|
101
|
-
11. Open-source development tools and platforms
|
102
|
-
- Git Hub
|
103
|
-
- VSCode
|
104
|
-
- Bootstrap, Material, Tailwind CSS
|
105
|
-
- Angular, React, Vue
|
106
|
-
12. Input and output requirements & examples
|
107
|
-
- Input
|
108
|
-
- Console, Terminal, Browser, Ports, Devices -
|
109
|
-
Output - Console, Screen, Printer, Devices (3D Printer, Robot), Ports (Database, Message Queue)
|
110
|
-
13. Testing techniques
|
111
|
-
- Unit Testing
|
112
|
-
- Integration Test
|
113
|
-
- Regression Testing
|
114
|
-
- Penn Testing
|
115
|
-
- User Acceptance Testing
|
116
|
-
14. Computer hardware & why it is important in soft dev
|
117
|
-
|
118
|
-
- PC, Mac, Embedded Device, IOT, Mobile (Android, IOS, Tablets)
|
119
|
-
- Operating systems, Kernals, VM's and Dockerization
|
120
|
-
- Provides both a physical devices and virtual environments on which to run applications
|
121
|
-
15. Computer networking components & why it is important in soft dev
|
122
|
-
- Allows for distributed computing
|
123
|
-
- Scalable databases
|
124
|
-
- Scalable services
|
125
|
-
- Provides redundancy and resilience.
|
126
|
-
- Provides external backup stores
|
127
|
-
|
data/Assessment2.md
DELETED
@@ -1,88 +0,0 @@
|
|
1
|
-
# Assessment
|
2
|
-
|
3
|
-
Validate Software
|
4
|
-
|
5
|
-
ICPTPRG520 Validate an application design against specifications
|
6
|
-
|
7
|
-
## PART 1
|
8
|
-
|
9
|
-
1. Develop a proof of concept
|
10
|
-
2. Present the prototype system
|
11
|
-
3. Perform design and code validation
|
12
|
-
4. Document and report validation results
|
13
|
-
|
14
|
-
A. Determine the procedures and tools required to perform
|
15
|
-
|
16
|
-
* Software requirements validation
|
17
|
-
* Database validation
|
18
|
-
* Software design validation
|
19
|
-
* Source code validation
|
20
|
-
* User Interface (UI) validation
|
21
|
-
* Test validation
|
22
|
-
|
23
|
-
B. Now it is time to design and build a prototype.
|
24
|
-
1. Identify a prototyping tool to develop proof of concept
|
25
|
-
2. Identify the use cases from the software requirements.
|
26
|
-
3. Develop a prototype using the selected tool.
|
27
|
-
|
28
|
-
C. Save your word-processed document as VDP_Part1
|
29
|
-
|
30
|
-
## PART 2
|
31
|
-
|
32
|
-
10-15 minutes to present your prototype
|
33
|
-
|
34
|
-
Role Play Participants:
|
35
|
-
Client and Developer.
|
36
|
-
|
37
|
-
1. Identify each use case requirements that you need to fulfil
|
38
|
-
2. Confirm the completeness and correctness of the requirements using appropriate questioning and listening techniques.
|
39
|
-
3. Demonstrate the prototype (from Part 1) to the client and determine whether any further refinements need to be made.
|
40
|
-
4. Record the outcome of the presentation and any changes required in a document.
|
41
|
-
|
42
|
-
## PART 3
|
43
|
-
|
44
|
-
Now you have implement selected use cases, its time for you to validate it.
|
45
|
-
|
46
|
-
Record your validation details
|
47
|
-
- Date
|
48
|
-
- Name
|
49
|
-
- Procedures
|
50
|
-
- Results (including screen shots)
|
51
|
-
|
52
|
-
1. Validate the software design to ensure the design is complete, accurate and feasible.
|
53
|
-
1. Include diagrams, class, erd, activity, seq, flow etc...
|
54
|
-
2. Validate the database structure and elements, inluding screenshots
|
55
|
-
3. Validate the UI design
|
56
|
-
4. Validate the software code for consistency and analysis of the code using 2 static analysis tools (c# and web). Include screen shots
|
57
|
-
|
58
|
-
## PART 4
|
59
|
-
|
60
|
-
Document and report validation results
|
61
|
-
See: Original document for this.
|
62
|
-
|
63
|
-
### Application Requirements
|
64
|
-
|
65
|
-
Sydney club needs a simple membership system.
|
66
|
-
|
67
|
-
System should allow club employees to enter member details.
|
68
|
-
|
69
|
-
Future: Guests can sign-up and manage their membership online via the clubs website and via mobile app.
|
70
|
-
|
71
|
-
## Database
|
72
|
-
|
73
|
-
### Users
|
74
|
-
|
75
|
-
The users table will hold a list of employees who can add new members to the system.
|
76
|
-
|
77
|
-
* email - Valid email that acts as a unique user name
|
78
|
-
* password - hashed value that holds the users password
|
79
|
-
|
80
|
-
### Members
|
81
|
-
|
82
|
-
Members table will store member details
|
83
|
-
|
84
|
-
* First name
|
85
|
-
* Last name
|
86
|
-
* Phone number
|
87
|
-
* Date of Birth
|
88
|
-
|
@@ -1,31 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module KManager
|
4
|
-
module CreateDocument
|
5
|
-
def model(key = nil, **opts)
|
6
|
-
opts = { key: key }.merge(opts) unless key.nil?
|
7
|
-
document = new_document(KManager::Documents::ModelDocument, **opts)
|
8
|
-
|
9
|
-
attach_to_resource(document, change_resource_type: :dsl)
|
10
|
-
end
|
11
|
-
|
12
|
-
def attach_to_resource(document, change_resource_type: :dsl)
|
13
|
-
KManager.target_resource&.attach_document(document, change_resource_type: :dsl)
|
14
|
-
document
|
15
|
-
end
|
16
|
-
|
17
|
-
# Create an instance of a document
|
18
|
-
#
|
19
|
-
# @param [Class<DocumentTaggable>] klass type of document to create
|
20
|
-
def new_document(klass, **opts)
|
21
|
-
key = KManager.target_resource.documents.length.zero? ? KManager.target_resource.infer_key : nil
|
22
|
-
|
23
|
-
opts = {
|
24
|
-
resource: KManager.target_resource,
|
25
|
-
key: key
|
26
|
-
}.merge(opts)
|
27
|
-
|
28
|
-
klass.new(**opts)
|
29
|
-
end
|
30
|
-
end
|
31
|
-
end
|
@@ -1,21 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module KManager
|
4
|
-
module Documents
|
5
|
-
# A basic document stores a simple data object with tags for
|
6
|
-
# unique key, type, namespace and project.
|
7
|
-
class BasicDocument < KDoc::Container
|
8
|
-
include KLog::Logging
|
9
|
-
include KManager::Documents::DocumentTaggable
|
10
|
-
|
11
|
-
def initialize(**opts)
|
12
|
-
super(**opts)
|
13
|
-
initialize_document_tags(**opts)
|
14
|
-
end
|
15
|
-
|
16
|
-
def default_document_type
|
17
|
-
:basic
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|
@@ -1,18 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module KManager
|
4
|
-
module Documents
|
5
|
-
class BuilderDocument
|
6
|
-
include KLog::Logging
|
7
|
-
include KManager::Documents::DocumentTaggable
|
8
|
-
|
9
|
-
def initialize(**opts)
|
10
|
-
initialize_document_tags(**opts)
|
11
|
-
end
|
12
|
-
|
13
|
-
# def default_document_type
|
14
|
-
# nil
|
15
|
-
# end
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|
@@ -1,94 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module KManager
|
4
|
-
module Documents
|
5
|
-
# Tag a document with attributes that can be used to uniquely identify
|
6
|
-
# a document within a project or namespace
|
7
|
-
#
|
8
|
-
# Examples:
|
9
|
-
# User DSL could be tagged user_entity
|
10
|
-
# Blue print DSL for building a data layer User could be tagged user_blueprint
|
11
|
-
# Users.csv file could be tagged data_files_users_csv
|
12
|
-
# Account DSL in the CRM project could be tagged crm_account_entity
|
13
|
-
# AccountController DSL in the CRM project could be tagged crm_controllers_account_controller
|
14
|
-
module DocumentTaggable
|
15
|
-
# Name of the document (required)
|
16
|
-
#
|
17
|
-
# Examples: user, account, country
|
18
|
-
attr_reader :key
|
19
|
-
|
20
|
-
# Type of document (optional, but will set to :default_document_type if not provided)
|
21
|
-
#
|
22
|
-
# Examples by data type
|
23
|
-
# :csv, :yaml, :json, :xml
|
24
|
-
#
|
25
|
-
# Examples by shape of the data in a DSL
|
26
|
-
# :entity, :microapp, blueprint
|
27
|
-
attr_reader :type
|
28
|
-
|
29
|
-
# Namespace of the document (optional, '' if not set)
|
30
|
-
#
|
31
|
-
# When using a data file, this should be based on the relative file path
|
32
|
-
# When using a DSL data file, this will be manually configured
|
33
|
-
attr_reader :namespace
|
34
|
-
|
35
|
-
# Resource that this document belongs to (optional)
|
36
|
-
attr_accessor :resource
|
37
|
-
|
38
|
-
# Project that this document belongs to (optional)
|
39
|
-
attr_reader :project
|
40
|
-
|
41
|
-
# Project key is inferred from the attached project ('' if project not set)
|
42
|
-
attr_reader :project_key
|
43
|
-
|
44
|
-
# Errors in documents can be stored against the document
|
45
|
-
#
|
46
|
-
# This helps debugging invalid DSL's and data documents
|
47
|
-
attr_reader :error
|
48
|
-
|
49
|
-
def initialize_document_tags(**opts)
|
50
|
-
@key = opts[:key] || SecureRandom.alphanumeric(4)
|
51
|
-
@type = opts[:type] || default_document_type
|
52
|
-
@namespace = opts[:namespace] || ''
|
53
|
-
@resource = opts[:resource]
|
54
|
-
@project = @resource&.project
|
55
|
-
@project_key = project&.infer_key
|
56
|
-
end
|
57
|
-
|
58
|
-
# This method should be implemented on the document class
|
59
|
-
# generally it will return a :symbol
|
60
|
-
# def default_document_type; end;
|
61
|
-
|
62
|
-
# The unique key on resources provides a way to prevent conflicts
|
63
|
-
# between resource names, resource types, local namespaces and projects.
|
64
|
-
def unique_key
|
65
|
-
return @unique_key if defined? @unique_key
|
66
|
-
|
67
|
-
@unique_key = begin
|
68
|
-
raise KDoc::Error, 'key is required when generating unique key' if key.nil? || key.empty?
|
69
|
-
|
70
|
-
[project_key, namespace, key, type]
|
71
|
-
.reject { |k| k.nil? || k == '' }
|
72
|
-
.map { |k| k.to_s.gsub('_', '-') }
|
73
|
-
.join('-')
|
74
|
-
end
|
75
|
-
end
|
76
|
-
|
77
|
-
# rubocop:disable Metrics/AbcSize
|
78
|
-
def debug
|
79
|
-
log.section_heading(self.class.name)
|
80
|
-
|
81
|
-
log.kv 'unique_key' , unique_key , 15
|
82
|
-
log.kv 'key' , key , 15
|
83
|
-
log.kv 'type' , type , 15
|
84
|
-
log.kv 'namespace' , namespace , 15
|
85
|
-
# log.kv 'resource' , resource , 15
|
86
|
-
# log.kv 'project' , project , 15
|
87
|
-
log.kv 'project_key' , project_key , 15
|
88
|
-
log.kv 'data' , data.nil? ? '' : data.to_s[0..100].gsub("\n", '\n'), 15
|
89
|
-
log.kv 'error' , error , 15
|
90
|
-
end
|
91
|
-
# rubocop:enable Metrics/AbcSize
|
92
|
-
end
|
93
|
-
end
|
94
|
-
end
|
@@ -1,19 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module KManager
|
4
|
-
module Documents
|
5
|
-
class ModelDocument < KDoc::Model
|
6
|
-
include KLog::Logging
|
7
|
-
include KManager::Documents::DocumentTaggable
|
8
|
-
|
9
|
-
def initialize(**opts)
|
10
|
-
super(**opts)
|
11
|
-
initialize_document_tags(**opts)
|
12
|
-
end
|
13
|
-
|
14
|
-
def default_document_type
|
15
|
-
KDoc.opinion.default_model_type
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|