Hello community,
here is the log from the commit of package rubygem-binding_of_caller for
openSUSE:Factory checked in at 2017-11-01 11:09:43
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/rubygem-binding_of_caller (Old)
and /work/SRC/openSUSE:Factory/.rubygem-binding_of_caller.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "rubygem-binding_of_caller"
Wed Nov 1 11:09:43 2017 rev:2 rq:537514 version:0.7.3
Changes:
--------
---
/work/SRC/openSUSE:Factory/rubygem-binding_of_caller/rubygem-binding_of_caller.changes
2015-02-16 21:11:47.000000000 +0100
+++
/work/SRC/openSUSE:Factory/.rubygem-binding_of_caller.new/rubygem-binding_of_caller.changes
2017-11-01 11:09:42.585616674 +0100
@@ -1,0 +2,42 @@
+Thu Oct 26 09:56:57 UTC 2017 - [email protected]
+
+- updated to version 0.7.3
+ see installed HISTORY
+
+ ## 0.7.3.pre1 / 2014-08-20
+
+ This release includes compatibility fixes for different ruby versions
+ and some minor enhancements.
+
+ * C Extensions are only compiled on MRI 1.9.x.
+
+ For MRI >= 2 the native API is used, so this should speedup
+ installation.
+
+ For JRuby this will avoid crashes on gem installation.
+
+ This was alredy being checked for Rubinius.
+
+ *Amadeus Folego*
+
+ * Added experimental JRuby support for 1.7.x series.
+
+ Only the main API is implemented and `Binding#eval` is
+ monkey-patched as it is private on JRuby.
+
+ This requires the compiler to be run on interpreted mode,
+ otherwise an exception will be thrown when `of_caller` is called.
+
+ *Charles Nutter*
+
+ * Remove executability from non-executable files.
+
+ *David Celis*
+
+ * Test and notice MRI 2.1 as a working Ruby implementation.
+
+ *Lennart Fridén*
+
+ ## 0.7.2 / 2013-06-07
+
+-------------------------------------------------------------------
Old:
----
binding_of_caller-0.7.2.gem
New:
----
binding_of_caller-0.7.3.gem
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ rubygem-binding_of_caller.spec ++++++
--- /var/tmp/diff_new_pack.kxt7XC/_old 2017-11-01 11:09:43.521582486 +0100
+++ /var/tmp/diff_new_pack.kxt7XC/_new 2017-11-01 11:09:43.521582486 +0100
@@ -1,7 +1,7 @@
#
# spec file for package rubygem-binding_of_caller
#
-# Copyright (c) 2015 SUSE LINUX Products GmbH, Nuernberg, Germany.
+# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@@ -24,16 +24,16 @@
#
Name: rubygem-binding_of_caller
-Version: 0.7.2
+Version: 0.7.3
Release: 0
%define mod_name binding_of_caller
%define mod_full_name %{mod_name}-%{version}
BuildRoot: %{_tmppath}/%{name}-%{version}-build
-BuildRequires: ruby-macros >= 5
BuildRequires: %{rubydevel}
BuildRequires: %{rubygem gem2rpm}
+BuildRequires: ruby-macros >= 5
Url: http://github.com/banister/binding_of_caller
-Source: http://rubygems.org/gems/%{mod_full_name}.gem
+Source: https://rubygems.org/gems/%{mod_full_name}.gem
Source1: rubygem-binding_of_caller-rpmlintrc
Source2: gem2rpm.yml
Summary: Retrieve the binding of a method's caller. Can also retrieve
++++++ binding_of_caller-0.7.2.gem -> binding_of_caller-0.7.3.gem ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/.travis.yml new/.travis.yml
--- old/.travis.yml 1970-01-01 01:00:00.000000000 +0100
+++ new/.travis.yml 2017-10-22 02:45:01.000000000 +0200
@@ -2,7 +2,10 @@
- 1.9.2
- 1.9.3
- 2.0.0
- - rbx-19mode
+ - 2.1.0
+ - 2.2.6
+ - 2.3.0
+ - 2.4.0
notifications:
irc: "irc.freenode.org#pry"
@@ -13,6 +16,14 @@
only:
- master
+matrix:
+ include:
+ - rvm: jruby
+ env: JRUBY_OPTS=-X-C
+ allow_failures:
+ - rvm: jruby
+ - rvm: 1.9.3
+
#script: rake test --trace
#
#before_install:
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/HISTORY new/HISTORY
--- old/HISTORY 1970-01-01 01:00:00.000000000 +0100
+++ new/HISTORY 2017-10-22 02:45:01.000000000 +0200
@@ -0,0 +1,35 @@
+## 0.7.3.pre1 / 2014-08-20
+
+This release includes compatibility fixes for different ruby versions
+and some minor enhancements.
+
+* C Extensions are only compiled on MRI 1.9.x.
+
+ For MRI >= 2 the native API is used, so this should speedup
+ installation.
+
+ For JRuby this will avoid crashes on gem installation.
+
+ This was alredy being checked for Rubinius.
+
+ *Amadeus Folego*
+
+* Added experimental JRuby support for 1.7.x series.
+
+ Only the main API is implemented and `Binding#eval` is
+ monkey-patched as it is private on JRuby.
+
+ This requires the compiler to be run on interpreted mode,
+ otherwise an exception will be thrown when `of_caller` is called.
+
+ *Charles Nutter*
+
+* Remove executability from non-executable files.
+
+ *David Celis*
+
+* Test and notice MRI 2.1 as a working Ruby implementation.
+
+ *Lennart Fridén*
+
+## 0.7.2 / 2013-06-07
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/README.md new/README.md
--- old/README.md 1970-01-01 01:00:00.000000000 +0100
+++ new/README.md 2017-10-22 02:45:01.000000000 +0200
@@ -5,7 +5,7 @@
(C) John Mair (banisterfiend) 2012
-_Retrieve the binding of a method's caller in MRI 1.9.2+, MRI 2.0 and RBX
(Rubinius)_
+_Retrieve the binding of a method's caller in MRI (>= 1.9.2) and RBX
(Rubinius)_
The `binding_of_caller` gem provides the `Binding#of_caller` method.
@@ -15,7 +15,7 @@
**Recommended for use only in debugging situations. Do not use this in
production apps.**
-**Only works in MRI Ruby 1.9.2, 1.9.3, 2.0 and RBX (Rubinius)**
+**Works in MRI Ruby (>= 1.9.2) and RBX (Rubinius)**
* Install the [gem](https://rubygems.org/gems/binding_of_caller): `gem install
binding_of_caller`
* See the [source code](http://github.com/banister/binding_of_caller)
@@ -52,8 +52,11 @@
Features and limitations
-------------------------
-* Only works with MRI 1.9.2, 1.9.3, 2.0 and RBX (Rubinius)
+* Works in MRI (>= 1.9.2) and RBX (Rubinius)
* Does not work in 1.8.7, but there is a well known (continuation-based) hack
to get a `Binding#of_caller` there.
+* There is experimental support for jruby 1.7.x, but it only works in
interpreted
+mode (i.e. use the option `-Djruby.compile.mode=OFF` or append
+`compile.mode=OFF` to your `.jrubyrc`)
Contact
-------
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Rakefile new/Rakefile
--- old/Rakefile 1970-01-01 01:00:00.000000000 +0100
+++ new/Rakefile 2017-10-22 02:45:01.000000000 +0200
@@ -46,12 +46,12 @@
desc "Run tests"
task :test do
- unless defined?(Rubinius)
+ unless defined?(Rubinius) or defined?(JRuby)
Rake::Task['compile'].execute
end
$stdout.puts("\033[33m")
- sh "bacon -Itest -rubygems -a -q"
+ sh "bacon -Itest -r rubygems -a -q"
$stdout.puts("\033[0m")
unless defined?(Rubinius)
@@ -89,7 +89,7 @@
desc "build the binaries"
task :compile => :cleanup do
- if !mri_2?
+ if !mri_2?
chdir "./ext/binding_of_caller/" do
sh "ruby extconf.rb"
sh "make"
@@ -103,7 +103,7 @@
if !mri_2?
sh 'rm -rf lib/binding_of_caller.so'
chdir "./ext/binding_of_caller/" do
- sh 'make clean'
+ sh 'make clean'
end
end
end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/binding_of_caller.gemspec
new/binding_of_caller.gemspec
--- old/binding_of_caller.gemspec 1970-01-01 01:00:00.000000000 +0100
+++ new/binding_of_caller.gemspec 2017-10-22 02:45:01.000000000 +0200
@@ -1,37 +1,39 @@
# -*- encoding: utf-8 -*-
+# stub: binding_of_caller 0.7.3 ruby lib
+# stub: ext/binding_of_caller/extconf.rb
Gem::Specification.new do |s|
- s.name = "binding_of_caller"
- s.version = "0.7.2"
+ s.name = "binding_of_caller".freeze
+ s.version = "0.7.3"
- s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to?
:required_rubygems_version=
- s.authors = ["John Mair (banisterfiend)"]
- s.date = "2013-06-07"
- s.description = "Retrieve the binding of a method's caller. Can also
retrieve bindings even further up the stack."
- s.email = "[email protected]"
- s.extensions = ["ext/binding_of_caller/extconf.rb"]
- s.files = [".gemtest", ".gitignore", ".travis.yml", ".yardopts", "Gemfile",
"HISTORY", "LICENSE", "README.md", "Rakefile", "binding_of_caller.gemspec",
"examples/example.rb", "ext/binding_of_caller/binding_of_caller.c",
"ext/binding_of_caller/extconf.rb",
"ext/binding_of_caller/ruby_headers/192/debug.h",
"ext/binding_of_caller/ruby_headers/192/dln.h",
"ext/binding_of_caller/ruby_headers/192/eval_intern.h",
"ext/binding_of_caller/ruby_headers/192/id.h",
"ext/binding_of_caller/ruby_headers/192/iseq.h",
"ext/binding_of_caller/ruby_headers/192/method.h",
"ext/binding_of_caller/ruby_headers/192/node.h",
"ext/binding_of_caller/ruby_headers/192/regenc.h",
"ext/binding_of_caller/ruby_headers/192/regint.h",
"ext/binding_of_caller/ruby_headers/192/regparse.h",
"ext/binding_of_caller/ruby_headers/192/rubys_gc.h",
"ext/binding_of_caller/ruby_headers/192/thread_pthread.h",
"ext/binding_of_caller/ruby_headers/192/thread_win32.h",
"ext/binding_of_caller/ruby_headers/192/timev.h",
"ext/binding_of_caller/ruby_headers/192/transcode_data.h",
"ext/binding_of_caller/ruby_headers/192/version.h",
"ext/binding_of_caller/ruby_headers/192/vm_core.h",
"ext/binding_of_caller/ruby_headers/192/vm_exec.h",
"ext/binding_of_caller/ruby_headers/192/vm_insnhelper.h",
"ext/binding_of_caller/ruby_headers/192/vm_opts.h",
"ext/binding_of_caller/ruby_headers/193/addr2line.h",
"ext/binding_of_caller/ruby_headers/193/atomic.h",
"ext/binding_of_caller/ruby_headers/193/constant.h",
"ext/binding_of_caller/ruby_headers/193/debug.h",
"ext/binding_of_caller/ruby_headers/193/dln.h",
"ext/binding_of_caller/ruby_headers/193/encdb.h",
"ext/binding_of_caller/ruby_headers/193/eval_intern.h",
"ext/binding_of_caller/ruby_headers/193/id.h",
"ext/binding_of_caller/ruby_headers/193/internal.h",
"ext/binding_of_caller/ruby_headers/193/iseq.h",
"ext/binding_of_caller/ruby_headers/193/method.h",
"ext/binding_of_caller/ruby_headers/193/node.h",
"ext/binding_of_caller/ruby_headers/193/parse.h",
"ext/binding_of_caller/ruby_headers/193/regenc.h",
"ext/binding_of_caller/ruby_headers/193/regint.h",
"ext/binding_of_caller/ruby_headers/193/regparse.h",
"ext/binding_of_caller/ruby_headers/193/revision.h",
"ext/binding_of_caller/ruby_headers/193/rubys_gc.h",
"ext/binding_of_caller/ruby_headers/193/thread_pthread.h",
"ext/binding_of_caller/ruby_headers/193/thread_win32.h",
"ext/binding_of_caller/ruby_headers/193/timev.h",
"ext/binding_of_caller/ruby_headers/193/transcode_data.h",
"ext/binding_of_caller/ruby_headers/193/transdb.h",
"ext/binding_of_caller/ruby_headers/193/version.h",
"ext/binding_of_caller/ruby_headers/193/vm_core.h",
"ext/binding_of_caller/ruby_headers/193/vm_exec.h",
"ext/binding_of_caller/ruby_headers/193/vm_insnhelper.h",
"ext/binding_of_caller/ruby_headers/193/vm_opts.h", "lib/binding_of_caller.rb",
"lib/binding_of_caller/mri2.rb", "lib/binding_of_caller/rubinius.rb",
"lib/binding_of_caller/version.rb", "test/test_binding_of_caller.rb"]
- s.homepage = "http://github.com/banister/binding_of_caller"
- s.require_paths = ["lib"]
- s.rubygems_version = "2.0.3"
- s.summary = "Retrieve the binding of a method's caller. Can also retrieve
bindings even further up the stack."
- s.test_files = ["test/test_binding_of_caller.rb"]
+ s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if
s.respond_to? :required_rubygems_version=
+ s.require_paths = ["lib".freeze]
+ s.authors = ["John Mair (banisterfiend)".freeze]
+ s.date = "2017-10-22"
+ s.description = "Retrieve the binding of a method's caller. Can also
retrieve bindings even further up the stack.".freeze
+ s.email = "[email protected]".freeze
+ s.extensions = ["ext/binding_of_caller/extconf.rb".freeze]
+ s.files = [".gemtest".freeze, ".gitignore".freeze, ".travis.yml".freeze,
".yardopts".freeze, "Gemfile".freeze, "HISTORY".freeze, "LICENSE".freeze,
"README.md".freeze, "Rakefile".freeze, "binding_of_caller.gemspec".freeze,
"examples/benchmark.rb".freeze, "examples/example.rb".freeze,
"ext/binding_of_caller/binding_of_caller.c".freeze,
"ext/binding_of_caller/extconf.rb".freeze,
"ext/binding_of_caller/ruby_headers/192/debug.h".freeze,
"ext/binding_of_caller/ruby_headers/192/dln.h".freeze,
"ext/binding_of_caller/ruby_headers/192/eval_intern.h".freeze,
"ext/binding_of_caller/ruby_headers/192/id.h".freeze,
"ext/binding_of_caller/ruby_headers/192/iseq.h".freeze,
"ext/binding_of_caller/ruby_headers/192/method.h".freeze,
"ext/binding_of_caller/ruby_headers/192/node.h".freeze,
"ext/binding_of_caller/ruby_headers/192/regenc.h".freeze,
"ext/binding_of_caller/ruby_headers/192/regint.h".freeze,
"ext/binding_of_caller/ruby_headers/192/regparse.h".freeze,
"ext/binding_of_caller/ruby_headers/192/rubys_gc.h".freeze,
"ext/binding_of_caller/ruby_headers/192/thread_pthread.h".freeze,
"ext/binding_of_caller/ruby_headers/192/thread_win32.h".freeze,
"ext/binding_of_caller/ruby_headers/192/timev.h".freeze,
"ext/binding_of_caller/ruby_headers/192/transcode_data.h".freeze,
"ext/binding_of_caller/ruby_headers/192/version.h".freeze,
"ext/binding_of_caller/ruby_headers/192/vm_core.h".freeze,
"ext/binding_of_caller/ruby_headers/192/vm_exec.h".freeze,
"ext/binding_of_caller/ruby_headers/192/vm_insnhelper.h".freeze,
"ext/binding_of_caller/ruby_headers/192/vm_opts.h".freeze,
"ext/binding_of_caller/ruby_headers/193/addr2line.h".freeze,
"ext/binding_of_caller/ruby_headers/193/atomic.h".freeze,
"ext/binding_of_caller/ruby_headers/193/constant.h".freeze,
"ext/binding_of_caller/ruby_headers/193/debug.h".freeze,
"ext/binding_of_caller/ruby_headers/193/dln.h".freeze,
"ext/binding_of_caller/ruby_headers/193/encdb.h".freeze,
"ext/binding_of_caller/ruby_headers/193/eval_intern.h".freeze,
"ext/binding_of_caller/ruby_headers/193/id.h".freeze,
"ext/binding_of_caller/ruby_headers/193/internal.h".freeze,
"ext/binding_of_caller/ruby_headers/193/iseq.h".freeze,
"ext/binding_of_caller/ruby_headers/193/method.h".freeze,
"ext/binding_of_caller/ruby_headers/193/node.h".freeze,
"ext/binding_of_caller/ruby_headers/193/parse.h".freeze,
"ext/binding_of_caller/ruby_headers/193/regenc.h".freeze,
"ext/binding_of_caller/ruby_headers/193/regint.h".freeze,
"ext/binding_of_caller/ruby_headers/193/regparse.h".freeze,
"ext/binding_of_caller/ruby_headers/193/revision.h".freeze,
"ext/binding_of_caller/ruby_headers/193/rubys_gc.h".freeze,
"ext/binding_of_caller/ruby_headers/193/thread_pthread.h".freeze,
"ext/binding_of_caller/ruby_headers/193/thread_win32.h".freeze,
"ext/binding_of_caller/ruby_headers/193/timev.h".freeze,
"ext/binding_of_caller/ruby_headers/193/transcode_data.h".freeze,
"ext/binding_of_caller/ruby_headers/193/transdb.h".freeze,
"ext/binding_of_caller/ruby_headers/193/version.h".freeze,
"ext/binding_of_caller/ruby_headers/193/vm_core.h".freeze,
"ext/binding_of_caller/ruby_headers/193/vm_exec.h".freeze,
"ext/binding_of_caller/ruby_headers/193/vm_insnhelper.h".freeze,
"ext/binding_of_caller/ruby_headers/193/vm_opts.h".freeze,
"lib/binding_of_caller.rb".freeze,
"lib/binding_of_caller/jruby_interpreted.rb".freeze,
"lib/binding_of_caller/mri2.rb".freeze,
"lib/binding_of_caller/rubinius.rb".freeze,
"lib/binding_of_caller/version.rb".freeze,
"test/test_binding_of_caller.rb".freeze]
+ s.homepage = "http://github.com/banister/binding_of_caller".freeze
+ s.rubygems_version = "2.6.13".freeze
+ s.summary = "Retrieve the binding of a method's caller. Can also retrieve
bindings even further up the stack.".freeze
+ s.test_files = ["test/test_binding_of_caller.rb".freeze]
if s.respond_to? :specification_version then
s.specification_version = 4
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
- s.add_runtime_dependency(%q<debug_inspector>, [">= 0.0.1"])
- s.add_development_dependency(%q<bacon>, [">= 0"])
- s.add_development_dependency(%q<rake>, [">= 0"])
+ s.add_runtime_dependency(%q<debug_inspector>.freeze, [">= 0.0.1"])
+ s.add_development_dependency(%q<bacon>.freeze, [">= 0"])
+ s.add_development_dependency(%q<rake>.freeze, [">= 0"])
else
- s.add_dependency(%q<debug_inspector>, [">= 0.0.1"])
- s.add_dependency(%q<bacon>, [">= 0"])
- s.add_dependency(%q<rake>, [">= 0"])
+ s.add_dependency(%q<debug_inspector>.freeze, [">= 0.0.1"])
+ s.add_dependency(%q<bacon>.freeze, [">= 0"])
+ s.add_dependency(%q<rake>.freeze, [">= 0"])
end
else
- s.add_dependency(%q<debug_inspector>, [">= 0.0.1"])
- s.add_dependency(%q<bacon>, [">= 0"])
- s.add_dependency(%q<rake>, [">= 0"])
+ s.add_dependency(%q<debug_inspector>.freeze, [">= 0.0.1"])
+ s.add_dependency(%q<bacon>.freeze, [">= 0"])
+ s.add_dependency(%q<rake>.freeze, [">= 0"])
end
end
Binary files old/checksums.yaml.gz and new/checksums.yaml.gz differ
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/examples/benchmark.rb new/examples/benchmark.rb
--- old/examples/benchmark.rb 1970-01-01 01:00:00.000000000 +0100
+++ new/examples/benchmark.rb 2017-10-22 02:45:01.000000000 +0200
@@ -0,0 +1,63 @@
+require 'benchmark'
+
+unless Object.const_defined? :BindingOfCaller
+ $:.unshift File.expand_path '../../lib', __FILE__
+ require 'binding_of_caller'
+ require 'binding_of_caller/version'
+end
+
+
+n = 250000
+
+Benchmark.bm(10) do |x|
+ x.report("#of_caller") do
+ 1.upto(n) do
+ 1.times do
+ 1.times do
+ binding.of_caller(2)
+ binding.of_caller(1)
+ end
+ end
+ end
+ end
+
+ x.report("#frame_count") do
+ 1.upto(n) do
+ 1.times do
+ 1.times do
+ binding.frame_count
+ end
+ end
+ end
+ end
+
+ x.report("#callers") do
+ 1.upto(n) do
+ 1.times do
+ 1.times do
+ binding.callers
+ end
+ end
+ end
+ end
+
+ x.report("#frame_description") do
+ 1.upto(n) do
+ 1.times do
+ 1.times do
+ binding.of_caller(1).frame_description
+ end
+ end
+ end
+ end
+
+ x.report("#frame_type") do
+ 1.upto(n) do
+ 1.times do
+ 1.times do
+ binding.of_caller(1).frame_type
+ end
+ end
+ end
+ end
+end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/ext/binding_of_caller/extconf.rb
new/ext/binding_of_caller/extconf.rb
--- old/ext/binding_of_caller/extconf.rb 1970-01-01 01:00:00.000000000
+0100
+++ new/ext/binding_of_caller/extconf.rb 2017-10-22 02:45:01.000000000
+0200
@@ -4,18 +4,12 @@
end
end
-def mri_2?
+def mri_1_9?
defined?(RUBY_ENGINE) && RUBY_ENGINE == "ruby" &&
- RUBY_VERSION =~ /^2/
+ RUBY_VERSION =~ /^1\.9/
end
-def rbx?
- defined?(RUBY_ENGINE) && RUBY_ENGINE =~ /rbx/
-end
-
-if mri_2? || rbx?
- fake_makefile
-else
+if mri_1_9?
require 'mkmf'
$CFLAGS += " -O0"
@@ -29,5 +23,6 @@
end
create_makefile('binding_of_caller')
+else
+ fake_makefile
end
-
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/lib/binding_of_caller/jruby_interpreted.rb
new/lib/binding_of_caller/jruby_interpreted.rb
--- old/lib/binding_of_caller/jruby_interpreted.rb 1970-01-01
01:00:00.000000000 +0100
+++ new/lib/binding_of_caller/jruby_interpreted.rb 2017-10-22
02:45:01.000000000 +0200
@@ -0,0 +1,123 @@
+module BindingOfCaller
+ class JRubyBindingHolder
+ java_import org.jruby.RubyBinding
+
+ def initialize(binding)
+ @binding = binding
+ end
+
+ def eval(code, file = nil, line = nil)
+ b = JRuby.dereference(RubyBinding.new(JRuby.runtime, Binding, @binding))
+ if (file == nil)
+ Kernel.eval code, b
+ else
+ Kernel.eval code, b, file, line
+ end
+ end
+
+ def frame_type
+ case
+ when block?
+ :block
+ when eval?
+ :eval
+ when top?
+ :top
+ else
+ :method
+ end
+ end
+
+ def frame_description
+ "#{block_desc}#{method_desc}"
+ end
+
+ private
+
+ def block?
+ @binding.getDynamicScope().getStaticScope().isBlockScope()
+ end
+
+ def eval?
+ @binding.getFrame().getKlazz().nil? && @binding.getLine() != 0
+ end
+
+ def top?
+ @binding.getFrame().getKlazz().nil? && @binding.getLine() == 0
+ end
+
+ def block_desc
+ if frame_type == :block
+ "block in "
+ end
+ end
+
+ def method_desc
+ @binding.getFrame().getName() || "<main>"
+ end
+ end
+
+ module BindingExtensions
+ def of_caller(index = 1)
+ index += 1 # always omit this frame
+ JRuby.runtime.current_context.binding_of_caller(index)
+ end
+
+ def callers
+ ary = []
+ n = 2
+ while binding = of_caller(n)
+ ary << binding
+ n += 1
+ end
+ ary
+ end
+
+ def frame_count
+ callers.count - 1
+ end
+
+ def frame_type
+ nil
+ end
+
+ def frame_description
+ nil
+ end
+ end
+end
+
+
+class org::jruby::runtime::ThreadContext
+ java_import org.jruby.runtime.Binding
+ java_import org.jruby.RubyInstanceConfig::CompileMode
+
+ field_accessor :frameStack, :frameIndex,
+ :scopeStack, :scopeIndex,
+ :backtrace, :backtraceIndex
+
+ def binding_of_caller(index)
+ unless JRuby.runtime.instance_config.compile_mode == CompileMode::OFF
+ raise RuntimeError, "caller binding only supported in interpreter"
+ end
+
+ index += 1 # always omit this frame
+
+ return nil if index > frameIndex
+
+ frame = frameStack[frameIndex - index]
+
+ return binding_of_caller(index - 1) if index > scopeIndex
+
+ scope = scopeStack[scopeIndex - index]
+ element = backtrace[backtraceIndex - index]
+
+ binding = Binding.new(frame, scope.static_scope.module, scope,
element.clone)
+
+ BindingOfCaller::JRubyBindingHolder.new(binding)
+ end
+end
+
+class ::Binding
+ include BindingOfCaller::BindingExtensions
+end
\ No newline at end of file
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/lib/binding_of_caller/rubinius.rb
new/lib/binding_of_caller/rubinius.rb
--- old/lib/binding_of_caller/rubinius.rb 1970-01-01 01:00:00.000000000
+0100
+++ new/lib/binding_of_caller/rubinius.rb 2017-10-22 02:45:01.000000000
+0200
@@ -4,22 +4,11 @@
# Retrieve the binding of the nth caller of the current frame.
# @return [Binding]
def of_caller(n)
- bt = Rubinius::VM.backtrace(1 + n, true).first
+ location = Rubinius::VM.backtrace(1 + n, true).first
- raise RuntimeError, "Invalid frame, gone beyond end of stack!" if bt.nil?
+ raise RuntimeError, "Invalid frame, gone beyond end of stack!" if
location.nil?
- b = Binding.setup(
- bt.variables,
- bt.variables.method,
- bt.constant_scope,
- bt.variables.self,
- bt
- )
-
- b.instance_variable_set :@frame_description,
- bt.describe.gsub("{ } in", "block in")
-
- b
+ setup_binding_from_location(location)
end
# The description of the frame.
@@ -31,25 +20,14 @@
# Return bindings for all caller frames.
# @return [Array<Binding>]
def callers
- ary = []
- n = 0
- loop do
- begin
- ary << Binding.of_caller(n)
- rescue
- break
- end
- n += 1
- end
- ary.drop_while do |v|
- !(v.frame_type == :method && v.eval("__method__") == :callers)
- end.drop(1)
+ Rubinius::VM.backtrace(1, true).map
&(method(:setup_binding_from_location).
+ to_proc)
end
# Number of parent frames available at the point of call.
# @return [Fixnum]
def frame_count
- callers.size - 1
+ Rubinius::VM.backtrace(1).count
end
# The type of the frame.
@@ -65,6 +43,21 @@
:method
end
end
+
+ protected
+
+ def setup_binding_from_location(location)
+ binding = Binding.setup location.variables,
+ location.variables.method,
+ location.constant_scope,
+ location.variables.self,
+ location
+
+ binding.instance_variable_set :@frame_description,
+ location.describe.gsub("{ } in", "block in")
+
+ binding
+ end
end
end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/lib/binding_of_caller/version.rb
new/lib/binding_of_caller/version.rb
--- old/lib/binding_of_caller/version.rb 1970-01-01 01:00:00.000000000
+0100
+++ new/lib/binding_of_caller/version.rb 2017-10-22 02:45:01.000000000
+0200
@@ -1,3 +1,3 @@
module BindingOfCaller
- VERSION = "0.7.2"
+ VERSION = "0.7.3"
end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/lib/binding_of_caller.rb new/lib/binding_of_caller.rb
--- old/lib/binding_of_caller.rb 1970-01-01 01:00:00.000000000 +0100
+++ new/lib/binding_of_caller.rb 2017-10-22 02:45:01.000000000 +0200
@@ -1,14 +1,14 @@
dlext = RbConfig::CONFIG['DLEXT']
-def mri_2?
- defined?(RUBY_ENGINE) && RUBY_ENGINE == "ruby" &&
+mri_2 = defined?(RUBY_ENGINE) && RUBY_ENGINE == "ruby" &&
RUBY_VERSION =~ /^2/
-end
-if mri_2?
+if mri_2
require 'binding_of_caller/mri2'
elsif defined?(RUBY_ENGINE) && RUBY_ENGINE == "ruby"
require "binding_of_caller.#{dlext}"
elsif defined?(Rubinius)
require 'binding_of_caller/rubinius'
+elsif defined?(JRuby)
+ require 'binding_of_caller/jruby_interpreted'
end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/metadata new/metadata
--- old/metadata 1970-01-01 01:00:00.000000000 +0100
+++ new/metadata 2017-10-22 02:45:01.000000000 +0200
@@ -1,55 +1,55 @@
--- !ruby/object:Gem::Specification
name: binding_of_caller
version: !ruby/object:Gem::Version
- version: 0.7.2
+ version: 0.7.3
platform: ruby
authors:
- John Mair (banisterfiend)
autorequire:
bindir: bin
cert_chain: []
-date: 2013-06-07 00:00:00.000000000 Z
+date: 2017-10-22 00:00:00.000000000 Z
dependencies:
- !ruby/object:Gem::Dependency
name: debug_inspector
requirement: !ruby/object:Gem::Requirement
requirements:
- - - '>='
+ - - ! '>='
- !ruby/object:Gem::Version
version: 0.0.1
type: :runtime
prerelease: false
version_requirements: !ruby/object:Gem::Requirement
requirements:
- - - '>='
+ - - ! '>='
- !ruby/object:Gem::Version
version: 0.0.1
- !ruby/object:Gem::Dependency
name: bacon
requirement: !ruby/object:Gem::Requirement
requirements:
- - - '>='
+ - - ! '>='
- !ruby/object:Gem::Version
version: '0'
type: :development
prerelease: false
version_requirements: !ruby/object:Gem::Requirement
requirements:
- - - '>='
+ - - ! '>='
- !ruby/object:Gem::Version
version: '0'
- !ruby/object:Gem::Dependency
name: rake
requirement: !ruby/object:Gem::Requirement
requirements:
- - - '>='
+ - - ! '>='
- !ruby/object:Gem::Version
version: '0'
type: :development
prerelease: false
version_requirements: !ruby/object:Gem::Requirement
requirements:
- - - '>='
+ - - ! '>='
- !ruby/object:Gem::Version
version: '0'
description: Retrieve the binding of a method's caller. Can also retrieve
bindings
@@ -70,6 +70,7 @@
- README.md
- Rakefile
- binding_of_caller.gemspec
+- examples/benchmark.rb
- examples/example.rb
- ext/binding_of_caller/binding_of_caller.c
- ext/binding_of_caller/extconf.rb
@@ -122,6 +123,7 @@
- ext/binding_of_caller/ruby_headers/193/vm_insnhelper.h
- ext/binding_of_caller/ruby_headers/193/vm_opts.h
- lib/binding_of_caller.rb
+- lib/binding_of_caller/jruby_interpreted.rb
- lib/binding_of_caller/mri2.rb
- lib/binding_of_caller/rubinius.rb
- lib/binding_of_caller/version.rb
@@ -135,17 +137,17 @@
- lib
required_ruby_version: !ruby/object:Gem::Requirement
requirements:
- - - '>='
+ - - ! '>='
- !ruby/object:Gem::Version
version: '0'
required_rubygems_version: !ruby/object:Gem::Requirement
requirements:
- - - '>='
+ - - ! '>='
- !ruby/object:Gem::Version
version: '0'
requirements: []
rubyforge_project:
-rubygems_version: 2.0.3
+rubygems_version: 2.6.13
signing_key:
specification_version: 4
summary: Retrieve the binding of a method's caller. Can also retrieve bindings
even