Skip to content

Commit

Permalink
V0.0.2
Browse files Browse the repository at this point in the history
* do nothing when Rails::ShowExceptions is not loaded (i.e. production env)
* documentation
  • Loading branch information
alexrothenberg committed Dec 10, 2010
1 parent f379ec4 commit 60b0c96
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 15 deletions.
26 changes: 13 additions & 13 deletions README.rdoc
@@ -1,30 +1,30 @@
=CodeBuddy

CodeBuddy will display a Ruby stack in your browser, along with code snippets around each line of code in the stack.
CodeBuddy makes it easy for you to understand the code behind each line of a Ruby exception stack. When something goes wrong during development and you get an exception do you read through the stack trace and start opening files in VIM or TextMate? With CodeBuddy the stack trace and source files are all available in your browser making it easy to understand what's going on.

== Run as a Sinatra app

$ gem install code_buddy
$ code_buddy
== Sinatra/1.1.0 has taken the stage on 4567 for development with backup from Mongrel

Now open http://localhost:4567 and paste your stack.

== Run as Rack middleware
== Use it in your Rails app

Just add CodeBuddy to your Gemfile in any Rails 3 app:
Simply add one line to your app's Gemfile and the Rails exception page just got better.

gem 'code_buddy'

And install it:

$ bundle install

Now if config.consider_all_requests_local=true whenever you see a exception page you'll be able to click on the stack and see it inside CodeBuddy.
Now when you're running in development (or any environment with config.consider_all_requests_local=true) whenever you see a exception page you'll be able to click on the stack and see it inside CodeBuddy.

== Run as a Sinatra app

$ gem install code_buddy
$ code_buddy
== Sinatra/1.1.0 has taken the stage on 4567 for development with backup from Mongrel

Now open http://localhost:4567 and paste your stack.

== Caveats

This should also work as Rack middleware in Rails 2.3.x soon, but we haven't tested it yet.
This should also work as Rack middleware in Rails 2.3.x or any Rack app soon, but we haven't tried it yet.

We also haven't tested viewing a stack with Internet Explorer or running the Sinatra app on Windows.

Expand Down
4 changes: 3 additions & 1 deletion lib/code_buddy/middleware.rb
Expand Up @@ -9,7 +9,9 @@ def rails_loaded
module CodeBuddy
class Railtie < Rails::Railtie
initializer "code_buddy.add_middleware" do |app|
app.middleware.swap ActionDispatch::ShowExceptions, CodeBuddy::ShowExceptions
if app.config.action_dispatch.show_exceptions
app.middleware.swap ActionDispatch::ShowExceptions, CodeBuddy::ShowExceptions
end
end
end

Expand Down
2 changes: 1 addition & 1 deletion lib/code_buddy/version.rb
@@ -1,3 +1,3 @@
module CodeBuddy
VERSION = "0.0.1"
VERSION = "0.0.2"
end

0 comments on commit 60b0c96

Please sign in to comment.