Sha256: 72beca700ec568c7e1d352c2c0b34cfe9b27249e141d1a0ef01dc5d78d758f86

Contents?: true

Size: 979 Bytes

Versions: 1

Compression:

Stored size: 979 Bytes

Contents

require "yaml"
require "csv"
require "pathname"

require "active_support"
require "active_record"
require "activerecord-import"

require "seed_gimmick/version"
require "seed_gimmick/errors"
require "seed_gimmick/options"
require "seed_gimmick/inflector"
require "seed_gimmick/seed_io"
require "seed_gimmick/seed"
require "seed_gimmick/railtie" if defined?(Rails)

module SeedGimmick
  class << self
    def bootstrap(options = nil)
      Seed.find(options).each {|seed| seed.bootstrap }
    end

    def dump(options = nil)
      options ||= Options.new
      options.models.each do |model_name|
        Seed.new(model_name, options).dump
      end
    end

    def diff(options = nil)
      SeedGimmick::Seed.find(options).each do |seed|
        ActiveRecord::Migration.say_with_time(seed.table_name) do
          seed.compare.each do |changed|
            puts [changed.flag, changed.id, changed.change_values].join("\t")
          end
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
seed_gimmick-0.0.3 lib/seed_gimmick.rb