class DataAnon::ThorHelpers::RDBMSDSLGenerator
Public Class Methods
source_root()
click to toggle source
# File lib/thor/helpers/rdbms_dsl_generator.rb, line 9 def self.source_root File.dirname(__FILE__) end
Public Instance Methods
generate_whitelist_script(configuration_hash)
click to toggle source
# 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