github github
  • Home
  • Pricing and Signup
  • Training
  • Gist
  • Blog
  • Login

avdi / hammertime

  • Admin
  • Watch Unwatch
  • Fork
  • Your Fork
  • Pull Request
  • Download Source
    • 108
    • 2
  • Source
  • Commits
  • Network (2)
  • Issues (0)
  • Downloads (2)
  • Graphs
  • Branch: master

click here to add a description

click here to add a homepage

  • Switch Branches (1)
    • master ✓
  • Switch Tags (2)
    • v0.0.2
    • v0.0.1
  • Branch List
Sending Request…

Exception debugging console for Ruby — Read more

  Cancel

test

  Cancel
  • HTTP
  • Git Read-Only

This URL has Read+Write access

Regenerated gemspec for version 0.0.2 
avdi (author)
Wed Jan 20 20:22:59 -0800 2010
commit  167a664102efe5671602
tree    757578f72d61bcadec80
parent  b4292c8af7e93febacba
hammertime /
name age
history
message
file .document Sun Jan 17 09:02:47 -0800 2010 Initial commit to hammertime. [avdi]
file .gitignore Sun Jan 17 17:43:29 -0800 2010 Added gemspec [avdi]
file LICENSE Sun Jan 17 09:02:47 -0800 2010 Initial commit to hammertime. [avdi]
file README.rdoc Sun Jan 17 18:05:55 -0800 2010 README updates. [avdi]
file Rakefile Sun Jan 17 17:42:16 -0800 2010 Updated Rakefile, README, etc. [avdi]
file VERSION Wed Jan 20 20:22:23 -0800 2010 Version bump to 0.0.2 [avdi]
file example.rb Sun Jan 17 17:42:16 -0800 2010 Updated Rakefile, README, etc. [avdi]
file hammertime.gemspec Wed Jan 20 20:22:59 -0800 2010 Regenerated gemspec for version 0.0.2 [avdi]
directory lib/ Wed Jan 20 20:21:51 -0800 2010 Made debug_supported? a class method instead of... [avdi]
directory spec/ Sun Jan 17 09:02:47 -0800 2010 Initial commit to hammertime. [avdi]
README.rdoc

hammertime

An interactive error console similar to those found in Lisp and Smalltalk environments.

Synopsis

Simply require the Hammertime library:

    require 'hammertime'

    $broken = true

    def faulty_method
      raise "Oh no!" if $broken
    end

    3.times do |n|
      puts "Attempt (#{n+1}/3)"
      begin
        faulty_method
        puts "No error raised"
      rescue => error
        puts "Error raised: #{error.inspect}"
      end
    end

When an error is raised, a menu of possible actions will be presented at the console:

    === Stop! Hammertime. ===
    An error has occurred at example.rb:4:in `raise_runtime_error'
    The error is: #<RuntimeError: Oh no!>
    1. Continue (process the exception normally)
    2. Ignore (proceed without raising an exception)
    3. Permit by type (don't ask about future errors of this type)
    4. Permit by line (don't ask about future errors raised from this point)
    5. Backtrace (show the call stack leading up to the error)
    6. Debug (start a debugger)
    7. Console (start an IRB session)
    What now?

This enables a fix-and-continue style of development:

    $ ruby example.rb
    Attempt (1/3)

    === Stop! Hammertime. ===
    An error has occurred at example.rb:6:in `faulty_method'
    The error is: #<RuntimeError: Oh no!>
    1. Continue (process the exception normally)
    2. Ignore (proceed without raising an exception)
    3. Permit by type (don't ask about future errors of this type)
    4. Permit by line (don't ask about future errors raised from this point)
    5. Backtrace (show the call stack leading up to the error)
    6. Debug (start a debugger)
    7. Console (start an IRB session)
    What now?
    7

    >> $broken = false
    => false
    >> exit

    1. Continue (process the exception normally)
    2. Ignore (proceed without raising an exception)
    3. Permit by type (don't ask about future errors of this type)
    4. Permit by line (don't ask about future errors raised from this point)
    5. Backtrace (show the call stack leading up to the error)
    6. Debug (start a debugger)
    7. Console (start an IRB session)
    What now?
    2
    No error raised
    Attempt (2/3)
    No error raised
    Attempt (3/3)
    No error raised

Known Bugs

  • Hammertime cannot intercept exceptions which are raised from native code.

TODO

  • Better integration with IRB to enable a "Retry" option.
  • Start console/debugger at fail site, instead of in Hammertime code.
  • Tests

Copyright

Copyright © 2010 Avdi Grimm. See LICENSE for details.

Dedicated Server Powered by the Dedicated Servers and
Cloud Computing of Rackspace Hosting®
  • Blog
  • Support
  • Training
  • Job Board
  • Shop
  • Contact
  • API
  • Status
  • © 2010 GitHub Inc. All rights reserved.
  • Terms of Service
  • Privacy
  • Security
  • English
  • Deutsch
  • Français
  • 日本語
  • Português (BR)
  • 中文
  • See all available languages

Your current locale selection: English. Choose another?

  • English
  • Afrikaans
  • Català
  • Čeština
  • Deutsch
  • Español
  • Français
  • Hrvatski
  • Indonesia
  • Italiano
  • 日本語
  • Nederlands
  • Norsk
  • Polski
  • Português (BR)
  • Српски
  • Svenska
  • 中文