In your Gemfile:
gem 'rack-webconsole'
Rack-webconsole needs JQuery. If you are using Rails 3, JQuery is loaded by default. In case you don't want to use JQuery in your application, rack-webconsole can inject it for you only when it needs it. To do that you should put this line somewhere in your application (a Rails initializer, or some configuration file):
Rack::Webconsole.inject_jquery = true
If you are using Rails 3, you have no further steps to do. It works! To give
it a try, fire up the Rails server and go to any page, press the ` key and
the console will show :)
With Sinatra and Padrino you have to tell your application to use the middleware:
require 'sinatra'
require 'rack/webconsole'
class MySinatraApp < Sinatra::Application
use Rack::Webconsole
# . . .
end
class SamplePadrino < Padrino::Application
use Rack::Webconsole
# . . .
end
NOTE: If you are using Bundler and initializing it from config.ru, you don't
have to require 'rack/webconsole'
manually, otherwise you have to.
And it works! Fire up the server, go to any page and press the ` key.
In the console you can issue whatever Ruby commands you want, except multiline commands. Local variables are kept, so you can get a more IRB-esque feeling.
To reset all local variables, just issue the reload!
command.
Run the test suite by typing:
rake
You can also build the documentation with the following command:
rake docs
Copyright (c) 2011 Codegram. See LICENSE for details.