Skip to content
Browse files

Allow the pry interactor to be turned of.

 Just use

     interactor :off

 to disable, all other usages are still deprecated.
  • Loading branch information...
1 parent abd66a9 commit c07093af84d78a7eaed95453e8b72cc6dc1e7363 @netzpirat netzpirat committed Oct 19, 2012
Showing with 27 additions and 14 deletions.
  1. +8 −0 README.md
  2. +7 −10 lib/guard/dsl.rb
  3. +12 −4 spec/guard/dsl_spec.rb
View
8 README.md
@@ -671,6 +671,14 @@ or using the cli switch `-n`:
notification :off
```
+### interactor
+
+If you do not need the Pry interactions with Guard at all, you can turn it off:
+
+```ruby
+interactor :off
+```
+
### callback
The `callback` method allows you to execute arbitrary code before or after any of the `start`, `stop`, `reload`,
View
17 lib/guard/dsl.rb
@@ -101,7 +101,8 @@ class Dsl
# Deprecation message for the `ignore_paths` method
INTERACTOR_DEPRECATION = <<-EOS.gsub(/^\s*/, '')
- Starting with Guard v1.4 the use of the 'interactor' Guardfile DSL method is deprecated.
+ Starting with Guard v1.4 the use of the 'interactor' Guardfile DSL method is only used to
+ turn the Pry interactor off. All other usages are deprecated.
Please make use of the Pry plugin architecture to customize the interactions and place them
either in your `~/.guardrc` or the `Guardfile`.
@@ -323,19 +324,15 @@ def notification(notifier, options = {})
# Sets the interactor to use.
#
- # @example Use the readline interactor
- # interactor :readline
- #
- # @example Use the gets interactor
- # interactor :gets
- #
# @example Turn off interactions
# interactor :off
#
- # @deprecated
- #
def interactor(interactor)
- ::Guard::UI.deprecation(INTERACTOR_DEPRECATION)
+ if interactor == :off
+ ::Guard.options[:no_interactions] = true
+ else
+ ::Guard::UI.deprecation(INTERACTOR_DEPRECATION)
+ end
end
# Declares a group of Guard plugins to be run with `guard start --group group_name`.
View
16 spec/guard/dsl_spec.rb
@@ -6,9 +6,8 @@
before(:each) do
@local_guardfile_path = File.join(Dir.pwd, 'Guardfile')
@home_guardfile_path = File.expand_path(File.join("~", ".Guardfile"))
- @user_config_path = File.expand_path(File.join("~", ".guard.rb"))
+ @user_config_path = File.expand_path(File.join("~", ".guard.rb"))
::Guard.setup
- ::Guard.stub!(:options).and_return(:debug => true)
::Guard.stub!(:guards).and_return([mock('Guard')])
end
@@ -370,9 +369,18 @@ def self.disable_user_config
describe "#interactor" do
disable_user_config
- it "sets the interactor implementation" do
+ before do
+ Guard.options = { :no_interactions => false }
+ end
+
+ it "disables the interactions with :off" do
+ ::Guard::UI.should_not_receive(:deprecation).with(described_class::INTERACTOR_DEPRECATION)
+ described_class.evaluate_guardfile(:guardfile_contents => "interactor :off")
+ Guard.options[:no_interactions].should be_true
+ end
+
+ it "shows a deprecation for anything but :off" do
::Guard::UI.should_receive(:deprecation).with(described_class::INTERACTOR_DEPRECATION)
-
described_class.evaluate_guardfile(:guardfile_contents => "interactor :coolline")
end
end

0 comments on commit c07093a

Please sign in to comment.
Something went wrong with that request. Please try again.