pry-exception_explorer 0.1.8 → 0.1.9

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -26,6 +26,7 @@ def apply_spec_defaults(s)
26
26
  s.add_dependency('pry-stack_explorer', ">=0.3.9")
27
27
  s.add_development_dependency("bacon","~>1.1.0")
28
28
  s.add_development_dependency('rake', '~> 0.9')
29
+ s.executables = ['pry-shim']
29
30
 
30
31
  s.files = `git ls-files`.split("\n")
31
32
  s.test_files = `git ls-files -- test/*`.split("\n")
@@ -55,16 +56,7 @@ end
55
56
 
56
57
  desc "Run example C inline"
57
58
  task :example_c_inline do
58
- require 'pry-exception_explorer/shim_builder'
59
- binary_name = "lib_overrides.#{PryExceptionExplorer::ShimBuilder::Dyname}"
60
- if RUBY_PLATFORM =~ /darwin/
61
- ENV['DYLD_FORCE_FLAT_NAMESPACE'] = "1"
62
- ENV['DYLD_INSERT_LIBRARIES'] = File.join PryExceptionExplorer::ShimBuilder.dir, binary_name
63
- else
64
- ENV['LD_PRELOAD'] = File.join PryExceptionExplorer::ShimBuilder.dir, binary_name
65
- end
66
-
67
- sh "ruby -I#{direc}/lib/ #{direc}/examples/example_c_inline.rb "
59
+ sh "pry-shim ruby -I#{direc}/lib/ #{direc}/examples/example_c_inline.rb "
68
60
  end
69
61
 
70
62
  task :default => :test
data/bin/pry-shim ADDED
@@ -0,0 +1,20 @@
1
+ require 'pry'
2
+ require 'pry-exception_explorer'
3
+ require 'pry-exception_explorer/shim_builder'
4
+
5
+ binary_name = "lib_overrides.#{PryExceptionExplorer::ShimBuilder::Dyname}"
6
+
7
+ if !File.exists? File.join PryExceptionExplorer::ShimBuilder.dir, binary_name
8
+ puts "First run, building shim"
9
+ PryExceptionExplorer::ShimBuilder.compile
10
+ puts "Hopefully built...!"
11
+ end
12
+
13
+ if RUBY_PLATFORM =~ /darwin/
14
+ ENV['DYLD_FORCE_FLAT_NAMESPACE'] = "1"
15
+ ENV['DYLD_INSERT_LIBRARIES'] = File.join PryExceptionExplorer::ShimBuilder.dir, binary_name
16
+ else
17
+ ENV['LD_PRELOAD'] = File.join PryExceptionExplorer::ShimBuilder.dir, binary_name
18
+ end
19
+
20
+ exec(*ARGV)
@@ -6,7 +6,6 @@ end
6
6
  require 'pry-exception_explorer'
7
7
 
8
8
  PryExceptionExplorer.enabled = true
9
- PryExceptionExplorer.intercept(NameError)
10
9
 
11
10
  def alpha
12
11
  name = "john"
@@ -21,7 +20,7 @@ def beta
21
20
  end
22
21
 
23
22
  def gamma
24
- UnknownConstant
23
+ 1/0
25
24
  end
26
25
 
27
26
  alpha
@@ -3,30 +3,13 @@ Pry::CLI.add_options do
3
3
  on :w, :wrap, "Run the provided FILE wrapped by the exception explorer", true do |file|
4
4
  require 'pry-exception_explorer'
5
5
  PryExceptionExplorer.wrap do
6
- require file
6
+ load file
7
7
  end
8
8
 
9
9
  exit
10
10
  end
11
11
 
12
12
  on "c-exceptions", "Experimental hook for C exceptions" do
13
- require 'pry-exception_explorer/shim_builder'
14
-
15
- binary_name = "lib_overrides.#{PryExceptionExplorer::ShimBuilder::Dyname}"
16
-
17
- if !File.exists? File.join PryExceptionExplorer::ShimBuilder.dir, binary_name
18
- puts "First run, building shim"
19
- PryExceptionExplorer::ShimBuilder.compile
20
- puts "Hopefully built...!"
21
- end
22
-
23
- if RUBY_PLATFORM =~ /darwin/
24
- ENV['DYLD_FORCE_FLAT_NAMESPACE'] = "1"
25
- ENV['DYLD_INSERT_LIBRARIES'] = File.join PryExceptionExplorer::ShimBuilder.dir, binary_name
26
- else
27
- ENV['LD_PRELOAD'] = File.join PryExceptionExplorer::ShimBuilder.dir, binary_name
28
- end
29
-
30
- exec("pry #{(ARGV - ["--c-exceptions"]).join(' ')}")
13
+ exec("pry-shim pry --no-pager #{(ARGV - ["--c-exceptions"]).join(' ')}")
31
14
  end
32
15
  end
@@ -26,9 +26,15 @@ module PryExceptionExplorer
26
26
  #include <ruby.h>
27
27
 
28
28
  void
29
- rb_raise(unsigned long exc, const char *fmt, ...)
29
+ rb_raise(VALUE exc, const char *fmt, ...)
30
30
  {
31
- rb_funcall(rb_cObject, rb_intern("raise"), 2, exc, rb_str_new2("hooked exception (pry)"));
31
+ va_list args;
32
+ VALUE mesg;
33
+
34
+ va_start(args, fmt);
35
+ mesg = rb_vsprintf(fmt, args);
36
+ va_end(args);
37
+ rb_funcall(rb_cObject, rb_intern("raise"), 2, exc, mesg);
32
38
  }
33
39
 
34
40
  void
@@ -1,3 +1,3 @@
1
1
  module PryExceptionExplorer
2
- VERSION = "0.1.8"
2
+ VERSION = "0.1.9"
3
3
  end
@@ -2,14 +2,15 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = "pry-exception_explorer"
5
- s.version = "0.1.8"
5
+ s.version = "0.1.9"
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-20"
9
+ s.date = "2012-02-21"
10
10
  s.description = "Enter the context of exceptions"
11
11
  s.email = "jrmair@gmail.com"
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"]
12
+ s.executables = ["pry-shim"]
13
+ s.files = [".gemtest", ".gitignore", ".travis.yml", ".yardopts", "CHANGELOG", "Gemfile", "LICENSE", "README.md", "Rakefile", "bin/pry-shim", "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
14
  s.homepage = "https://github.com/banister/pry-exception_explorer"
14
15
  s.require_paths = ["lib"]
15
16
  s.rubygems_version = "1.8.16"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pry-exception_explorer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.8
4
+ version: 0.1.9
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-02-20 00:00:00.000000000 Z
12
+ date: 2012-02-21 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: pry-stack_explorer
16
- requirement: &70343193135760 !ruby/object:Gem::Requirement
16
+ requirement: &70215207746240 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: 0.3.9
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70343193135760
24
+ version_requirements: *70215207746240
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: bacon
27
- requirement: &70343193135300 !ruby/object:Gem::Requirement
27
+ requirement: &70215207745780 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ~>
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: 1.1.0
33
33
  type: :development
34
34
  prerelease: false
35
- version_requirements: *70343193135300
35
+ version_requirements: *70215207745780
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: rake
38
- requirement: &70343188952860 !ruby/object:Gem::Requirement
38
+ requirement: &70215207745320 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ~>
@@ -43,10 +43,11 @@ dependencies:
43
43
  version: '0.9'
44
44
  type: :development
45
45
  prerelease: false
46
- version_requirements: *70343188952860
46
+ version_requirements: *70215207745320
47
47
  description: Enter the context of exceptions
48
48
  email: jrmair@gmail.com
49
- executables: []
49
+ executables:
50
+ - pry-shim
50
51
  extensions: []
51
52
  extra_rdoc_files: []
52
53
  files:
@@ -59,6 +60,7 @@ files:
59
60
  - LICENSE
60
61
  - README.md
61
62
  - Rakefile
63
+ - bin/pry-shim
62
64
  - examples/example_c_inline.rb
63
65
  - examples/example_inline.rb
64
66
  - examples/example_wrap.rb