Module: RailsLogConverter::CLI::Execute::ClassMethods

Defined in:
lib/rails_log_converter/cli/execute.rb

Instance Method Summary collapse

Instance Method Details

#close_databaseObject



30
31
32
# File 'lib/rails_log_converter/cli/execute.rb', line 30

def close_database
  ActiveRecord::Base.connection.disconnect!
end

#create_database(path) ⇒ Object



18
19
20
21
22
23
24
25
26
27
28
# File 'lib/rails_log_converter/cli/execute.rb', line 18

def create_database(path)
  ActiveRecord::Base.establish_connection(
    :adapter => "sqlite3",
    :database => path
  )
  UI.puts "Saving output file to #{path}"
  ActiveRecord::Base.connection

  ActiveRecord::Migration.verbose = Configuration.debug?
  ActiveRecord::Migrator.migrate(File.expand_path(File.dirname(__FILE__) + "/../db"), nil)
end

#executeObject



9
10
11
# File 'lib/rails_log_converter/cli/execute.rb', line 9

def execute
  parse(ARGV).execute!
end

#setup_loggerObject



13
14
15
16
# File 'lib/rails_log_converter/cli/execute.rb', line 13

def setup_logger
  ActiveRecord::Base.logger = Logger.new(Configuration.out_stream)
  ActiveRecord::Base.logger.level = Logger::WARN
end