Module: MasterDataTool

Defined in:
lib/master_data_tool.rb,
lib/master_data_tool/config.rb,
lib/master_data_tool/version.rb,
lib/master_data_tool/dump/config.rb,
lib/master_data_tool/master_data.rb,
lib/master_data_tool/report/core.rb,
lib/master_data_tool/spec_config.rb,
lib/master_data_tool/command/dump.rb,
lib/master_data_tool/dump/executor.rb,
lib/master_data_tool/import/config.rb,
lib/master_data_tool/verify/config.rb,
lib/master_data_tool/command/import.rb,
lib/master_data_tool/command/verify.rb,
lib/master_data_tool/report/printer.rb,
lib/master_data_tool/import/executor.rb,
lib/master_data_tool/verify/executor.rb,
lib/master_data_tool/master_data_file.rb,
lib/master_data_tool/act_as_master_data.rb,
lib/master_data_tool/master_data_status.rb,
lib/master_data_tool/report/import_report.rb,
lib/master_data_tool/report/verify_report.rb,
lib/master_data_tool/master_data_collection.rb,
lib/master_data_tool/report/default_printer.rb,
lib/master_data_tool/master_data_file_collection.rb,
lib/master_data_tool/report/print_affected_table_report.rb,
lib/generators/master_data_tool/install/install_generator.rb

Defined Under Namespace

Modules: ActAsMasterData, Command, Dump, Import, Report, Verify Classes: Config, DryRunError, Error, InstallGenerator, MasterData, MasterDataCollection, MasterDataFile, MasterDataFileCollection, MasterDataStatus, NotLoadedError, SpecConfig, VerifyFailed

Constant Summary collapse

VERSION =
"0.23.0"

Class Method Summary collapse

Class Method Details

.configObject



31
32
33
# File 'lib/master_data_tool.rb', line 31

def config
  @config ||= Config.new
end

.configure {|config| ... } ⇒ Object

Yields:



35
36
37
# File 'lib/master_data_tool.rb', line 35

def configure
  yield config
end

.need_skip_table?(table_name, only, except) ⇒ Boolean

  1. onlyを指定した時点でそのリストに含まれるものだけになるべき

  2. exceptのリストはどんな状況でも除外されるべき

  3. それ以外はすべて実行する

Returns:

  • (Boolean)


48
49
50
51
52
53
54
55
56
57
58
# File 'lib/master_data_tool.rb', line 48

def need_skip_table?(table_name, only, except)
  only_result = only.presence&.include?(table_name)
  except_result = except.presence&.include?(table_name)

  # onlyが指定された時点でデフォルトはskipとする
  default = only_result.nil? ? false : true
  return true if except_result == true
  return false if only_result == true

  default
end

.resolve_table_name(spec_name:, csv_path:, override_identifier:) ⇒ Object



39
40
41
42
43
# File 'lib/master_data_tool.rb', line 39

def resolve_table_name(spec_name:, csv_path:, override_identifier:)
  # 0001_table_nameのように投入順序を制御可能にする
  relative_path = MasterDataTool.config.csv_dir_for(spec_name: spec_name, override_identifier: override_identifier)
  csv_path.relative_path_from(relative_path).to_s.gsub(/^\d+_/, '').delete_suffix('.csv')
end