Sha256: 0b55c26e3c0fac960d0bc8a6757cf18ffec0d42664eec7cc5adbb8342b63945f

Contents?: true

Size: 710 Bytes

Versions: 2

Compression:

Stored size: 710 Bytes

Contents

class DatabaseConsole
  IRB = RUBY_PLATFORM =~ /(:?mswin|mingw)/ ? 'irb.bat' : 'irb'

  def initialize(arguments)
    @arguments = arguments
  end

  def run!
    libraries = ['irb/completion', 'rubygems', 'cli/database_console_init']
    libaries_string = libraries.map { |l| "-r #{l}" }.join(' ')

    ENV['RLA_DBCONSOLE_DATABASE'] = @arguments[:database]
    if @arguments[:apache_format]
      ENV['RLA_DBCONSOLE_FORMAT'] = 'apache'
      ENV['RLA_DBCONSOLE_FORMAT_ARGUMENT'] = @arguments[:apache_format]
    else
      ENV['RLA_DBCONSOLE_FORMAT'] = @arguments[:format]
    end
    # ENV['RLA_DBCONSOLE_FORMAT_ARGS'] = arguments['database']

    exec("#{IRB} #{libaries_string} --simple-prompt")
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
request-log-analyzer-1.13.4 lib/cli/database_console.rb
request-log-analyzer-1.13.3 lib/cli/database_console.rb