Permalink
Browse files

load correct readlines for jruby + win

  • Loading branch information...
1 parent 90c98ce commit f6e8d731cf32993e789a45e3641a19f8d7670979 @cldwalker committed Jan 9, 2011
Showing with 7 additions and 3 deletions.
  1. +7 −1 lib/bond/m.rb
  2. +0 −1 lib/bond/readlines/jruby.rb
  3. +0 −1 lib/bond/readlines/ruby.rb
View
@@ -30,7 +30,7 @@ def agent
# See {Bond#config}
def config
- @config ||= {:readline_plugin=>Bond::Readline, :debug=>false, :default_search=>:underscore}
+ @config ||= {:debug=>false, :default_search=>:underscore}
end
# Resets M's missions and config
@@ -47,6 +47,7 @@ def spy(input)
# Validates and sets values in M.config.
def debrief(options={})
config.merge! options
+ config[:readline_plugin] ||= default_readline_plugin
unless %w{setup line_buffer}.all? {|e| config[:readline_plugin].respond_to?(e) }
$stderr.puts "Bond Error: Invalid readline plugin given."
end
@@ -108,6 +109,11 @@ def home
end
protected
+ def default_readline_plugin
+ RUBY_PLATFORM[/mswin|mingw|bccwin|wince/i] ? Ruby :
+ RUBY_PLATFORM[/java/i] ? Jruby : Bond::Readline
+ end
+
def load_gem_completion(rubygem)
(dir = find_gem_file(rubygem, File.join(rubygem, '..', 'bond'))) ? load_dir(dir) :
rubygem[/\/|-/] ? load_plugin_file(rubygem) :
@@ -1,4 +1,3 @@
-# RUBY_PLATFORM[/java/i]
class Bond::Jruby < Bond::Readline
def self.readline_setup
require 'readline'
@@ -1,4 +1,3 @@
-# RUBY_PLATFORM[/mswin|mingw|bccwin|wince/i]
class Bond::Ruby < Bond::Readline
def self.readline_setup
require 'rb-readline'

0 comments on commit f6e8d73

Please sign in to comment.