pry-rescue 0.9.pre.1 → 0.9

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.
data/README.md CHANGED
@@ -11,6 +11,19 @@ instead of `ruby`:
11
11
  rescue <script.rb> [arguments..]
12
12
  ```
13
13
 
14
+ If you're using Rails, you should add `pry-rescue` to the development section of your
15
+ Gemspec and then run rails server using rescue:
16
+
17
+ ```
18
+ rescue rails server
19
+ ```
20
+
21
+ If you're using `bundle exec` the rescue should go after the exec:
22
+
23
+ ```
24
+ bundle exec rescue rails server
25
+ ```
26
+
14
27
  If you're using Rack, you should use the middleware instead (though be careful to only
15
28
  include it in development!)
16
29
  ```
@@ -49,6 +62,19 @@ from examples/example.rb:7:in `rescue in test'
49
62
  [1] pry(main)>
50
63
  ```
51
64
 
65
+ Finally. If you're doing your own exception handling, you can ask pry to open on an exception that you've caught.
66
+ For this to work you must be inside a Pry::rescue{ } block.
67
+
68
+ ```ruby
69
+ def test
70
+ raise "foo"
71
+ rescue => e
72
+ Pry::rescued(e)
73
+ end
74
+
75
+ Pry::rescue{ test }
76
+ ```
77
+
52
78
  cd-cause
53
79
  ========
54
80
 
@@ -97,18 +123,20 @@ pry-stack explorer
97
123
  ==================
98
124
 
99
125
  If you're running rubinius, or ruby-1.9, then you can use `pry-rescue` alongside
100
- `pry-stack_explorer`. This gives you the ability to move `up` or `down` the stack so that
126
+ `pry-stack\_explorer`. This gives you the ability to move `up` or `down` the stack so that
101
127
  you can get a better idea of why your function ended up in a bad state. Run
102
128
  [example2.rb](https://github.com/ConradIrwin/pry-rescue/blob/master/examples/example2.rb) to get a feel for what this is like.
103
129
 
104
130
  Known bugs
105
131
  ==========
106
132
 
107
- Occasionally, when using ruby-1.8 the value for `self` will be incorrect. You will still
108
- be able to access local variables, but calling methods will not work as you expect.
109
-
110
- On rbx we are unable to intercept some exceptions thrown from inside the C++ VM, for
111
- example the ZeroDivisionError in `1 / 0`.
133
+ * ruby 2.0, 1.9.3, 1.9.2 no known bugs
134
+ * ruby 1.9.1 not supported
135
+ * ruby 1.8.7 — occasional incorrect values for self
136
+ * ree 1.8.7 no known bugs
137
+ * jruby 1.7 (1.8 mode and 1.9 mode) — no known bugs
138
+ * jruby 1.6 (1.8 mode and 1.9 mode) — incorrect value for self in NoMethodErrors
139
+ * rbx (1.8 mode and 1.9 mode) – does not catch some low-level errors (e.g. ZeroDivisionError)
112
140
 
113
141
  Meta-fu
114
142
  =======
data/bin/rescue CHANGED
@@ -17,6 +17,11 @@ What it does:
17
17
 
18
18
  }
19
19
 
20
+ if ARGV[0] == 'rails'
21
+ ENV['PRY_RESCUE_RAILS'] = 'true'
22
+ exec(*ARGV)
23
+ end
24
+
20
25
  if script = ARGV.shift
21
26
  $0 = File.expand_path(script)
22
27
  if File.exists? script
data/lib/pry-rescue.rb CHANGED
@@ -6,6 +6,10 @@ require File.expand_path('../pry-rescue/core_ext', __FILE__)
6
6
  require File.expand_path('../pry-rescue/commands', __FILE__)
7
7
  require File.expand_path('../pry-rescue/rack', __FILE__)
8
8
 
9
+ if ENV['PRY_RESCUE_RAILS']
10
+ require File.expand_path('../pry-rescue/rails', __FILE__)
11
+ end
12
+
9
13
  begin
10
14
  require 'pry-stack_explorer'
11
15
  rescue LoadError
@@ -1,33 +1,8 @@
1
1
  require 'pry-rescue'
2
2
  class PryRescue
3
3
  class Railtie < ::Rails::Railtie
4
-
5
4
  initializer "pry_rescue" do |app|
6
- if Rails.env.development?
7
- app.config.middleware.use PryRescue::Rack
8
-
9
- if defined?(::ActionDispatch::DebugExceptions)
10
- monkeypatch(::ActionDispatch::DebugExceptions)
11
-
12
- elsif defined?(::ActionDispatch::ShowExceptions)
13
- monkeypatch(::ActionDispatch::ShowExceptions)
14
-
15
- else
16
- raise LoadError, "Sorry, your version of rails is not supported."
17
- end
18
- end
19
- end
20
-
21
- def monkeypatch(middleware)
22
- middleware.class_eval do
23
-
24
- def render_exception_with_pry_rescue(env, exception)
25
- Pry::rescued(exception)
26
- render_exception_without_pry_rescue(env, exception)
27
- end
28
-
29
- alias_method_chain :render_exception, :pry_rescue
30
- end
5
+ app.config.middleware.use PryRescue::Rack
31
6
  end
32
7
  end
33
8
  end
data/pry-rescue.gemspec CHANGED
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'pry-rescue'
3
- s.version = '0.9.pre.1'
3
+ s.version = '0.9'
4
4
  s.summary = 'Open a pry session on any unhandled exceptions'
5
5
  s.description = 'Allows you to wrap code in Pry::rescue{ } to open a pry session at any unhandled exceptions'
6
6
  s.homepage = 'https://github.com/ConradIrwin/pry-rescue'
@@ -11,7 +11,7 @@ Gem::Specification.new do |s|
11
11
  s.executables = ['rescue']
12
12
 
13
13
  s.add_dependency 'pry'
14
- s.add_dependency 'interception'
14
+ s.add_dependency 'interception', '>= 0.3'
15
15
 
16
16
  s.add_development_dependency 'rspec'
17
17
  s.add_development_dependency 'yard'
metadata CHANGED
@@ -1,13 +1,11 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pry-rescue
3
3
  version: !ruby/object:Gem::Version
4
- prerelease: true
4
+ prerelease: false
5
5
  segments:
6
6
  - 0
7
7
  - 9
8
- - pre
9
- - 1
10
- version: 0.9.pre.1
8
+ version: "0.9"
11
9
  platform: ruby
12
10
  authors:
13
11
  - Conrad Irwin
@@ -41,7 +39,8 @@ dependencies:
41
39
  - !ruby/object:Gem::Version
42
40
  segments:
43
41
  - 0
44
- version: "0"
42
+ - 3
43
+ version: "0.3"
45
44
  type: :runtime
46
45
  version_requirements: *id002
47
46
  - !ruby/object:Gem::Dependency
@@ -137,13 +136,11 @@ required_ruby_version: !ruby/object:Gem::Requirement
137
136
  version: "0"
138
137
  required_rubygems_version: !ruby/object:Gem::Requirement
139
138
  requirements:
140
- - - ">"
139
+ - - ">="
141
140
  - !ruby/object:Gem::Version
142
141
  segments:
143
- - 1
144
- - 3
145
- - 1
146
- version: 1.3.1
142
+ - 0
143
+ version: "0"
147
144
  requirements: []
148
145
 
149
146
  rubyforge_project: