Readme.md in rack-webconsole-0.1.1 vs Readme.md in rack-webconsole-0.1.2

- old
+ new

@@ -25,19 +25,23 @@ ##Install In your Gemfile: - gem 'rack-webconsole' +```ruby +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 +```ruby +Rack::Webconsole.inject_jquery = true +``` ##Usage with Rails 3 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 @@ -46,29 +50,39 @@ ##Usage with Sinatra/Padrino With Sinatra and Padrino you have to tell your application to use the middleware: - require 'sinatra' - require 'rack/webconsole' +```ruby +require 'sinatra' +require 'rack/webconsole' - class MySinatraApp < Sinatra::Application - use Rack::Webconsole - # . . . - end +class MySinatraApp < Sinatra::Application + use Rack::Webconsole + # . . . +end - class SamplePadrino < Padrino::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. +##Usage with Rails 2 +You need to add the following code to an intializer (i.e. config/initializers/webconsole.rb): + +```ruby +require 'rack/webconsole' +ActionController::Dispatcher.middleware.insert_after 1, Rack::Webconsole +``` + ##Commands 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. * `reload!` resets all local variables @@ -86,12 +100,12 @@ ## Note on Patches/Pull Requests * Fork the project. * Make your feature addition or bug fix. -* Add tests for it. This is important so I don't break it in a +* Add tests for it. This is important so we don't break it in a future version unintentionally. -* Commit, do not mess with rakefile, version, or history. (if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull) +* Commit, do not mess with rakefile, version, or history. (if you want to have your own version, that is fine but bump version in a commit by itself we can ignore when we pull) * Send us a pull request. Bonus points for topic branches. ## Copyright Copyright (c) 2011 Codegram. See LICENSE for details.