hammertime 0.0.1 → 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -77,11 +77,13 @@ This enables a fix-and-continue style of development:
77
77
 
78
78
  == Known Bugs
79
79
 
80
- * Hammertime cannot intercept exceptions which are raised from native code.
80
+ * Hammertime cannot intercept exceptions which are raised from native code.
81
81
 
82
82
  == TODO
83
83
 
84
- * Better integration with IRB to enable a "Retry" option.
84
+ * Better integration with IRB to enable a "Retry" option.
85
+ * Start console/debugger at fail site, instead of in Hammertime code.
86
+ * Tests
85
87
 
86
88
  == Copyright
87
89
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.1
1
+ 0.0.2
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{hammertime}
8
- s.version = "0.0.1"
8
+ s.version = "0.0.2"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Avdi Grimm"]
12
- s.date = %q{2010-01-17}
12
+ s.date = %q{2010-01-20}
13
13
  s.description = %q{When this library is required, it replaces the default Ruby exception-raising
14
14
  behavior. When an error is raised, the developer is presented with a menu
15
15
  enabling them to ignore the error, view a stack trace, debug the error using IRB
@@ -1,5 +1,4 @@
1
1
  require 'highline'
2
- require 'ruby-debug'
3
2
 
4
3
  module Hammertime
5
4
  def self.ignored_errors
@@ -18,6 +17,15 @@ module Hammertime
18
17
  @stopped = value
19
18
  end
20
19
 
20
+ def self.debug_supported?
21
+ require 'ruby-debug'
22
+ @debug_support = true
23
+ rescue LoadError
24
+ warn "Unable to load ruby-debug"
25
+ warn "Gem not installed or debugging not supported on your platform"
26
+ @debug_support = false
27
+ end
28
+
21
29
  def hammertime_raise(*args)
22
30
  backtrace = caller(2)
23
31
  Thread.exclusive do
@@ -78,9 +86,11 @@ module Hammertime
78
86
  backtrace.each do |frame| c.say frame end
79
87
  false
80
88
  end
81
- menu.choice "Debug (start a debugger)" do
82
- debugger
83
- false
89
+ if Hammertime.debug_supported?
90
+ menu.choice "Debug (start a debugger)" do
91
+ debugger
92
+ false
93
+ end
84
94
  end
85
95
  menu.choice "Console (start an IRB session)" do
86
96
  require 'irb'
@@ -124,5 +134,5 @@ unless ::Object < Hammertime
124
134
  class ::Object
125
135
  include ::Hammertime
126
136
  end
127
- Debugger.start
137
+ Debugger.start if $hammertime_debug_support
128
138
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hammertime
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Avdi Grimm
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2010-01-17 00:00:00 -05:00
12
+ date: 2010-01-20 00:00:00 -05:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency