master_data_tool 0.24.0 → 0.25.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 520706b20c931a673301487ce675c612cc006df654c5d1aa925f089e6f78ad7d
4
- data.tar.gz: 3e67ebc9d39c8ed1608ca2658c69cb53ebdec2fd089e4a13a42cd77792de3e2a
3
+ metadata.gz: 5f41479288ffbabe0ecdd06a1764457c6c5041b14339d5b8f14ffb26412d3461
4
+ data.tar.gz: a9d0f6847ac1edb2207455e7342593f5b1b6f848b582b59c60347cd5caebd3a0
5
5
  SHA512:
6
- metadata.gz: 5f8bde29cc94213487b3efe35c084470a79a35dfaa8f0429e31636b53ee9d20d448e24edd8a9a19484d841032b49d4acbcca4d89aff6a143f38c2763e9dd6164
7
- data.tar.gz: f1d335eca45faa04863007c2fcf5385e07b18175ab83bee68011afc80f6c974724052b5313f83db6320b326e5de3daa776dd9deec5a7c10573f4c91a6b8aaec1
6
+ metadata.gz: d08b291ab0364d63ed20df1bde2299660276d7e51efc2d8ee262c4b2d5b818b9652afdd9cbb2df6c5bc1b246446b643790ca09c5702d5fdbf73582258c000d80
7
+ data.tar.gz: e8363e24888d72932f8d0e7db1784ddaa6e8a083f692da6ee4f8ba51fbaf9f8686999f42427aa385827668d25a66c8ea4505fa885019a76ae1611aa4b320601e
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module MasterDataTool
4
- VERSION = "0.24.0"
4
+ VERSION = "0.25.0"
5
5
  end
data/sig/manifest.yaml ADDED
@@ -0,0 +1,5 @@
1
+ dependencies:
2
+ - name: activerecord
3
+ - name: activesupport
4
+ - name: thor
5
+ - name: csv
@@ -0,0 +1,9 @@
1
+ module MasterDataTool
2
+ module ActAsMasterData
3
+ extend ActiveSupport::Concern
4
+
5
+ module ClassMethods
6
+ def master_data?: () -> true
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,9 @@
1
+ module MasterDataTool
2
+ module Command
3
+ module Dump
4
+ extend ActiveSupport::Concern
5
+
6
+ def dump: () -> nil
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,15 @@
1
+ module MasterDataTool
2
+ module Command
3
+ module Import
4
+ extend ActiveSupport::Concern
5
+
6
+ def import: () -> untyped
7
+
8
+ def import_all: () -> untyped
9
+
10
+ private
11
+
12
+ def build_import_executor: (SpecConfig spec_config) -> untyped
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,15 @@
1
+ module MasterDataTool
2
+ module Command
3
+ module Verify
4
+ extend ActiveSupport::Concern
5
+
6
+ def verify: () -> untyped
7
+
8
+ def verify_all: () -> untyped
9
+
10
+ private
11
+
12
+ def build_verify_executor: (SpecConfig spec_config) -> untyped
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,9 @@
1
+ module MasterDataTool
2
+ class Config
3
+ def initialize: () -> void
4
+
5
+ def spec_config: (String spec_name) -> SpecConfig?
6
+
7
+ def csv_dir_for: (spec_name: String, ?override_identifier: String?) -> Pathname
8
+ end
9
+ end
@@ -0,0 +1,24 @@
1
+ module MasterDataTool
2
+ module Dump
3
+ class Config
4
+ DEFAULT_IGNORE_TABLES: Array[String]
5
+ DEFAULT_IGNORE_COLUMNS: Array[String]
6
+ DEFAULT_VALUES: { ignore_empty_table: bool, ignore_tables: Array[String], ignore_column_names: Array[String], only_tables: Array[String] }
7
+
8
+ attr_accessor ignore_empty_table: bool
9
+ attr_accessor ignore_tables: Array[String]
10
+ attr_accessor ignore_column_names: Array[String]
11
+ attr_accessor only_tables: Array[String]
12
+
13
+ def initialize: (ignore_empty_table: bool, ignore_tables: Array[String], ignore_column_names: Array[String], only_tables: Array[String]) -> void
14
+
15
+ def configure: () { (Config) -> void } -> void
16
+
17
+ def ignore_tables=: (Array[String] tables) -> Array[String]
18
+
19
+ def ignore_column_names=: (Array[String] column_names) -> Array[String]
20
+
21
+ def self.default_config: () -> Config
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,26 @@
1
+ module MasterDataTool
2
+ module Dump
3
+ class Executor
4
+ class Error < Struct[untyped]
5
+ attr_accessor table: String
6
+ attr_accessor exception: StandardError
7
+ end
8
+
9
+ def initialize: (spec_config: SpecConfig, dump_config: Dump::Config, verbose: bool) -> void
10
+
11
+ def execute: () -> Array[Error]
12
+
13
+ private
14
+
15
+ attr_reader spec_config: SpecConfig
16
+ attr_reader dump_config: Dump::Config
17
+ attr_reader verbose: bool
18
+
19
+ def print_message: (String message) -> nil
20
+
21
+ def dump_to_csv: (String table) -> nil
22
+
23
+ def ignore?: (Class model_klass) -> bool
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,20 @@
1
+ module MasterDataTool
2
+ module Import
3
+ class Config
4
+ DEFAULT_VALUES: { only_tables: Array[String], except_tables: Array[String], skip_no_change: bool, ignore_foreign_key_when_delete: bool }
5
+
6
+ attr_accessor only_tables: Array[String]
7
+ attr_accessor except_tables: Array[String]
8
+ attr_accessor skip_no_change: bool
9
+ attr_accessor ignore_foreign_key_when_delete: bool
10
+
11
+ def initialize: (only_tables: Array[String], except_tables: Array[String], skip_no_change: bool, ignore_foreign_key_when_delete: bool) -> void
12
+
13
+ def skip_table?: (String table_name) -> bool
14
+
15
+ def configure: () { (Config) -> void } -> void
16
+
17
+ def self.default_config: () -> Config
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,43 @@
1
+ module MasterDataTool
2
+ module Import
3
+ class Executor
4
+ def initialize: (spec_config: SpecConfig, import_config: Import::Config?, verify_config: Verify::Config?, dry_run: bool, verify: bool, silent: bool, override_identifier: String?, report_printer: Report::Printer?) -> void
5
+
6
+ def execute: () -> nil
7
+
8
+ private
9
+
10
+ attr_reader spec_config: SpecConfig
11
+ attr_reader import_config: Import::Config
12
+ attr_reader verify_config: Verify::Config
13
+ attr_reader dry_run: bool
14
+ attr_reader verify: bool
15
+ attr_reader silent: bool
16
+ attr_reader override_identifier: String?
17
+ attr_reader report_printer: Report::DefaultPrinter
18
+ attr_reader master_data_statuses_by_name: Hash[String, MasterDataStatus]
19
+
20
+ def load_master_data_statuses: () -> Hash[String, MasterDataStatus]
21
+
22
+ def print_execute_options: () -> nil
23
+
24
+ def build_master_data_collection: () -> MasterDataCollection
25
+
26
+ def import_all!: (MasterDataCollection master_data_collection) -> untyped
27
+
28
+ def transaction: -> untyped
29
+
30
+ def verify_all!: (MasterDataCollection master_data_collection) -> untyped
31
+
32
+ def save_master_data_statuses!: (MasterDataCollection master_data_collection) -> untyped
33
+
34
+ def print_affected_tables: (MasterDataCollection master_data_collection) -> untyped
35
+
36
+ def load_skip_table?: (MasterDataFile master_data_file) -> bool
37
+
38
+ def extract_master_data_csv_paths: () -> Array[Pathname]
39
+
40
+ def overridden_master_data_csv_paths: () -> Array[Pathname]
41
+ end
42
+ end
43
+ end
@@ -0,0 +1,69 @@
1
+ module MasterDataTool
2
+ class MasterData
3
+ @affected: bool
4
+ @before_count: Integer
5
+ @after_count: Integer
6
+
7
+ BULK_INSERT_SIZE: Integer
8
+
9
+ attr_reader master_data_file: MasterDataFile
10
+ attr_reader model_klass: Class
11
+ attr_reader columns: Array[String]
12
+ attr_reader spec_config: SpecConfig
13
+
14
+ def initialize: (spec_config: SpecConfig, master_data_file: MasterDataFile, model_klass: Class) -> void
15
+
16
+ def self.build: (spec_config: SpecConfig, master_data_file: MasterDataFile, ?load: bool) -> MasterData
17
+
18
+ def basename: () -> Pathname
19
+
20
+ def load: () -> true
21
+
22
+ def import_records: () -> Array[ActiveRecord::Base]
23
+
24
+ def affected_records: () -> Array[ActiveRecord::Base]
25
+
26
+ def new_records: () -> Array[ActiveRecord::Base]
27
+
28
+ def updated_records: () -> Array[ActiveRecord::Base]
29
+
30
+ def no_change_records: () -> Array[ActiveRecord::Base]
31
+
32
+ def deleted_records: () -> Array[ActiveRecord::Base]
33
+
34
+ def loaded?: () -> bool
35
+
36
+ def affected?: () -> bool
37
+
38
+ def before_count: () -> Integer
39
+
40
+ def after_count: () -> Integer
41
+
42
+ def table_name: () -> String
43
+
44
+ def import!: (import_config: Import::Config, ?dry_run: bool) -> Report::ImportReport
45
+
46
+ def verify!: (verify_config: Verify::Config, ?ignore_fail: bool) -> Report::VerifyReport
47
+
48
+ def print_affected_table: () -> Report::PrintAffectedTableReport?
49
+
50
+ private
51
+
52
+ attr_writer loaded: bool
53
+ attr_writer columns: Array[String]
54
+ attr_writer new_records: Array[ActiveRecord::Base]
55
+ attr_writer updated_records: Array[ActiveRecord::Base]
56
+ attr_writer no_change_records: Array[ActiveRecord::Base]
57
+ attr_writer deleted_records: Array[ActiveRecord::Base]
58
+
59
+ def decide_preload_associations: (Verify::Config verify_config) -> Array[String]
60
+
61
+ def decide_eager_load_associations: (Verify::Config verify_config) -> Array[String]
62
+
63
+ def build_records_from_csv: (untyped csv, Hash[Integer, ActiveRecord::Base] old_records_by_id) -> Hash[Integer, ActiveRecord::Base]
64
+
65
+ def enable_foreign_key_checks: () -> void
66
+
67
+ def disable_foreign_key_checks: () -> void
68
+ end
69
+ end
@@ -0,0 +1,14 @@
1
+ module MasterDataTool
2
+ class MasterDataCollection
3
+ @collection: Array[MasterData]
4
+
5
+ def initialize: () -> void
6
+
7
+ def append: (master_data: MasterData) -> Array[MasterData]
8
+
9
+ def each: () { (MasterData) -> void } -> void
10
+ | () -> Enumerator[MasterData, void]
11
+
12
+ def to_a: () -> Array[MasterData]
13
+ end
14
+ end
@@ -0,0 +1,20 @@
1
+ module MasterDataTool
2
+ class MasterDataFile
3
+ attr_reader spec_name: String
4
+ attr_reader table_name: String
5
+ attr_reader path: Pathname
6
+ attr_reader override_identifier: String?
7
+
8
+ def initialize: (spec_name: String, table_name: String, path: Pathname, override_identifier: String?) -> void
9
+
10
+ def self.build: (spec_name: String, path: Pathname, override_identifier: String?) -> MasterDataFile
11
+
12
+ def basename: () -> Pathname
13
+
14
+ def ==: (Integer | Object other) -> bool
15
+
16
+ alias eql? ==
17
+
18
+ def hash: () -> Integer
19
+ end
20
+ end
@@ -0,0 +1,22 @@
1
+ module MasterDataTool
2
+ class MasterDataFileCollection
3
+ def initialize: (spec_name: String, ?override_identifier: String?) -> void
4
+
5
+ def to_a: () -> Array[MasterDataFile]
6
+
7
+ def each: () { (MasterDataFile) -> void } -> void
8
+ | () -> Enumerator[MasterDataFile, void]
9
+
10
+ private
11
+
12
+ attr_reader spec_name: String
13
+ attr_reader override_identifier: String?
14
+ attr_reader collection: Array[MasterDataFile]
15
+
16
+ def build: () -> untyped
17
+
18
+ def extract_master_data_csv_paths: () -> untyped
19
+
20
+ def overridden_master_data_csv_paths: () -> Array[untyped]
21
+ end
22
+ end
@@ -0,0 +1,17 @@
1
+ module MasterDataTool
2
+ class MasterDataStatus < ::ActiveRecord::Base
3
+ def will_change?: (MasterDataFile master_data_file) -> bool
4
+
5
+ def model_klass: () -> Class
6
+
7
+ def self.build: (spec_name: String, master_data_file: MasterDataFile) -> MasterDataStatus
8
+
9
+ def self.import_records!: (records: Array[MasterDataStatus], ?dry_run: bool) -> nil
10
+
11
+ def self.decide_version: (Pathname csv_path) -> String
12
+
13
+ private
14
+
15
+ def self.import_columns: () -> Array[String]
16
+ end
17
+ end
@@ -0,0 +1,15 @@
1
+ module MasterDataTool
2
+ module Report
3
+ module Core
4
+ attr_reader master_data: MasterData
5
+
6
+ def initialize: (master_data: MasterData) -> void
7
+
8
+ def print: (printer: Printer) -> untyped
9
+
10
+ private
11
+
12
+ def convert_to_ltsv: ({ operation: :affected_table, table_name: String } items) -> String
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,9 @@
1
+ module MasterDataTool
2
+ module Report
3
+ class DefaultPrinter
4
+ include Printer
5
+
6
+ def print: (message: String) -> nil
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,23 @@
1
+ module MasterDataTool
2
+ module Report
3
+ class ImportReport
4
+ include Core
5
+
6
+ def reports: () -> Hash[Symbol, Array[Hash[untyped, untyped]]]
7
+
8
+ def print: (printer: Printer) -> untyped
9
+
10
+ private
11
+
12
+ def count_report: () -> Hash[Symbol, Array[Hash[untyped, untyped]]]
13
+
14
+ def new_records_report: () -> Hash[Symbol, Array[Hash[untyped, untyped]]]
15
+
16
+ def updated_records_report: () -> Hash[Symbol, Array[Hash[untyped, untyped]]]
17
+
18
+ def no_change_records_report: () -> Hash[Symbol, Array[Hash[untyped, untyped]]]
19
+
20
+ def deleted_records_report: () -> Hash[Symbol, Array[Hash[untyped, untyped]]]
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,9 @@
1
+ module MasterDataTool
2
+ module Report
3
+ class PrintAffectedTableReport
4
+ include Core
5
+
6
+ def print: (printer: Printer) -> untyped
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,13 @@
1
+ module MasterDataTool
2
+ module Report
3
+ module Printer
4
+ attr_reader spec_config: SpecConfig
5
+
6
+ attr_accessor silent: bool
7
+
8
+ def initialize: (spec_config: SpecConfig, silent: bool) -> void
9
+
10
+ def print: (message: String) -> nil
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,17 @@
1
+ module MasterDataTool
2
+ module Report
3
+ class VerifyReport
4
+ include Core
5
+
6
+ attr_reader reports: Array[{ operation: :verify, table_name: String, valid: bool, id: Integer }]
7
+
8
+ def initialize: (master_data: MasterData) -> void
9
+
10
+ def append: (report: { operation: :verify, table_name: String, valid: bool, id: Integer }) -> Array[{ operation: :verify, table_name: String, valid: bool, id: Integer }]
11
+
12
+ def print: (printer: Printer) -> untyped
13
+
14
+ def self.build_verify_record_report: (master_data: MasterData, record: ActiveRecord::Base, valid: bool) -> { operation: :verify, table_name: String, valid: bool, id: Integer }
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,14 @@
1
+ module MasterDataTool
2
+ class SpecConfig
3
+ attr_accessor spec_name: String
4
+ attr_accessor application_record_class: Class
5
+ attr_accessor import_config: Import::Config?
6
+ attr_accessor verify_config: Verify::Config?
7
+ attr_accessor dump_config: Dump::Config?
8
+ attr_accessor logger: Logger
9
+
10
+ def initialize: (spec_name: String, application_record_class: Class, ?import_config: Import::Config?, ?verify_config: Verify::Config?, ?dump_config: Dump::Config?, ?logger: Logger) -> void
11
+
12
+ def configure: () { (SpecConfig) -> void } -> void
13
+ end
14
+ end
@@ -0,0 +1,21 @@
1
+ module MasterDataTool
2
+ module Verify
3
+ class Config
4
+ DEFAULT_VALUES: { only_tables: Array[String], except_tables: Array[String], preload_belongs_to_associations: bool, preload_associations: Hash[Class, Array[Symbol]], eager_load_associations: Hash[Class, Array[Symbol]] }
5
+
6
+ attr_accessor only_tables: Array[String]
7
+ attr_accessor except_tables: Array[String]
8
+ attr_accessor preload_belongs_to_associations: bool
9
+ attr_accessor preload_associations: Hash[Class, Array[Symbol]]
10
+ attr_accessor eager_load_associations: Hash[Class, Array[Symbol]]
11
+
12
+ def initialize: (only_tables: Array[String], except_tables: Array[String], preload_belongs_to_associations: bool, preload_associations: Hash[Class, Array[Symbol]], eager_load_associations: Hash[Class, Array[Symbol]]) -> void
13
+
14
+ def skip_table?: (String table_name) -> bool
15
+
16
+ def configure: () { (Config) -> void } -> void
17
+
18
+ def self.default_config: () -> Config
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,19 @@
1
+ module MasterDataTool
2
+ module Verify
3
+ class Executor
4
+ def initialize: (spec_config: SpecConfig, verify_config: Verify::Config?, silent: bool, override_identifier: String?, report_printer: Report::Printer?) -> void
5
+
6
+ def execute: () -> untyped
7
+
8
+ private
9
+
10
+ attr_reader spec_config: SpecConfig
11
+ attr_reader verify_config: Verify::Config
12
+ attr_reader silent: bool
13
+ attr_reader override_identifier: String?
14
+ attr_reader report_printer: Report::DefaultPrinter
15
+
16
+ def build_master_data_collection: () -> MasterDataCollection
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,3 @@
1
+ module MasterDataTool
2
+ VERSION: String
3
+ end
@@ -1,400 +1,24 @@
1
1
  module MasterDataTool
2
- VERSION: String
3
-
4
- module ActAsMasterData
5
- extend ActiveSupport::Concern
6
-
7
- def master_data?: () -> true
8
- end
9
-
10
- class Config
11
- def initialize: () -> void
12
-
13
- def spec_config: (String spec_name) -> untyped
14
-
15
- def csv_dir_for: (spec_name: String, override_identifier: String?) -> Pathname
16
- end
17
-
18
- module Dump
19
- class Config
20
- DEFAULT_IGNORE_TABLES: [String]
21
- DEFAULT_IGNORE_COLUMNS: [String]
22
- DEFAULT_VALUES: { ignore_empty_table: bool, ignore_tables: Array[String], ignore_column_names: Array[String], only_tables: Array[String] }
23
-
24
- attr_accessor ignore_empty_table: bool
25
- attr_accessor ignore_tables: Array[String]
26
- attr_accessor ignore_column_names: Array[String]
27
- attr_accessor only_tables: Array[String]
28
-
29
- def initialize: (ignore_empty_table: bool, ignore_tables: Array[String], ignore_column_names: Array[String], only_tables: Array[String]) -> void
30
-
31
- def configure: () -> Config
32
-
33
- def self.default_config: () -> Config
34
- end
35
-
36
- class Executor
37
- class Error < Struct[untyped]
38
- attr_accessor table: String
39
- attr_accessor exception: StandardError
40
- end
41
-
42
- def initialize: (spec_config: SpecConfig, dump_config: Dump::Config, verbose: bool) -> void
43
-
44
- def execute: () -> Array[Error]
45
-
46
- private
47
-
48
- attr_reader spec_config: SpecConfig
49
- attr_reader dump_config: Dump::Config
50
- attr_reader verbose: bool
51
-
52
- def print_message: (String message) -> nil
53
-
54
- def dump_to_csv: (String table) -> nil
55
-
56
- def ignore?: (Class model_klass) -> bool
57
- end
58
- end
59
-
60
- module Import
61
- class Config
62
- DEFAULT_VALUES: { only_tables: Array[String], except_tables: Array[String], skip_no_change: bool, ignore_foreign_key_when_delete: bool }
63
-
64
- attr_accessor only_tables: Array[String]
65
- attr_accessor except_tables: Array[String]
66
- attr_accessor skip_no_change: bool
67
- attr_accessor ignore_foreign_key_when_delete: bool
68
-
69
- def initialize: (only_tables: Array[String], except_tables: Array[String], skip_no_change: bool, ignore_foreign_key_when_delete: bool) -> void
70
-
71
- def skip_table?: (String table_name) -> bool
72
-
73
- def configure: () -> Config
74
-
75
- def self.default_config: () -> Config
76
- end
77
-
78
- class Executor
79
- def initialize: (spec_config: SpecConfig, import_config: Import::Config?, verify_config: Verify::Config?, dry_run: bool, verify: bool, silent: bool, override_identifier: String?, report_printer: Report::Printer?) -> void
80
-
81
- def execute: () -> nil
82
-
83
- private
84
-
85
- attr_reader spec_config: SpecConfig
86
- attr_reader import_config: Import::Config
87
- attr_reader verify_config: Verify::Config
88
- attr_reader dry_run: bool
89
- attr_reader verify: bool
90
- attr_reader silent: bool
91
- attr_reader override_identifier: String?
92
- attr_reader report_printer: Report::DefaultPrinter
93
- attr_reader master_data_statuses_by_name: Hash[String, MasterDataStatus]
94
-
95
- def load_master_data_statuses: () -> Hash[String, MasterDataStatus]
96
-
97
- def print_execute_options: () -> nil
98
-
99
- def build_master_data_collection: () -> MasterDataCollection
100
-
101
- def import_all!: (MasterDataCollection master_data_collection) -> untyped
102
-
103
- def transaction: -> untyped
104
-
105
- def verify_all!: (MasterDataCollection master_data_collection) -> untyped
106
-
107
- def save_master_data_statuses!: (MasterDataCollection master_data_collection) -> untyped
108
-
109
- def print_affected_tables: (MasterDataCollection master_data_collection) -> untyped
110
-
111
- def load_skip_table?: (MasterDataFile master_data_file) -> bool
112
-
113
- def extract_master_data_csv_paths: () -> Array[Pathname]
114
-
115
- def overridden_master_data_csv_paths: () -> Array[Pathname]
116
- end
117
- end
118
-
119
- class MasterData
120
- @affected: bool
121
- @before_count: Integer
122
- @after_count: Integer
123
-
124
- attr_reader master_data_file: MasterDataFile
125
- attr_reader model_klass: Class
126
- attr_accessor columns: Array[String]
127
- attr_reader spec_config: SpecConfig
128
- attr_writer loaded: bool
129
- attr_writer new_records: Array[ActiveRecord::Base]
130
- attr_writer updated_records: Array[ActiveRecord::Base]
131
- attr_writer no_change_records: Array[ActiveRecord::Base]
132
- attr_writer deleted_records: Array[ActiveRecord::Base]
133
-
134
- def decide_preload_associations: (Verify::Config verify_config) -> Array[String]
135
-
136
- def decide_eager_load_associations: (Verify::Config verify_config) -> Array[String]
137
-
138
- def initialize: (spec_config: SpecConfig, master_data_file: MasterDataFile, model_klass: Class) -> void
139
-
140
- def self.build: (spec_config: SpecConfig, master_data_file: MasterDataFile, load: bool) -> MasterData
141
-
142
- def basename: () -> Pathname
143
-
144
- def load: () -> true
145
-
146
- def import_records: () -> Array[ActiveRecord::Base]
147
-
148
- def affected_records: () -> Array[ActiveRecord::Base]
149
-
150
- def new_records: () -> Array[ActiveRecord::Base]
151
-
152
- def updated_records: () -> Array[ActiveRecord::Base]
153
-
154
- def no_change_records: () -> Array[ActiveRecord::Base]
155
-
156
- def deleted_records: () -> Array[ActiveRecord::Base]
157
-
158
- def loaded?: () -> bool
159
-
160
- def affected?: () -> bool
161
-
162
- def before_count: () -> Integer
163
-
164
- def after_count: () -> Integer
165
-
166
- def table_name: () -> String
167
-
168
- def import!: (import_config: Import::Config, ?dry_run: bool) -> Report::ImportReport
169
-
170
- def verify!: (verify_config: Verify::Config, ?ignore_fail: bool) -> Report::VerifyReport
171
-
172
- def print_affected_table: () -> Report::PrintAffectedTableReport
173
-
174
- private
175
-
176
- def build_records_from_csv: (untyped csv, Hash[Integer, ActiveRecord::Base] old_records_by_id) -> Hash[Integer, ActiveRecord::Base]
177
-
178
- def enable_foreign_key_checks: () -> void
179
-
180
- def disable_foreign_key_checks: () -> void
181
- end
182
-
183
- class MasterDataCollection
184
- @collection: Array[MasterData]
185
-
186
- def initialize: () -> void
187
-
188
- def append: (master_data: MasterData) -> Array[MasterData]
189
-
190
- def each: () { (MasterData) -> void } -> void
191
- | () -> Enumerator[void, MasterData]
192
-
193
- def to_a: () -> Array[MasterData]
2
+ class Error < StandardError
194
3
  end
195
4
 
196
- class MasterDataFile
197
- attr_reader spec_name: String
198
- attr_reader table_name: String
199
- attr_reader path: Pathname
200
- attr_reader override_identifier: String?
201
-
202
- def initialize: (spec_name: String, table_name: String, path: Pathname, override_identifier: String?) -> void
203
-
204
- def self.build: (spec_name: String, path: Pathname, override_identifier: String?) -> MasterDataFile
205
-
206
- def basename: () -> Pathname
207
-
208
- def ==: (Integer | Object other) -> bool
209
-
210
- alias eql? ==
211
-
212
- def hash: () -> Integer
5
+ class DryRunError < StandardError
213
6
  end
214
7
 
215
- class MasterDataFileCollection
216
- attr_reader collection: [MasterDataFile]
217
- attr_reader spec_name: String
218
- attr_reader override_identifier: String?
219
-
220
- def initialize: (spec_name: String, override_identifier: String?) -> void
221
-
222
- def to_a: () -> Array[MasterDataFile]
223
-
224
- def each: () { (MasterDataFile) -> void } -> void
225
- | () -> Enumerator[void, MasterDataFile]
226
-
227
- private
228
-
229
- def build: () -> untyped
230
-
231
- def extract_master_data_csv_paths: () -> untyped
232
-
233
- def overridden_master_data_csv_paths: () -> Array[untyped]
8
+ class NotLoadedError < StandardError
234
9
  end
235
10
 
236
- class MasterDataStatus
237
- def will_change?: (MasterData master_data_file) -> bool
238
-
239
- def model_klass: () -> Class
240
-
241
- def self.build: (spec_name: String, master_data_file: MasterDataFile) -> MasterDataStatus
242
-
243
- def self.import_records!: (records: [MasterDataStatus], dry_run: bool) -> nil
244
-
245
- def self.decide_version: (Pathname csv_path) -> String
11
+ class VerifyFailed < StandardError
12
+ attr_accessor errors: untyped
246
13
 
247
- def self.import_columns: () -> Array[String]
14
+ def full_messages: () -> untyped
248
15
  end
249
16
 
250
- module Report
251
- module Printer
252
- attr_reader spec_config: SpecConfig
253
-
254
- attr_accessor silent: bool
255
-
256
- def initialize: (spec_config: SpecConfig, silent: bool) -> void
257
-
258
- def print: (message: String) -> nil
259
- end
260
-
261
- class DefaultPrinter
262
- include Printer
263
-
264
- def print: (message: String) -> nil
265
- end
266
-
267
- module Core
268
- attr_reader master_data: MasterData
269
-
270
- def initialize: (master_data: MasterData) -> void
271
-
272
- def print: (printer: Printer) -> untyped
273
-
274
- private
275
-
276
- def convert_to_ltsv: ({ operation: :affected_table, table_name: String } items) -> String
277
- end
278
-
279
- class ImportReport
280
- include Core
281
-
282
- def reports: () -> Hash[Symbol, Array[Hash[untyped, untyped]]]
283
-
284
- def print: (printer: Printer) -> untyped
285
-
286
- private
287
-
288
- def count_report: () -> Hash[Symbol, Array[Hash[untyped, untyped]]]
289
-
290
- def new_records_report: () -> Hash[Symbol, Array[Hash[untyped, untyped]]]
291
-
292
- def updated_records_report: () -> Hash[Symbol, Array[Hash[untyped, untyped]]]
293
-
294
- def no_change_records_report: () -> Hash[Symbol, Array[Hash[untyped, untyped]]]
17
+ def self.config: () -> Config
295
18
 
296
- def deleted_records_report: () -> Hash[Symbol, Array[Hash[untyped, untyped]]]
297
- end
19
+ def self.configure: () { (Config) -> void } -> void
298
20
 
299
- class VerifyReport
300
- include Core
21
+ def self.resolve_table_name: (spec_name: String, csv_path: Pathname, override_identifier: String?) -> String
301
22
 
302
- attr_reader reports: Array[{ operation: :verify, table_name: String, valid: bool, id: Integer }]
303
-
304
- def initialize: (master_data: MasterData) -> void
305
-
306
- def append: (report: { operation: :verify, table_name: String, valid: bool, id: Integer }) -> Array[{ operation: :verify, table_name: String, valid: bool, id: Integer }]
307
-
308
- def print: (printer: Printer) -> untyped
309
-
310
- def self.build_verify_record_report: (master_data: MasterData, record: ActiveRecord::Base, valid: bool) -> { operation: :verify, table_name: String, valid: bool, id: Integer }
311
- end
312
-
313
- class PrintAffectedTableReport
314
- include Core
315
-
316
- def print: (printer: Printer) -> untyped
317
- end
318
- end
319
-
320
- class SpecConfig
321
- attr_accessor spec_name: String
322
- attr_accessor application_record_class: Class
323
- attr_accessor import_config: Import::Config?
324
- attr_accessor verify_config: Verify::Config?
325
- attr_accessor dump_config: Dump::Config?
326
- attr_accessor logger: Logger
327
-
328
- def initialize: (spec_name: String, application_record_class: Class, import_config: Import::Config?, verify_config: Verify::Config?, dump_config: Dump::Config?, logger: Logger) -> void
329
-
330
- def configure: () -> SpecConfig
331
- end
332
-
333
- module Verify
334
- class Config
335
- DEFAULT_VALUES: { only_tables: Array[String], except_tables: Array[String], preload_belongs_to_associations: bool, preload_associations: Hash[Class, Array[Symbol]], eager_load_associations: Hash[Class, Array[Symbol]] }
336
-
337
- attr_accessor only_tables: Array[String]
338
- attr_accessor except_tables: Array[String]
339
- attr_accessor preload_belongs_to_associations: bool
340
- attr_accessor preload_associations: Hash[Class, Array[Symbol]]
341
- attr_accessor eager_load_associations: Hash[Class, Array[Symbol]]
342
-
343
- def initialize: (only_tables: Array[String], except_tables: Array[String], preload_belongs_to_associations: bool, preload_associations: Hash[Class, Array[Symbol]], eager_load_associations: Hash[Class, Array[Symbol]]) -> void
344
-
345
- def skip_table?: (String table_name) -> bool
346
-
347
- def configure: () -> Config
348
-
349
- def self.default_config: () -> Config
350
- end
351
-
352
- class Executor
353
- def initialize: (spec_config: SpecConfig, verify_config: Verify::Config?, silent: bool, override_identifier: String?, report_printer: Report::Printer?) -> void
354
-
355
- def execute: () -> untyped
356
-
357
- private
358
-
359
- attr_reader spec_config: SpecConfig
360
- attr_reader verify_config: Verify::Config
361
- attr_reader silent: bool
362
- attr_reader override_identifier: String?
363
- attr_reader report_printer: Report::DefaultPrinter
364
-
365
- def build_master_data_collection: () -> MasterDataCollection
366
- end
367
- end
368
-
369
- module Command
370
- module Import
371
- extend ActiveSupport::Concern
372
-
373
- def import: () -> untyped
374
-
375
- def import_all: () -> untyped
376
-
377
- private
378
-
379
- def build_import_executor: (SpecConfig spec_config) -> untyped
380
- end
381
-
382
- module Verify
383
- extend ActiveSupport::Concern
384
-
385
- def verify: () -> untyped
386
-
387
- def verify_all: () -> untyped
388
-
389
- private
390
-
391
- def build_verify_executor: (SpecConfig spec_config) -> untyped
392
- end
393
-
394
- module Dump
395
- extend ActiveSupport::Concern
396
-
397
- def dump: () -> nil
398
- end
399
- end
23
+ def self.need_skip_table?: (String table_name, Array[String] only, Array[String] except) -> bool
400
24
  end
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: master_data_tool
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.24.0
4
+ version: 0.25.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Takahiro Ooishi
8
- autorequire:
9
8
  bindir: exe
10
9
  cert_chain: []
11
- date: 2025-11-11 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: rspec
@@ -247,14 +246,38 @@ files:
247
246
  - lib/master_data_tool/verify/config.rb
248
247
  - lib/master_data_tool/verify/executor.rb
249
248
  - lib/master_data_tool/version.rb
249
+ - sig/manifest.yaml
250
250
  - sig/master_data_tool.rbs
251
+ - sig/master_data_tool/act_as_master_data.rbs
252
+ - sig/master_data_tool/command/dump.rbs
253
+ - sig/master_data_tool/command/import.rbs
254
+ - sig/master_data_tool/command/verify.rbs
255
+ - sig/master_data_tool/config.rbs
256
+ - sig/master_data_tool/dump/config.rbs
257
+ - sig/master_data_tool/dump/executor.rbs
258
+ - sig/master_data_tool/import/config.rbs
259
+ - sig/master_data_tool/import/executor.rbs
260
+ - sig/master_data_tool/master_data.rbs
261
+ - sig/master_data_tool/master_data_collection.rbs
262
+ - sig/master_data_tool/master_data_file.rbs
263
+ - sig/master_data_tool/master_data_file_collection.rbs
264
+ - sig/master_data_tool/master_data_status.rbs
265
+ - sig/master_data_tool/report/core.rbs
266
+ - sig/master_data_tool/report/default_printer.rbs
267
+ - sig/master_data_tool/report/import_report.rbs
268
+ - sig/master_data_tool/report/print_affected_table_report.rbs
269
+ - sig/master_data_tool/report/printer.rbs
270
+ - sig/master_data_tool/report/verify_report.rbs
271
+ - sig/master_data_tool/spec_config.rbs
272
+ - sig/master_data_tool/verify/config.rbs
273
+ - sig/master_data_tool/verify/executor.rbs
274
+ - sig/master_data_tool/version.rbs
251
275
  homepage: https://github.com/taka0125/master_data_tool
252
276
  licenses:
253
277
  - MIT
254
278
  metadata:
255
279
  homepage_uri: https://github.com/taka0125/master_data_tool
256
280
  source_code_uri: https://github.com/taka0125/master_data_tool
257
- post_install_message:
258
281
  rdoc_options: []
259
282
  require_paths:
260
283
  - lib
@@ -269,8 +292,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
269
292
  - !ruby/object:Gem::Version
270
293
  version: '0'
271
294
  requirements: []
272
- rubygems_version: 3.4.19
273
- signing_key:
295
+ rubygems_version: 3.6.9
274
296
  specification_version: 4
275
297
  summary: マスタデータの管理ツール
276
298
  test_files: []