Sha256: f8c5daf569467c7b490a4de5b59778a80f741f54cfa10101872c1d638893c607

Contents?: true

Size: 886 Bytes

Versions: 6

Compression:

Stored size: 886 Bytes

Contents

class Ridgepole::Client
  def initialize(conn_spec, options = {})
    @options = options
    ActiveRecord::Base.establish_connection(conn_spec)

    @dumper = Ridgepole::Dumper.new(@options)
    @parser = Ridgepole::DSLParser.new(@options)
    @diff = Ridgepole::Diff.new(@options)

    unless @options[:disable_mysql_unsigned]
      require 'activerecord-mysql-unsigned'
    end
  end

  def dump(&block)
    logger = Ridgepole::Logger.instance
    logger.verbose_info('# Load tables')
    @dumper.dump(&block)
  end

  def diff(dsl, opts = {})
    logger = Ridgepole::Logger.instance

    logger.verbose_info('# Parse DSL')
    expected_definition = @parser.parse(dsl, opts)
    logger.verbose_info('# Load tables')
    current_definition = @parser.parse(@dumper.dump)
    logger.verbose_info('# Compare definitions')
    @diff.diff(current_definition, expected_definition)
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
ridgepole-0.2.1 lib/ridgepole/client.rb
ridgepole-0.2.0 lib/ridgepole/client.rb
ridgepole-0.1.9 lib/ridgepole/client.rb
ridgepole-0.1.8 lib/ridgepole/client.rb
ridgepole-0.1.7 lib/ridgepole/client.rb
ridgepole-0.1.6 lib/ridgepole/client.rb