7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
# File 'lib/adaptation/base.rb', line 7
def self.run
if File.exists?("#{ADAPTOR_ROOT}/config/settings.yml")
$config = YAML::load(File.open("#{ADAPTOR_ROOT}/config/settings.yml"))[ADAPTOR_ENV]
end
if File.exists?("#{ADAPTOR_ROOT}/config/database.yml")
environment_configurations = YAML::load(File.open("#{ADAPTOR_ROOT}/config/database.yml"))[ADAPTOR_ENV]
ActiveRecord::Base.configurations.update(ADAPTOR_ENV => environment_configurations)
ActiveRecord::Base.establish_connection(ActiveRecord::Base.configurations[ADAPTOR_ENV])
end
require "#{ADAPTOR_ROOT}/app/adaptors/application.rb" if File.exist?("#{ADAPTOR_ROOT}/app/adaptors/application.rb")
Dir["#{ADAPTOR_ROOT}/app/adaptors/*.rb"].each do |f|
require f
end
Dir["#{ADAPTOR_ROOT}/app/messages/*.rb"].reject{|f| f =~ /\/_/}.each do |f|
require f
end
Dir["#{ADAPTOR_ROOT}/app/models/*.rb"].each do |f|
require f
end
end
|