From 1c6a145ba746a404e86ca73d4fc313d229d14bb1 Mon Sep 17 00:00:00 2001 From: Robert Gleeson Date: Mon, 17 Mar 2014 08:41:42 +0100 Subject: [PATCH] remove attempt at bond support from pry and move to `pry-bond` project. https://github.com/johnny5-/pry-bond project adds the enable-bond! and disable-bond! commands, as well as other features, that enhance the pry&bond experience and make it easier to use and setup without a manual effort. see #1165 closes #1160 --- Gemfile | 1 - lib/pry/bond_completer.rb | 17 ----------------- lib/pry/config/default.rb | 15 ++++----------- spec/completion_spec.rb | 18 ------------------ 4 files changed, 4 insertions(+), 47 deletions(-) delete mode 100644 lib/pry/bond_completer.rb diff --git a/Gemfile b/Gemfile index e084cdd1..5f7e69a0 100644 --- a/Gemfile +++ b/Gemfile @@ -17,7 +17,6 @@ end group :development, :test do gem 'simplecov', '~> 0.8' - gem 'bond', '~> 0.5' end platform :rbx do diff --git a/lib/pry/bond_completer.rb b/lib/pry/bond_completer.rb deleted file mode 100644 index b73a2535..00000000 --- a/lib/pry/bond_completer.rb +++ /dev/null @@ -1,17 +0,0 @@ -module Pry::BondCompleter - def self.call(input, options) - Pry.current[:pry] = options[:pry] - Bond.agent.call(input) - end - - def self.start - Bond.start(:eval_binding => lambda{ Pry.current[:pry] && Pry.current[:pry].current_context }) - Bond.complete(:on => /\A/) do |input| - Pry.commands.complete(input.line, - :pry_instance => Pry.current[:pry], - :target => Pry.current[:pry].current_context, - :command_set => Pry.current[:pry].commands) - end - self - end -end diff --git a/lib/pry/config/default.rb b/lib/pry/config/default.rb index 070d7132..36b7cdfc 100644 --- a/lib/pry/config/default.rb +++ b/lib/pry/config/default.rb @@ -35,7 +35,10 @@ class Pry::Config::Default :extra_sticky_locals => proc { {} }, :command_completions => proc { proc { commands.keys } }, :file_completions => proc { proc { Dir["."] } }, - :completer => proc { lazy_completer } + :completer => proc { + require "pry/input_completer" + Pry::InputCompleter.start + } } def initialize @@ -113,16 +116,6 @@ private raise end - def lazy_completer - if defined?(Bond) && !is_editline?(input) - require "pry/bond_completer" unless defined?(Pry::BondCompleter) - Pry::BondCompleter.start - else - require "pry/input_completer" unless defined?(Pry::InputCompleter) - Pry::InputCompleter.start - end - end - def is_editline?(input) defined?(input::VERSION) && input::VERSION =~ /editline/i end diff --git a/spec/completion_spec.rb b/spec/completion_spec.rb index 114c4e7e..d54f7833 100644 --- a/spec/completion_spec.rb +++ b/spec/completion_spec.rb @@ -5,24 +5,6 @@ def completer_test(bind, pry=nil, assert_flag=true) Pry::InputCompleter.call(symbol[0..-2], :target => Pry.binding_for(bind), :pry => pry).include?(symbol).should == assert_flag} return proc {|*symbols| symbols.each(&test) } end - -require "pry/bond_completer" -describe Pry::BondCompleter do - before do - @local = Pry::Config.new Pry::Config::Default.new - @local.completer - end - - it "should use Bond if it's available" do - if defined?(Bond) && defined?(Readline) && Readline::VERSION !~ /editline/i - @local.completer.should == Pry::BondCompleter - else - @local.completer.should == Pry::InputCompleter - end - end -end - - require "pry/input_completer" describe Pry::InputCompleter do before do