Sha256: 72a3329709f9ef2933ed60b782e2871f459a6e77d86a7463fe3117bb74432c03
Contents?: true
Size: 2 KB
Versions: 2
Compression:
Stored size: 2 KB
Contents
#!/usr/bin/env ruby # frozen_string_literal: true require 'thor' require 'master_data_tool' environment_path = "#{Dir.pwd}/config/environment" require environment_path module MasterDataTool class CLI < Thor option :dry_run, default: nil, type: :boolean option :verify, default: nil, type: :boolean option :only_import_tables, default: nil, type: :array option :except_import_tables, default: nil, type: :array option :only_verify_tables, default: nil, type: :array option :except_verify_tables, default: nil, type: :array option :skip_no_change, default: nil, type: :boolean option :silent, default: nil, type: :boolean option :delete_all_ignore_foreign_key, default: nil, type: :boolean desc 'import', 'import' def import new_options = MasterDataTool.config.default_import_options.with_indifferent_access.merge(options) executor = MasterDataTool::Import::Executor.new(**new_options.symbolize_keys) executor.execute end option :ignore_empty_table, default: true, type: :boolean option :ignore_tables, default: [], type: :array option :ignore_column_names, default: [], type: :array option :only_tables, default: nil, type: :array option :verbose, default: false, type: :boolean desc 'dump', 'dump' def dump ignore_empty_table = options[:ignore_empty_table] ignore_tables = options[:ignore_tables] ignore_column_names = options[:ignore_column_names] only_tables = options[:only_tables] verbose = options[:verbose] executor = MasterDataTool::Dump::Executor.new( ignore_empty_table: ignore_empty_table, ignore_tables: ignore_tables, ignore_column_names: ignore_column_names, only_tables: only_tables, verbose: verbose ) errors = executor.execute return if errors.empty? message = errors.map { |error| "table:#{error.table}\tmessage:#{error.exception.message}" }.join("\n") raise message end end end MasterDataTool::CLI.start(ARGV)
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
master_data_tool-0.15.0 | exe/master_data_tool |
master_data_tool-0.14.0 | exe/master_data_tool |