pry-exception_explorer 0.1.7 → 0.1.8

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -5,9 +5,6 @@ pry-exception_explorer
5
5
 
6
6
  _Enter the context of exceptions_
7
7
 
8
- **Please note, this is a first release for pry-exception_explorer and as such it may still have teething
9
- problems. If you encounter any quirks or crashes please [file an issue](https://github.com/pry/pry-exception_explorer/issues)**
10
-
11
8
  `pry-exception_explorer` is an interactive error console for MRI Ruby 1.9.2+ inspired by the [Hammertime](https://github.com/avdi/hammertime)
12
9
  gem, which was in turn inspired by consoles found in the Lisp and Smalltalk environments. `pry-exception_explorer` is a plugin
13
10
  for the [Pry REPL](http://pry.github.com).
@@ -21,6 +18,7 @@ parent frames (using [pry-stack_explorer](https://github.com/pry/pry-stack_explo
21
18
  * Install the [gem](https://rubygems.org/gems/pry-exception_explorer): `gem install pry-exception_explorer`
22
19
  * Read the [documentation](http://rdoc.info/github/banister/pry-exception_explorer/master/file/README.md)
23
20
  * See the [source code](http://github.com/banister/pry-exception_explorer)
21
+ * See the [wiki](https://github.com/pry/pry-exception_explorer/wiki) for in-depth usage information.
24
22
 
25
23
  Example:
26
24
  --------
@@ -104,7 +102,6 @@ Features and limitations
104
102
 
105
103
  * Only works on Ruby 1.9.2+ (including 1.9.3) MRI.
106
104
  * Limited support for `C` exceptions -- only some exceptions that arise from C code are caught.
107
- * Wiki documentation coming soon ;)
108
105
 
109
106
  Contact
110
107
  -------
@@ -1,6 +1,7 @@
1
1
  Pry::CLI.add_options do
2
2
 
3
- on :w, :wrap, "Run the script wrapped by the exception explorer", true do |file|
3
+ on :w, :wrap, "Run the provided FILE wrapped by the exception explorer", true do |file|
4
+ require 'pry-exception_explorer'
4
5
  PryExceptionExplorer.wrap do
5
6
  require file
6
7
  end
@@ -27,70 +27,77 @@ class Exception
27
27
  end
28
28
 
29
29
  # `PryExceptionExplorer` monkey-patches to `Object`
30
- class Object
31
-
32
- # We monkey-patch the `raise` method so we can intercept exceptions
33
- def raise(*args)
34
- exception, string, array = args
30
+ module PryExceptionExplorer
31
+ module CoreExtensions
35
32
 
36
- if exception.is_a?(String)
37
- string = exception
38
- exception = RuntimeError
39
- end
33
+ # We monkey-patch the `raise` method so we can intercept exceptions
34
+ def raise(*args)
35
+ exception, string, array = args
40
36
 
41
- if exception.is_a?(Exception) || (exception.is_a?(Class) && exception < Exception)
42
- if PryExceptionExplorer.enabled?
43
- ex = string ? exception.exception(string) : exception.exception
44
- else
45
- return super(*args)
37
+ if exception.is_a?(String)
38
+ string = exception
39
+ exception = RuntimeError
46
40
  end
47
- elsif exception.nil?
48
- if $!
41
+
42
+ if exception.is_a?(Exception) || (exception.is_a?(Class) && exception < Exception)
49
43
  if PryExceptionExplorer.enabled?
50
- ex = $!.exception
44
+ ex = string ? exception.exception(string) : exception.exception
51
45
  else
52
- return super($!)
46
+ return super(*args)
47
+ end
48
+ elsif exception.nil?
49
+ if $!
50
+ if PryExceptionExplorer.enabled?
51
+ ex = $!.exception
52
+ else
53
+ return super($!)
54
+ end
55
+ else
56
+ if PryExceptionExplorer.enabled?
57
+ ex = RuntimeError.exception
58
+ else
59
+ return super(RuntimeError)
60
+ end
53
61
  end
54
62
  else
55
63
  if PryExceptionExplorer.enabled?
56
64
  ex = RuntimeError.exception
57
65
  else
58
- return super(RuntimeError)
66
+ return super(*args)
59
67
  end
60
68
  end
61
- else
62
- if PryExceptionExplorer.enabled?
63
- ex = RuntimeError.exception
64
- else
65
- return super(*args)
66
- end
67
- end
68
69
 
69
- ex.set_backtrace(array ? array : caller)
70
+ ex.set_backtrace(array ? array : caller)
70
71
 
71
- intercept_object = PryExceptionExplorer.intercept_object
72
+ intercept_object = PryExceptionExplorer.intercept_object
72
73
 
73
- # FIXME: CodeRay stuff is a hack because CodeRay generates a bunch of
74
- # exceptions that would cause EE to infiniloop on
75
- # intercept(Exception), find a better solution.
76
- if PryExceptionExplorer.should_intercept_exception?(binding.of_caller(1), ex) &&
77
- binding.of_caller(1).eval('[__method__, self.to_s]') != [:make_plugin_hash, "CodeRay::Encoders"]
74
+ # FIXME: CodeRay stuff is a hack because CodeRay generates a bunch of
75
+ # exceptions that would cause EE to infiniloop on
76
+ # intercept(Exception), find a better solution.
77
+ if PryExceptionExplorer.should_intercept_exception?(binding.of_caller(1), ex) &&
78
+ binding.of_caller(1).eval('[__method__, self.to_s]') != [:make_plugin_hash, "CodeRay::Encoders"]
78
79
 
79
- ex.exception_call_stack = binding.callers.tap { |v| v.shift(1 + intercept_object.skip_num) }
80
- PryExceptionExplorer.amend_exception_call_stack!(ex)
80
+ ex.exception_call_stack = binding.callers.tap { |v| v.shift(1 + intercept_object.skip_num) }
81
+ PryExceptionExplorer.amend_exception_call_stack!(ex)
81
82
 
82
- ex.should_intercept = true
83
+ ex.should_intercept = true
83
84
 
84
- if !PryExceptionExplorer.wrap_active?
85
- retval = PryExceptionExplorer.enter_exception(ex, :inline => true)
85
+ if !PryExceptionExplorer.wrap_active?
86
+ retval = PryExceptionExplorer.enter_exception(ex, :inline => true)
87
+ end
86
88
  end
87
- end
88
89
 
89
- if retval != PryExceptionExplorer::CONTINUE_INLINE_EXCEPTION
90
- callcc do |cc|
91
- ex.continuation = cc
92
- super(ex)
90
+ if retval != PryExceptionExplorer::CONTINUE_INLINE_EXCEPTION
91
+ callcc do |cc|
92
+ ex.continuation = cc
93
+ super(ex)
94
+ end
93
95
  end
94
96
  end
95
97
  end
96
98
  end
99
+
100
+
101
+ class Object
102
+ include PryExceptionExplorer::CoreExtensions
103
+ end
@@ -1,3 +1,3 @@
1
1
  module PryExceptionExplorer
2
- VERSION = "0.1.7"
2
+ VERSION = "0.1.8"
3
3
  end
@@ -2,17 +2,17 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = "pry-exception_explorer"
5
- s.version = "0.1.7"
5
+ s.version = "0.1.8"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["John Mair (banisterfiend)"]
9
- s.date = "2012-02-10"
9
+ s.date = "2012-02-20"
10
10
  s.description = "Enter the context of exceptions"
11
11
  s.email = "jrmair@gmail.com"
12
12
  s.files = [".gemtest", ".gitignore", ".travis.yml", ".yardopts", "CHANGELOG", "Gemfile", "LICENSE", "README.md", "Rakefile", "examples/example_c_inline.rb", "examples/example_inline.rb", "examples/example_wrap.rb", "lib/pry-exception_explorer.rb", "lib/pry-exception_explorer/cli.rb", "lib/pry-exception_explorer/commands.rb", "lib/pry-exception_explorer/core_ext.rb", "lib/pry-exception_explorer/intercept.rb", "lib/pry-exception_explorer/lazy_frame.rb", "lib/pry-exception_explorer/shim_builder.rb", "lib/pry-exception_explorer/version.rb", "pry-exception_explorer.gemspec", "test/helper.rb", "test/test_exceptions_in_pry.rb", "test/test_inline_exceptions.rb", "test/test_raise.rb", "test/test_wrapped_exceptions.rb"]
13
13
  s.homepage = "https://github.com/banister/pry-exception_explorer"
14
14
  s.require_paths = ["lib"]
15
- s.rubygems_version = "1.8.11"
15
+ s.rubygems_version = "1.8.16"
16
16
  s.summary = "Enter the context of exceptions"
17
17
  s.test_files = ["test/helper.rb", "test/test_exceptions_in_pry.rb", "test/test_inline_exceptions.rb", "test/test_raise.rb", "test/test_wrapped_exceptions.rb"]
18
18
 
metadata CHANGED
@@ -1,59 +1,55 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: pry-exception_explorer
3
- version: !ruby/object:Gem::Version
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.8
4
5
  prerelease:
5
- version: 0.1.7
6
6
  platform: ruby
7
- authors:
7
+ authors:
8
8
  - John Mair (banisterfiend)
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
-
13
- date: 2012-02-10 00:00:00 Z
14
- dependencies:
15
- - !ruby/object:Gem::Dependency
12
+ date: 2012-02-20 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
16
15
  name: pry-stack_explorer
17
- prerelease: false
18
- requirement: &id001 !ruby/object:Gem::Requirement
16
+ requirement: &70343193135760 !ruby/object:Gem::Requirement
19
17
  none: false
20
- requirements:
21
- - - ">="
22
- - !ruby/object:Gem::Version
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
23
21
  version: 0.3.9
24
22
  type: :runtime
25
- version_requirements: *id001
26
- - !ruby/object:Gem::Dependency
27
- name: bacon
28
23
  prerelease: false
29
- requirement: &id002 !ruby/object:Gem::Requirement
24
+ version_requirements: *70343193135760
25
+ - !ruby/object:Gem::Dependency
26
+ name: bacon
27
+ requirement: &70343193135300 !ruby/object:Gem::Requirement
30
28
  none: false
31
- requirements:
29
+ requirements:
32
30
  - - ~>
33
- - !ruby/object:Gem::Version
31
+ - !ruby/object:Gem::Version
34
32
  version: 1.1.0
35
33
  type: :development
36
- version_requirements: *id002
37
- - !ruby/object:Gem::Dependency
38
- name: rake
39
34
  prerelease: false
40
- requirement: &id003 !ruby/object:Gem::Requirement
35
+ version_requirements: *70343193135300
36
+ - !ruby/object:Gem::Dependency
37
+ name: rake
38
+ requirement: &70343188952860 !ruby/object:Gem::Requirement
41
39
  none: false
42
- requirements:
40
+ requirements:
43
41
  - - ~>
44
- - !ruby/object:Gem::Version
45
- version: "0.9"
42
+ - !ruby/object:Gem::Version
43
+ version: '0.9'
46
44
  type: :development
47
- version_requirements: *id003
45
+ prerelease: false
46
+ version_requirements: *70343188952860
48
47
  description: Enter the context of exceptions
49
48
  email: jrmair@gmail.com
50
49
  executables: []
51
-
52
50
  extensions: []
53
-
54
51
  extra_rdoc_files: []
55
-
56
- files:
52
+ files:
57
53
  - .gemtest
58
54
  - .gitignore
59
55
  - .travis.yml
@@ -82,32 +78,29 @@ files:
82
78
  - test/test_wrapped_exceptions.rb
83
79
  homepage: https://github.com/banister/pry-exception_explorer
84
80
  licenses: []
85
-
86
81
  post_install_message:
87
82
  rdoc_options: []
88
-
89
- require_paths:
83
+ require_paths:
90
84
  - lib
91
- required_ruby_version: !ruby/object:Gem::Requirement
85
+ required_ruby_version: !ruby/object:Gem::Requirement
92
86
  none: false
93
- requirements:
94
- - - ">="
95
- - !ruby/object:Gem::Version
96
- version: "0"
97
- required_rubygems_version: !ruby/object:Gem::Requirement
87
+ requirements:
88
+ - - ! '>='
89
+ - !ruby/object:Gem::Version
90
+ version: '0'
91
+ required_rubygems_version: !ruby/object:Gem::Requirement
98
92
  none: false
99
- requirements:
100
- - - ">="
101
- - !ruby/object:Gem::Version
102
- version: "0"
93
+ requirements:
94
+ - - ! '>='
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
103
97
  requirements: []
104
-
105
98
  rubyforge_project:
106
- rubygems_version: 1.8.11
99
+ rubygems_version: 1.8.16
107
100
  signing_key:
108
101
  specification_version: 3
109
102
  summary: Enter the context of exceptions
110
- test_files:
103
+ test_files:
111
104
  - test/helper.rb
112
105
  - test/test_exceptions_in_pry.rb
113
106
  - test/test_inline_exceptions.rb