Permalink
Browse files

rename :readline_plugin option to :readline

  • Loading branch information...
1 parent 3bd58d4 commit 85ceedc142bc8dc44edf3707ecc94061c78b87b3 @cldwalker committed Jan 10, 2011
Showing with 29 additions and 30 deletions.
  1. +1 −1 lib/bond.rb
  2. +2 −2 lib/bond/agent.rb
  3. +1 −1 lib/bond/completions/bond.rb
  4. +7 −8 lib/bond/m.rb
  5. +14 −14 test/bond_test.rb
  6. +1 −1 test/completion_test.rb
  7. +3 −3 test/test_helper.rb
View
@@ -91,7 +91,7 @@ def config; M.config; end
# @option options [Array<String>] :gems Gems which have their completions loaded from
# @gem_source/lib/bond/completions/*.rb. If gem is a plugin gem i.e. ripl-plugin, completion will be loaded
# from @gem_source/lib/ripl/completions/plugin.rb.
- # @option options [Module, Symbol] :readline_plugin (Bond::Readline) Specifies a Bond readline plugin.
+ # @option options [Module, Symbol] :readline (Bond::Readline) Specifies a Bond readline plugin.
# A symbol points to a capitalized Bond constant i.e. :ruby -> Bond::Ruby.
# Available plugins are Bond::Readline, Bond::Ruby, Bond::Jruby and Bond::Rawline.
# @option options [Proc] :default_mission (DefaultMission) Sets default completion to use when no missions match.
View
@@ -8,7 +8,7 @@ class Agent
attr_reader :weapon
def initialize(options={}) #@private
- setup_readline_plugin(options[:readline_plugin])
+ setup_readline(options[:readline])
@default_mission_action = options[:default_mission] if options[:default_mission]
Mission.eval_binding = options[:eval_binding] if options[:eval_binding]
Search.default_search = options[:default_search] || :normal
@@ -78,7 +78,7 @@ def reset
end
protected
- def setup_readline_plugin(plugin)
+ def setup_readline(plugin)
@weapon = plugin
@weapon.setup(self)
rescue
@@ -2,5 +2,5 @@
["on", "method", "methods", "class", "object", "anywhere", "prefix", "search", "action", "place", "name"]
}
complete(:methods=>['Bond.start', 'Bond.restart']) {
- %w{gems readline_plugin default_mission default_search eval_binding debug eval_debug bare}
+ %w{gems readline default_mission default_search eval_binding debug eval_debug bare}
}
View
@@ -47,14 +47,13 @@ def spy(input)
# Validates and sets values in M.config.
def debrief(options={})
config.merge! options
- config[:readline_plugin] ||= default_readline_plugin
- if !config[:readline_plugin].is_a?(Module) &&
- Bond.const_defined?(config[:readline_plugin].to_s.capitalize)
- config[:readline_plugin] = Bond.const_get(
- config[:readline_plugin].to_s.capitalize)
+ config[:readline] ||= default_readline
+ if !config[:readline].is_a?(Module) &&
+ Bond.const_defined?(config[:readline].to_s.capitalize)
+ config[:readline] = Bond.const_get(config[:readline].to_s.capitalize)
end
- unless %w{setup line_buffer}.all? {|e| config[:readline_plugin].respond_to?(e) }
- $stderr.puts "Bond Error: Invalid readline plugin '#{config[:readline_plugin]}'."
+ unless %w{setup line_buffer}.all? {|e| config[:readline].respond_to?(e) }
+ $stderr.puts "Bond Error: Invalid readline plugin '#{config[:readline]}'."
end
end
@@ -114,7 +113,7 @@ def home
end
protected
- def default_readline_plugin
+ def default_readline
RUBY_PLATFORM[/mswin|mingw|bccwin|wince/i] ? Ruby :
RUBY_PLATFORM[/java/i] ? Jruby : Bond::Readline
end
View
@@ -3,29 +3,29 @@
describe "Bond" do
describe "start" do
def start(options={}, &block)
- Bond.start({:readline_plugin=>valid_readline_plugin}.merge(options), &block)
+ Bond.start({:readline=>valid_readline}.merge(options), &block)
end
before { M.instance_eval("@started = @agent = @config = nil"); M.expects(:load_completions) }
- it "prints error if readline_plugin doesn't have all required methods" do
+ it "prints error if readline doesn't have all required methods" do
capture_stderr {
- start :readline_plugin=>Module.new{ def self.setup(arg); end }
+ start :readline=>Module.new{ def self.setup(arg); end }
}.should =~ /Invalid/
end
- it "prints error if readline_plugin symbol is invalid" do
+ it "prints error if readline symbol is invalid" do
capture_stderr {
- start :readline_plugin => :blah
+ start :readline => :blah
}.should =~ /Invalid.*'blah'/
end
- it "prints no error if valid readline_plugin" do
+ it "prints no error if valid readline" do
capture_stderr { start }.should == ''
end
- it 'prints no error if valid readline_plugin symbol' do
- capture_stderr { start :readline_plugin => :ruby }.should == ''
- Bond.config[:readline_plugin].should == Bond::Ruby
+ it 'prints no error if valid readline symbol' do
+ capture_stderr { start :readline => :ruby }.should == ''
+ Bond.config[:readline].should == Bond::Ruby
end
it "sets default mission" do
@@ -102,8 +102,8 @@ def start(options={}, &block)
it "prints error if Readline setup fails" do
Bond::Readline.expects(:setup).raises('WTF')
- capture_stderr { Bond.start(:readline_plugin=>Bond::Readline) }.should =~ /Error.*Failed Readline.*'WTF'/
- M.debrief :readline_plugin=>valid_readline_plugin
+ capture_stderr { Bond.start(:readline=>Bond::Readline) }.should =~ /Error.*Failed Readline.*'WTF'/
+ M.debrief :readline=>valid_readline
end
it "start prints error for failed completion file" do
@@ -120,21 +120,21 @@ def start(options={}, &block)
describe "restart" do
def start(options={}, &block)
- Bond.start({:readline_plugin=>valid_readline_plugin}.merge(options), &block)
+ Bond.start({:readline=>valid_readline}.merge(options), &block)
end
it "deletes previous config" do
start :blah=>''
Bond.config[:blah].should.not == nil
- Bond.restart({:readline_plugin=>valid_readline_plugin})
+ Bond.restart({:readline=>valid_readline})
Bond.config[:blah].should == nil
end
it "deletes previous method completions" do
start
complete(:method=>'blah') { [] }
MethodMission.actions['blah'].should.not == nil
- Bond.restart({:readline_plugin=>valid_readline_plugin})
+ Bond.restart({:readline=>valid_readline})
MethodMission.actions['blah'].should == nil
end
end
View
@@ -48,7 +48,7 @@
end
it "completes hash coming from a method" do
- tab('Bond.config[:r').should == ["Bond.config[:readline_plugin"]
+ tab('Bond.config[:r').should == ["Bond.config[:readline"]
end
it "methods don't swallow up default completion" do
View
@@ -50,13 +50,13 @@ def complete(*args, &block)
Bond.complete(*args, &block)
end
- def valid_readline_plugin
+ def valid_readline
Class.new { def self.setup(arg); end; def self.line_buffer; end }
end
def reset
M.reset
- M.debrief :readline_plugin => TestHelpers.valid_readline_plugin
+ M.debrief :readline => TestHelpers.valid_readline
end
end
@@ -65,5 +65,5 @@ class Bacon::Context
end
# Default settings
-Bond::M.debrief(:readline_plugin=>TestHelpers.valid_readline_plugin, :debug=>true)
+Bond::M.debrief(:readline=>TestHelpers.valid_readline, :debug=>true)
include Bond

0 comments on commit 85ceedc

Please sign in to comment.