13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
# File 'lib/thor/helpers/rdbms_dsl_generator.rb', line 13
def generate_whitelist_script(configuration_hash)
@configuration_hash = configuration_hash
@ar_object = ActiveRecord::Base.establish_connection(@configuration_hash)
@tables = @ar_object.connection.tables
erb = ERB.new( File.new(RDBMSDSLGenerator.source_root + "/../templates/whitelist_template.erb").read, nil, '-')
File.open('rdbms_whitelist_generated.rb', 'w') do |f|
f.write erb.result(binding)
f.close
end
rescue => e
puts "\e[31mActiverecord was unable to establish a connection to the specified database. Please check the configuration options and try again.\e[0m"
puts e.backtrace
end
|