Class: MasterDataTool::Import::Executor
- Inherits:
-
Object
- Object
- MasterDataTool::Import::Executor
- Defined in:
- lib/master_data_tool/import/executor.rb
Instance Method Summary collapse
- #execute ⇒ Object
-
#initialize(spec_config:, import_config: nil, verify_config: nil, dry_run: true, verify: true, silent: false, override_identifier: nil, report_printer: nil) ⇒ Executor
constructor
A new instance of Executor.
Constructor Details
#initialize(spec_config:, import_config: nil, verify_config: nil, dry_run: true, verify: true, silent: false, override_identifier: nil, report_printer: nil) ⇒ Executor
Returns a new instance of Executor.
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/master_data_tool/import/executor.rb', line 6 def initialize(spec_config:, import_config: nil, verify_config: nil, dry_run: true, verify: true, silent: false, override_identifier: nil, report_printer: nil) @spec_config = spec_config @import_config = import_config || MasterDataTool::Import::Config.default_config @verify_config = verify_config || MasterDataTool::Verify::Config.default_config @dry_run = dry_run @verify = verify @silent = silent @override_identifier = override_identifier @report_printer = report_printer || MasterDataTool::Report::DefaultPrinter.new(spec_config: spec_config) @report_printer.silent = silent @master_data_statuses_by_name = {} end |
Instance Method Details
#execute ⇒ Object
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/master_data_tool/import/executor.rb', line 25 def execute transaction do load_master_data_statuses master_data_collection = build_master_data_collection import_all!(master_data_collection) verify_all!(master_data_collection) if verify save_master_data_statuses!(master_data_collection) print_affected_tables(master_data_collection) raise DryRunError if dry_run master_data_collection end rescue DryRunError puts "[DryRun] end" end |