bindex 0.5.0 → 0.6.0
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.
- checksums.yaml +5 -5
- data/CONTRIBUTING.md +1 -1
- data/Gemfile +1 -1
- data/README.md +4 -4
- data/Rakefile +9 -5
- data/bindex.gemspec +4 -4
- data/ext/{bindex/com/gsamokovarov/bindex → skiptrace/com/gsamokovarov/skiptrace}/BindingBuilder.java +1 -1
- data/ext/{bindex/com/gsamokovarov/bindex → skiptrace/com/gsamokovarov/skiptrace}/CurrentBindingsIterator.java +1 -1
- data/ext/{bindex/com/gsamokovarov/bindex → skiptrace/com/gsamokovarov/skiptrace}/JRubyIntegration.java +4 -4
- data/ext/{bindex/com/gsamokovarov/bindex → skiptrace/com/gsamokovarov/skiptrace}/RubyBindingsCollector.java +1 -1
- data/ext/{bindex/com/gsamokovarov/bindex → skiptrace/com/gsamokovarov/skiptrace}/SetExceptionBindingsEventHook.java +1 -1
- data/ext/{bindex/com/gsamokovarov/bindex → skiptrace/com/gsamokovarov/skiptrace}/ThreadContextInterfaceException.java +1 -1
- data/ext/{bindex/com/gsamokovarov/bindex → skiptrace/com/gsamokovarov/skiptrace}/ThreadContextInternals.java +1 -1
- data/ext/{bindex → skiptrace}/cruby.c +8 -8
- data/ext/{bindex → skiptrace}/extconf.rb +1 -1
- data/lib/bindex.rb +3 -9
- data/lib/skiptrace.rb +11 -0
- data/lib/skiptrace/jruby.rb +5 -0
- data/lib/{bindex → skiptrace}/jruby_internals.jar +0 -0
- data/lib/{bindex → skiptrace}/rubinius.rb +5 -5
- data/lib/skiptrace/version.rb +3 -0
- data/skiptrace.gemspec +27 -0
- data/test/current_bindings_test.rb +1 -1
- data/test/test_helper.rb +1 -1
- metadata +31 -30
- data/lib/bindex/jruby.rb +0 -5
- data/lib/bindex/version.rb +0 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 2867a8904ab8da23b1efdebf16b5838ff0409fca71b139b320bf793dfd37b2f5
|
4
|
+
data.tar.gz: cff287d77781d2c866a9266e6a3315b93256370d0ef0d4cdd10e785ea592855b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8c9e6fb660a6d8115e7f8d7dc1acc80ec326fec6ad46ac36c6456a39796f4c726ee40e74a97ae71682fc69f24d00a18bfabd75acbb19fca5da73f796c2905360
|
7
|
+
data.tar.gz: 576d1d81270f95c00d6a814b5d4f902485484526c6d12f916c23e3e9a35a46adeccc7c6611efca1e8c0a9a4cb007658a264679f0a336728d0d6b0ab1ac653ecd
|
data/CONTRIBUTING.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# Contributing
|
2
2
|
|
3
|
-
1. Fork it ( https://github.com/gsamokovarov/
|
3
|
+
1. Fork it ( https://github.com/gsamokovarov/skiptrace/fork )
|
4
4
|
2. Create your feature branch (`git checkout -b my-new-feature`)
|
5
5
|
3. Commit your changes (`git commit -am 'Add some feature'`)
|
6
6
|
4. Push to the branch (`git push origin my-new-feature`)
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -1,7 +1,7 @@
|
|
1
|
-
#
|
1
|
+
# Skiptrace [](https://travis-ci.org/gsamokovarov/bindex)
|
2
2
|
|
3
3
|
When Ruby raises an exception, it leaves you a backtrace to help you figure out
|
4
|
-
where did the exception originated in.
|
4
|
+
where did the exception originated in. Skiptrace gives you the bindings as well.
|
5
5
|
This can help you introspect the state of the Ruby program when at the point
|
6
6
|
the exception occurred.
|
7
7
|
|
@@ -12,13 +12,13 @@ worth it anywhere outside of development.
|
|
12
12
|
|
13
13
|
### API
|
14
14
|
|
15
|
-
|
15
|
+
Skiptrace defines the following API:
|
16
16
|
|
17
17
|
#### Exception#bindings
|
18
18
|
|
19
19
|
Returns all the bindings up to the one in which the exception originated in.
|
20
20
|
|
21
|
-
####
|
21
|
+
#### Skiptrace.current_bindings
|
22
22
|
|
23
23
|
Returns all of the current Ruby execution state bindings. The first one is the
|
24
24
|
current one, the second is the caller one, the third is the caller of the
|
data/Rakefile
CHANGED
@@ -1,5 +1,9 @@
|
|
1
|
-
require 'bundler/gem_tasks'
|
2
1
|
require 'rake/testtask'
|
2
|
+
require "rake/clean"
|
3
|
+
|
4
|
+
CLOBBER.include "pkg"
|
5
|
+
|
6
|
+
Bundler::GemHelper.install_tasks name: ENV.fetch('GEM_NAME', 'skiptrace')
|
3
7
|
|
4
8
|
Rake::TestTask.new do |t|
|
5
9
|
t.libs << 'test'
|
@@ -11,18 +15,18 @@ case RUBY_ENGINE
|
|
11
15
|
when 'ruby'
|
12
16
|
require 'rake/extensiontask'
|
13
17
|
|
14
|
-
Rake::ExtensionTask.new('
|
18
|
+
Rake::ExtensionTask.new('skiptrace') do |ext|
|
15
19
|
ext.name = 'cruby'
|
16
|
-
ext.lib_dir = 'lib/
|
20
|
+
ext.lib_dir = 'lib/skiptrace'
|
17
21
|
end
|
18
22
|
|
19
23
|
task default: [:clean, :compile, :test]
|
20
24
|
when 'jruby'
|
21
25
|
require 'rake/javaextensiontask'
|
22
26
|
|
23
|
-
Rake::JavaExtensionTask.new('
|
27
|
+
Rake::JavaExtensionTask.new('skiptrace') do |ext|
|
24
28
|
ext.name = 'jruby_internals'
|
25
|
-
ext.lib_dir = 'lib/
|
29
|
+
ext.lib_dir = 'lib/skiptrace'
|
26
30
|
end
|
27
31
|
|
28
32
|
task default: [:clean, :compile, :test]
|
data/bindex.gemspec
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
$LOAD_PATH << File.expand_path('../lib', __FILE__)
|
2
2
|
|
3
|
-
require '
|
3
|
+
require 'skiptrace/version'
|
4
4
|
|
5
5
|
Gem::Specification.new do |spec|
|
6
6
|
spec.name = "bindex"
|
7
|
-
spec.version =
|
7
|
+
spec.version = Skiptrace::VERSION
|
8
8
|
spec.authors = ["Genadi Samokovarov"]
|
9
9
|
spec.email = ["gsamokovarov@gmail.com"]
|
10
|
-
spec.extensions = ["ext/
|
10
|
+
spec.extensions = ["ext/skiptrace/extconf.rb"]
|
11
11
|
spec.summary = "Bindings for your Ruby exceptions"
|
12
12
|
spec.homepage = "https://github.com/gsamokovarov/bindex"
|
13
13
|
spec.license = "MIT"
|
@@ -18,7 +18,7 @@ Gem::Specification.new do |spec|
|
|
18
18
|
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
19
19
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
20
20
|
spec.require_paths = ["lib"]
|
21
|
-
spec.extensions = ["ext/
|
21
|
+
spec.extensions = ["ext/skiptrace/extconf.rb"]
|
22
22
|
|
23
23
|
spec.add_development_dependency "minitest", "~> 5.4"
|
24
24
|
spec.add_development_dependency "bundler"
|
@@ -1,4 +1,4 @@
|
|
1
|
-
package com.gsamokovarov.
|
1
|
+
package com.gsamokovarov.skiptrace;
|
2
2
|
|
3
3
|
import org.jruby.Ruby;
|
4
4
|
import org.jruby.RubyArray;
|
@@ -11,8 +11,8 @@ import org.jruby.anno.JRubyMethod;
|
|
11
11
|
|
12
12
|
public class JRubyIntegration {
|
13
13
|
public static void setup(Ruby runtime) {
|
14
|
-
RubyModule
|
15
|
-
|
14
|
+
RubyModule skiptrace = runtime.defineModule("Skiptrace");
|
15
|
+
skiptrace.defineAnnotatedMethods(SkiptraceMethods.class);
|
16
16
|
|
17
17
|
RubyClass exception = runtime.getException();
|
18
18
|
exception.defineAnnotatedMethods(ExceptionExtensionMethods.class);
|
@@ -26,7 +26,7 @@ public class JRubyIntegration {
|
|
26
26
|
}
|
27
27
|
}
|
28
28
|
|
29
|
-
public static class
|
29
|
+
public static class SkiptraceMethods {
|
30
30
|
@JRubyMethod(name = "current_bindings", meta = true)
|
31
31
|
public static IRubyObject currentBindings(ThreadContext context, IRubyObject self) {
|
32
32
|
return RubyBindingsCollector.collectCurrentFor(context);
|
@@ -1,7 +1,7 @@
|
|
1
1
|
#include <ruby.h>
|
2
2
|
#include <ruby/debug.h>
|
3
3
|
|
4
|
-
VALUE
|
4
|
+
static VALUE st_mSkiptrace;
|
5
5
|
static ID id_bindings;
|
6
6
|
|
7
7
|
static VALUE
|
@@ -22,7 +22,7 @@ current_bindings_callback(const rb_debug_inspector_t *context, void *data)
|
|
22
22
|
return bindings;
|
23
23
|
}
|
24
24
|
|
25
|
-
VALUE
|
25
|
+
static VALUE
|
26
26
|
current_bindings(void)
|
27
27
|
{
|
28
28
|
return rb_debug_inspector_open(current_bindings_callback, NULL);
|
@@ -42,7 +42,7 @@ set_exception_bindings_callback(VALUE tpval, void *data)
|
|
42
42
|
}
|
43
43
|
}
|
44
44
|
|
45
|
-
void
|
45
|
+
static void
|
46
46
|
set_exception_bindings_on_raise(void)
|
47
47
|
{
|
48
48
|
VALUE tpval = rb_tracepoint_new(0, RUBY_EVENT_RAISE, set_exception_bindings_callback, 0);
|
@@ -50,13 +50,13 @@ set_exception_bindings_on_raise(void)
|
|
50
50
|
}
|
51
51
|
|
52
52
|
static VALUE
|
53
|
-
|
53
|
+
st_current_bindings(VALUE self)
|
54
54
|
{
|
55
55
|
return current_bindings();
|
56
56
|
}
|
57
57
|
|
58
58
|
static VALUE
|
59
|
-
|
59
|
+
st_exc_bindings(VALUE self)
|
60
60
|
{
|
61
61
|
VALUE bindings = rb_attr_get(self, id_bindings);
|
62
62
|
|
@@ -70,11 +70,11 @@ bx_exc_bindings(VALUE self)
|
|
70
70
|
void
|
71
71
|
Init_cruby(void)
|
72
72
|
{
|
73
|
-
|
73
|
+
st_mSkiptrace = rb_define_module("Skiptrace");
|
74
74
|
id_bindings = rb_intern("bindings");
|
75
75
|
|
76
|
-
rb_define_singleton_method(
|
77
|
-
rb_define_method(rb_eException, "bindings",
|
76
|
+
rb_define_singleton_method(st_mSkiptrace, "current_bindings", st_current_bindings, 0);
|
77
|
+
rb_define_method(rb_eException, "bindings", st_exc_bindings, 0);
|
78
78
|
|
79
79
|
set_exception_bindings_on_raise();
|
80
80
|
}
|
@@ -5,7 +5,7 @@ when "ruby"
|
|
5
5
|
$CFLAGS << " -Wall"
|
6
6
|
$CFLAGS << " -g3 -O0" if ENV["DEBUG"]
|
7
7
|
|
8
|
-
create_makefile("
|
8
|
+
create_makefile("skiptrace/cruby")
|
9
9
|
else
|
10
10
|
IO.write(File.expand_path("../Makefile", __FILE__), <<-END)
|
11
11
|
all install static install-so install-rb: Makefile
|
data/lib/bindex.rb
CHANGED
@@ -1,10 +1,4 @@
|
|
1
|
-
|
2
|
-
when 'rbx'
|
3
|
-
require 'bindex/rubinius'
|
4
|
-
when 'jruby'
|
5
|
-
require 'bindex/jruby'
|
6
|
-
when 'ruby'
|
7
|
-
require 'bindex/cruby'
|
8
|
-
end
|
1
|
+
require_relative "skiptrace"
|
9
2
|
|
10
|
-
|
3
|
+
# Keep backwards compatibility with the previous name.
|
4
|
+
Bindex = Skiptrace
|
data/lib/skiptrace.rb
ADDED
File without changes
|
@@ -1,4 +1,4 @@
|
|
1
|
-
module
|
1
|
+
module Skiptrace
|
2
2
|
module Rubinius
|
3
3
|
# Filters internal Rubinius locations.
|
4
4
|
#
|
@@ -32,11 +32,11 @@ end
|
|
32
32
|
|
33
33
|
# Gets the current bindings for all available Ruby frames.
|
34
34
|
#
|
35
|
-
# Filters the internal Rubinius and
|
36
|
-
def
|
35
|
+
# Filters the internal Rubinius and Skiptrace frames.
|
36
|
+
def Skiptrace.current_bindings
|
37
37
|
locations = ::Rubinius::VM.backtrace(1, true)
|
38
38
|
|
39
|
-
|
39
|
+
Skiptrace::Rubinius::InternalLocationFilter.new(locations).filter.map do |location|
|
40
40
|
Binding.setup(
|
41
41
|
location.variables,
|
42
42
|
location.variables.method,
|
@@ -58,7 +58,7 @@ end
|
|
58
58
|
|
59
59
|
define_method(:raise_exception) do |exc|
|
60
60
|
if exc.bindings.empty?
|
61
|
-
exc.instance_variable_set(:@bindings,
|
61
|
+
exc.instance_variable_set(:@bindings, Skiptrace.current_bindings)
|
62
62
|
end
|
63
63
|
|
64
64
|
raise_exception.bind(self).call(exc)
|
data/skiptrace.gemspec
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
$LOAD_PATH << File.expand_path('../lib', __FILE__)
|
2
|
+
|
3
|
+
require 'skiptrace/version'
|
4
|
+
|
5
|
+
Gem::Specification.new do |spec|
|
6
|
+
spec.name = "skiptrace"
|
7
|
+
spec.version = Skiptrace::VERSION
|
8
|
+
spec.authors = ["Genadi Samokovarov"]
|
9
|
+
spec.email = ["gsamokovarov@gmail.com"]
|
10
|
+
spec.extensions = ["ext/skiptrace/extconf.rb"]
|
11
|
+
spec.summary = "Bindings for your Ruby exceptions"
|
12
|
+
spec.homepage = "https://github.com/gsamokovarov/skiptrace"
|
13
|
+
spec.license = "MIT"
|
14
|
+
|
15
|
+
spec.required_ruby_version = ">= 2.0.0"
|
16
|
+
|
17
|
+
spec.files = `git ls-files -z`.split("\x0")
|
18
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
19
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
20
|
+
spec.require_paths = ["lib"]
|
21
|
+
spec.extensions = ["ext/skiptrace/extconf.rb"]
|
22
|
+
|
23
|
+
spec.add_development_dependency "minitest", "~> 5.4"
|
24
|
+
spec.add_development_dependency "bundler"
|
25
|
+
spec.add_development_dependency "rake"
|
26
|
+
spec.add_development_dependency "rake-compiler"
|
27
|
+
end
|
@@ -2,6 +2,6 @@ require 'test_helper'
|
|
2
2
|
|
3
3
|
class CurrentBindingsTest < BaseTest
|
4
4
|
test 'first binding returned is the current one' do
|
5
|
-
assert_equal __LINE__,
|
5
|
+
assert_equal __LINE__, Skiptrace.current_bindings.first.eval('__LINE__')
|
6
6
|
end
|
7
7
|
end
|
data/test/test_helper.rb
CHANGED
metadata
CHANGED
@@ -1,77 +1,77 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bindex
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Genadi Samokovarov
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2019-03-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
+
name: minitest
|
14
15
|
requirement: !ruby/object:Gem::Requirement
|
15
16
|
requirements:
|
16
17
|
- - "~>"
|
17
18
|
- !ruby/object:Gem::Version
|
18
19
|
version: '5.4'
|
19
|
-
name: minitest
|
20
|
-
prerelease: false
|
21
20
|
type: :development
|
21
|
+
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '5.4'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
|
+
name: bundler
|
28
29
|
requirement: !ruby/object:Gem::Requirement
|
29
30
|
requirements:
|
30
31
|
- - ">="
|
31
32
|
- !ruby/object:Gem::Version
|
32
33
|
version: '0'
|
33
|
-
name: bundler
|
34
|
-
prerelease: false
|
35
34
|
type: :development
|
35
|
+
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
|
+
name: rake
|
42
43
|
requirement: !ruby/object:Gem::Requirement
|
43
44
|
requirements:
|
44
45
|
- - ">="
|
45
46
|
- !ruby/object:Gem::Version
|
46
47
|
version: '0'
|
47
|
-
name: rake
|
48
|
-
prerelease: false
|
49
48
|
type: :development
|
49
|
+
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
|
+
name: rake-compiler
|
56
57
|
requirement: !ruby/object:Gem::Requirement
|
57
58
|
requirements:
|
58
59
|
- - ">="
|
59
60
|
- !ruby/object:Gem::Version
|
60
61
|
version: '0'
|
61
|
-
name: rake-compiler
|
62
|
-
prerelease: false
|
63
62
|
type: :development
|
63
|
+
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - ">="
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0'
|
69
|
-
description:
|
69
|
+
description:
|
70
70
|
email:
|
71
71
|
- gsamokovarov@gmail.com
|
72
72
|
executables: []
|
73
73
|
extensions:
|
74
|
-
- ext/
|
74
|
+
- ext/skiptrace/extconf.rb
|
75
75
|
extra_rdoc_files: []
|
76
76
|
files:
|
77
77
|
- ".gitignore"
|
@@ -82,20 +82,22 @@ files:
|
|
82
82
|
- README.md
|
83
83
|
- Rakefile
|
84
84
|
- bindex.gemspec
|
85
|
-
- ext/
|
86
|
-
- ext/
|
87
|
-
- ext/
|
88
|
-
- ext/
|
89
|
-
- ext/
|
90
|
-
- ext/
|
91
|
-
- ext/
|
92
|
-
- ext/
|
93
|
-
- ext/
|
85
|
+
- ext/skiptrace/com/gsamokovarov/skiptrace/BindingBuilder.java
|
86
|
+
- ext/skiptrace/com/gsamokovarov/skiptrace/CurrentBindingsIterator.java
|
87
|
+
- ext/skiptrace/com/gsamokovarov/skiptrace/JRubyIntegration.java
|
88
|
+
- ext/skiptrace/com/gsamokovarov/skiptrace/RubyBindingsCollector.java
|
89
|
+
- ext/skiptrace/com/gsamokovarov/skiptrace/SetExceptionBindingsEventHook.java
|
90
|
+
- ext/skiptrace/com/gsamokovarov/skiptrace/ThreadContextInterfaceException.java
|
91
|
+
- ext/skiptrace/com/gsamokovarov/skiptrace/ThreadContextInternals.java
|
92
|
+
- ext/skiptrace/cruby.c
|
93
|
+
- ext/skiptrace/extconf.rb
|
94
94
|
- lib/bindex.rb
|
95
|
-
- lib/
|
96
|
-
- lib/
|
97
|
-
- lib/
|
98
|
-
- lib/
|
95
|
+
- lib/skiptrace.rb
|
96
|
+
- lib/skiptrace/jruby.rb
|
97
|
+
- lib/skiptrace/jruby_internals.jar
|
98
|
+
- lib/skiptrace/rubinius.rb
|
99
|
+
- lib/skiptrace/version.rb
|
100
|
+
- skiptrace.gemspec
|
99
101
|
- test/current_bindings_test.rb
|
100
102
|
- test/exception_test.rb
|
101
103
|
- test/fixtures/basic_nested_fixture.rb
|
@@ -108,7 +110,7 @@ homepage: https://github.com/gsamokovarov/bindex
|
|
108
110
|
licenses:
|
109
111
|
- MIT
|
110
112
|
metadata: {}
|
111
|
-
post_install_message:
|
113
|
+
post_install_message:
|
112
114
|
rdoc_options: []
|
113
115
|
require_paths:
|
114
116
|
- lib
|
@@ -123,9 +125,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
123
125
|
- !ruby/object:Gem::Version
|
124
126
|
version: '0'
|
125
127
|
requirements: []
|
126
|
-
|
127
|
-
|
128
|
-
signing_key:
|
128
|
+
rubygems_version: 3.0.3
|
129
|
+
signing_key:
|
129
130
|
specification_version: 4
|
130
131
|
summary: Bindings for your Ruby exceptions
|
131
132
|
test_files:
|
data/lib/bindex/jruby.rb
DELETED
data/lib/bindex/version.rb
DELETED