Class: MuleMigrations::Configurator
- Inherits:
-
Object
- Object
- MuleMigrations::Configurator
- Defined in:
- lib/mule_migrations/configurator.rb
Class Method Summary collapse
Instance Method Summary collapse
- #config ⇒ Object
- #config_for(environment) ⇒ Object
- #config_for_all ⇒ Object
-
#initialize(options = {}) ⇒ Configurator
constructor
A new instance of Configurator.
- #migrate_dir ⇒ Object
- #schema ⇒ Object
- #seeds ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ Configurator
Returns a new instance of Configurator.
31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/mule_migrations/configurator.rb', line 31 def initialize( = {}) defaults = { :config => "#{ENV["DB_NAME"]}db/config.yml", :migrate_dir => "#{ENV["DB_NAME"]}db/migrate", :seeds => "#{ENV["DB_NAME"]}db/seeds.rb", :schema => "#{ENV["DB_NAME"]}db/schema.rb" } @options = load_from_file(defaults.dup) || defaults.merge() ENV['SCHEMA'] = File.(schema) end |
Class Method Details
.environments_config {|proxy| ... } ⇒ Object
26 27 28 29 |
# File 'lib/mule_migrations/configurator.rb', line 26 def self.environments_config proxy = InternalConfigurationsProxy.new(load_configurations) yield(proxy) if block_given? end |
.load_configurations ⇒ Object
21 22 23 24 |
# File 'lib/mule_migrations/configurator.rb', line 21 def self.load_configurations @mule_configs ||= Configurator.new.config @environments_config ||= YAML.load(ERB.new(File.read(@mule_configs)).result).with_indifferent_access end |
Instance Method Details
#config ⇒ Object
43 44 45 |
# File 'lib/mule_migrations/configurator.rb', line 43 def config @options[:config] end |
#config_for(environment) ⇒ Object
63 64 65 |
# File 'lib/mule_migrations/configurator.rb', line 63 def config_for(environment) config_for_all[environment] end |
#config_for_all ⇒ Object
59 60 61 |
# File 'lib/mule_migrations/configurator.rb', line 59 def config_for_all Configurator.load_configurations.dup end |
#migrate_dir ⇒ Object
47 48 49 |
# File 'lib/mule_migrations/configurator.rb', line 47 def migrate_dir @options[:migrate_dir] end |
#schema ⇒ Object
55 56 57 |
# File 'lib/mule_migrations/configurator.rb', line 55 def schema @options[:schema] end |
#seeds ⇒ Object
51 52 53 |
# File 'lib/mule_migrations/configurator.rb', line 51 def seeds @options[:seeds] end |