k_domain 0.0.23 → 0.0.26
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/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/load.rb +41 -0
- 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/step7_rails_structure_controllers.rb +5 -3
- data/lib/k_domain/domain_model/transform_steps/step8_domain_columns.rb +51 -56
- 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/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 +31 -36
- data/lib/k_domain/schemas/{domain/_.rb → domain_types.rb} +1 -8
- data/lib/k_domain/schemas/rails_structure.rb +10 -0
- data/lib/k_domain/version.rb +1 -1
- data/lib/k_domain.rb +3 -0
- data/templates/sample_config.rb +47 -0
- metadata +10 -7
- 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
@@ -1,82 +1,83 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
+
# # frozen_string_literal: true
|
2
3
|
|
3
|
-
# Domain class holds a list of the entities
|
4
|
-
module KDomain
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
4
|
+
# # Domain class holds a list of the entities
|
5
|
+
# module KDomain
|
6
|
+
# module DomainModel
|
7
|
+
#
|
8
|
+
# class ErdFile < Dry::Struct
|
9
|
+
# attribute :name , Types::Strict::String
|
10
|
+
# attribute :name_plural , Types::Strict::String
|
11
|
+
# attribute :dsl_file , Types::Strict::String
|
11
12
|
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
# attribute? :source , Dry::Struct.optional.default(nil) do
|
14
|
+
# attribute :ruby , Types::Strict::String
|
15
|
+
# attribute :public , Types::Strict::String.optional.default(nil)
|
16
|
+
# attribute :private , Types::Strict::String.optional.default(nil)
|
16
17
|
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
18
|
+
# attribute? :all_methods , Dry::Struct.optional.default(nil) do
|
19
|
+
# attribute? :klass , Types::Strict::Array do
|
20
|
+
# attribute :name , Types::Strict::String
|
21
|
+
# attribute :scope , Types::Strict::String # .optional.default(nil)
|
22
|
+
# attribute :class_method , Types::Strict::Bool
|
23
|
+
# attribute :arguments , Types::Strict::String
|
24
|
+
# end
|
25
|
+
# attribute? :instance , Types::Strict::Array do
|
26
|
+
# attribute :name , Types::Strict::String
|
27
|
+
# attribute :scope , Types::Strict::String # .optional.default(nil)
|
28
|
+
# attribute :class_method , Types::Strict::Bool
|
29
|
+
# attribute :arguments , Types::Strict::String
|
30
|
+
# end
|
31
|
+
# attribute? :instance_public , Types::Strict::Array do
|
32
|
+
# attribute :name , Types::Strict::String
|
33
|
+
# attribute :scope , Types::Strict::String # .optional.default(nil)
|
34
|
+
# attribute :class_method , Types::Strict::Bool
|
35
|
+
# attribute :arguments , Types::Strict::String
|
36
|
+
# end
|
37
|
+
# attribute? :instance_private , Types::Strict::Array do
|
38
|
+
# attribute :name , Types::Strict::String
|
39
|
+
# attribute :scope , Types::Strict::String # .optional.default(nil)
|
40
|
+
# attribute :class_method , Types::Strict::Bool
|
41
|
+
# attribute :arguments , Types::Strict::String
|
42
|
+
# end
|
43
|
+
# end
|
44
|
+
# end
|
45
|
+
# attribute? :dsl , Dry::Struct.optional.default(nil) do
|
46
|
+
# attribute :default_scope , Types::Strict::String.optional.default(nil)
|
46
47
|
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
end
|
48
|
+
# attribute? :scopes , Types::Strict::Array do
|
49
|
+
# attribute :name , Types::Strict::String
|
50
|
+
# attribute :scope , Types::Strict::String # .optional.default(nil)
|
51
|
+
# end
|
52
|
+
# attribute? :belongs_to , Types::Strict::Array do
|
53
|
+
# attribute :name , Types::Strict::String
|
54
|
+
# attribute :options , Types::Strict::Hash.optional.default({}.freeze)
|
55
|
+
# attribute :raw_options , Types::Strict::String
|
56
|
+
# end
|
57
|
+
# attribute? :has_one , Types::Strict::Array do
|
58
|
+
# attribute :name , Types::Strict::String
|
59
|
+
# attribute :options , Types::Strict::Hash.optional.default({}.freeze)
|
60
|
+
# attribute :raw_options , Types::Strict::String
|
61
|
+
# end
|
62
|
+
# attribute? :has_many , Types::Strict::Array do
|
63
|
+
# attribute :name , Types::Strict::String
|
64
|
+
# attribute :options , Types::Strict::Hash.optional.default({}.freeze)
|
65
|
+
# attribute :raw_options , Types::Strict::String
|
66
|
+
# end
|
67
|
+
# attribute? :has_and_belongs_to_many , Types::Strict::Array do
|
68
|
+
# attribute :name , Types::Strict::String
|
69
|
+
# attribute :options , Types::Strict::Hash.optional.default({}.freeze)
|
70
|
+
# attribute :raw_options , Types::Strict::String
|
71
|
+
# end
|
72
|
+
# attribute? :validate_on , Types::Strict::Array do
|
73
|
+
# attribute :line , Types::Strict::String
|
74
|
+
# end
|
75
|
+
# attribute? :validates_on , Types::Strict::Array do
|
76
|
+
# attribute :name , Types::Strict::String
|
77
|
+
# attribute :raw_options , Types::Strict::String
|
78
|
+
# end
|
79
|
+
# end
|
80
|
+
# end
|
81
|
+
# # rubocop:enable Metrics/BlockLength
|
82
|
+
# end
|
83
|
+
# end
|
@@ -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,27 @@ 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
49
|
end
|
50
50
|
end
|
51
51
|
|
@@ -64,6 +64,9 @@ module KDomain
|
|
64
64
|
attribute :columns , Types::Strict::Array.of(KDomain::Schemas::Domain::Model::Column)
|
65
65
|
attribute :file , Types::Strict::String.optional.default(nil)
|
66
66
|
|
67
|
+
# Link <KDomain::Schemas::RailsStructure::Model> to the domain model
|
68
|
+
attr_accessor :rails_model
|
69
|
+
|
67
70
|
def ruby?
|
68
71
|
file && File.exist?(file)
|
69
72
|
end
|
@@ -72,35 +75,24 @@ module KDomain
|
|
72
75
|
pk.exist
|
73
76
|
end
|
74
77
|
|
78
|
+
# Custom model configurations such as main_key and traits
|
79
|
+
def config
|
80
|
+
@config ||= KDomain.configuration.find_model(name.to_sym)
|
81
|
+
end
|
82
|
+
|
75
83
|
# 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
84
|
def main_key
|
77
|
-
@main_key ||=
|
85
|
+
@main_key ||= config.main_key || KDomain.configuration.fallback_key(columns_data)
|
78
86
|
end
|
79
87
|
|
80
88
|
def traits
|
81
|
-
|
89
|
+
config.traits
|
82
90
|
end
|
83
91
|
|
84
|
-
# def where()
|
85
|
-
# end
|
86
|
-
|
87
|
-
# def columns_where()
|
88
|
-
# end
|
89
|
-
|
90
|
-
# Column filters
|
91
|
-
|
92
92
|
def columns_data
|
93
93
|
@columns_data ||= columns_for_structure_types(:data)
|
94
94
|
end
|
95
95
|
|
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
96
|
def columns_primary
|
105
97
|
@columns_primary ||= columns_for_structure_types(:primary_key)
|
106
98
|
end
|
@@ -109,6 +101,10 @@ module KDomain
|
|
109
101
|
@columns_foreign ||= columns_for_structure_types(:foreign_key)
|
110
102
|
end
|
111
103
|
|
104
|
+
def columns_foreign_type
|
105
|
+
@columns_foreign_type ||= columns_for_structure_types(:foreign_type)
|
106
|
+
end
|
107
|
+
|
112
108
|
def columns_timestamp
|
113
109
|
@columns_data_timestamp ||= columns_for_structure_types(:timestamp)
|
114
110
|
end
|
@@ -118,7 +114,7 @@ module KDomain
|
|
118
114
|
end
|
119
115
|
|
120
116
|
def columns_virtual
|
121
|
-
@columns_virtual ||= columns_for_structure_types(:timestamp, :deleted_at)
|
117
|
+
@columns_virtual ||= columns_for_structure_types(:foreign_type, :timestamp, :deleted_at)
|
122
118
|
end
|
123
119
|
|
124
120
|
def columns_data_foreign
|
@@ -132,12 +128,12 @@ module KDomain
|
|
132
128
|
alias rows_fields_and_pk columns_data_primary
|
133
129
|
|
134
130
|
def columns_data_virtual
|
135
|
-
@columns_data_virtual ||= columns_for_structure_types(:data, :timestamp, :deleted_at)
|
131
|
+
@columns_data_virtual ||= columns_for_structure_types(:data, :foreign_type, :timestamp, :deleted_at)
|
136
132
|
end
|
137
133
|
alias rows_fields_and_virtual columns_data_virtual
|
138
134
|
|
139
135
|
def columns_data_foreign_virtual
|
140
|
-
@columns_data_foreign_virtual ||= columns_for_structure_types(:data, :foreign_key, :timestamp, :deleted_at)
|
136
|
+
@columns_data_foreign_virtual ||= columns_for_structure_types(:data, :foreign_key, :foreign_type, :timestamp, :deleted_at)
|
141
137
|
end
|
142
138
|
|
143
139
|
private
|
@@ -148,7 +144,6 @@ module KDomain
|
|
148
144
|
end
|
149
145
|
|
150
146
|
attribute :models , Types::Strict::Array.of(KDomain::Schemas::Domain::Model)
|
151
|
-
# attribute :erd_files , Types::Strict::Array.of(KDomain::DomainModel::ErdFile)
|
152
147
|
end
|
153
148
|
end
|
154
149
|
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',
|
@@ -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,6 +5,7 @@ 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'
|
@@ -19,6 +20,8 @@ require 'k_domain/rails_code_extractor/_'
|
|
19
20
|
# end
|
20
21
|
|
21
22
|
module KDomain
|
23
|
+
extend KDomain::Config
|
24
|
+
|
22
25
|
# raise KDomain::Error, 'Sample message'
|
23
26
|
class Error < StandardError; end
|
24
27
|
|
@@ -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.26
|
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-04-08 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,9 @@ 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
|
100
104
|
- lib/k_domain/domain_model/load.rb
|
101
105
|
- lib/k_domain/domain_model/transform.rb
|
102
106
|
- lib/k_domain/domain_model/transform_steps/_.rb
|
@@ -119,7 +123,6 @@ files:
|
|
119
123
|
- lib/k_domain/schemas/database.rb
|
120
124
|
- lib/k_domain/schemas/dictionary.rb
|
121
125
|
- lib/k_domain/schemas/domain.rb
|
122
|
-
- lib/k_domain/schemas/domain/_.rb
|
123
126
|
- lib/k_domain/schemas/domain/erd_file.rb
|
124
127
|
- lib/k_domain/schemas/domain/old/belongs_to.rb
|
125
128
|
- lib/k_domain/schemas/domain/old/column_old.rb
|
@@ -138,6 +141,7 @@ files:
|
|
138
141
|
- lib/k_domain/schemas/domain/old/validate.rb
|
139
142
|
- lib/k_domain/schemas/domain/old/validates.rb
|
140
143
|
- lib/k_domain/schemas/domain_model.rb
|
144
|
+
- lib/k_domain/schemas/domain_types.rb
|
141
145
|
- lib/k_domain/schemas/investigate.rb
|
142
146
|
- lib/k_domain/schemas/rails_resource.rb
|
143
147
|
- lib/k_domain/schemas/rails_structure.rb
|
@@ -146,12 +150,11 @@ files:
|
|
146
150
|
- templates/custom/controller_interceptors.rb
|
147
151
|
- templates/custom/model_interceptors.rb
|
148
152
|
- templates/load_schema.rb
|
149
|
-
- templates/old_printspeek_schema copy.rb
|
150
|
-
- templates/old_printspeek_schema.rb
|
151
153
|
- templates/rails/action_controller.rb
|
152
154
|
- templates/rails/active_record.rb
|
153
155
|
- templates/ruby_code_extractor/attach_class_info.rb
|
154
156
|
- templates/ruby_code_extractor/behaviour_accessors.rb
|
157
|
+
- templates/sample_config.rb
|
155
158
|
- templates/simple/controller_interceptors.rb
|
156
159
|
homepage: http://appydave.com/gems/k-domain
|
157
160
|
licenses:
|
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'
|