master_data_tool 0.17.0 → 0.18.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/master_data_tool/config.rb +4 -0
- data/lib/master_data_tool/master_data.rb +13 -1
- data/lib/master_data_tool/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 553fcd688f3ae346cc356961473852142c87f0ee66145b9e1892bfac3e230927
|
4
|
+
data.tar.gz: 64813eea92f8afc4612cdeb19f281c11ecef5537a207a736cd38ef68d57d9adf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9b617aed72fbd9bc0a355e81baef951c4f7f3d4cdf3838cf80b7e35533c98ba4fdfc0c01137d6b28e81f4d60798f21c4b81c94f1c53badba689edfe6d9c0c117
|
7
|
+
data.tar.gz: 0d1daa98e982a6bb918d6dc63dde683b8ce65181337a6fb1754a124d7f93d0e6daa7b25e5cfa5f31a16261c8c4624d6544313a72105dff7746d9df69c28277d5
|
@@ -9,12 +9,16 @@ module MasterDataTool
|
|
9
9
|
config_accessor :dump_ignore_columns
|
10
10
|
config_accessor :default_import_options
|
11
11
|
config_accessor :logger
|
12
|
+
config_accessor :preload_associations
|
13
|
+
config_accessor :eager_load_associations
|
12
14
|
|
13
15
|
def initialize
|
14
16
|
self.master_data_dir = nil
|
15
17
|
self.dump_ignore_tables = %w[]
|
16
18
|
self.dump_ignore_columns = %w[]
|
17
19
|
self.default_import_options = {}
|
20
|
+
self.preload_associations = {} # key: Class, value: associations
|
21
|
+
self.eager_load_associations = {} # key: Class, value: associations
|
18
22
|
self.logger = Logger.new(nil)
|
19
23
|
end
|
20
24
|
end
|
@@ -135,7 +135,11 @@ module MasterDataTool
|
|
135
135
|
|
136
136
|
def verify!(ignore_fail: false)
|
137
137
|
MasterDataTool::Report::VerifyReport.new(self).tap do |report|
|
138
|
-
@model_klass.all
|
138
|
+
scoped = @model_klass.all
|
139
|
+
scoped = scoped.preload(preload_associations) if preload_associations
|
140
|
+
scoped = scoped.eager_load(eager_load_associations) if eager_load_associations
|
141
|
+
|
142
|
+
scoped.find_each do |record|
|
139
143
|
valid = record.valid?
|
140
144
|
report.append(MasterDataTool::Report::VerifyReport.build_verify_record_report(self, record, valid))
|
141
145
|
next if ignore_fail
|
@@ -154,6 +158,14 @@ module MasterDataTool
|
|
154
158
|
|
155
159
|
private
|
156
160
|
|
161
|
+
def preload_associations
|
162
|
+
@preload_associations ||= MasterDataTool.config.preload_associations.dig(@model_klass.to_s.to_sym)
|
163
|
+
end
|
164
|
+
|
165
|
+
def eager_load_associations
|
166
|
+
@eager_load_associations ||= MasterDataTool.config.eager_load_associations.dig(@model_klass.to_s.to_sym)
|
167
|
+
end
|
168
|
+
|
157
169
|
def build_records_from_csv(csv, old_records_by_id)
|
158
170
|
{}.tap do |records|
|
159
171
|
csv.each do |row|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: master_data_tool
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.18.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Takahiro Ooishi
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-07-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|
@@ -231,7 +231,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
231
231
|
- !ruby/object:Gem::Version
|
232
232
|
version: '0'
|
233
233
|
requirements: []
|
234
|
-
rubygems_version: 3.2.
|
234
|
+
rubygems_version: 3.2.33
|
235
235
|
signing_key:
|
236
236
|
specification_version: 4
|
237
237
|
summary: マスタデータの管理ツール
|