Skip to content

Instantly share code, notes, and snippets.

@hone
Created November 7, 2009 23:57
Show Gist options
  • Select an option

  • Save hone/228957 to your computer and use it in GitHub Desktop.

Select an option

Save hone/228957 to your computer and use it in GitHub Desktop.
# ... in def console_session
binding =
if File.exist?('config.ru')
RackEnvironment.new.create_binding
else
RailsEnvironment.new.create_binding
end
module Heroku
class RackEnvironment
def create_binding
# handle any loading errors
begin
load 'config.ru'
rescue
$std.err.puts $!
end
Proc.new {}.binding
end
end
class RailsEnvironment
def create_binding
# handle any loading errors
begin
require File.dirname(__FILE__) + '/../config/boot'
require 'commands/console'
rescue
$std.err.puts $!
end
Proc.new {}.binding
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment