bin/ridgepole in ridgepole-0.7.4 vs bin/ridgepole in ridgepole-0.7.5.beta

- old
+ new

@@ -22,11 +22,11 @@ integer: :int, bigint: :bigint, float: :float, string: :string, text: :text, - binary: :binary + binary: :binary, }.freeze config = nil env = 'development' mode = nil @@ -38,15 +38,16 @@ exit_code = 0 options = { dry_run: false, debug: false, - color: $stdout.tty? + color: $stdout.tty?, } set_mode = proc do |m| raise OptionParser::InvalidOption, 'More than one mode is specified' if mode + mode = m end def noop_migrate(delta, options) puts delta.script + "\n\n" unless delta.script.empty? @@ -83,10 +84,11 @@ opt.on('', '--table-options OPTIONS') { |v| options[:table_options] = v } opt.on('', '--alter-extra ALTER_SPEC') { |v| options[:alter_extra] = v } opt.on('', '--external-script SCRIPT') { |v| options[:external_script] = v } opt.on('', '--bulk-change') do raise OptionParser::InvalidOption, 'Cannot use `bulk-change` in `merge`' if options[:merge] + options[:bulk_change] = true end COLUMN_TYPES.each do |column_type, column_type_alias| opt.on('', "--default-#{column_type_alias}-limit LIMIT", Integer) do |v| @@ -127,13 +129,11 @@ opt.on('', '--skip-column-comment-change') { options[:skip_column_comment_change] = true } opt.on('', '--allow-pk-change') { options[:allow_pk_change] = true } opt.on('', '--create-table-with-index') { options[:create_table_with_index] = true } opt.on('', '--mysql-dump-auto-increment') do - if Gem::Version.new(ActiveRecord::VERSION::STRING) < Gem::Version.new('5.1') - raise OptionParser::InvalidOption, '`mysql-dump-auto-increment` is not available in `activerecord < 5.1`' - end + raise OptionParser::InvalidOption, '`mysql-dump-auto-increment` is not available in `activerecord < 5.1`' if Gem::Version.new(ActiveRecord::VERSION::STRING) < Gem::Version.new('5.1') options[:mysql_dump_auto_increment] = true end opt.on('-r', '--require LIBS', Array) { |v| v.each { |i| require i } } @@ -154,13 +154,11 @@ exit 1 end rescue StandardError => e warn("[ERROR] #{e.message}") - unless e.is_a?(OptionParser::ParseError) - puts "\t" + e.backtrace.join("\n\t") - end + puts "\t" + e.backtrace.join("\n\t") unless e.is_a?(OptionParser::ParseError) exit 1 end end @@ -249,9 +247,16 @@ if %w[.yml .yaml].include?(file_ext) Ridgepole::Config.load(diff_file, env) else File.open(diff_file) end + elsif Gem::Version.new(Psych::VERSION) >= Gem::Version.new('3.1.0.pre1') # Ruby 2.6 + YAML.safe_load( + diff_file, + permitted_classes: [], + permitted_symbols: [], + aliases: true + ) else YAML.safe_load(diff_file, [], [], true) end end