pry-rescue 0.9 → 0.9.1.martin
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +38 -37
- data/bin/rescue +0 -5
- data/lib/pry-rescue.rb +1 -7
- data/pry-rescue.gemspec +1 -1
- metadata +96 -91
- data/lib/pry-rescue/rails.rb +0 -8
data/README.md
CHANGED
@@ -11,19 +11,6 @@ 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
|
-
|
27
14
|
If you're using Rack, you should use the middleware instead (though be careful to only
|
28
15
|
include it in development!)
|
29
16
|
```
|
@@ -62,19 +49,6 @@ from examples/example.rb:7:in `rescue in test'
|
|
62
49
|
[1] pry(main)>
|
63
50
|
```
|
64
51
|
|
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
|
-
|
78
52
|
cd-cause
|
79
53
|
========
|
80
54
|
|
@@ -119,24 +93,51 @@ From: examples/example.rb @ line 4 Object#test:
|
|
119
93
|
foo
|
120
94
|
```
|
121
95
|
|
96
|
+
Pry::rescued
|
97
|
+
============
|
98
|
+
|
99
|
+
If your exception handling needs are truly complicated then you can pass explicitly
|
100
|
+
rescued exceptions into Pry::rescue:
|
101
|
+
|
102
|
+
```ruby
|
103
|
+
def test
|
104
|
+
raise "foo"
|
105
|
+
end
|
106
|
+
|
107
|
+
def safely_test
|
108
|
+
test
|
109
|
+
rescue => e
|
110
|
+
Pry::rescued e
|
111
|
+
end
|
112
|
+
|
113
|
+
Pry::rescue do
|
114
|
+
safely_test
|
115
|
+
end
|
116
|
+
```
|
117
|
+
|
118
|
+
This lets you open a Pry session as part of your normal exception handling. N.B.
|
119
|
+
`Pry::rescued` must always be called from somewhere within a `Pry::rescue`, and the
|
120
|
+
exception object you pass to it must have actually been raised!
|
121
|
+
|
122
122
|
pry-stack explorer
|
123
123
|
==================
|
124
124
|
|
125
125
|
If you're running rubinius, or ruby-1.9, then you can use `pry-rescue` alongside
|
126
|
-
`pry-
|
126
|
+
`pry-stack_explorer`. This gives you the ability to move `up` or `down` the stack so that
|
127
127
|
you can get a better idea of why your function ended up in a bad state. Run
|
128
128
|
[example2.rb](https://github.com/ConradIrwin/pry-rescue/blob/master/examples/example2.rb) to get a feel for what this is like.
|
129
129
|
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
*
|
134
|
-
*
|
135
|
-
*
|
136
|
-
*
|
137
|
-
*
|
138
|
-
* jruby
|
139
|
-
*
|
130
|
+
Compatibility
|
131
|
+
=============
|
132
|
+
|
133
|
+
* mri 2.0
|
134
|
+
* mri 1.9.3
|
135
|
+
* mri 1.9.2
|
136
|
+
* mri 1.8.7 — occasionally the value for `self` will be incorrect.
|
137
|
+
* ree 1.8.7 — occasionally the value for `self` will be incorrect.
|
138
|
+
* jruby-head (--1.8, --1.9)
|
139
|
+
* jruby 1.6 (--1.8, --1.9) — the value for `self` is incorrect in `NoMethodError`s.
|
140
|
+
* rubinius (-Xversion=18, -Xversion=19) — some low-level exceptions are missed (e.g. ZeroDivisionError when doing `1 / 0`)
|
140
141
|
|
141
142
|
Meta-fu
|
142
143
|
=======
|
data/bin/rescue
CHANGED
data/lib/pry-rescue.rb
CHANGED
@@ -6,10 +6,6 @@ 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
|
-
|
13
9
|
begin
|
14
10
|
require 'pry-stack_explorer'
|
15
11
|
rescue LoadError
|
@@ -93,9 +89,7 @@ class PryRescue
|
|
93
89
|
# @param [String] file the absolute path
|
94
90
|
# @return [Boolean]
|
95
91
|
def user_path?(file)
|
96
|
-
!file.start_with?(RbConfig::CONFIG['libdir'])
|
97
|
-
!Gem::Specification.any?{ |gem| file.start_with?(gem.full_gem_path) } &&
|
98
|
-
!(file == '<internal:prelude>')
|
92
|
+
!file.start_with?(RbConfig::CONFIG['libdir'])
|
99
93
|
end
|
100
94
|
|
101
95
|
# Remove bindings that are part of Interception/Pry.rescue's internal
|
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'
|
3
|
+
s.version = '0.9.1.martin'
|
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'
|
metadata
CHANGED
@@ -1,96 +1,109 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: pry-rescue
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
|
6
|
-
- 0
|
7
|
-
- 9
|
8
|
-
version: "0.9"
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.9.1.martin
|
5
|
+
prerelease: 6
|
9
6
|
platform: ruby
|
10
|
-
authors:
|
7
|
+
authors:
|
11
8
|
- Conrad Irwin
|
12
9
|
- banisterfiend
|
13
10
|
- epitron
|
14
11
|
autorequire:
|
15
12
|
bindir: bin
|
16
13
|
cert_chain: []
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
dependencies:
|
21
|
-
- !ruby/object:Gem::Dependency
|
14
|
+
date: 2012-10-03 00:00:00.000000000 Z
|
15
|
+
dependencies:
|
16
|
+
- !ruby/object:Gem::Dependency
|
22
17
|
name: pry
|
23
|
-
|
24
|
-
|
25
|
-
requirements:
|
26
|
-
- -
|
27
|
-
- !ruby/object:Gem::Version
|
28
|
-
|
29
|
-
- 0
|
30
|
-
version: "0"
|
18
|
+
requirement: !ruby/object:Gem::Requirement
|
19
|
+
none: false
|
20
|
+
requirements:
|
21
|
+
- - ! '>='
|
22
|
+
- !ruby/object:Gem::Version
|
23
|
+
version: '0'
|
31
24
|
type: :runtime
|
32
|
-
version_requirements: *id001
|
33
|
-
- !ruby/object:Gem::Dependency
|
34
|
-
name: interception
|
35
25
|
prerelease: false
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
26
|
+
version_requirements: !ruby/object:Gem::Requirement
|
27
|
+
none: false
|
28
|
+
requirements:
|
29
|
+
- - ! '>='
|
30
|
+
- !ruby/object:Gem::Version
|
31
|
+
version: '0'
|
32
|
+
- !ruby/object:Gem::Dependency
|
33
|
+
name: interception
|
34
|
+
requirement: !ruby/object:Gem::Requirement
|
35
|
+
none: false
|
36
|
+
requirements:
|
37
|
+
- - ! '>='
|
38
|
+
- !ruby/object:Gem::Version
|
39
|
+
version: '0.3'
|
44
40
|
type: :runtime
|
45
|
-
version_requirements: *id002
|
46
|
-
- !ruby/object:Gem::Dependency
|
47
|
-
name: rspec
|
48
41
|
prerelease: false
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
42
|
+
version_requirements: !ruby/object:Gem::Requirement
|
43
|
+
none: false
|
44
|
+
requirements:
|
45
|
+
- - ! '>='
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0.3'
|
48
|
+
- !ruby/object:Gem::Dependency
|
49
|
+
name: rspec
|
50
|
+
requirement: !ruby/object:Gem::Requirement
|
51
|
+
none: false
|
52
|
+
requirements:
|
53
|
+
- - ! '>='
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
version: '0'
|
56
56
|
type: :development
|
57
|
-
version_requirements: *id003
|
58
|
-
- !ruby/object:Gem::Dependency
|
59
|
-
name: yard
|
60
57
|
prerelease: false
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
58
|
+
version_requirements: !ruby/object:Gem::Requirement
|
59
|
+
none: false
|
60
|
+
requirements:
|
61
|
+
- - ! '>='
|
62
|
+
- !ruby/object:Gem::Version
|
63
|
+
version: '0'
|
64
|
+
- !ruby/object:Gem::Dependency
|
65
|
+
name: yard
|
66
|
+
requirement: !ruby/object:Gem::Requirement
|
67
|
+
none: false
|
68
|
+
requirements:
|
69
|
+
- - ! '>='
|
70
|
+
- !ruby/object:Gem::Version
|
71
|
+
version: '0'
|
68
72
|
type: :development
|
69
|
-
version_requirements: *id004
|
70
|
-
- !ruby/object:Gem::Dependency
|
71
|
-
name: redcarpet
|
72
73
|
prerelease: false
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
74
|
+
version_requirements: !ruby/object:Gem::Requirement
|
75
|
+
none: false
|
76
|
+
requirements:
|
77
|
+
- - ! '>='
|
78
|
+
- !ruby/object:Gem::Version
|
79
|
+
version: '0'
|
80
|
+
- !ruby/object:Gem::Dependency
|
81
|
+
name: redcarpet
|
82
|
+
requirement: !ruby/object:Gem::Requirement
|
83
|
+
none: false
|
84
|
+
requirements:
|
85
|
+
- - ! '>='
|
86
|
+
- !ruby/object:Gem::Version
|
87
|
+
version: '0'
|
80
88
|
type: :development
|
81
|
-
|
82
|
-
|
83
|
-
|
89
|
+
prerelease: false
|
90
|
+
version_requirements: !ruby/object:Gem::Requirement
|
91
|
+
none: false
|
92
|
+
requirements:
|
93
|
+
- - ! '>='
|
94
|
+
- !ruby/object:Gem::Version
|
95
|
+
version: '0'
|
96
|
+
description: Allows you to wrap code in Pry::rescue{ } to open a pry session at any
|
97
|
+
unhandled exceptions
|
98
|
+
email:
|
84
99
|
- conrad.irwin@gmail.com
|
85
100
|
- jrmair@gmail.com
|
86
101
|
- chris@ill-logic.com
|
87
|
-
executables:
|
102
|
+
executables:
|
88
103
|
- rescue
|
89
104
|
extensions: []
|
90
|
-
|
91
105
|
extra_rdoc_files: []
|
92
|
-
|
93
|
-
files:
|
106
|
+
files:
|
94
107
|
- .gitignore
|
95
108
|
- Gemfile
|
96
109
|
- LICENSE.MIT
|
@@ -105,7 +118,6 @@ files:
|
|
105
118
|
- lib/pry-rescue/commands.rb
|
106
119
|
- lib/pry-rescue/core_ext.rb
|
107
120
|
- lib/pry-rescue/rack.rb
|
108
|
-
- lib/pry-rescue/rails.rb
|
109
121
|
- lib/pry/rescue.rb
|
110
122
|
- pry-rescue.gemspec
|
111
123
|
- spec/commands_spec.rb
|
@@ -118,35 +130,28 @@ files:
|
|
118
130
|
- spec/fixtures/super.rb
|
119
131
|
- spec/fixtures/uri.rb
|
120
132
|
- spec/pry_rescue_spec.rb
|
121
|
-
has_rdoc: true
|
122
133
|
homepage: https://github.com/ConradIrwin/pry-rescue
|
123
134
|
licenses: []
|
124
|
-
|
125
135
|
post_install_message:
|
126
136
|
rdoc_options: []
|
127
|
-
|
128
|
-
require_paths:
|
137
|
+
require_paths:
|
129
138
|
- lib
|
130
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
requirements:
|
139
|
-
- -
|
140
|
-
- !ruby/object:Gem::Version
|
141
|
-
|
142
|
-
- 0
|
143
|
-
version: "0"
|
139
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
140
|
+
none: false
|
141
|
+
requirements:
|
142
|
+
- - ! '>='
|
143
|
+
- !ruby/object:Gem::Version
|
144
|
+
version: '0'
|
145
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
146
|
+
none: false
|
147
|
+
requirements:
|
148
|
+
- - ! '>'
|
149
|
+
- !ruby/object:Gem::Version
|
150
|
+
version: 1.3.1
|
144
151
|
requirements: []
|
145
|
-
|
146
152
|
rubyforge_project:
|
147
|
-
rubygems_version: 1.
|
153
|
+
rubygems_version: 1.8.23
|
148
154
|
signing_key:
|
149
155
|
specification_version: 3
|
150
156
|
summary: Open a pry session on any unhandled exceptions
|
151
157
|
test_files: []
|
152
|
-
|