Module: Convertr

Defined in:
lib/convertr/convertor.rb,
lib/convertr.rb,
lib/convertr/file.rb,
lib/convertr/task.rb,
lib/convertr/runner.rb,
lib/convertr/migration.rb,
lib/convertr/scheduler.rb,
lib/convertr/scheduler_factory.rb,
lib/convertr/scheduler/all_bt_first.rb,
lib/convertr/scheduler/bt_600_first.rb

Overview

}}}

Defined Under Namespace

Modules: Scheduler, Version Classes: Config, Convertor, File, Migration, Runner, SchedulerFactory, Task

Class Method Summary collapse

Class Method Details

.configure(config = nil) {|Config.instance| ... } ⇒ Object

Yields:



22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/convertr.rb', line 22

def self.configure(config = nil)
  config ||= Config.instance
  yield Config.instance if block_given?
  enviroment = ENV['RAILS_ENV'] || 'development'
  config.db_config = YAML.load_file(config.db_config_file)[enviroment]
  if config.settings_file
    YAML.load_file(config.settings_file)[enviroment]['convertor'].each do |k, v|
      config.send("#{k}=", v)
    end
  end
  self.init!
end

.init!Object



35
36
37
38
39
40
41
# File 'lib/convertr.rb', line 35

def self.init!
  conf = Config.instance
  ActiveRecord::Base.establish_connection(conf.db_config)
  require 'convertr/file'
  require 'convertr/task'
  $stderr.puts "Tables not found" && exit(1) unless Convertr::File.table_exists? && Convertr::Task.table_exists?
end