master_data_tool 0.17.0 → 0.19.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Appraisals +10 -6
- data/README.md +14 -11
- data/gemfiles/{activerecord52.gemfile → activerecord5.2.gemfile} +1 -1
- data/gemfiles/{activerecord61.gemfile → activerecord6.0.gemfile} +1 -1
- data/gemfiles/{activerecord70.gemfile → activerecord6.1.gemfile} +1 -1
- data/gemfiles/activerecord7.0.gemfile +9 -0
- data/lib/master_data_tool/config.rb +4 -0
- data/lib/master_data_tool/import/executor.rb +12 -1
- data/lib/master_data_tool/master_data.rb +18 -2
- data/lib/master_data_tool/master_data_status.rb +12 -7
- data/lib/master_data_tool/report/default_printer.rb +1 -0
- data/lib/master_data_tool/version.rb +1 -1
- data/lib/master_data_tool.rb +6 -1
- data/master_data_tool.gemspec +2 -1
- data/scripts/drop_db.sh +11 -0
- data/sig/master_data_tool.rbs +227 -1
- metadata +22 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6c86a9d847de2f8f125153cd284d3ea10120d3c0aad5ed27e9ccbf24a01be848
|
4
|
+
data.tar.gz: fa2eadc1507bb37376083a180b774a78dcef234edb10137c2dcc76c5eb7f9567
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b09a34de53816d663d2c527151fa89065cb4c0bb6526c91f999ff32062f4bec5022d63ec0f6120abbf7922a8ab1844129d3d94e5661a293fe0d37f613c4c0834
|
7
|
+
data.tar.gz: ef198841455751e21559c3759ea70985f0d49b49d4688c175318809317a6bf6cb2544b3fdde4125ac2f8a64db963e4e3063ebb3726ecfcba918fa94fa39be676
|
data/Appraisals
CHANGED
@@ -1,13 +1,17 @@
|
|
1
|
-
appraise '
|
2
|
-
gem 'activerecord', '~> 5.2'
|
1
|
+
appraise 'activerecord5.2' do
|
2
|
+
gem 'activerecord', '~> 5.2.0'
|
3
3
|
end
|
4
4
|
|
5
|
-
appraise '
|
6
|
-
gem 'activerecord', '~> 6.
|
5
|
+
appraise 'activerecord6.0' do
|
6
|
+
gem 'activerecord', '~> 6.0.0'
|
7
|
+
end
|
8
|
+
|
9
|
+
appraise 'activerecord6.1' do
|
10
|
+
gem 'activerecord', '~> 6.1.0'
|
7
11
|
end
|
8
12
|
|
9
13
|
if RUBY_VERSION >= '2.7.0'
|
10
|
-
appraise '
|
11
|
-
gem 'activerecord', '~> 7.0'
|
14
|
+
appraise 'activerecord7.0' do
|
15
|
+
gem 'activerecord', '~> 7.0.0'
|
12
16
|
end
|
13
17
|
end
|
data/README.md
CHANGED
@@ -1,6 +1,9 @@
|
|
1
1
|
# MasterDataTool
|
2
2
|
|
3
3
|
[![Build Status](https://github.com/taka0125/master_data_tool/workflows/Ruby/badge.svg?branch=main)](https://github.com/taka0125/master_data_tool/actions)
|
4
|
+
[![Gem Version](https://badge.fury.io/rb/master_data_tool.svg)](https://badge.fury.io/rb/master_data_tool)
|
5
|
+
[![Maintainability](https://api.codeclimate.com/v1/badges/5fc8420c4fe83a2e6c92/maintainability)](https://codeclimate.com/github/taka0125/master_data_tool/maintainability)
|
6
|
+
[![Test Coverage](https://api.codeclimate.com/v1/badges/5fc8420c4fe83a2e6c92/test_coverage)](https://codeclimate.com/github/taka0125/master_data_tool/test_coverage)
|
4
7
|
|
5
8
|
システムが稼働する上で最初から必要なデータ(マスタデータ)を管理するツール
|
6
9
|
|
@@ -35,18 +38,18 @@ Or install it yourself as:
|
|
35
38
|
|
36
39
|
### マスタデータの投入
|
37
40
|
|
38
|
-
| option
|
39
|
-
|
40
|
-
| --dry-run
|
41
|
-
| --verify
|
42
|
-
| --only-import-tables
|
43
|
-
| --except-import-tables
|
44
|
-
| --only-verify-tables
|
45
|
-
| --except-verify-tables
|
46
|
-
| --skip-no-change
|
47
|
-
| --silent
|
41
|
+
| option | default | 内容 |
|
42
|
+
|---------------------------------| --- |-----------------------------------------------------------------|
|
43
|
+
| --dry-run | true | dry-runモードで実行する(データ変更は行わない) |
|
44
|
+
| --verify | true | データ投入後に全テーブル・全レコードのバリデーションチェックを行う |
|
45
|
+
| --only-import-tables | [] | 指定したテーブルのみデータ投入を行う |
|
46
|
+
| --except-import-tables | [] | 指定したテーブルのデータ投入を行わない |
|
47
|
+
| --only-verify-tables | [] | 指定したテーブルのみ投入後のバリデーションチェックを行う |
|
48
|
+
| --except-verify-tables | [] | 指定したテーブルのバリデーションチェックを行わない |
|
49
|
+
| --skip-no-change | true | CSVファイルに更新がないテーブルをスキップする |
|
50
|
+
| --silent | false | 結果の出力をやめる |
|
48
51
|
| --delete-all-ignore-foreign-key | false | 外部キー制約を無視してレコードを消すかどうか |
|
49
|
-
| --
|
52
|
+
| --override-identifier | nil | fixtures/#{override_identifier} のディレクトリにある内容でfixturesを上書きして投入する |
|
50
53
|
|
51
54
|
```bash
|
52
55
|
bundle exec master_data_tool import
|
@@ -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
|
@@ -27,11 +27,13 @@ module MasterDataTool
|
|
27
27
|
@override_identifier = override_identifier
|
28
28
|
@report_printer = report_printer
|
29
29
|
@report_printer.silent = silent
|
30
|
+
@master_data_statuses = []
|
30
31
|
end
|
31
32
|
|
32
33
|
def execute
|
33
34
|
ApplicationRecord.transaction do
|
34
35
|
print_execute_options
|
36
|
+
load_master_data_statuses
|
35
37
|
|
36
38
|
master_data_collection = build_master_data_collection
|
37
39
|
|
@@ -51,6 +53,8 @@ module MasterDataTool
|
|
51
53
|
|
52
54
|
private
|
53
55
|
|
56
|
+
attr_reader :master_data_statuses
|
57
|
+
|
54
58
|
def print_execute_options
|
55
59
|
return if @silent
|
56
60
|
|
@@ -115,7 +119,10 @@ module MasterDataTool
|
|
115
119
|
return true if import_skip_table?(master_data_file.table_name)
|
116
120
|
return false unless @skip_no_change
|
117
121
|
|
118
|
-
|
122
|
+
master_data_status = master_data_statuses.dig(master_data_file.table_name)
|
123
|
+
return false unless master_data_status
|
124
|
+
|
125
|
+
!master_data_status.will_change?(master_data_file)
|
119
126
|
end
|
120
127
|
|
121
128
|
def import_skip_table?(table_name)
|
@@ -152,6 +159,10 @@ module MasterDataTool
|
|
152
159
|
pattern = Pathname.new(MasterDataTool.config.master_data_dir).join(@override_identifier).join('*.csv').to_s
|
153
160
|
Pathname.glob(pattern).select(&:file?)
|
154
161
|
end
|
162
|
+
|
163
|
+
def load_master_data_statuses
|
164
|
+
@master_data_statuses = MasterDataTool::MasterDataStatus.fetch_all
|
165
|
+
end
|
155
166
|
end
|
156
167
|
end
|
157
168
|
end
|
@@ -135,12 +135,20 @@ 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))
|
145
|
+
next if valid
|
141
146
|
next if ignore_fail
|
142
147
|
|
143
|
-
|
148
|
+
e = MasterDataTool::VerifyFailed.new("[#{table_name}] id = #{record.id} is invalid")
|
149
|
+
e.errors = record.errors
|
150
|
+
|
151
|
+
raise e
|
144
152
|
end
|
145
153
|
end
|
146
154
|
end
|
@@ -154,6 +162,14 @@ module MasterDataTool
|
|
154
162
|
|
155
163
|
private
|
156
164
|
|
165
|
+
def preload_associations
|
166
|
+
@preload_associations ||= MasterDataTool.config.preload_associations.dig(@model_klass.to_s.to_sym)
|
167
|
+
end
|
168
|
+
|
169
|
+
def eager_load_associations
|
170
|
+
@eager_load_associations ||= MasterDataTool.config.eager_load_associations.dig(@model_klass.to_s.to_sym)
|
171
|
+
end
|
172
|
+
|
157
173
|
def build_records_from_csv(csv, old_records_by_id)
|
158
174
|
{}.tap do |records|
|
159
175
|
csv.each do |row|
|
@@ -14,7 +14,17 @@ module MasterDataTool
|
|
14
14
|
validates :version,
|
15
15
|
presence: true
|
16
16
|
|
17
|
+
def will_change?(master_data_file)
|
18
|
+
raise unless name == master_data_file.table_name
|
19
|
+
|
20
|
+
version != self.class.decide_version(master_data_file.path)
|
21
|
+
end
|
22
|
+
|
17
23
|
class << self
|
24
|
+
def fetch_all
|
25
|
+
all.index_by(&:name)
|
26
|
+
end
|
27
|
+
|
18
28
|
def build(master_data_file)
|
19
29
|
version = decide_version(master_data_file.path)
|
20
30
|
new(name: MasterDataTool.resolve_table_name(master_data_file.path, master_data_file.override_identifier), version: version)
|
@@ -23,15 +33,10 @@ module MasterDataTool
|
|
23
33
|
def import_records!(records, dry_run: true)
|
24
34
|
if dry_run
|
25
35
|
pp records
|
26
|
-
|
27
|
-
import!(records, validate: true, on_duplicate_key_update: %w[name version], timestamps: true)
|
36
|
+
return
|
28
37
|
end
|
29
|
-
end
|
30
38
|
|
31
|
-
|
32
|
-
def master_data_will_change?(master_data_file)
|
33
|
-
new_version = decide_version(master_data_file.path)
|
34
|
-
!where(name: master_data_file.table_name, version: new_version).exists?
|
39
|
+
import!(records, validate: true, on_duplicate_key_update: %w[name version], timestamps: true)
|
35
40
|
end
|
36
41
|
|
37
42
|
def decide_version(csv_path)
|
data/lib/master_data_tool.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require 'csv'
|
4
|
+
require 'socket'
|
4
5
|
require_relative "master_data_tool/version"
|
5
6
|
require_relative "master_data_tool/config"
|
6
7
|
require_relative "master_data_tool/master_data_status"
|
@@ -15,9 +16,13 @@ require_relative "master_data_tool/import"
|
|
15
16
|
module MasterDataTool
|
16
17
|
class Error < StandardError; end
|
17
18
|
class DryRunError < StandardError; end
|
18
|
-
class VerifyFailed < StandardError; end
|
19
19
|
class NotLoadedError < StandardError; end
|
20
20
|
|
21
|
+
class VerifyFailed < StandardError
|
22
|
+
attr_accessor :errors
|
23
|
+
delegate :full_messages, to: :errors
|
24
|
+
end
|
25
|
+
|
21
26
|
class << self
|
22
27
|
def config
|
23
28
|
@config ||= Config.new
|
data/master_data_tool.gemspec
CHANGED
@@ -33,7 +33,8 @@ Gem::Specification.new do |spec|
|
|
33
33
|
spec.add_development_dependency 'appraisal'
|
34
34
|
spec.add_development_dependency 'ridgepole'
|
35
35
|
spec.add_development_dependency 'database_cleaner-active_record'
|
36
|
-
spec.add_development_dependency 'standalone_activerecord_boot_loader'
|
36
|
+
spec.add_development_dependency 'standalone_activerecord_boot_loader', '>= 0.3 '
|
37
|
+
spec.add_development_dependency 'simplecov'
|
37
38
|
|
38
39
|
spec.add_dependency 'activerecord', '>= 5.1.7'
|
39
40
|
spec.add_dependency 'activesupport'
|
data/scripts/drop_db.sh
ADDED
data/sig/master_data_tool.rbs
CHANGED
@@ -1,4 +1,230 @@
|
|
1
|
+
# TypeProf 0.21.3
|
2
|
+
|
3
|
+
# Classes
|
1
4
|
module MasterDataTool
|
2
5
|
VERSION: String
|
3
|
-
|
6
|
+
self.@config: Config
|
7
|
+
|
8
|
+
def self.config: -> Config
|
9
|
+
def self.configure: -> untyped
|
10
|
+
def self.resolve_table_name: (Pathname csv_path, String? override_identifier) -> String
|
11
|
+
|
12
|
+
class Config
|
13
|
+
def initialize: -> void
|
14
|
+
end
|
15
|
+
|
16
|
+
class MasterDataStatus
|
17
|
+
def will_change?: (MasterDataFile master_data_file) -> bool
|
18
|
+
def self.fetch_all: -> Hash[String,MasterDataStatus]
|
19
|
+
def self.build: (MasterDataFile master_data_file) -> MasterDataStatus
|
20
|
+
def self.import_records!: (Array[MasterDataStatus] records, dry_run: bool) -> Array[MasterDataStatus]
|
21
|
+
def self.master_data_will_change?: (MasterDataFile master_data_file) -> bool
|
22
|
+
def self.decide_version: (Pathname csv_path) -> String
|
23
|
+
end
|
24
|
+
|
25
|
+
class MasterDataFile
|
26
|
+
attr_reader table_name: String
|
27
|
+
attr_reader path: Pathname
|
28
|
+
attr_reader override_identifier: String?
|
29
|
+
def initialize: (String table_name, Pathname path, String? override_identifier) -> void
|
30
|
+
def self.build: (Pathname path, String? override_identifier) -> MasterDataFile
|
31
|
+
def basename: -> Pathname
|
32
|
+
def ==: (untyped other) -> bool
|
33
|
+
alias eql? ==
|
34
|
+
def hash: -> Integer
|
35
|
+
end
|
36
|
+
|
37
|
+
class MasterDataFileCollection
|
38
|
+
@override_identifier: String?
|
39
|
+
@collection: Array[MasterDataFile]
|
40
|
+
|
41
|
+
def initialize: (override_identifier: String?) -> void
|
42
|
+
def each: ?{ -> Array[MasterDataFile] } -> Enumerator[bot, untyped]
|
43
|
+
def to_a: -> Array[MasterDataFile]
|
44
|
+
|
45
|
+
private
|
46
|
+
def build: -> Array[MasterDataFile]
|
47
|
+
def extract_master_data_csv_paths: -> Array[MasterDataFile]
|
48
|
+
def overridden_master_data_csv_paths: -> Array[MasterDataFile]
|
49
|
+
end
|
50
|
+
|
51
|
+
class MasterData
|
52
|
+
@loaded: bool
|
53
|
+
@affected: bool
|
54
|
+
@preload_associations: Array[untyped]
|
55
|
+
@eager_load_associations: Array[untyped]
|
56
|
+
|
57
|
+
attr_reader master_data_file: MasterDataFile
|
58
|
+
attr_reader model_klass: untyped
|
59
|
+
attr_reader columns: Array[String]
|
60
|
+
attr_reader new_records: Array[untyped]
|
61
|
+
def new_records: -> Array[untyped]
|
62
|
+
attr_reader updated_records: Array[untyped]
|
63
|
+
def updated_records: -> Array[untyped]
|
64
|
+
attr_reader no_change_records: Array[untyped]
|
65
|
+
def no_change_records: -> Array[untyped]
|
66
|
+
attr_reader deleted_records: Array[untyped]
|
67
|
+
def deleted_records: -> Array[untyped]
|
68
|
+
attr_reader before_count: Integer
|
69
|
+
def before_count: -> Integer
|
70
|
+
attr_reader after_count: Integer
|
71
|
+
def after_count: -> Integer
|
72
|
+
def initialize: (MasterDataFile master_data_file, untyped model_klass) -> void
|
73
|
+
def self.build: (MasterDataFile master_data_file, ?load: bool) -> MasterData
|
74
|
+
def basename: -> Pathname
|
75
|
+
def load: -> true
|
76
|
+
def import_records: -> Array[untyped]
|
77
|
+
def affected_records: -> Array[untyped]
|
78
|
+
def loaded?: -> bool
|
79
|
+
def affected?: -> bool?
|
80
|
+
def table_name: -> String
|
81
|
+
def import!: (?dry_run: true, ?delete_all_ignore_foreign_key: false) -> Report::ImportReport
|
82
|
+
def verify!: (?ignore_fail: bool) -> Report::VerifyReport
|
83
|
+
def print_affected_table: -> Report::PrintAffectedTableReport?
|
84
|
+
|
85
|
+
private
|
86
|
+
def preload_associations: -> Array[untyped]
|
87
|
+
def eager_load_associations: -> Array[untyped]
|
88
|
+
def build_records_from_csv: (Array[Array[String?]] csv, Hash[Integer, untyped] old_records_by_id) -> Hash[Integer, untyped]
|
89
|
+
def enable_foreign_key_checks: -> untyped
|
90
|
+
def disable_foreign_key_checks: -> untyped
|
91
|
+
end
|
92
|
+
|
93
|
+
class MasterDataCollection
|
94
|
+
@collection: Array[MasterData]
|
95
|
+
|
96
|
+
def initialize: -> void
|
97
|
+
def append: (MasterData master_data) -> Array[MasterData]
|
98
|
+
def each: ?{ (MasterData) -> (Array[MasterDataStatus | {operation: :verify, table_name: untyped, valid: untyped, id: untyped}]?) } -> (Array[MasterData] | Enumerator[MasterData, untyped] | Enumerator[untyped, untyped])
|
99
|
+
def to_a: -> Array[MasterData]
|
100
|
+
end
|
101
|
+
|
102
|
+
module Report
|
103
|
+
module Printer
|
104
|
+
attr_accessor silent: false
|
105
|
+
def initialize: (?silent: false) -> void
|
106
|
+
def print: (String message) -> nil
|
107
|
+
end
|
108
|
+
|
109
|
+
class DefaultPrinter
|
110
|
+
include Printer
|
111
|
+
|
112
|
+
def print: (String message) -> nil
|
113
|
+
end
|
114
|
+
|
115
|
+
module Core
|
116
|
+
def initialize: (MasterData master_data) -> void
|
117
|
+
def print: (Printer printer) -> untyped
|
118
|
+
|
119
|
+
private
|
120
|
+
def convert_to_ltsv: ({operation: :affected_table | :verify, table_name: untyped, valid: untyped, id: untyped} items) -> String
|
121
|
+
end
|
122
|
+
|
123
|
+
class ImportReport
|
124
|
+
include Core
|
125
|
+
@master_data: MasterData
|
126
|
+
|
127
|
+
attr_reader reports: Array[untyped]
|
128
|
+
def reports: -> Array[untyped]
|
129
|
+
def print: (Printer printer) -> untyped
|
130
|
+
|
131
|
+
private
|
132
|
+
def count_report: -> Hash[Symbol, Array[Hash[Symbol, untyped]]]
|
133
|
+
def new_records_report: -> Hash[Symbol, Array[Hash[Symbol, untyped]]]
|
134
|
+
def updated_records_report: -> Hash[Symbol, Array[Hash[Symbol, untyped]]]
|
135
|
+
def no_change_records_report: -> Hash[Symbol, Array[Hash[Symbol, untyped]]]
|
136
|
+
def deleted_records_report: -> Hash[Symbol, Array[Hash[Symbol, untyped]]]
|
137
|
+
end
|
138
|
+
|
139
|
+
class VerifyReport
|
140
|
+
include Core
|
141
|
+
@master_data: MasterData
|
142
|
+
|
143
|
+
attr_reader reports: Array[{operation: :verify, table_name: untyped, valid: untyped, id: untyped}]
|
144
|
+
def initialize: (MasterData master_data) -> void
|
145
|
+
def append: ({operation: :verify, table_name: untyped, valid: untyped, id: untyped} verify_record_report) -> Array[{operation: :verify, table_name: untyped, valid: untyped, id: untyped}]
|
146
|
+
def print: (Printer printer) -> Array[{operation: :verify, table_name: untyped, valid: untyped, id: untyped}]
|
147
|
+
def self.build_verify_record_report: (MasterData master_data, untyped record, untyped valid) -> {operation: :verify, table_name: untyped, valid: untyped, id: untyped}
|
148
|
+
end
|
149
|
+
|
150
|
+
class PrintAffectedTableReport
|
151
|
+
include Core
|
152
|
+
@master_data: MasterData
|
153
|
+
|
154
|
+
def print: (Printer printer) -> nil
|
155
|
+
end
|
156
|
+
end
|
157
|
+
|
158
|
+
module Dump
|
159
|
+
class Executor
|
160
|
+
DEFAULT_IGNORE_TABLES: [String, String, String]
|
161
|
+
DEFAULT_IGNORE_COLUMNS: [String, String]
|
162
|
+
@ignore_empty_table: bool
|
163
|
+
@ignore_tables: Array[String]
|
164
|
+
@ignore_column_names: Array[String]
|
165
|
+
@only_tables: Array[String]
|
166
|
+
@verbose: bool
|
167
|
+
|
168
|
+
def initialize: (ignore_empty_table: bool, ignore_tables: Array[String], ignore_column_names: Array[String], only_tables: Array[String], verbose: bool) -> void
|
169
|
+
def execute: -> Array[untyped]
|
170
|
+
|
171
|
+
private
|
172
|
+
def print_message: (String message) -> nil
|
173
|
+
def dump_to_csv: (untyped table) -> nil
|
174
|
+
def ignore?: (untyped model_klass) -> false
|
175
|
+
|
176
|
+
class Error < Struct[untyped]
|
177
|
+
attr_accessor table(): untyped
|
178
|
+
attr_accessor exception(): nil
|
179
|
+
end
|
180
|
+
end
|
181
|
+
end
|
182
|
+
|
183
|
+
module Import
|
184
|
+
class Executor
|
185
|
+
@dry_run: bool
|
186
|
+
@verify: bool
|
187
|
+
@only_import_tables: Array[String]
|
188
|
+
@except_import_tables: Array[String]
|
189
|
+
@only_verify_tables: Array[String]
|
190
|
+
@except_verify_tables: Array[String]
|
191
|
+
@skip_no_change: bool
|
192
|
+
@silent: bool
|
193
|
+
@delete_all_ignore_foreign_key: bool
|
194
|
+
@override_identifier: String?
|
195
|
+
@report_printer: Report::DefaultPrinter
|
196
|
+
@master_data_statuses: [MasterDataStatus]
|
197
|
+
|
198
|
+
def initialize: (dry_run: bool, verify: bool, only_import_tables: Array[String], except_import_tables: Array[String], only_verify_tables: Array[String], except_verify_tables: Array[String], skip_no_change: bool, silent: bool, delete_all_ignore_foreign_key: bool, override_identifier: String?, report_printer: Report::Printer) -> void
|
199
|
+
def execute: -> nil
|
200
|
+
|
201
|
+
private
|
202
|
+
def print_execute_options: -> nil
|
203
|
+
def build_master_data_collection: -> MasterDataCollection
|
204
|
+
def import_all!: (MasterDataCollection master_data_collection) -> (Array[MasterData] | Enumerator[MasterData, untyped] | Enumerator[untyped, untyped])
|
205
|
+
def verify_all!: (MasterDataCollection master_data_collection) -> (Array[MasterData] | Enumerator[MasterData, untyped] | Enumerator[untyped, untyped])
|
206
|
+
def save_master_data_statuses!: (MasterDataCollection master_data_collection) -> Array[MasterDataStatus]
|
207
|
+
def print_affected_tables: (MasterDataCollection master_data_collection) -> (Array[MasterData] | Enumerator[MasterData, untyped] | Enumerator[untyped, untyped])
|
208
|
+
def load_skip_table?: (untyped master_data_file) -> bool
|
209
|
+
def import_skip_table?: (untyped table_name) -> bool
|
210
|
+
def verify_skip_table?: (untyped table_name) -> bool
|
211
|
+
def need_skip_table?: (untyped table_name, Array[untyped] only, Array[untyped] except) -> bool
|
212
|
+
def extract_master_data_csv_paths: -> Array[Pathname]
|
213
|
+
def overridden_master_data_csv_paths: -> Array[Pathname]
|
214
|
+
def master_data_statuses: -> untyped
|
215
|
+
end
|
216
|
+
end
|
217
|
+
|
218
|
+
class Error < StandardError
|
219
|
+
end
|
220
|
+
|
221
|
+
class DryRunError < StandardError
|
222
|
+
end
|
223
|
+
|
224
|
+
class NotLoadedError < StandardError
|
225
|
+
end
|
226
|
+
|
227
|
+
class VerifyFailed < StandardError
|
228
|
+
attr_accessor errors: untyped
|
229
|
+
end
|
4
230
|
end
|
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.19.1
|
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-09-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|
@@ -96,6 +96,20 @@ dependencies:
|
|
96
96
|
version: '0'
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
98
|
name: standalone_activerecord_boot_loader
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0.3'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ">="
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0.3'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: simplecov
|
99
113
|
requirement: !ruby/object:Gem::Requirement
|
100
114
|
requirements:
|
101
115
|
- - ">="
|
@@ -183,9 +197,10 @@ files:
|
|
183
197
|
- docker-compose.yml
|
184
198
|
- exe/master_data_tool
|
185
199
|
- gemfiles/.bundle/config
|
186
|
-
- gemfiles/
|
187
|
-
- gemfiles/
|
188
|
-
- gemfiles/
|
200
|
+
- gemfiles/activerecord5.2.gemfile
|
201
|
+
- gemfiles/activerecord6.0.gemfile
|
202
|
+
- gemfiles/activerecord6.1.gemfile
|
203
|
+
- gemfiles/activerecord7.0.gemfile
|
189
204
|
- lib/generators/master_data_tool/install/install_generator.rb
|
190
205
|
- lib/generators/master_data_tool/install/templates/create_master_data_statuses.rb.erb
|
191
206
|
- lib/master_data_tool.rb
|
@@ -209,6 +224,7 @@ files:
|
|
209
224
|
- lib/master_data_tool/version.rb
|
210
225
|
- log/test.log
|
211
226
|
- master_data_tool.gemspec
|
227
|
+
- scripts/drop_db.sh
|
212
228
|
- scripts/setup.sh
|
213
229
|
- sig/master_data_tool.rbs
|
214
230
|
homepage: https://github.com/taka0125/master_data_tool
|
@@ -231,7 +247,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
231
247
|
- !ruby/object:Gem::Version
|
232
248
|
version: '0'
|
233
249
|
requirements: []
|
234
|
-
rubygems_version: 3.
|
250
|
+
rubygems_version: 3.3.7
|
235
251
|
signing_key:
|
236
252
|
specification_version: 4
|
237
253
|
summary: マスタデータの管理ツール
|