Created
November 7, 2009 23:57
-
-
Save hone/228957 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # ... 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