code_buddy
code_buddy copied to clipboard
Sinatra app to view a Ruby stack trace
=CodeBuddy
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.
{See a Live Demo of CodeBuddy}[http://www.alexrothenberg.com/examples/code_buddy/]
== Use it in your Rails app
Follow the instructions below to add CodeBuddy to your Rails 3 or Rails 2 app then the Rails exception page just got better.
Make sure you've set the config setting config.consider_all_requests_local=true (it should already be that way in development.rb). Now whenever you see a exception page you'll be able to click on the stack and see it inside CodeBuddy.
=== Rails 3
Add one line to your app's Gemfile.
gem 'code_buddy'
And install it:
$ bundle install
=== Rails 2
Add these two lines to your environment.rb
config.gem 'code_buddy' config.middleware.use "CodeBuddy::ShowApp"
== Run as a standalone app
$ gem install code_buddy $ code_buddy start
Now open http://localhost:4567 and paste your stack.
== Open file in text editor To open the current file you're looking at in an editor press "e" it will open the current file in your current editor using the environment variable CODE_BUDDY_EDITOR or if that's not set EDITOR.
== Caveats
We haven't tested viewing a stack with Internet Explorer or running the Sinatra app on Windows.
We have tested with Rails 2.3 and Rails 3 on Ruby 1.8.7 and 1.9.2.
== Contributors
{Alex Rothenberg}[http://www.alexrothenberg.com/], {Daniel Higginbotham}[http://www.flyingmachinestudios.com/], {Pat Shaughnessy}[http://patshaughnessy.net/]
If you find a problem or have an idea please create an {issue}[https://github.com/patshaughnessy/code_buddy/issues] or fork the project and send us a pull request.