class Rails::Console

def self.start(*args)

def self.start(*args)
  new(*args).start
end

def environment

def environment
  options[:environment]
end

def initialize(app, options = {})

def initialize(app, options = {})
  @app     = app
  @options = options
  app.sandbox = sandbox?
  if sandbox? && app.config.disable_sandbox
    puts "Error: Unable to start console in sandbox mode as sandbox mode is disabled (config.disable_sandbox is true)."
    exit 1
  end
  app.load_console
  @console = app.config.console || IRB
  if @console == IRB
    IRB::WorkSpace.prepend(BacktraceCleaner)
    if Rails.env.production?
      ENV["IRB_USE_AUTOCOMPLETE"] ||= "false"
    end
  end
end

def sandbox?

def sandbox?
  options[:sandbox]
end

def set_environment!

def set_environment!
  Rails.env = environment
end

def start

def start
  set_environment! if environment?
  if sandbox?
    puts "Loading #{Rails.env} environment in sandbox (Rails #{Rails.version})"
    puts "Any modifications you make will be rolled back on exit"
  else
    puts "Loading #{Rails.env} environment (Rails #{Rails.version})"
  end
  if defined?(console::ExtendCommandBundle)
    console::ExtendCommandBundle.include(Rails::ConsoleMethods)
  end
  console.start
end