Sha256: 065ed68a953f896328e6b09613fc3faa76c16dfd5a413aabe7e58d63445cdf76

Contents?: true

Size: 750 Bytes

Versions: 1

Compression:

Stored size: 750 Bytes

Contents

module DataMigrate
  include ActiveSupport::Configurable
  class << self

    def configure
      yield config
    end

    def config
      @config ||= Config.new
    end
  end

  class Config
    attr_accessor :data_migrations_path, :data_template_path, :db_configuration, :spec_name

    DEFAULT_DATA_TEMPLATE_PATH = "data_migration.rb"

    def initialize
      @data_migrations_path = "db/data/"
      @data_template_path = DEFAULT_DATA_TEMPLATE_PATH
      @db_configuration = nil
      @spec_name = nil
    end

    def data_template_path=(value)
      @data_template_path = value.tap do |path|
        raise ArgumentError, "File not found: '#{path}'" unless path == DEFAULT_DATA_TEMPLATE_PATH || File.exists?(path)
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
data_migrate-8.5.0 lib/data_migrate/config.rb