Sha256: b77730709b98154d914c20ea0668c46ae77016d0ee68777ce6df25c17417eb8a

Contents?: true

Size: 853 Bytes

Versions: 5

Compression:

Stored size: 853 Bytes

Contents

require_relative 'yaml_configurable'

module PgObjects
  ##
  # Use to set custom configuration:
  #
  #   PgObjects.configure do |config|
  #     # use relative from RAILS_ROOT
  #     config.before_path = 'db/alternate/before'
  #     # or full
  #     config.after_path = '/var/tmp/alternate/after'
  #     config.extensions = ['sql', 'txt']
  #     # suppress output to console
  #     config.silent = true
  #   end
  class << self
    def configure
      yield Config.config
    end

    def config
      Config.config
    end
  end

  class Config
    extend Dry::Configurable
    extend YamlConfigurable

    setting :before_path, default: 'db/objects/before'
    setting :after_path, default: 'db/objects/after'
    setting :extensions, default: ['sql']
    setting :silent, default: false

    load_from_yaml 'config/pg_objects.yml'
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
pg_objects-1.4.0 lib/pg_objects/config.rb
pg_objects-1.3.3 lib/pg_objects/config.rb
pg_objects-1.3.2 lib/pg_objects/config.rb
pg_objects-1.3.1 lib/pg_objects/config.rb
pg_objects-1.3.0 lib/pg_objects/config.rb