Skip to content

Commit 0da5bc0

Browse files
cfismrkn
authored andcommitted
This commit replaces bond with IRB. Bond is a gem that hasn't been updated in 6 years, requires a native extension, and does not compile with MSVC. Instead, the PlainBackend is switched over to IRB which is installed with Ruby.
1 parent 8f13607 commit 0da5bc0

File tree

3 files changed

+13
-6
lines changed

3 files changed

+13
-6
lines changed

iruby.gemspec

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ Gem::Specification.new do |s|
1717

1818
s.required_ruby_version = '>= 2.3.0'
1919

20-
s.add_dependency 'bond', '~> 0.5'
2120
s.add_dependency 'data_uri', '~> 0.1'
2221
s.add_dependency 'ffi-rzmq'
2322
s.add_dependency 'mime-types', '>= 3.3.1'

lib/iruby/backend.rb

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,17 +36,20 @@ class PlainBackend
3636
prepend History
3737

3838
def initialize
39-
require 'bond'
40-
Bond.start(debug: true)
41-
@eval_path = '(iruby)'
39+
require 'irb'
40+
require 'irb/completion'
41+
IRB.setup(nil)
42+
@irb = IRB::Irb.new
43+
IRB.conf[:MAIN_CONTEXT] = @irb.context
4244
end
4345

4446
def eval(code, store_history)
45-
TOPLEVEL_BINDING.eval(code, @eval_path, 1)
47+
@irb.context.evaluate(code, 0)
48+
@irb.context.last_value
4649
end
4750

4851
def complete(code)
49-
Bond.agent.call(code, code)
52+
IRB::InputCompletor::CompletionProc.call(code)
5053
end
5154
end
5255

lib/iruby/ostream.rb

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,11 @@ def writelines(lines)
4646
lines.each { |s| write(s) }
4747
end
4848

49+
# Called by irb
50+
def set_encoding(extern, intern)
51+
a = extern
52+
end
53+
4954
private
5055

5156
def build_string

0 commit comments

Comments
 (0)