k_domain 0.0.23 → 0.0.28
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/.builders/boot.rb +40 -0
- data/.builders/generators/configuration_generator.rb +22 -0
- data/.builders/run.rb +16 -0
- data/.github/workflows/main.yml +5 -3
- data/.gitignore +1 -0
- data/.rubocop.yml +8 -3
- data/Gemfile +2 -2
- data/k_domain.gemspec +1 -1
- data/lib/k_domain/config/_.rb +4 -0
- data/lib/k_domain/config/config.rb +19 -0
- data/lib/k_domain/config/configuration.rb +76 -0
- data/lib/k_domain/domain_model/build_rich_models.rb +83 -0
- data/lib/k_domain/domain_model/load.rb +44 -1
- data/lib/k_domain/domain_model/transform.rb +13 -11
- data/lib/k_domain/domain_model/transform_steps/step1_db_schema.rb +1 -1
- data/lib/k_domain/domain_model/transform_steps/step2_domain_models.rb +1 -1
- data/lib/k_domain/domain_model/transform_steps/step6_rails_structure_models.rb +1 -0
- data/lib/k_domain/domain_model/transform_steps/step7_rails_structure_controllers.rb +8 -3
- data/lib/k_domain/domain_model/transform_steps/step8_domain_columns.rb +51 -56
- data/lib/k_domain/queries/_.rb +4 -0
- data/lib/k_domain/queries/base_query.rb +13 -0
- data/lib/k_domain/queries/domain_model_query.rb +88 -0
- data/lib/k_domain/rails_code_extractor/extract_controller.rb +2 -0
- data/lib/k_domain/rails_code_extractor/extract_model.rb +2 -0
- data/lib/k_domain/rails_code_extractor/shim_loader.rb +4 -2
- data/lib/k_domain/raw_db_schema/transform.rb +26 -2
- data/lib/k_domain/schemas/_.rb +3 -1
- data/lib/k_domain/schemas/domain/erd_file.rb +78 -77
- data/lib/k_domain/schemas/domain.rb +79 -38
- data/lib/k_domain/schemas/{domain/_.rb → domain_types.rb} +1 -8
- data/lib/k_domain/schemas/{domain_model.rb → main_dataset.rb} +2 -2
- data/lib/k_domain/schemas/rails_structure.rb +10 -0
- data/lib/k_domain/version.rb +1 -1
- data/lib/k_domain.rb +6 -1
- data/templates/custom/action_controller.rb +0 -29
- data/templates/custom/controller_interceptors.rb +9 -7
- data/templates/custom/model_interceptors.rb +48 -3
- data/templates/rails/active_record.rb +2 -0
- data/templates/sample_config.rb +47 -0
- metadata +17 -10
- data/.builders/config/_.rb +0 -3
- data/.builders/setup.rb +0 -30
- data/templates/old_printspeek_schema copy.rb +0 -231
- data/templates/old_printspeek_schema.rb +0 -233
@@ -5,6 +5,14 @@ module KDomain
|
|
5
5
|
module Schemas
|
6
6
|
class Domain < Dry::Struct
|
7
7
|
class Model < Dry::Struct
|
8
|
+
class Relationship < KDomain::Schemas::RailsStructure::NameOptsType
|
9
|
+
attribute :relation_type , Types::Coercible::Symbol
|
10
|
+
|
11
|
+
def to_s
|
12
|
+
"#{relation_type}: :#{name} fk: #{opts[:foreign_key]}"
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
8
16
|
class Column < Dry::Struct
|
9
17
|
attribute :name , Types::Strict::String # "source_account_id"
|
10
18
|
attribute :name_plural , Types::Strict::String # "source_account_ids"
|
@@ -17,35 +25,62 @@ module KDomain
|
|
17
25
|
attribute :array , Types::Strict::Bool.optional.default(nil) # null
|
18
26
|
|
19
27
|
# Calculated value
|
20
|
-
attribute :structure_type , Types::Coercible::Symbol
|
21
|
-
# attribute :foreign_key , Types::Strict::Bool.optional.default(nil) #
|
22
|
-
# attribute :foreign_table , Types::Strict::String #
|
23
|
-
# attribute :foreign_table_plural , Types::Strict::String #
|
28
|
+
attribute :structure_type , Types::Coercible::Symbol
|
24
29
|
|
25
|
-
#
|
26
|
-
|
27
|
-
# end
|
28
|
-
|
29
|
-
# def structure_type?(*structure_types)
|
30
|
-
# structure_types.include?(column.structure_type)
|
31
|
-
# end
|
30
|
+
# Any column may have a bunch of related models using various relationship types (belong_to, has_one, has_many etc...)
|
31
|
+
attr_accessor :relationships
|
32
32
|
|
33
33
|
def db_type
|
34
34
|
return @db_type if defined? @db_type
|
35
35
|
|
36
|
-
@db_type = DB_TYPE[type] || '******'
|
36
|
+
@db_type = KDomain::Schemas::DB_TYPE[type] || '******'
|
37
37
|
end
|
38
38
|
|
39
39
|
def ruby_type
|
40
40
|
return @ruby_type if defined? @ruby_type
|
41
41
|
|
42
|
-
@ruby_type = RUBY_TYPE[type] || '******'
|
42
|
+
@ruby_type = KDomain::Schemas::RUBY_TYPE[type] || '******'
|
43
43
|
end
|
44
44
|
|
45
45
|
def csharp_type
|
46
46
|
return @csharp_type if defined? @csharp_type
|
47
47
|
|
48
|
-
@csharp_type = CSHARP_TYPE[type] || '******'
|
48
|
+
@csharp_type = KDomain::Schemas::CSHARP_TYPE[type] || '******'
|
49
|
+
end
|
50
|
+
|
51
|
+
def to_h
|
52
|
+
{
|
53
|
+
name: name,
|
54
|
+
name_plural: name_plural,
|
55
|
+
type: type,
|
56
|
+
precision: precision,
|
57
|
+
scale: scale,
|
58
|
+
default: default,
|
59
|
+
default_as_code: value_as_code(default),
|
60
|
+
null: null,
|
61
|
+
null_as_code: value_as_code(null), # handlebars does not like null property name
|
62
|
+
limit: limit,
|
63
|
+
array: array,
|
64
|
+
array_as_code: value_as_code(array),
|
65
|
+
db_type: db_type,
|
66
|
+
ruby_type: ruby_type,
|
67
|
+
csharp_type: csharp_type,
|
68
|
+
structure_type: structure_type,
|
69
|
+
relationships: relationships
|
70
|
+
}
|
71
|
+
end
|
72
|
+
|
73
|
+
private
|
74
|
+
|
75
|
+
def value_as_code(value)
|
76
|
+
return value if value.nil?
|
77
|
+
|
78
|
+
case value
|
79
|
+
when String # , Hash
|
80
|
+
"'#{value}'"
|
81
|
+
else
|
82
|
+
value.to_s
|
83
|
+
end
|
49
84
|
end
|
50
85
|
end
|
51
86
|
|
@@ -53,6 +88,10 @@ module KDomain
|
|
53
88
|
attribute :name , Types::Strict::String.optional.default(nil)
|
54
89
|
attribute :type , Types::Strict::String.optional.default(nil)
|
55
90
|
attribute :exist , Types::Strict::Bool
|
91
|
+
|
92
|
+
def exist?
|
93
|
+
exist
|
94
|
+
end
|
56
95
|
end
|
57
96
|
|
58
97
|
attribute :name , Types::Strict::String
|
@@ -64,6 +103,9 @@ module KDomain
|
|
64
103
|
attribute :columns , Types::Strict::Array.of(KDomain::Schemas::Domain::Model::Column)
|
65
104
|
attribute :file , Types::Strict::String.optional.default(nil)
|
66
105
|
|
106
|
+
# Link <KDomain::Schemas::RailsStructure::Model> to the domain model
|
107
|
+
attr_accessor :rails_model
|
108
|
+
|
67
109
|
def ruby?
|
68
110
|
file && File.exist?(file)
|
69
111
|
end
|
@@ -72,43 +114,43 @@ module KDomain
|
|
72
114
|
pk.exist
|
73
115
|
end
|
74
116
|
|
117
|
+
def create_update_timestamp?
|
118
|
+
names = columns_timestamp.map(&:name)
|
119
|
+
|
120
|
+
(names & %w[created_at updated_at]).any?
|
121
|
+
end
|
122
|
+
|
123
|
+
# Custom model configurations such as main_key and traits
|
124
|
+
def config
|
125
|
+
@config ||= KDomain.configuration.find_model(name.to_sym)
|
126
|
+
end
|
127
|
+
|
75
128
|
# If filled in, the model has a main field that is useful for rendering and may be used for unique constraint, may also be called display_name
|
76
129
|
def main_key
|
77
|
-
@main_key ||=
|
130
|
+
@main_key ||= config.main_key || KDomain.configuration.fallback_key(columns_data)
|
78
131
|
end
|
79
132
|
|
80
133
|
def traits
|
81
|
-
|
134
|
+
config.traits
|
82
135
|
end
|
83
136
|
|
84
|
-
# def where()
|
85
|
-
# end
|
86
|
-
|
87
|
-
# def columns_where()
|
88
|
-
# end
|
89
|
-
|
90
|
-
# Column filters
|
91
|
-
|
92
137
|
def columns_data
|
93
138
|
@columns_data ||= columns_for_structure_types(:data)
|
94
139
|
end
|
95
140
|
|
96
|
-
# def columns_data_optional
|
97
|
-
# @columns_data_optional ||= columns_for_structure_types(:data).select { |c| true }
|
98
|
-
# end
|
99
|
-
|
100
|
-
# def columns_data_required
|
101
|
-
# @columns_data_required ||= columns_for_structure_types(:data).select { |c| false }
|
102
|
-
# end
|
103
|
-
|
104
141
|
def columns_primary
|
105
142
|
@columns_primary ||= columns_for_structure_types(:primary_key)
|
106
143
|
end
|
107
144
|
|
108
|
-
def
|
145
|
+
def columns_foreign_key
|
109
146
|
@columns_foreign ||= columns_for_structure_types(:foreign_key)
|
110
147
|
end
|
111
148
|
|
149
|
+
# polymorphic foreign keys
|
150
|
+
def columns_foreign_type
|
151
|
+
@columns_foreign_type ||= columns_for_structure_types(:foreign_type)
|
152
|
+
end
|
153
|
+
|
112
154
|
def columns_timestamp
|
113
155
|
@columns_data_timestamp ||= columns_for_structure_types(:timestamp)
|
114
156
|
end
|
@@ -118,11 +160,11 @@ module KDomain
|
|
118
160
|
end
|
119
161
|
|
120
162
|
def columns_virtual
|
121
|
-
@columns_virtual ||= columns_for_structure_types(:timestamp, :deleted_at)
|
163
|
+
@columns_virtual ||= columns_for_structure_types(:foreign_type, :timestamp, :deleted_at)
|
122
164
|
end
|
123
165
|
|
124
166
|
def columns_data_foreign
|
125
|
-
@columns_data_foreign ||= columns_for_structure_types(:data, :foreign_key)
|
167
|
+
@columns_data_foreign ||= columns_for_structure_types(:data, :foreign_key, :foreign_type)
|
126
168
|
end
|
127
169
|
alias rows_fields_and_fk columns_data_foreign
|
128
170
|
|
@@ -132,12 +174,12 @@ module KDomain
|
|
132
174
|
alias rows_fields_and_pk columns_data_primary
|
133
175
|
|
134
176
|
def columns_data_virtual
|
135
|
-
@columns_data_virtual ||= columns_for_structure_types(:data, :timestamp, :deleted_at)
|
177
|
+
@columns_data_virtual ||= columns_for_structure_types(:data, :foreign_type, :timestamp, :deleted_at)
|
136
178
|
end
|
137
179
|
alias rows_fields_and_virtual columns_data_virtual
|
138
180
|
|
139
181
|
def columns_data_foreign_virtual
|
140
|
-
@columns_data_foreign_virtual ||= columns_for_structure_types(:data, :foreign_key, :timestamp, :deleted_at)
|
182
|
+
@columns_data_foreign_virtual ||= columns_for_structure_types(:data, :foreign_key, :foreign_type, :timestamp, :deleted_at)
|
141
183
|
end
|
142
184
|
|
143
185
|
private
|
@@ -148,7 +190,6 @@ module KDomain
|
|
148
190
|
end
|
149
191
|
|
150
192
|
attribute :models , Types::Strict::Array.of(KDomain::Schemas::Domain::Model)
|
151
|
-
# attribute :erd_files , Types::Strict::Array.of(KDomain::DomainModel::ErdFile)
|
152
193
|
end
|
153
194
|
end
|
154
195
|
end
|
@@ -1,14 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
# log.warn 'models->domain' if AppDebug.require?
|
4
|
-
|
5
|
-
require_relative './models/column'
|
6
|
-
require_relative './models/model'
|
7
|
-
require_relative './erd_file'
|
8
|
-
require_relative './domain'
|
9
|
-
|
10
3
|
module KDomain
|
11
|
-
module
|
4
|
+
module Schemas
|
12
5
|
RUBY_TYPE = {
|
13
6
|
text: 'String',
|
14
7
|
string: 'String',
|
@@ -1,9 +1,9 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
#
|
3
|
+
# MainDataset holds the entire domain model including database and ancillary information
|
4
4
|
module KDomain
|
5
5
|
module Schemas
|
6
|
-
class
|
6
|
+
class MainDataset < Dry::Struct
|
7
7
|
attribute :domain , KDomain::Schemas::Domain
|
8
8
|
attribute :database , KDomain::Schemas::Database
|
9
9
|
attribute :dictionary , KDomain::Schemas::Dictionary
|
@@ -51,6 +51,16 @@ module KDomain
|
|
51
51
|
attribute :attr_accessor? , Types::Array.of(Types::Strict::String)
|
52
52
|
attribute :attr_reader? , Types::Array.of(Types::Strict::String)
|
53
53
|
attribute :attr_writer? , Types::Array.of(Types::Strict::String)
|
54
|
+
|
55
|
+
# Not sure if I need to do a behaviours by column names
|
56
|
+
# def belongs_to_by(foreign_key: )
|
57
|
+
# end
|
58
|
+
# def has_one_by(foreign_key: )
|
59
|
+
# end
|
60
|
+
# def has_many_by(foreign_key: )
|
61
|
+
# end
|
62
|
+
# def has_and_belongs_to_many_to_by(foreign_key: )
|
63
|
+
# end
|
54
64
|
end
|
55
65
|
|
56
66
|
class Method < Dry::Struct
|
data/lib/k_domain/version.rb
CHANGED
data/lib/k_domain.rb
CHANGED
@@ -5,13 +5,16 @@ require 'dry-struct'
|
|
5
5
|
require 'k_log'
|
6
6
|
require 'peeky'
|
7
7
|
require 'k_domain/version'
|
8
|
+
require 'k_domain/config/_'
|
8
9
|
require 'k_domain/schemas/_'
|
9
10
|
require 'k_domain/raw_db_schema/transform'
|
10
11
|
require 'k_domain/raw_db_schema/load'
|
11
12
|
require 'k_domain/domain_model/transform'
|
12
13
|
require 'k_domain/domain_model/transform_steps/_'
|
13
14
|
require 'k_domain/domain_model/load'
|
15
|
+
require 'k_domain/domain_model/build_rich_models'
|
14
16
|
require 'k_domain/rails_code_extractor/_'
|
17
|
+
require 'k_domain/queries/_'
|
15
18
|
|
16
19
|
# # This is useful if you want to initialize structures via Hash
|
17
20
|
# class SymbolizeStruct < Dry::Struct
|
@@ -19,6 +22,8 @@ require 'k_domain/rails_code_extractor/_'
|
|
19
22
|
# end
|
20
23
|
|
21
24
|
module KDomain
|
25
|
+
extend KDomain::Config
|
26
|
+
|
22
27
|
# raise KDomain::Error, 'Sample message'
|
23
28
|
class Error < StandardError; end
|
24
29
|
|
@@ -35,7 +40,7 @@ module KDomain
|
|
35
40
|
# Your code goes here...
|
36
41
|
end
|
37
42
|
|
38
|
-
if ENV
|
43
|
+
if ENV.fetch('KLUE_DEBUG', 'false').downcase == 'true'
|
39
44
|
namespace = 'KDomain::Version'
|
40
45
|
file_path = $LOADED_FEATURES.find { |f| f.include?('k_domain/version') }
|
41
46
|
version = KDomain::VERSION.ljust(9)
|
@@ -3,34 +3,5 @@ module ActionController
|
|
3
3
|
def self.require(require)
|
4
4
|
add(:require, require)
|
5
5
|
end
|
6
|
-
# def self.rescue_from(type)#, &block)
|
7
|
-
# # block_source = nil
|
8
|
-
# # block_source = lambda_source(block, 'default_scope') if block_given?
|
9
|
-
|
10
|
-
# add(:rescue_from, {
|
11
|
-
# type: type#,
|
12
|
-
# # block: block_source
|
13
|
-
# })
|
14
|
-
# end
|
15
|
-
# def self.helper_method(*names)
|
16
|
-
# add(:helper_method, {
|
17
|
-
# names: names
|
18
|
-
# })
|
19
|
-
# end
|
20
|
-
# def self.helper(name)
|
21
|
-
# add(:helper, {
|
22
|
-
# name: name
|
23
|
-
# })
|
24
|
-
# end
|
25
|
-
# def self.http_basic_authenticate_with(**opts)
|
26
|
-
# add(:http_basic_authenticate_with, {
|
27
|
-
# opts: opts
|
28
|
-
# })
|
29
|
-
# end
|
30
|
-
# def self.protect_from_forgery(**opts)
|
31
|
-
# add(:protect_from_forgery, {
|
32
|
-
# opts: opts
|
33
|
-
# })
|
34
|
-
# end
|
35
6
|
end
|
36
7
|
end
|
@@ -10,18 +10,14 @@ class Rails
|
|
10
10
|
)
|
11
11
|
end
|
12
12
|
end
|
13
|
-
class RegionConfig
|
14
|
-
def self.require_value(*_p, **_o, &block); end
|
15
|
-
end
|
16
|
-
|
17
13
|
class ApplicationController < ActionController::Base
|
14
|
+
def self.require(*_p, **_o); end
|
18
15
|
end
|
19
16
|
|
20
17
|
module Admin
|
21
18
|
class BaseController < ActionController::Base
|
22
19
|
end
|
23
20
|
end
|
24
|
-
|
25
21
|
module Api
|
26
22
|
module V1
|
27
23
|
class BaseController < ActionController::Base
|
@@ -38,12 +34,18 @@ module Portal
|
|
38
34
|
class BaseController < ApplicationController
|
39
35
|
end
|
40
36
|
end
|
41
|
-
|
42
37
|
module ActiveRecord
|
43
38
|
class RecordNotFound
|
44
39
|
end
|
45
40
|
end
|
46
|
-
|
41
|
+
class RegionConfig < ActiveRecord::Base
|
42
|
+
def self.require_value(*_p, **_o, &block)
|
43
|
+
return 'ABC'
|
44
|
+
end
|
45
|
+
def self.get_value
|
46
|
+
return 'ABC'
|
47
|
+
end
|
48
|
+
end
|
47
49
|
module Aws
|
48
50
|
class Credentials
|
49
51
|
def initialize(*_p, **_o, &block); end
|
@@ -11,11 +11,32 @@ module ActsAsCommentable
|
|
11
11
|
end
|
12
12
|
end
|
13
13
|
|
14
|
+
|
14
15
|
module Scopes
|
15
16
|
module CompanyScopes
|
16
17
|
end
|
17
18
|
end
|
18
19
|
|
20
|
+
module DeIdentifiable
|
21
|
+
def deidentifiable(*_p, **_o); end
|
22
|
+
end
|
23
|
+
|
24
|
+
class Company < ActiveRecord::Base
|
25
|
+
extend DeIdentifiable
|
26
|
+
end
|
27
|
+
class Estimate < ActiveRecord::Base
|
28
|
+
extend DeIdentifiable
|
29
|
+
end
|
30
|
+
class Invoice < ActiveRecord::Base
|
31
|
+
extend DeIdentifiable
|
32
|
+
end
|
33
|
+
class Address < ActiveRecord::Base
|
34
|
+
extend DeIdentifiable
|
35
|
+
end
|
36
|
+
class Contact < ActiveRecord::Base
|
37
|
+
extend DeIdentifiable
|
38
|
+
end
|
39
|
+
|
19
40
|
class Thread
|
20
41
|
def initialize(*_p, **_o, &block); end
|
21
42
|
end
|
@@ -41,17 +62,41 @@ module ApiLoggable; end
|
|
41
62
|
module Excludable; end
|
42
63
|
module Bookmarkable; end
|
43
64
|
module Categorizable; end
|
44
|
-
module PgSearch
|
65
|
+
module PgSearch
|
66
|
+
module Model
|
67
|
+
end
|
68
|
+
end
|
45
69
|
module Excludable; end
|
46
|
-
module JsonbStore
|
70
|
+
module JsonbStore
|
71
|
+
def self.included(klass)
|
72
|
+
klass.extend(ClassMethods)
|
73
|
+
end
|
47
74
|
|
75
|
+
module ClassMethods
|
76
|
+
def jsonb_store(*_p, **_o); end
|
77
|
+
end
|
78
|
+
end
|
48
79
|
module ActionView
|
49
80
|
module Helpers
|
50
81
|
module NumberHelper
|
51
82
|
end
|
52
83
|
end
|
53
84
|
end
|
54
|
-
|
85
|
+
module PrintSpeak
|
86
|
+
class Application
|
87
|
+
def self.google_oath_secret_key
|
88
|
+
'ABC'
|
89
|
+
end
|
90
|
+
end
|
91
|
+
end
|
92
|
+
class RegionConfig < ActiveRecord::Base
|
93
|
+
def self.require_value(*_p, **_o, &block)
|
94
|
+
'ABC'
|
95
|
+
end
|
96
|
+
def self.get_value
|
97
|
+
return 'ABC'
|
98
|
+
end
|
99
|
+
end
|
55
100
|
module RailsUpgrade
|
56
101
|
def rails4?
|
57
102
|
true
|
@@ -0,0 +1,47 @@
|
|
1
|
+
KDomain.configure do |config|
|
2
|
+
config.default_main_key = nil
|
3
|
+
config.default_traits = %i[
|
4
|
+
trait1
|
5
|
+
trait2
|
6
|
+
trait3
|
7
|
+
]
|
8
|
+
|
9
|
+
config.fallback_keys = %i[
|
10
|
+
name
|
11
|
+
category
|
12
|
+
description
|
13
|
+
global
|
14
|
+
key
|
15
|
+
klass
|
16
|
+
message
|
17
|
+
lead_source
|
18
|
+
body
|
19
|
+
status
|
20
|
+
subject
|
21
|
+
]
|
22
|
+
|
23
|
+
config.register_entity(:action_log , main_key: :action)
|
24
|
+
config.register_entity(:backup , main_key: :filename)
|
25
|
+
config.register_entity(:campaign_calendar_entry , main_key: :date)
|
26
|
+
config.register_entity(:campaign_count , main_key: :total_count)
|
27
|
+
config.register_entity(:comment , main_key: :title)
|
28
|
+
config.register_entity(:contact_group , main_key: :email)
|
29
|
+
config.register_entity(:email_alias , main_key: :email)
|
30
|
+
config.register_entity(:unsubscribe , main_key: :email)
|
31
|
+
config.register_entity(:email_credential , main_key: :credentials)
|
32
|
+
config.register_entity(:email_soft_bounce , main_key: :email_address)
|
33
|
+
config.register_entity(:suppressed_address , main_key: :email_address)
|
34
|
+
config.register_entity(:email_template_value , main_key: :value)
|
35
|
+
config.register_entity(:email_validation , main_key: :address)
|
36
|
+
config.register_entity(:enterprise_togglefield , main_key: :field)
|
37
|
+
config.register_entity(:event_stat , main_key: :event_type)
|
38
|
+
config.register_entity(:holiday_date , main_key: :date)
|
39
|
+
config.register_entity(:job_stat , main_key: :job_name)
|
40
|
+
config.register_entity(:original_user , main_key: :target_user_id)
|
41
|
+
config.register_entity(:pending_attachment , main_key: :file_name)
|
42
|
+
config.register_entity(:sales_base_tax , main_key: :total)
|
43
|
+
config.register_entity(:shared_user , main_key: :shared_id)
|
44
|
+
config.register_entity(:task_repeat , main_key: :repeat_type)
|
45
|
+
config.register_entity(:user , main_key: :username)
|
46
|
+
config.register_entity(:token , main_key: :gmail_history_id)
|
47
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: k_domain
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.28
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Cruwys
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-06-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -74,8 +74,9 @@ executables: []
|
|
74
74
|
extensions: []
|
75
75
|
extra_rdoc_files: []
|
76
76
|
files:
|
77
|
-
- ".builders/
|
78
|
-
- ".builders/
|
77
|
+
- ".builders/boot.rb"
|
78
|
+
- ".builders/generators/configuration_generator.rb"
|
79
|
+
- ".builders/run.rb"
|
79
80
|
- ".github/workflows/main.yml"
|
80
81
|
- ".gitignore"
|
81
82
|
- ".rspec"
|
@@ -97,6 +98,10 @@ files:
|
|
97
98
|
- hooks/update-version
|
98
99
|
- k_domain.gemspec
|
99
100
|
- lib/k_domain.rb
|
101
|
+
- lib/k_domain/config/_.rb
|
102
|
+
- lib/k_domain/config/config.rb
|
103
|
+
- lib/k_domain/config/configuration.rb
|
104
|
+
- lib/k_domain/domain_model/build_rich_models.rb
|
100
105
|
- lib/k_domain/domain_model/load.rb
|
101
106
|
- lib/k_domain/domain_model/transform.rb
|
102
107
|
- lib/k_domain/domain_model/transform_steps/_.rb
|
@@ -109,6 +114,9 @@ files:
|
|
109
114
|
- lib/k_domain/domain_model/transform_steps/step6_rails_structure_models.rb
|
110
115
|
- lib/k_domain/domain_model/transform_steps/step7_rails_structure_controllers.rb
|
111
116
|
- lib/k_domain/domain_model/transform_steps/step8_domain_columns.rb
|
117
|
+
- lib/k_domain/queries/_.rb
|
118
|
+
- lib/k_domain/queries/base_query.rb
|
119
|
+
- lib/k_domain/queries/domain_model_query.rb
|
112
120
|
- lib/k_domain/rails_code_extractor/_.rb
|
113
121
|
- lib/k_domain/rails_code_extractor/extract_controller.rb
|
114
122
|
- lib/k_domain/rails_code_extractor/extract_model.rb
|
@@ -119,7 +127,6 @@ files:
|
|
119
127
|
- lib/k_domain/schemas/database.rb
|
120
128
|
- lib/k_domain/schemas/dictionary.rb
|
121
129
|
- lib/k_domain/schemas/domain.rb
|
122
|
-
- lib/k_domain/schemas/domain/_.rb
|
123
130
|
- lib/k_domain/schemas/domain/erd_file.rb
|
124
131
|
- lib/k_domain/schemas/domain/old/belongs_to.rb
|
125
132
|
- lib/k_domain/schemas/domain/old/column_old.rb
|
@@ -137,8 +144,9 @@ files:
|
|
137
144
|
- lib/k_domain/schemas/domain/old/statistics.rb
|
138
145
|
- lib/k_domain/schemas/domain/old/validate.rb
|
139
146
|
- lib/k_domain/schemas/domain/old/validates.rb
|
140
|
-
- lib/k_domain/schemas/
|
147
|
+
- lib/k_domain/schemas/domain_types.rb
|
141
148
|
- lib/k_domain/schemas/investigate.rb
|
149
|
+
- lib/k_domain/schemas/main_dataset.rb
|
142
150
|
- lib/k_domain/schemas/rails_resource.rb
|
143
151
|
- lib/k_domain/schemas/rails_structure.rb
|
144
152
|
- lib/k_domain/version.rb
|
@@ -146,12 +154,11 @@ files:
|
|
146
154
|
- templates/custom/controller_interceptors.rb
|
147
155
|
- templates/custom/model_interceptors.rb
|
148
156
|
- templates/load_schema.rb
|
149
|
-
- templates/old_printspeek_schema copy.rb
|
150
|
-
- templates/old_printspeek_schema.rb
|
151
157
|
- templates/rails/action_controller.rb
|
152
158
|
- templates/rails/active_record.rb
|
153
159
|
- templates/ruby_code_extractor/attach_class_info.rb
|
154
160
|
- templates/ruby_code_extractor/behaviour_accessors.rb
|
161
|
+
- templates/sample_config.rb
|
155
162
|
- templates/simple/controller_interceptors.rb
|
156
163
|
homepage: http://appydave.com/gems/k-domain
|
157
164
|
licenses:
|
@@ -168,14 +175,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
168
175
|
requirements:
|
169
176
|
- - ">="
|
170
177
|
- !ruby/object:Gem::Version
|
171
|
-
version: '2.
|
178
|
+
version: '2.7'
|
172
179
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
173
180
|
requirements:
|
174
181
|
- - ">="
|
175
182
|
- !ruby/object:Gem::Version
|
176
183
|
version: '0'
|
177
184
|
requirements: []
|
178
|
-
rubygems_version: 3.
|
185
|
+
rubygems_version: 3.1.6
|
179
186
|
signing_key:
|
180
187
|
specification_version: 4
|
181
188
|
summary: K Domain builds complex domain schemas by combining the database schema with
|
data/.builders/config/_.rb
DELETED
data/.builders/setup.rb
DELETED
@@ -1,30 +0,0 @@
|
|
1
|
-
require 'config/_'
|
2
|
-
require_relative "../lib/k_domain"
|
3
|
-
|
4
|
-
db_schema_ruby_file = '/Users/davidcruwys/dev/printspeak/printspeak-master/db/schema.rb'
|
5
|
-
|
6
|
-
# /Users/davidcruwys/dev/printspeak/printspeak/.builders/config/raw/schema_printspeak.rb
|
7
|
-
output_folder = File.expand_path('../.output')
|
8
|
-
db_schema_json_file = File.join(output_folder, 'db_schema.json')
|
9
|
-
schema_loader_file = File.join(output_folder, 'schema_printspeak.rb')
|
10
|
-
|
11
|
-
transformer = KDomain::RawDbSchema::Transform.new(db_schema_ruby_file)
|
12
|
-
transformer.template_file = '/Users/davidcruwys/dev/kgems/k_domain/templates/old_printspeek_schema.rb'
|
13
|
-
puts db_schema_ruby_file
|
14
|
-
puts transformer.template_file
|
15
|
-
transformer.call
|
16
|
-
transformer.write_json(db_schema_json_file)
|
17
|
-
transformer.write_schema_loader(schema_loader_file)
|
18
|
-
# transformer.schema
|
19
|
-
|
20
|
-
|
21
|
-
# transform = KDomain::DomainModel::Transform.new(
|
22
|
-
# db_schema: db_schema,
|
23
|
-
# target_file: target_file,
|
24
|
-
# target_step_file: target_step_file,
|
25
|
-
# model_path: model_path,
|
26
|
-
# controller_path: controller_path,
|
27
|
-
# route_path: route_path
|
28
|
-
# )
|
29
|
-
|
30
|
-
puts 'done'
|