From b1b69924a7f921a643974c6a23b3ba84854c0a0f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Re=CC=81my=20Coutable?=
@@ -127,6 +129,8 @@
<a href="#NAME">NAME</a>
+<a href="#NAME">NAME</a>
+<a href="#NAME">NAME</a>
@@ -147,6 +151,229 @@ +
!DOCTYPE html + +
+ + ++ + + + +
<a href="#NAME">NAME</a>
+<a href="#NAME">NAME</a>
+
+
+
+
+
++ + + + +
<li class='tl'>guard</li>
+<li class='tc'></li>
+<li class='tr'>guard</li>
+
+
+
+
+
++ + + + +
+ guard
+
!DOCTYPE html + +
+ + ++ + + + +
<a href="#NAME">NAME</a>
+
+
+
+
+
++ + + + +
<li class='tl'>guard</li>
+<li class='tc'></li>
+<li class='tr'>guard</li>
+
+
+
+
+
++ + + + +
+ guard
+
.\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . @@ -242,6 +469,56 @@ This manual has been written by Remy Coutable. https://github.com/guard/guard
+ + +
<li class='tl'></li>
+<li class='tc'>September 2011</li>
+<li class='tr'>guard</li>
+
+
+
+
+
++ + + + +
+ +
+ + + + +
<li class='tl'></li>
+<li class='tc'>September 2011</li>
+<li class='tr'>guard</li>
+
+
+
+
+
++ + + + +
+ +
+ +
<li class='tl'></li>
From ed97336c7d5ccad2f8adb9e5cde5816802ee897b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Re=CC=81my=20Coutable?=
Date: Fri, 23 Sep 2011 00:20:35 +0200
Subject: [PATCH 05/21] New Group class
---
lib/guard.rb | 17 ++++++++++++-----
lib/guard/group.rb | 23 +++++++++++++++++++++++
spec/guard/group_spec.rb | 19 +++++++++++++++++++
3 files changed, 54 insertions(+), 5 deletions(-)
create mode 100644 lib/guard/group.rb
create mode 100644 spec/guard/group_spec.rb
diff --git a/lib/guard.rb b/lib/guard.rb
index 5f79470..37653fb 100644
--- a/lib/guard.rb
+++ b/lib/guard.rb
@@ -6,6 +6,7 @@ module Guard
autoload :UI, 'guard/ui'
autoload :Dsl, 'guard/dsl'
autoload :DslDescriber, 'guard/dsl_describer'
+ autoload :Group, 'guard/group'
autoload :Interactor, 'guard/interactor'
autoload :Listener, 'guard/listener'
autoload :Watcher, 'guard/watcher'
@@ -28,7 +29,7 @@ module Guard
def setup(options = {})
@options = options
@guards = []
- @groups = [{ :name => :default, :options => {} }]
+ @groups = [Group.new(:default)]
@interactor = Interactor.new
@listener = Listener.select_and_init(@options[:watchdir] ? File.expand_path(@options[:watchdir]) : Dir.pwd)
@@ -140,9 +141,9 @@ module Guard
# @param [Array] files the list of files to pass to the task
#
def execute_supervised_task_for_all_guards(task, files = nil)
- groups.each do |group_hash|
- catch group_hash[:options][:halt_on_fail] == true ? :task_has_failed : :no_catch do
guards.find_all { |guard| guard.group == group_hash[:name] }.each do |guard|
+ groups.each do |group|
+ catch group.options[:halt_on_fail] == true ? :task_has_failed : :no_catch do
if task == :run_on_change
paths = Watcher.match_files(guard, files)
UI.debug "#{guard.class.name}##{task} with #{paths.inspect}"
@@ -200,10 +201,16 @@ module Guard
#
# @param [String] name the group name
# @param [Hash] options the group options
- # @option options [Boolean] halt_on_fail if a task execution should be halted for all Guards in this group if one Guard throws `:task_has_failed`
+ # @option options [Boolean] halt_on_fail if a task execution
+ # should be halted for all Guards in this group if one Guard throws `:task_has_failed`
#
def add_group(name, options = {})
- @groups << { :name => name.to_sym, :options => options } unless name.nil? || @groups.find { |group| group[:name] == name }
+ group = groups(name)
+ if group.nil?
+ group = Group.new(name, options)
+ @groups << group
+ end
+ group
end
# Tries to load the Guard main class.
diff --git a/lib/guard/group.rb b/lib/guard/group.rb
new file mode 100644
index 0000000..a044fbd
--- /dev/null
+++ b/lib/guard/group.rb
@@ -0,0 +1,23 @@
+module Guard
+
+ # A group of Guards.
+ #
+ class Group
+
+ attr_accessor :name, :options
+
+ # Initialize a Group.
+ #
+ # @param [String] name the name of the group
+ # @param [Hash] options the group options
+ # @option options [Boolean] halt_on_fail if a task execution
+ # should be halted for all Guards in this group if one Guard throws `:task_has_failed`
+ #
+ def initialize(name, options = {})
+ @name = name.to_sym
+ @options = options
+ end
+
+ end
+
+end
diff --git a/spec/guard/group_spec.rb b/spec/guard/group_spec.rb
new file mode 100644
index 0000000..3711c0d
--- /dev/null
+++ b/spec/guard/group_spec.rb
@@ -0,0 +1,19 @@
+require 'spec_helper'
+
+describe Guard::Group do
+
+ describe ".initialize" do
+ it "accepts a name as a string and provides an accessor for it (returning a symbol)" do
+ described_class.new('foo').name.should eql :foo
+ end
+
+ it "accepts a name as a symbol and provides an accessor for it (returning a symbol)" do
+ described_class.new(:foo).name.should eql :foo
+ end
+
+ it "accepts options and provides an accessor for it" do
+ described_class.new('foo', :halt_on_fail => true).options.should == { :halt_on_fail => true }
+ end
+ end
+
+end
From 12fcf15a958c394b3cba7d62bea4758631b0b467 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Re=CC=81my=20Coutable?=
Date: Fri, 23 Sep 2011 00:21:30 +0200
Subject: [PATCH 06/21] New smart accessors for guards and groups
---
lib/guard.rb | 44 ++++++++++++++++++-
spec/guard_spec.rb | 107 ++++++++++++++++++++++++++++++++++++++++++---
2 files changed, 144 insertions(+), 7 deletions(-)
diff --git a/lib/guard.rb b/lib/guard.rb
index 37653fb..6916f90 100644
--- a/lib/guard.rb
+++ b/lib/guard.rb
@@ -14,7 +14,7 @@ module Guard
autoload :Hook, 'guard/hook'
class << self
- attr_accessor :options, :guards, :groups, :interactor, :listener
+ attr_accessor :options, :interactor, :listener
# Initialize the Guard singleton.
#
@@ -41,6 +41,46 @@ module Guard
self
end
+ # Smart accessor for retrieving a specific guard or several guards at once.
+ #
+ # @param [Object] filter an optional filter to retrieve specific guard(s).
+ # @option filter [String, Symbol] return the guard with the given name, or nil if not found
+ # @option filter [Regexp] returns all guards matching the Regexp, or [] if no guard match
+ # @option filter [NilClass] returns all guards
+ #
+ def guards(filter = nil)
+ case filter
+ when String, Symbol
+ @guards.find { |guard| guard.class.to_s.downcase.sub('guard::', '') == filter.to_s.downcase.gsub('-', '') }
+ when Regexp
+ @guards.find_all { |guard| guard.class.to_s.downcase.sub('guard::', '') =~ filter }
+ when Hash
+ filter.inject(@guards) do |matches, (k, v)|
+ matches.find_all { |guard| guard.send(k).to_sym == v.to_sym }
+ end
+ else
+ @guards
+ end
+ end
+
+ # Smart accessor for retrieving a specific group or several groups at once.
+ #
+ # @param [Object] filter an optional filter to retrieve specific group(s).
+ # @option filter [String, Symbol] return the group with the given name, or nil if not found
+ # @option filter [Regexp] returns all groups matching the Regexp, or [] if no group match
+ # @option filter [NilClass] returns all groups
+ #
+ def groups(filter = nil)
+ case filter
+ when String, Symbol
+ @groups.find { |group| group.name == filter.to_sym }
+ when Regexp
+ @groups.find_all { |group| group.name =~ filter }
+ else
+ @groups
+ end
+ end
+
# Start Guard by evaluate the `Guardfile`, initialize the declared Guards
# and start the available file change listener.
#
@@ -141,9 +181,9 @@ module Guard
# @param [Array] files the list of files to pass to the task
#
def execute_supervised_task_for_all_guards(task, files = nil)
- guards.find_all { |guard| guard.group == group_hash[:name] }.each do |guard|
groups.each do |group|
catch group.options[:halt_on_fail] == true ? :task_has_failed : :no_catch do
+ guards(:group => group.name).each do |guard|
if task == :run_on_change
paths = Watcher.match_files(guard, files)
UI.debug "#{guard.class.name}##{task} with #{paths.inspect}"
diff --git a/spec/guard_spec.rb b/spec/guard_spec.rb
index 714df2c..080dd97 100644
--- a/spec/guard_spec.rb
+++ b/spec/guard_spec.rb
@@ -15,7 +15,8 @@ describe Guard do
end
it "initializes @groups" do
- Guard.groups.should eql [{ :name => :default, :options => {} }]
+ described_class.groups[0].name.should eql :default
+ described_class.groups[0].options.should == {}
end
it "initializes the options" do
@@ -55,6 +56,99 @@ describe Guard do
end
end
+ describe ".guards" do
+
+ class Guard::FooBar < Guard::Guard; end
+ class Guard::FooBaz < Guard::Guard; end
+
+ subject do
+ guard = ::Guard.setup
+ @guard_foo_bar = Guard::FooBar.new([], { :group => 'backend' })
+ @guard_foo_baz = Guard::FooBaz.new([], { :group => 'frontend' })
+ guard.instance_variable_get("@guards").push(@guard_foo_bar)
+ guard.instance_variable_get("@guards").push(@guard_foo_baz)
+ guard
+ end
+
+ it "return @guards without any argument" do
+ subject.guards.should eql subject.instance_variable_get("@guards")
+ end
+
+ describe "find a guard by as string/symbol" do
+ it "find a guard by a string" do
+ subject.guards('foo-bar').should eql @guard_foo_bar
+ end
+
+ it "find a guard by a symbol" do
+ subject.guards(:'foo-bar').should eql @guard_foo_bar
+ end
+
+ it "returns nil if guard is not found" do
+ subject.guards('foo-foo').should be_nil
+ end
+ end
+
+ describe "find guards matching a regexp" do
+ it "with matches" do
+ subject.guards(/^foo/).should eql [@guard_foo_bar, @guard_foo_baz]
+ end
+
+ it "without matches" do
+ subject.guards(/foo$/).should eql []
+ end
+ end
+
+ describe "find guards by their group" do
+ it "group name is a string" do
+ subject.guards(:group => 'backend').should eql [@guard_foo_bar]
+ end
+ it "group name is a symbol" do
+ subject.guards(:group => :frontend).should eql [@guard_foo_baz]
+ end
+
+ it "returns [] if guard is not found" do
+ subject.guards(:group => :unknown).should eql []
+ end
+ end
+ end
+
+ describe ".groups" do
+ subject do
+ guard = ::Guard.setup
+ @group_backend = guard.add_group(:backend)
+ @group_backflip = guard.add_group(:backflip)
+ guard
+ end
+
+ it "return @groups without any argument" do
+ subject.groups.should eql subject.instance_variable_get("@groups")
+ end
+
+ describe "find a group by as string/symbol" do
+ it "find a group by a string" do
+ subject.groups('backend').should eql @group_backend
+ end
+
+ it "find a group by a symbol" do
+ subject.groups(:backend).should eql @group_backend
+ end
+
+ it "returns nil if group is not found" do
+ subject.groups(:foo).should be_nil
+ end
+ end
+
+ describe "find groups matching a regexp" do
+ it "with matches" do
+ subject.groups(/^back/).should eql [@group_backend, @group_backflip]
+ end
+
+ it "without matches" do
+ subject.groups(/back$/).should eql []
+ end
+ end
+ end
+
describe ".start" do
it "basic check that core methods are called" do
opts = { :my_opts => true, :guardfile => File.join(@fixture_path, "Guardfile") }
@@ -135,19 +229,22 @@ describe Guard do
it "accepts group name as string" do
subject.add_group('backend')
- subject.groups.should eql [{ :name => :default, :options => {} }, { :name => :backend, :options => {} }]
+ subject.groups[0].name.should eql :default
+ subject.groups[1].name.should eql :backend
end
it "accepts group name as symbol" do
subject.add_group(:backend)
- subject.groups.should eql [{ :name => :default, :options => {} }, { :name => :backend, :options => {} }]
+ subject.groups[0].name.should eql :default
+ subject.groups[1].name.should eql :backend
end
it "accepts options" do
subject.add_group(:backend, { :halt_on_fail => true })
- subject.groups.should eql [{ :name => :default, :options => {} }, { :name => :backend, :options => { :halt_on_fail => true } }]
+ subject.groups[0].options.should == {}
+ subject.groups[1].options.should == { :halt_on_fail => true }
end
end
@@ -282,7 +379,7 @@ describe Guard do
before do
@g = mock(Guard::Guard).as_null_object
subject.guards.push(@g)
- subject.groups.push({ :name => :foo, :options => { :halt_on_fail => true } })
+ subject.add_group(:foo, { :halt_on_fail => true })
end
context "with a task that succeed" do
From 916613c027c05e99f21db0ef7078d8ab66e49f27 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Re=CC=81my=20Coutable?=
Date: Fri, 23 Sep 2011 00:22:25 +0200
Subject: [PATCH 07/21] Ensure group name is a Symbol in
Guard::Guard#initialize
---
lib/guard/guard.rb | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/lib/guard/guard.rb b/lib/guard/guard.rb
index 184d22e..f63be8d 100644
--- a/lib/guard/guard.rb
+++ b/lib/guard/guard.rb
@@ -19,7 +19,7 @@ module Guard
# @param [Hash] options the custom Guard options.
#
def initialize(watchers = [], options = {})
- @group = options.delete(:group) || :default
+ @group = options[:group] ? options.delete(:group).to_sym : :default
@watchers, @options = watchers, options
end
@@ -85,4 +85,5 @@ module Guard
end
end
+
end
From 1cd669bf60bb72d8ca66f1f433032cd222691893 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Re=CC=81my=20Coutable?=
Date: Fri, 23 Sep 2011 00:22:44 +0200
Subject: [PATCH 08/21] Refactor & fix specs
---
spec/guard/dsl_describer_spec.rb | 8 +-
spec/guard/dsl_spec.rb | 119 ++++++++++++---------------
spec/guard/hook_spec.rb | 25 +++---
spec/guard/listener_spec.rb | 16 ++--
spec/guard/listeners/darwin_spec.rb | 8 +-
spec/guard/listeners/linux_spec.rb | 9 +-
spec/guard/listeners/polling_spec.rb | 2 +-
spec/guard/listeners/windows_spec.rb | 13 ++-
spec/guard/notifier_spec.rb | 100 +++++++++++-----------
spec/guard/watcher_spec.rb | 96 ++++++++++-----------
10 files changed, 190 insertions(+), 206 deletions(-)
diff --git a/spec/guard/dsl_describer_spec.rb b/spec/guard/dsl_describer_spec.rb
index eaaa03d..9c17ac6 100644
--- a/spec/guard/dsl_describer_spec.rb
+++ b/spec/guard/dsl_describer_spec.rb
@@ -6,8 +6,6 @@ describe Guard::DslDescriber do
user_config_path = File.expand_path(File.join('~', '.guard.rb'))
File.stub(:exist?).with(user_config_path) { false }
end
- subject { described_class }
-
it 'should evaluate a Guardfile and create the right structure' do
mixed_guardfile_string = <<-GUARD
@@ -28,13 +26,13 @@ group "b" do
end
GUARD
- subject.evaluate_guardfile(:guardfile_contents => mixed_guardfile_string)
+ described_class.evaluate_guardfile(:guardfile_contents => mixed_guardfile_string)
- subject.guardfile_structure.should == [
+ described_class.guardfile_structure.should == [
{ :guards => [ { :name => 'test', :options => { :a => :b } } ] },
{ :group => :a, :guards => [ { :name => 'test', :options => {} } ] },
{ :group => :b, :guards => [ { :name => 'another', :options => {} } ] }
]
-
end
+
end
diff --git a/spec/guard/dsl_spec.rb b/spec/guard/dsl_spec.rb
index 37d07d3..d23f56e 100644
--- a/spec/guard/dsl_spec.rb
+++ b/spec/guard/dsl_spec.rb
@@ -2,7 +2,7 @@ require 'spec_helper'
require 'guard/guard'
describe Guard::Dsl do
- subject { described_class }
+
class Guard::Dummy < Guard::Guard; end
before(:each) do
@@ -24,24 +24,24 @@ describe Guard::Dsl do
it "should use a string for initializing" do
Guard::UI.should_not_receive(:error)
- lambda { subject.evaluate_guardfile(:guardfile_contents => valid_guardfile_string) }.should_not raise_error
- subject.guardfile_contents.should == valid_guardfile_string
+ lambda { described_class.evaluate_guardfile(:guardfile_contents => valid_guardfile_string) }.should_not raise_error
+ described_class.guardfile_contents.should == valid_guardfile_string
end
it "should use a given file over the default loc" do
fake_guardfile('/abc/Guardfile', "guard :foo")
Guard::UI.should_not_receive(:error)
- lambda { subject.evaluate_guardfile(:guardfile => '/abc/Guardfile') }.should_not raise_error
- subject.guardfile_contents.should == "guard :foo"
+ lambda { described_class.evaluate_guardfile(:guardfile => '/abc/Guardfile') }.should_not raise_error
+ described_class.guardfile_contents.should == "guard :foo"
end
it "should use a default file if no other options are given" do
fake_guardfile(@local_guardfile_path, "guard :bar")
Guard::UI.should_not_receive(:error)
- lambda { subject.evaluate_guardfile }.should_not raise_error
- subject.guardfile_contents.should == "guard :bar"
+ lambda { described_class.evaluate_guardfile }.should_not raise_error
+ described_class.guardfile_contents.should == "guard :bar"
end
it "should use a string over any other method" do
@@ -49,8 +49,8 @@ describe Guard::Dsl do
fake_guardfile(@local_guardfile_path, "guard :bar")
Guard::UI.should_not_receive(:error)
- lambda { subject.evaluate_guardfile(:guardfile_contents => valid_guardfile_string) }.should_not raise_error
- subject.guardfile_contents.should == valid_guardfile_string
+ lambda { described_class.evaluate_guardfile(:guardfile_contents => valid_guardfile_string) }.should_not raise_error
+ described_class.guardfile_contents.should == valid_guardfile_string
end
it "should use the given Guardfile over default Guardfile" do
@@ -58,31 +58,31 @@ describe Guard::Dsl do
fake_guardfile(@local_guardfile_path, "guard :bar")
Guard::UI.should_not_receive(:error)
- lambda { subject.evaluate_guardfile(:guardfile => '/abc/Guardfile') }.should_not raise_error
- subject.guardfile_contents.should == "guard :foo"
+ lambda { described_class.evaluate_guardfile(:guardfile => '/abc/Guardfile') }.should_not raise_error
+ described_class.guardfile_contents.should == "guard :foo"
end
it 'should append the user config file if present' do
fake_guardfile('/abc/Guardfile', "guard :foo")
fake_guardfile(@user_config_path, "guard :bar")
Guard::UI.should_not_receive(:error)
- lambda { subject.evaluate_guardfile(:guardfile => '/abc/Guardfile') }.should_not raise_error
- subject.guardfile_contents_with_user_config.should == "guard :foo\nguard :bar"
+ lambda { described_class.evaluate_guardfile(:guardfile => '/abc/Guardfile') }.should_not raise_error
+ described_class.guardfile_contents_with_user_config.should == "guard :foo\nguard :bar"
end
end
it "displays an error message when no Guardfile is found" do
- subject.stub(:guardfile_default_path).and_return("no_guardfile_here")
+ described_class.stub(:guardfile_default_path).and_return("no_guardfile_here")
Guard::UI.should_receive(:error).with("No Guardfile found, please create one with `guard init`.")
- lambda { subject.evaluate_guardfile }.should raise_error
+ lambda { described_class.evaluate_guardfile }.should raise_error
end
it "displays an error message when no guard are defined in Guardfile" do
::Guard::Dsl.stub!(:instance_eval_guardfile)
::Guard.stub!(:guards).and_return([])
Guard::UI.should_receive(:error)
- subject.evaluate_guardfile(:guardfile_contents => valid_guardfile_string)
+ described_class.evaluate_guardfile(:guardfile_contents => valid_guardfile_string)
end
describe "correctly reads data from its valid data source" do
@@ -90,22 +90,22 @@ describe Guard::Dsl do
disable_user_config
it "reads correctly from a string" do
- lambda { subject.evaluate_guardfile(:guardfile_contents => valid_guardfile_string) }.should_not raise_error
- subject.guardfile_contents.should == valid_guardfile_string
+ lambda { described_class.evaluate_guardfile(:guardfile_contents => valid_guardfile_string) }.should_not raise_error
+ described_class.guardfile_contents.should == valid_guardfile_string
end
it "reads correctly from a Guardfile" do
fake_guardfile('/abc/Guardfile', "guard :foo" )
- lambda { subject.evaluate_guardfile(:guardfile => '/abc/Guardfile') }.should_not raise_error
- subject.guardfile_contents.should == "guard :foo"
+ lambda { described_class.evaluate_guardfile(:guardfile => '/abc/Guardfile') }.should_not raise_error
+ described_class.guardfile_contents.should == "guard :foo"
end
it "reads correctly from a Guardfile" do
fake_guardfile(File.join(Dir.pwd, 'Guardfile'), valid_guardfile_string)
- lambda { subject.evaluate_guardfile }.should_not raise_error
- subject.guardfile_contents.should == valid_guardfile_string
+ lambda { described_class.evaluate_guardfile }.should_not raise_error
+ described_class.guardfile_contents.should == valid_guardfile_string
end
end
@@ -117,14 +117,14 @@ describe Guard::Dsl do
File.stub!(:read).with('/def/Guardfile') { raise Errno::EACCES.new("permission error") }
Guard::UI.should_receive(:error).with(/^Error reading file/)
- lambda { subject.evaluate_guardfile(:guardfile => '/def/Guardfile') }.should raise_error
+ lambda { described_class.evaluate_guardfile(:guardfile => '/def/Guardfile') }.should raise_error
end
it "raises error when given Guardfile doesn't exist" do
File.stub!(:exist?).with('/def/Guardfile') { false }
Guard::UI.should_receive(:error).with(/No Guardfile exists at/)
- lambda { subject.evaluate_guardfile(:guardfile => '/def/Guardfile') }.should raise_error
+ lambda { described_class.evaluate_guardfile(:guardfile => '/def/Guardfile') }.should raise_error
end
it "raises error when resorting to use default, finds no default" do
@@ -132,24 +132,24 @@ describe Guard::Dsl do
File.stub!(:exist?).with(@home_guardfile_path) { false }
Guard::UI.should_receive(:error).with("No Guardfile found, please create one with `guard init`.")
- lambda { subject.evaluate_guardfile }.should raise_error
+ lambda { described_class.evaluate_guardfile }.should raise_error
end
it "raises error when guardfile_content ends up empty or nil" do
Guard::UI.should_receive(:error).with(/The command file/)
- lambda { subject.evaluate_guardfile(:guardfile_contents => "") }.should raise_error
+ lambda { described_class.evaluate_guardfile(:guardfile_contents => "") }.should raise_error
end
it "doesn't raise error when guardfile_content is nil (skipped)" do
Guard::UI.should_not_receive(:error)
- lambda { subject.evaluate_guardfile(:guardfile_contents => nil) }.should_not raise_error
+ lambda { described_class.evaluate_guardfile(:guardfile_contents => nil) }.should_not raise_error
end
end
it "displays an error message when Guardfile is not valid" do
Guard::UI.should_receive(:error).with(/Invalid Guardfile, original error is:/)
- lambda { subject.evaluate_guardfile(:guardfile_contents => invalid_guardfile_string ) }.should raise_error
+ lambda { described_class.evaluate_guardfile(:guardfile_contents => invalid_guardfile_string ) }.should raise_error
end
describe ".reevaluate_guardfile" do
@@ -157,10 +157,10 @@ describe Guard::Dsl do
it "resets already definded guards before calling evaluate_guardfile" do
Guard::Notifier.turn_off
- subject.evaluate_guardfile(:guardfile_contents => invalid_guardfile_string)
+ described_class.evaluate_guardfile(:guardfile_contents => invalid_guardfile_string)
::Guard.guards.should_not be_empty
::Guard::Dsl.should_receive(:evaluate_guardfile)
- subject.reevaluate_guardfile
+ described_class.reevaluate_guardfile
::Guard.guards.should be_empty
end
end
@@ -173,14 +173,14 @@ describe Guard::Dsl do
context "when there is a local Guardfile" do
it "returns the path to the local Guardfile" do
File.stub(:exist?).with(local_path).and_return(true)
- subject.guardfile_default_path.should == local_path
+ described_class.guardfile_default_path.should == local_path
end
end
context "when there is a Guardfile in the user's home directory" do
it "returns the path to the user Guardfile" do
File.stub(:exist?).with(user_path).and_return(true)
- subject.guardfile_default_path.should == user_path
+ described_class.guardfile_default_path.should == user_path
end
end
@@ -188,34 +188,34 @@ describe Guard::Dsl do
it "returns the path to the local Guardfile" do
File.stub(:exist?).with(local_path).and_return(true)
File.stub(:exist?).with(user_path).and_return(true)
- subject.guardfile_default_path.should == local_path
+ described_class.guardfile_default_path.should == local_path
end
end
end
describe ".guardfile_include?" do
it "detects a guard specified by a string with double quotes" do
- subject.stub(:guardfile_contents => 'guard "test" {watch("c")}')
+ described_class.stub(:guardfile_contents => 'guard "test" {watch("c")}')
- subject.guardfile_include?('test').should be_true
+ described_class.guardfile_include?('test').should be_true
end
it "detects a guard specified by a string with single quote" do
- subject.stub(:guardfile_contents => 'guard \'test\' {watch("c")}')
+ described_class.stub(:guardfile_contents => 'guard \'test\' {watch("c")}')
- subject.guardfile_include?('test').should be_true
+ described_class.guardfile_include?('test').should be_true
end
it "detects a guard specified by a symbol" do
- subject.stub(:guardfile_contents => 'guard :test {watch("c")}')
+ described_class.stub(:guardfile_contents => 'guard :test {watch("c")}')
- subject.guardfile_include?('test').should be_true
+ described_class.guardfile_include?('test').should be_true
end
it "detects a guard wrapped in parentheses" do
- subject.stub(:guardfile_contents => 'guard(:test) {watch("c")}')
+ described_class.stub(:guardfile_contents => 'guard(:test) {watch("c")}')
- subject.guardfile_include?('test').should be_true
+ described_class.guardfile_include?('test').should be_true
end
end
@@ -226,7 +226,7 @@ describe Guard::Dsl do
::Guard.stub!(:listener).and_return(mock('Listener'))
::Guard.listener.should_receive(:ignore_paths).and_return(ignore_paths = ['faz'])
- subject.evaluate_guardfile(:guardfile_contents => "ignore_paths 'foo', 'bar'")
+ described_class.evaluate_guardfile(:guardfile_contents => "ignore_paths 'foo', 'bar'")
ignore_paths.should == ['faz', 'foo', 'bar']
end
end
@@ -238,18 +238,14 @@ describe Guard::Dsl do
::Guard.should_receive(:add_guard).with('pow', [], [], { :group => :default })
::Guard.should_receive(:add_guard).with('test', [], [], { :group => :w })
- subject.evaluate_guardfile(:guardfile_contents => valid_guardfile_string, :group => [:w])
-
- ::Guard.groups.should eql [{ :name => :default, :options => {} }, { :name => :w, :options => {} }]
+ described_class.evaluate_guardfile(:guardfile_contents => valid_guardfile_string, :group => [:w])
end
it "evaluates only the specified symbol group" do
::Guard.should_receive(:add_guard).with('pow', [], [], { :group => :default })
::Guard.should_receive(:add_guard).with('test', [], [], { :group => :w })
- subject.evaluate_guardfile(:guardfile_contents => valid_guardfile_string, :group => [:w])
-
- ::Guard.groups.should eql [{ :name => :default, :options => {} }, { :name => :w, :options => {} }]
+ described_class.evaluate_guardfile(:guardfile_contents => valid_guardfile_string, :group => [:w])
end
it "evaluates only the specified groups (with their options)" do
@@ -258,18 +254,14 @@ describe Guard::Dsl do
::Guard.should_receive(:add_guard).with('ronn', [], [], { :group => :x })
::Guard.should_receive(:add_guard).with('less', [], [], { :group => :y })
- subject.evaluate_guardfile(:guardfile_contents => valid_guardfile_string, :group => [:x, :y])
-
- ::Guard.groups.should eql [{ :name => :default, :options => {} }, { :name => :x, :options => { :halt_on_fail => true } }, { :name => :y, :options => {} }]
+ described_class.evaluate_guardfile(:guardfile_contents => valid_guardfile_string, :group => [:x, :y])
end
it "evaluates always guard outside any group (even when a group is given)" do
::Guard.should_receive(:add_guard).with('pow', [], [], { :group => :default })
::Guard.should_receive(:add_guard).with('test', [], [], { :group => :w })
- subject.evaluate_guardfile(:guardfile_contents => valid_guardfile_string, :group => [:w])
-
- ::Guard.groups.should eql [{ :name => :default, :options => {} }, { :name => :w, :options => {} }]
+ described_class.evaluate_guardfile(:guardfile_contents => valid_guardfile_string, :group => [:w])
end
it "evaluates all groups when no group option is specified (with their options)" do
@@ -279,10 +271,7 @@ describe Guard::Dsl do
::Guard.should_receive(:add_guard).with('ronn', [], [], { :group => :x })
::Guard.should_receive(:add_guard).with('less', [], [], { :group => :y })
- subject.evaluate_guardfile(:guardfile_contents => valid_guardfile_string)
-
- ::Guard.groups.should eql [{ :name => :default, :options => {} }, { :name => :w, :options => {} }, { :name => :x, :options => { :halt_on_fail => true } }, { :name => :y, :options => {} }]
-
+ described_class.evaluate_guardfile(:guardfile_contents => valid_guardfile_string)
end
end
@@ -292,31 +281,31 @@ describe Guard::Dsl do
it "loads a guard specified as a quoted string from the DSL" do
::Guard.should_receive(:add_guard).with('test', [], [], { :group => :default })
- subject.evaluate_guardfile(:guardfile_contents => "guard 'test'")
+ described_class.evaluate_guardfile(:guardfile_contents => "guard 'test'")
end
it "loads a guard specified as a double quoted string from the DSL" do
::Guard.should_receive(:add_guard).with('test', [], [], { :group => :default })
- subject.evaluate_guardfile(:guardfile_contents => 'guard "test"')
+ described_class.evaluate_guardfile(:guardfile_contents => 'guard "test"')
end
it "loads a guard specified as a symbol from the DSL" do
::Guard.should_receive(:add_guard).with('test', [], [], { :group => :default })
- subject.evaluate_guardfile(:guardfile_contents => "guard :test")
+ described_class.evaluate_guardfile(:guardfile_contents => "guard :test")
end
it "loads a guard specified as a symbol and called with parens from the DSL" do
::Guard.should_receive(:add_guard).with('test', [], [], { :group => :default })
- subject.evaluate_guardfile(:guardfile_contents => "guard(:test)")
+ described_class.evaluate_guardfile(:guardfile_contents => "guard(:test)")
end
it "receives options when specified, from normal arg" do
::Guard.should_receive(:add_guard).with('test', [], [], { :opt_a => 1, :opt_b => 'fancy', :group => :default })
- subject.evaluate_guardfile(:guardfile_contents => "guard 'test', :opt_a => 1, :opt_b => 'fancy'")
+ described_class.evaluate_guardfile(:guardfile_contents => "guard 'test', :opt_a => 1, :opt_b => 'fancy'")
end
end
@@ -331,7 +320,7 @@ describe Guard::Dsl do
watchers[1].pattern.should == 'c'
watchers[1].action.should == nil
end
- subject.evaluate_guardfile(:guardfile_contents => "
+ described_class.evaluate_guardfile(:guardfile_contents => "
guard :dummy do
watch('a') { 'b' }
watch('c')
@@ -354,7 +343,7 @@ describe Guard::Dsl do
callbacks[1][:events].should == [:start_begin, :run_all_begin]
callbacks[1][:listener].should == MyCustomCallback
end
- subject.evaluate_guardfile(:guardfile_contents => '
+ described_class.evaluate_guardfile(:guardfile_contents => '
guard :dummy do
callback(:start_end) { |guard_class, event, args| "#{guard_class} executed \'#{event}\' hook with #{args}!" }
callback(MyCustomCallback, [:start_begin, :run_all_begin])
diff --git a/spec/guard/hook_spec.rb b/spec/guard/hook_spec.rb
index af2a6ac..fa81aeb 100644
--- a/spec/guard/hook_spec.rb
+++ b/spec/guard/hook_spec.rb
@@ -2,48 +2,47 @@ require 'spec_helper'
require 'guard/guard'
describe Guard::Hook do
- subject { Guard::Hook }
class Guard::Dummy < Guard::Guard; end
let(:guard_class) { ::Guard::Dummy }
let(:listener) { double('listener').as_null_object }
- after { subject.reset_callbacks! }
+ after { described_class.reset_callbacks! }
- context "--module methods--" do
- before { subject.add_callback(listener, guard_class, :start_begin) }
+ describe "--module methods--" do
+ before { described_class.add_callback(listener, guard_class, :start_begin) }
describe ".add_callback" do
it "can add a single callback" do
- subject.has_callback?(listener, guard_class, :start_begin).should be_true
+ described_class.has_callback?(listener, guard_class, :start_begin).should be_true
end
it "can add multiple callbacks" do
- subject.add_callback(listener, guard_class, [:event1, :event2])
- subject.has_callback?(listener, guard_class, :event1).should be_true
- subject.has_callback?(listener, guard_class, :event2).should be_true
+ described_class.add_callback(listener, guard_class, [:event1, :event2])
+ described_class.has_callback?(listener, guard_class, :event1).should be_true
+ described_class.has_callback?(listener, guard_class, :event2).should be_true
end
end
describe ".notify" do
it "sends :call to the given Guard class's callbacks" do
listener.should_receive(:call).with(guard_class, :start_begin, "args")
- subject.notify(guard_class, :start_begin, "args")
+ described_class.notify(guard_class, :start_begin, "args")
end
it "runs only the given callbacks" do
listener2 = double('listener2')
- subject.add_callback(listener2, guard_class, :start_end)
+ described_class.add_callback(listener2, guard_class, :start_end)
listener2.should_not_receive(:call).with(guard_class, :start_end)
- subject.notify(guard_class, :start_begin)
+ described_class.notify(guard_class, :start_begin)
end
it "runs callbacks only for the guard given" do
guard2_class = double('Guard::Dummy2').class
- subject.add_callback(listener, guard2_class, :start_begin)
+ described_class.add_callback(listener, guard2_class, :start_begin)
listener.should_not_receive(:call).with(guard2_class, :start_begin)
- subject.notify(guard_class, :start_begin)
+ described_class.notify(guard_class, :start_begin)
end
end
end
diff --git a/spec/guard/listener_spec.rb b/spec/guard/listener_spec.rb
index 011b829..70c26e6 100644
--- a/spec/guard/listener_spec.rb
+++ b/spec/guard/listener_spec.rb
@@ -1,7 +1,6 @@
require 'spec_helper'
describe Guard::Listener do
- subject { Guard::Listener }
describe ".select_and_init" do
before(:each) { @target_os = RbConfig::CONFIG['target_os'] }
@@ -11,30 +10,30 @@ describe Guard::Listener do
RbConfig::CONFIG['target_os'] = 'darwin10.4.0'
Guard::Darwin.stub(:usable?).and_return(true)
Guard::Darwin.should_receive(:new)
- subject.select_and_init
+ described_class.select_and_init
end
it "uses the Windows listener on Windows" do
RbConfig::CONFIG['target_os'] = 'mingw'
Guard::Windows.stub(:usable?).and_return(true)
Guard::Windows.should_receive(:new)
- subject.select_and_init
+ described_class.select_and_init
end
it "uses the Linux listener on Linux" do
RbConfig::CONFIG['target_os'] = 'linux'
Guard::Linux.stub(:usable?).and_return(true)
Guard::Linux.should_receive(:new)
- subject.select_and_init
+ described_class.select_and_init
end
it "forwards its arguments to the constructor" do
- subject.stub!(:mac?).and_return(true)
+ described_class.stub!(:mac?).and_return(true)
Guard::Darwin.stub!(:usable?).and_return(true)
path, opts = 'path', { :foo => 23 }
Guard::Darwin.should_receive(:new).with(path, opts).and_return(true)
- subject.select_and_init(path, opts)
+ described_class.select_and_init(path, opts)
end
end
@@ -172,11 +171,11 @@ describe Guard::Listener do
describe "#ignore_paths" do
it "defaults to the default ignore paths" do
- subject.new.ignore_paths.should == Guard::Listener::DEFAULT_IGNORE_PATHS
+ described_class.new.ignore_paths.should == Guard::Listener::DEFAULT_IGNORE_PATHS
end
it "can be added to via :ignore_paths option" do
- listener = subject.new 'path', :ignore_paths => ['foo', 'bar']
+ listener = described_class.new 'path', :ignore_paths => ['foo', 'bar']
listener.ignore_paths.should include('foo', 'bar')
end
end
@@ -197,4 +196,5 @@ describe Guard::Listener do
end
end
end
+
end
diff --git a/spec/guard/listeners/darwin_spec.rb b/spec/guard/listeners/darwin_spec.rb
index 1b679bb..2f394c0 100644
--- a/spec/guard/listeners/darwin_spec.rb
+++ b/spec/guard/listeners/darwin_spec.rb
@@ -2,26 +2,26 @@ require 'spec_helper'
require 'guard/listeners/darwin'
describe Guard::Darwin do
- subject { Guard::Darwin }
if windows?
it "isn't usable on windows" do
- subject.should_not be_usable
+ described_class.should_not be_usable
end
end
if linux?
it "isn't usable on linux" do
- subject.should_not be_usable
+ described_class.should_not be_usable
end
end
if mac? && Guard::Darwin.usable?
it "is usable on 10.6" do
- subject.should be_usable
+ described_class.should be_usable
end
it_should_behave_like "a listener that reacts to #on_change"
it_should_behave_like "a listener scoped to a specific directory"
end
+
end
diff --git a/spec/guard/listeners/linux_spec.rb b/spec/guard/listeners/linux_spec.rb
index 2ca2f18..eb9dbe7 100644
--- a/spec/guard/listeners/linux_spec.rb
+++ b/spec/guard/listeners/linux_spec.rb
@@ -3,23 +3,22 @@ require 'fileutils'
require 'guard/listeners/linux'
describe Guard::Linux do
- subject { Guard::Linux }
if mac?
it "isn't usable on 10.6" do
- subject.should_not be_usable
+ described_class.should_not be_usable
end
end
if windows?
it "isn't usable on windows" do
- subject.should_not be_usable
+ described_class.should_not be_usable
end
end
if linux? && Guard::Linux.usable?
it "is usable on linux" do
- subject.should be_usable
+ described_class.should be_usable
end
describe "#start", :long_running => true do
@@ -72,6 +71,6 @@ describe Guard::Linux do
stop
File.open(file, 'w') {|f| f.write('') }
end
-
end
+
end
diff --git a/spec/guard/listeners/polling_spec.rb b/spec/guard/listeners/polling_spec.rb
index 072421e..ef066bb 100644
--- a/spec/guard/listeners/polling_spec.rb
+++ b/spec/guard/listeners/polling_spec.rb
@@ -2,8 +2,8 @@ require 'spec_helper'
require 'guard/listeners/polling'
describe Guard::Polling do
- subject { Guard::Polling }
it_should_behave_like "a listener that reacts to #on_change"
it_should_behave_like "a listener scoped to a specific directory"
+
end
diff --git a/spec/guard/listeners/windows_spec.rb b/spec/guard/listeners/windows_spec.rb
index f59cf55..0048e5e 100644
--- a/spec/guard/listeners/windows_spec.rb
+++ b/spec/guard/listeners/windows_spec.rb
@@ -2,27 +2,26 @@ require 'spec_helper'
require 'guard/listeners/windows'
describe Guard::Windows do
- subject { Guard::Windows }
if linux?
it "isn't usable on linux" do
- subject.should_not be_usable
+ described_class.should_not be_usable
end
end
if mac?
it "isn't usable on Mac" do
- subject.should_not be_usable
+ described_class.should_not be_usable
end
end
if windows?
it "is usable on Windows 2000 and later" do
- subject.should be_usable
+ described_class.should be_usable
end
- it_should_behave_like "a listener that reacts to #on_change"
- it_should_behave_like "a listener scoped to a specific directory"
-
+ it_should_behave_like "a listener that reacts to #on_change"
+ it_should_behave_like "a listener scoped to a specific directory"
end
+
end
diff --git a/spec/guard/notifier_spec.rb b/spec/guard/notifier_spec.rb
index ea24b90..806e2a0 100644
--- a/spec/guard/notifier_spec.rb
+++ b/spec/guard/notifier_spec.rb
@@ -1,12 +1,11 @@
require 'spec_helper'
describe Guard::Notifier do
- subject { Guard::Notifier }
describe ".turn_off" do
before do
ENV["GUARD_NOTIFY"] = 'true'
- subject.turn_off
+ described_class.turn_off
end
it "disables the notifications" do
@@ -28,10 +27,10 @@ describe Guard::Notifier do
end
it "loads the library and enables the notifications" do
- subject.should_receive(:require).with('growl_notify').and_return true
+ described_class.should_receive(:require).with('growl_notify').and_return true
GrowlNotify.should_receive(:application_name).and_return ''
- subject.turn_on
- subject.should be_enabled
+ described_class.turn_on
+ described_class.should be_enabled
end
after do
@@ -41,19 +40,19 @@ describe Guard::Notifier do
context "with the Growl library available" do
it "loads the library and enables the notifications" do
- subject.should_receive(:require).with('growl_notify').and_raise LoadError
- subject.should_receive(:require).with('growl').and_return true
- subject.turn_on
- subject.should be_enabled
+ described_class.should_receive(:require).with('growl_notify').and_raise LoadError
+ described_class.should_receive(:require).with('growl').and_return true
+ described_class.turn_on
+ described_class.should be_enabled
end
end
context "without the Growl library available" do
it "disables the notifications" do
- subject.should_receive(:require).with('growl_notify').and_raise LoadError
- subject.should_receive(:require).with('growl').and_raise LoadError
- subject.turn_on
- subject.should_not be_enabled
+ described_class.should_receive(:require).with('growl_notify').and_raise LoadError
+ described_class.should_receive(:require).with('growl').and_raise LoadError
+ described_class.turn_on
+ described_class.should_not be_enabled
end
end
end
@@ -65,17 +64,17 @@ describe Guard::Notifier do
context "with the Libnotify library available" do
it "loads the library and enables the notifications" do
- subject.should_receive(:require).with('libnotify').and_return true
- subject.turn_on
- subject.should be_enabled
+ described_class.should_receive(:require).with('libnotify').and_return true
+ described_class.turn_on
+ described_class.should be_enabled
end
end
context "without the Libnotify library available" do
it "disables the notifications" do
- subject.should_receive(:require).with('libnotify').and_raise LoadError
- subject.turn_on
- subject.should_not be_enabled
+ described_class.should_receive(:require).with('libnotify').and_raise LoadError
+ described_class.turn_on
+ described_class.should_not be_enabled
end
end
end
@@ -87,29 +86,29 @@ describe Guard::Notifier do
context "with the rb-notifu library available" do
it "loads the library and enables the notifications" do
- subject.should_receive(:require).with('rb-notifu').and_return true
- subject.turn_on
- subject.should be_enabled
+ described_class.should_receive(:require).with('rb-notifu').and_return true
+ described_class.turn_on
+ described_class.should be_enabled
end
end
context "without the rb-notify library available" do
it "disables the notifications" do
- subject.should_receive(:require).with('rb-notifu').and_raise LoadError
- subject.turn_on
- subject.should_not be_enabled
+ described_class.should_receive(:require).with('rb-notifu').and_raise LoadError
+ described_class.turn_on
+ described_class.should_not be_enabled
end
end
end
end
describe ".notify" do
- before { subject.stub(:enabled?).and_return(true) }
+ before { described_class.stub(:enabled?).and_return(true) }
context "on Mac OS" do
before do
RbConfig::CONFIG.should_receive(:[]).with('target_os').and_return 'darwin'
- subject.stub(:require_growl)
+ described_class.stub(:require_growl)
end
context 'with growl gem' do
@@ -128,13 +127,13 @@ describe Guard::Notifier do
:icon => Pathname.new(File.dirname(__FILE__)).join('../../images/success.png').to_s,
:name => "Guard"
)
- subject.notify 'great', :title => 'Guard'
+ described_class.notify 'great', :title => 'Guard'
end
it "don't passes the notification to Growl if library is not available" do
Growl.should_not_receive(:notify)
- subject.should_receive(:enabled?).and_return(true, false)
- subject.notify 'great', :title => 'Guard'
+ described_class.should_receive(:enabled?).and_return(true, false)
+ described_class.notify 'great', :title => 'Guard'
end
it "allows additional notification options" do
@@ -144,7 +143,7 @@ describe Guard::Notifier do
:name => "Guard",
:priority => 1
)
- subject.notify 'great', :title => 'Guard', :priority => 1
+ described_class.notify 'great', :title => 'Guard', :priority => 1
end
it "allows to overwrite a default notification option" do
@@ -153,7 +152,7 @@ describe Guard::Notifier do
:icon => Pathname.new(File.dirname(__FILE__)).join('../../images/success.png').to_s,
:name => "Guard-Cucumber"
)
- subject.notify 'great', :title => 'Guard', :name => "Guard-Cucumber"
+ described_class.notify 'great', :title => 'Guard', :name => "Guard-Cucumber"
end
end
@@ -174,13 +173,13 @@ describe Guard::Notifier do
:application_name => "Guard",
:description => 'great'
)
- subject.notify 'great', :title => 'Guard'
+ described_class.notify 'great', :title => 'Guard'
end
it "don't passes the notification to Growl if library is not available" do
GrowlNotify.should_not_receive(:send_notification)
- subject.should_receive(:enabled?).and_return(true, false)
- subject.notify 'great', :title => 'Guard'
+ described_class.should_receive(:enabled?).and_return(true, false)
+ described_class.notify 'great', :title => 'Guard'
end
it "allows additional notification options" do
@@ -191,7 +190,7 @@ describe Guard::Notifier do
:description => 'great',
:priority => 1
)
- subject.notify 'great', :title => 'Guard', :priority => 1
+ described_class.notify 'great', :title => 'Guard', :priority => 1
end
it "throws out the application name since Guard should only use one Growl App Name while running" do
@@ -201,15 +200,15 @@ describe Guard::Notifier do
:application_name => "Guard",
:description => 'great'
)
- subject.notify 'great', :title => 'Guard', :name => "Guard-Cucumber"
+ described_class.notify 'great', :title => 'Guard', :name => "Guard-Cucumber"
end
end
end
-
+
context "on Linux" do
before do
RbConfig::CONFIG.should_receive(:[]).with('target_os').and_return 'linux'
- subject.stub(:require_libnotify)
+ described_class.stub(:require_libnotify)
Object.send(:remove_const, :Libnotify) if defined?(Libnotify)
Libnotify = Object.new
end
@@ -225,13 +224,13 @@ describe Guard::Notifier do
:icon_path => Pathname.new(File.dirname(__FILE__)).join('../../images/success.png').to_s,
:transient => true
)
- subject.notify 'great', :title => 'Guard'
+ described_class.notify 'great', :title => 'Guard'
end
it "don't passes the notification to Libnotify if library is not available" do
Libnotify.should_not_receive(:show)
- subject.should_receive(:enabled?).and_return(true, false)
- subject.notify 'great', :title => 'Guard'
+ described_class.should_receive(:enabled?).and_return(true, false)
+ described_class.notify 'great', :title => 'Guard'
end
it "allows additional notification options" do
@@ -242,7 +241,7 @@ describe Guard::Notifier do
:transient => true,
:urgency => :critical
)
- subject.notify 'great', :title => 'Guard', :urgency => :critical
+ described_class.notify 'great', :title => 'Guard', :urgency => :critical
end
it "allows to overwrite a default notification option" do
@@ -252,14 +251,14 @@ describe Guard::Notifier do
:icon_path => '~/.guard/success.png',
:transient => true
)
- subject.notify 'great', :title => 'Guard', :icon_path => '~/.guard/success.png'
+ described_class.notify 'great', :title => 'Guard', :icon_path => '~/.guard/success.png'
end
end
context "on Windows" do
before do
RbConfig::CONFIG.should_receive(:[]).with('target_os').and_return 'mswin'
- subject.stub(:require_rbnotifu)
+ described_class.stub(:require_rbnotifu)
Object.send(:remove_const, :Notifu) if defined?(Notifu)
Notifu = Object.new
end
@@ -275,13 +274,13 @@ describe Guard::Notifier do
:type => :info,
:time => 3
)
- subject.notify 'great', :title => 'Guard'
+ described_class.notify 'great', :title => 'Guard'
end
it "don't passes the notification to rb-notifu if library is not available" do
Notifu.should_not_receive(:show)
- subject.should_receive(:enabled?).and_return(true, false)
- subject.notify 'great', :title => 'Guard'
+ described_class.should_receive(:enabled?).and_return(true, false)
+ described_class.notify 'great', :title => 'Guard'
end
it "allows additional notification options" do
@@ -292,7 +291,7 @@ describe Guard::Notifier do
:time => 3,
:nosound => true
)
- subject.notify 'great', :title => 'Guard', :nosound => true
+ described_class.notify 'great', :title => 'Guard', :nosound => true
end
it "allows to overwrite a default notification option" do
@@ -302,7 +301,7 @@ describe Guard::Notifier do
:type => :info,
:time => 10
)
- subject.notify 'great', :title => 'Guard', :time => 10
+ described_class.notify 'great', :title => 'Guard', :time => 10
end
end
end
@@ -320,4 +319,5 @@ describe Guard::Notifier do
it { should_not be_enabled }
end
end
+
end
diff --git a/spec/guard/watcher_spec.rb b/spec/guard/watcher_spec.rb
index bf09df5..ff1775f 100644
--- a/spec/guard/watcher_spec.rb
+++ b/spec/guard/watcher_spec.rb
@@ -5,19 +5,19 @@ describe Guard::Watcher do
describe "#initialize" do
it "requires a pattern parameter" do
- expect { Guard::Watcher.new }.to raise_error(ArgumentError)
+ expect { described_class.new }.to raise_error(ArgumentError)
end
context "with a pattern parameter" do
context "that is a string" do
it "keeps the string pattern unmodified" do
- Guard::Watcher.new('spec_helper.rb').pattern.should == 'spec_helper.rb'
+ described_class.new('spec_helper.rb').pattern.should == 'spec_helper.rb'
end
end
context "that is a regexp" do
it "keeps the regex pattern unmodified" do
- Guard::Watcher.new(/spec_helper\.rb/).pattern.should == /spec_helper\.rb/
+ described_class.new(/spec_helper\.rb/).pattern.should == /spec_helper\.rb/
end
end
@@ -25,10 +25,10 @@ describe Guard::Watcher do
before(:each) { Guard::UI.should_receive(:info).any_number_of_times }
it "converts the string automatically to a regex" do
- Guard::Watcher.new('^spec_helper.rb').pattern.should == /^spec_helper.rb/
- Guard::Watcher.new('spec_helper.rb$').pattern.should == /spec_helper.rb$/
- Guard::Watcher.new('spec_helper\.rb').pattern.should == /spec_helper\.rb/
- Guard::Watcher.new('.*_spec.rb').pattern.should == /.*_spec.rb/
+ described_class.new('^spec_helper.rb').pattern.should == /^spec_helper.rb/
+ described_class.new('spec_helper.rb$').pattern.should == /spec_helper.rb$/
+ described_class.new('spec_helper\.rb').pattern.should == /spec_helper\.rb/
+ described_class.new('.*_spec.rb').pattern.should == /.*_spec.rb/
end
end
end
@@ -36,12 +36,12 @@ describe Guard::Watcher do
describe "#action" do
it "sets the action to nothing by default" do
- Guard::Watcher.new(/spec_helper\.rb/).action.should be_nil
+ described_class.new(/spec_helper\.rb/).action.should be_nil
end
it "sets the action to the supplied block" do
action = lambda { |m| "spec/#{m[1]}_spec.rb" }
- Guard::Watcher.new(%r{^lib/(.*).rb}, action).action.should == action
+ described_class.new(%r{^lib/(.*).rb}, action).action.should == action
end
end
@@ -50,18 +50,18 @@ describe Guard::Watcher do
context "with a watcher without action" do
context "that is a regex pattern" do
- before(:all) { @guard.watchers = [Guard::Watcher.new(/.*_spec\.rb/)] }
+ before(:all) { @guard.watchers = [described_class.new(/.*_spec\.rb/)] }
it "returns the paths that matches the regex" do
- Guard::Watcher.match_files(@guard, ['guard_rocks_spec.rb', 'guard_rocks.rb']).should == ['guard_rocks_spec.rb']
+ described_class.match_files(@guard, ['guard_rocks_spec.rb', 'guard_rocks.rb']).should == ['guard_rocks_spec.rb']
end
end
context "that is a string pattern" do
- before(:all) { @guard.watchers = [Guard::Watcher.new('guard_rocks_spec.rb')] }
+ before(:all) { @guard.watchers = [described_class.new('guard_rocks_spec.rb')] }
it "returns the path that matches the string" do
- Guard::Watcher.match_files(@guard, ['guard_rocks_spec.rb', 'guard_rocks.rb']).should == ['guard_rocks_spec.rb']
+ described_class.match_files(@guard, ['guard_rocks_spec.rb', 'guard_rocks.rb']).should == ['guard_rocks_spec.rb']
end
end
end
@@ -69,79 +69,79 @@ describe Guard::Watcher do
context "with a watcher action without parameter" do
before(:all) do
@guard.watchers = [
- Guard::Watcher.new('spec_helper.rb', lambda { 'spec' }),
- Guard::Watcher.new('addition.rb', lambda { 1 + 1 }),
- Guard::Watcher.new('hash.rb', lambda { Hash[:foo, 'bar'] }),
- Guard::Watcher.new('array.rb', lambda { ['foo', 'bar'] }),
- Guard::Watcher.new('blank.rb', lambda { '' }),
- Guard::Watcher.new(/^uptime\.rb/, lambda { `uptime > /dev/null` })
+ described_class.new('spec_helper.rb', lambda { 'spec' }),
+ described_class.new('addition.rb', lambda { 1 + 1 }),
+ described_class.new('hash.rb', lambda { Hash[:foo, 'bar'] }),
+ described_class.new('array.rb', lambda { ['foo', 'bar'] }),
+ described_class.new('blank.rb', lambda { '' }),
+ described_class.new(/^uptime\.rb/, lambda { `uptime > /dev/null` })
]
end
it "returns a single file specified within the action" do
- Guard::Watcher.match_files(@guard, ['spec_helper.rb']).should == ['spec']
+ described_class.match_files(@guard, ['spec_helper.rb']).should == ['spec']
end
it "returns multiple files specified within the action" do
- Guard::Watcher.match_files(@guard, ['hash.rb']).should == ['foo', 'bar']
+ described_class.match_files(@guard, ['hash.rb']).should == ['foo', 'bar']
end
it "returns multiple files by combining the results of different actions" do
- Guard::Watcher.match_files(@guard, ['spec_helper.rb', 'array.rb']).should == ['spec', 'foo', 'bar']
+ described_class.match_files(@guard, ['spec_helper.rb', 'array.rb']).should == ['spec', 'foo', 'bar']
end
it "returns nothing if the action returns something other than a string or an array of strings" do
- Guard::Watcher.match_files(@guard, ['addition.rb']).should == []
+ described_class.match_files(@guard, ['addition.rb']).should == []
end
it "returns nothing if the action response is empty" do
- Guard::Watcher.match_files(@guard, ['blank.rb']).should == []
+ described_class.match_files(@guard, ['blank.rb']).should == []
end
it "returns nothing if the action returns nothing" do
- Guard::Watcher.match_files(@guard, ['uptime.rb']).should == []
+ described_class.match_files(@guard, ['uptime.rb']).should == []
end
end
context "with a watcher action that takes a parameter" do
before(:all) do
@guard.watchers = [
- Guard::Watcher.new(%r{lib/(.*)\.rb}, lambda { |m| "spec/#{m[1]}_spec.rb" }),
- Guard::Watcher.new(/addition(.*)\.rb/, lambda { |m| 1 + 1 }),
- Guard::Watcher.new('hash.rb', lambda { Hash[:foo, 'bar'] }),
- Guard::Watcher.new(/array(.*)\.rb/, lambda { |m| ['foo', 'bar'] }),
- Guard::Watcher.new(/blank(.*)\.rb/, lambda { |m| '' }),
- Guard::Watcher.new(/uptime(.*)\.rb/, lambda { |m| `uptime > /dev/null` })
+ described_class.new(%r{lib/(.*)\.rb}, lambda { |m| "spec/#{m[1]}_spec.rb" }),
+ described_class.new(/addition(.*)\.rb/, lambda { |m| 1 + 1 }),
+ described_class.new('hash.rb', lambda { Hash[:foo, 'bar'] }),
+ described_class.new(/array(.*)\.rb/, lambda { |m| ['foo', 'bar'] }),
+ described_class.new(/blank(.*)\.rb/, lambda { |m| '' }),
+ described_class.new(/uptime(.*)\.rb/, lambda { |m| `uptime > /dev/null` })
]
end
it "returns a substituted single file specified within the action" do
- Guard::Watcher.match_files(@guard, ['lib/my_wonderful_lib.rb']).should == ['spec/my_wonderful_lib_spec.rb']
+ described_class.match_files(@guard, ['lib/my_wonderful_lib.rb']).should == ['spec/my_wonderful_lib_spec.rb']
end
it "returns multiple files specified within the action" do
- Guard::Watcher.match_files(@guard, ['hash.rb']).should == ['foo', 'bar']
+ described_class.match_files(@guard, ['hash.rb']).should == ['foo', 'bar']
end
it "returns multiple files by combining the results of different actions" do
- Guard::Watcher.match_files(@guard, ['lib/my_wonderful_lib.rb', 'array.rb']).should == ['spec/my_wonderful_lib_spec.rb', 'foo', 'bar']
+ described_class.match_files(@guard, ['lib/my_wonderful_lib.rb', 'array.rb']).should == ['spec/my_wonderful_lib_spec.rb', 'foo', 'bar']
end
it "returns nothing if the action returns something other than a string or an array of strings" do
- Guard::Watcher.match_files(@guard, ['addition.rb']).should == []
+ described_class.match_files(@guard, ['addition.rb']).should == []
end
it "returns nothing if the action response is empty" do
- Guard::Watcher.match_files(@guard, ['blank.rb']).should == []
+ described_class.match_files(@guard, ['blank.rb']).should == []
end
it "returns nothing if the action returns nothing" do
- Guard::Watcher.match_files(@guard, ['uptime.rb']).should == []
+ described_class.match_files(@guard, ['uptime.rb']).should == []
end
end
context "with an exception that is raised" do
- before(:all) { @guard.watchers = [Guard::Watcher.new('evil.rb', lambda { raise "EVIL" })] }
+ before(:all) { @guard.watchers = [described_class.new('evil.rb', lambda { raise "EVIL" })] }
it "displays the error and backtrace" do
Guard::UI.should_receive(:error) { |msg|
@@ -149,31 +149,31 @@ describe Guard::Watcher do
msg.should include("EVIL")
}
- Guard::Watcher.match_files(@guard, ['evil.rb'])
+ described_class.match_files(@guard, ['evil.rb'])
end
end
end
describe ".match_files?" do
before(:all) do
- @guard1 = Guard::Guard.new([Guard::Watcher.new(/.*_spec\.rb/)])
- @guard2 = Guard::Guard.new([Guard::Watcher.new('spec_helper.rb', 'spec')])
+ @guard1 = Guard::Guard.new([described_class.new(/.*_spec\.rb/)])
+ @guard2 = Guard::Guard.new([described_class.new('spec_helper.rb', 'spec')])
@guards = [@guard1, @guard2]
end
context "with a watcher that matches a file" do
- specify { Guard::Watcher.match_files?(@guards, ['lib/my_wonderful_lib.rb', 'guard_rocks_spec.rb']).should be_true }
+ specify { described_class.match_files?(@guards, ['lib/my_wonderful_lib.rb', 'guard_rocks_spec.rb']).should be_true }
end
context "with no watcher that matches a file" do
- specify { Guard::Watcher.match_files?(@guards, ['lib/my_wonderful_lib.rb']).should be_false }
+ specify { described_class.match_files?(@guards, ['lib/my_wonderful_lib.rb']).should be_false }
end
end
describe "#match_file?" do
context "with a string pattern" do
context "that is a normal string" do
- subject { Guard::Watcher.new('guard_rocks_spec.rb') }
+ subject { described_class.new('guard_rocks_spec.rb') }
context "with a watcher that matches a file" do
specify { subject.match_file?('guard_rocks_spec.rb').should be_true }
@@ -185,7 +185,7 @@ describe Guard::Watcher do
end
context "that is a string representing a regexp (deprecated)" do
- subject { Guard::Watcher.new('^guard_rocks_spec\.rb$') }
+ subject { described_class.new('^guard_rocks_spec\.rb$') }
context "with a watcher that matches a file" do
specify { subject.match_file?('guard_rocks_spec.rb').should be_true }
@@ -198,7 +198,7 @@ describe Guard::Watcher do
end
context "that is a regexp pattern" do
- subject { Guard::Watcher.new(/.*_spec\.rb/) }
+ subject { described_class.new(/.*_spec\.rb/) }
context "with a watcher that matches a file" do
specify { subject.match_file?('guard_rocks_spec.rb').should be_true }
@@ -214,11 +214,11 @@ describe Guard::Watcher do
before(:all) { Guard::Dsl.stub(:guardfile_path) { Dir.pwd + '/Guardfile' } }
context "with files that match the Guardfile" do
- specify { Guard::Watcher.match_guardfile?(['Guardfile', 'guard_rocks_spec.rb']).should be_true }
+ specify { described_class.match_guardfile?(['Guardfile', 'guard_rocks_spec.rb']).should be_true }
end
context "with no files that match the Guardfile" do
- specify { Guard::Watcher.match_guardfile?(['guard_rocks.rb', 'guard_rocks_spec.rb']).should be_false }
+ specify { described_class.match_guardfile?(['guard_rocks.rb', 'guard_rocks_spec.rb']).should be_false }
end
end
From dc526f28986cf3bcce291c9ce2f3bf4606f60a08 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Re=CC=81my=20Coutable?=
Date: Fri, 23 Sep 2011 00:23:46 +0200
Subject: [PATCH 09/21] Man
---
man/guard | 310 +++++++++++++++++++++++++++++++++++++++++++++++++
man/guard.html | 277 +++++++++++++++++++++++++++++++++++++++++++
2 files changed, 587 insertions(+)
create mode 100644 man/guard
diff --git a/man/guard b/man/guard
new file mode 100644
index 0000000..00640fb
--- /dev/null
+++ b/man/guard
@@ -0,0 +1,310 @@
+.\" generated with Ronn/v0.7.3
+.\" http://github.com/rtomayko/ronn/tree/0.7.3
+.
+.TH "GUARD" "" "September 2011" "" ""
+.
+.SH "NAME"
+\fBguard\fR
+.
+.P
+\fI!DOCTYPE html\fR
+.
+.P
+.
+.P
+.
+.IP "" 4
+.
+.nf
+
+NAME
+NAME
+NAME
+NAME
+.
+.fi
+.
+.IP "" 0
+.
+.P
+.
+.P
+.
+.IP "" 4
+.
+.nf
+
+guard
+
+guard
+.
+.fi
+.
+.IP "" 0
+.
+.P
+.
+.P
+.
+.P
+\fBguard\fR
+.
+.P
+\fI!DOCTYPE html\fR
+.
+.P
+.
+.P
+.
+.IP "" 4
+.
+.nf
+
+NAME
+NAME
+NAME
+.
+.fi
+.
+.IP "" 0
+.
+.P
+.
+.P
+.
+.IP "" 4
+.
+.nf
+
+guard
+
+guard
+.
+.fi
+.
+.IP "" 0
+.
+.P
+.
+.P
+.
+.P
+\fBguard\fR
+.
+.P
+\fI!DOCTYPE html\fR
+.
+.P
+.
+.P
+.
+.IP "" 4
+.
+.nf
+
+NAME
+NAME
+.
+.fi
+.
+.IP "" 0
+.
+.P
+.
+.P
+.
+.IP "" 4
+.
+.nf
+
+guard
+
+guard
+.
+.fi
+.
+.IP "" 0
+.
+.P
+.
+.P
+.
+.P
+\fBguard\fR
+.
+.P
+NAME
+.
+.fi
+.
+.IP "" 0
+.
+.P
+.
+.P
+.
+.IP "" 4
+.
+.nf
+
+
guard
+
+guard
+.
+.fi
+.
+.IP "" 0
+.
+.P
+.
+.P
+.
+.P
+\fBguard\fR
+.
+.P
+\&\.\e" generated with Ronn/v0\.7\.3 \.\e" http://github\.com/rtomayko/ronn/tree/0\.7\.3 \. \.TH "GUARD" "1" "August 2011" "" "" \. \.SH "NAME" \efBguard\efR \- Guard keeps an eye on your file modifications\. \. \.SH "DESCRIPTION" Guard is a command line tool that easily handle events on files modifications\. \. \.SH "SYNOPSIS" \efBguard \fICOMMAND\fR \fIOPTIONS\fR\efR \. \.SH "COMMANDS" \. \.SS "start" Starts Guard\. This is the default command if none is provided\. \. \.P The following options are available: \. \.P \efB\-c\efR, \efB\-\-clear\efR Clears the Shell after each change\. \. \.P \efB\-n\efR, \efB\-\-notify\efR \efIFLAG\efR Disable notifications (Growl or Libnotify depending on your system)\. Notifications can be disabled globally by setting a GUARD_NOTIFY environment variable to false\. FLAG can be \efBtrue\efR/\efBfalse\efR or \efBt\efR/\efBf\efR\. \. \.P \efB\-d\efR, \efB\-\-debug\efR Runs Guard in debug mode\. \. \.P \efB\-g\efR, \efB\-\-group\efR \efIGROUP1\efR \efIGROUP2\efR\.\.\. Runs only the groups specified by GROUP1, GROUP2 etc\. Groups name should be separated by spaces\. Guards that don\e\'t belong to a group are considered global and are always run\. \. \.P \efB\-w\efR, \efB\-\-watchdir\efR \efIPATH\efR \. \.P Tells Guard to watch PATH instead of \efB\./\efR\. \. \.P \efB\-G\efR, \efB\-\-guardfile\efR \efIFILE\efR Tells Guard to use FILE as its Guardfile instead of \efB\./Guardfile\efR or \efB~/\.Guardfile\efR\. \. \.SS "init [GUARD]" If no Guardfile is present in the current directory, creates an empty Guardfile\. \. \.P If \efIGUARD\efR is present, add its default Guardfile configuration to the current Guardfile\. Note that \efIGUARD\efR is the guard\e\'s name without the \efBguard\-\efR prefix\. For instance to initialize guard\-rspec, run \efBguard init rspec\efR\. \. \.SS "list" Lists guards that can be used with the \efBinit\efR command\. \. \.SS "\-T, show" List defined groups and guards for the current Guardfile\. \. \.SS "\-h, help [COMMAND]" List all of Guard\e\'s available commands\. \. \.P If \efICOMMAND\efR is given, displays a specific help for \efITASK\efR\. \. \.SH "EXAMPLES" Initialize Guard and a specific guard at the same time: \. \.P \efB[bundle exec] guard init [rspec]\efR \. \.P Run Guard: \. \.P \efB[bundle exec] guard [start] \-\-watchdir ~/dev \-\-guardfile ~/env/Guardfile \-\-clear \-\-group backend frontend \-\-notify false \-\-debug\efR \. \.P or in a more concise way: \. \.P \efB[bundle exec] guard [start] \-w ~/dev \-G ~/env/Guardfile \-c \-g backend frontend \-n f \-d\efR \. \.SH "AUTHORS / CONTRIBUTORS" Thibaud Guillaume\-Gentil is the main author\. \. \.P A list of contributors based on all commits can be found here: https://github\.com/guard/guard/contributors \. \.P For an exhaustive list of all the contributors, please see the CHANGELOG: https://github\.com/guard/guard/blob/master/CHANGELOG\.md \. \.P This manual has been written by Remy Coutable\. \. \.SH "WWW" https://github\.com/guard/guard
+.
+.P
+.
+.IP "" 4
+.
+.nf
+
+
+September 2011
+guard
+.
+.fi
+.
+.IP "" 0
+.
+.P
+.
+.P
+.
+.P
+\fI<<<<<< HEAD\fR
+.
+.P
+
+
September 2011
+guard
+.
+.fi
+.
+.IP "" 0
+.
+.P
+.
+.P
+.
+.P
+=======
+.
+.P
+.
+.IP "" 4
+.
+.nf
+
+
+September 2011
+guard
+.
+.fi
+.
+.IP "" 0
+.
+.P
+.
+.P
+.
+.P
+.
+.IP "" 4
+.
+.nf
+
+
+September 2011
+guard
+.
+.fi
+.
+.IP "" 0
+.
+.P
+.
+.P
+.
+.P
+.
+.IP "" 4
+.
+.nf
+
+
+September 2011
+guard
+.
+.fi
+.
+.IP "" 0
+.
+.P
+.
+.P
+.
+.P
+.
+.IP "" 4
+.
+.nf
+
+
+September 2011
+guard
+.
+.fi
+.
+.IP "" 0
+.
+.P
+.
+.P
+.
+.P
+.
+.IP "" 4
+.
+.nf
+
+
+September 2011
+guard
+.
+.fi
+.
+.IP "" 0
+.
+.P
+.
+.P
+
diff --git a/man/guard.html b/man/guard.html
index 5b1d96f..94362f6 100644
--- a/man/guard.html
+++ b/man/guard.html
@@ -56,6 +56,8 @@
NAME
NAME
NAME
+ NAME
+ NAME
@@ -129,6 +131,8 @@
<a href="#NAME">NAME</a>
<a href="#NAME">NAME</a>
+<a href="#NAME">NAME</a>
+<a href="#NAME">NAME</a>
@@ -149,6 +153,229 @@
+!DOCTYPE html
+
+
+
+
+ guard
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+<a href="#NAME">NAME</a>
+<a href="#NAME">NAME</a>
+<a href="#NAME">NAME</a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+<li class='tl'>guard</li>
+<li class='tc'></li>
+<li class='tr'>guard</li>
+
+
+
+
+
+
+
+
+
+
+
NAME
+
+
+
+
+
+ guard
+
+
+
+
+
+!DOCTYPE html
+
+
+
+
+ guard
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+<a href="#NAME">NAME</a>
+<a href="#NAME">NAME</a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+<li class='tl'>guard</li>
+<li class='tc'></li>
+<li class='tr'>guard</li>
+
+
+
+
+
+
+
+
+
+
+
NAME
+
+
+
+
+
+ guard
+
+
+
<p!DOCTYPE html
@@ -472,6 +699,56 @@ https://github.com/guard/guard
+
+
+
+
+
+
+
+
+
+
+
+
+<li class='tl'></li>
+<li class='tc'>September 2011</li>
+<li class='tr'>guard</li>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+<li class='tl'></li>
+<li class='tc'>September 2011</li>
+<li class='tr'>guard</li>
+
+
+
+
+
+
+
+
+
+
From 0a60575dde4c03c583cba76201e700dba1e45e14 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Re=CC=81my=20Coutable?=
Date: Fri, 23 Sep 2011 00:32:30 +0200
Subject: [PATCH 10/21] Update CHANGELOG
---
CHANGELOG.md | 16 +++++++++++++++-
1 file changed, 15 insertions(+), 1 deletion(-)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index e358b89..d771a1b 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,6 +1,19 @@
## Master
+### Bugs fixes:
+
- Pull request [#137](https://github.com/guard/guard/pull/137): Fix interacting with tools like ruby-debug. ([@hron][] & [@netzpirat][])
+- Pull request [#138](https://github.com/guard/guard/pull/138): Fixed comments in example scaffold to reference interactions. ([@rmm5t][] & [@netzpirat][])
+
+### New feature:
+
+- Issue [#97](https://github.com/guard/guard/issues/97): Guard dependencies. Task execution can now be halted if a Guard throws `:task_has_failed` and `Guard::Dsl#group` options include `:halt_on_fail => true`. ([@rymai][])
+- Issue [#121](https://github.com/guard/guard/issues/121): `Guard.guards` and `Guard.groups` are now smart accessors. Filters can be passed to find a specific Guard/group or several Guards/groups that match (see YARDoc). ([@rymai][])
+- New `Guard::Group` class to store groups defined in Guardfile (with `Guard::Dsl#group`). ([@rymai][])
+
+### Improvement:
+
+- Full YARD documentation. ([@netzpirat][] & a little of [@rymai][])
## 0.7.0 - September 14, 2011
@@ -9,7 +22,7 @@
### Major Changes
- Posix Signals handlers (`Ctrl-C`, `Ctrl-\` and `Ctrl-Z`) are no more supported and replaced by `$stdin.gets`. Please refer to the "Interactions" section in the README for more information. ([@thibaudgg][])
-- JRuby & Rubinius support (beta). ([@thibaudgg][] and [@netzpirat][])
+- JRuby & Rubinius support (beta). ([@thibaudgg][] & [@netzpirat][])
### New feature:
@@ -272,6 +285,7 @@
[@niklas]: https://github.com/niklas
[@oliamb]: https://github.com/oliamb
[@pcreux]: https://github.com/pcreux
+[@rmm5t]: https://github.com/rmm5t
[@rymai]: https://github.com/rymai
[@stereobooster]: https://github.com/stereobooster
[@stouset]: https://github.com/stouset
From 41ada16595195c93d5bd2daf91ea43f3e98cabb8 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Re=CC=81my=20Coutable?=
Date: Fri, 23 Sep 2011 00:39:27 +0200
Subject: [PATCH 11/21] Allow more complex conditions when searching for guards
---
lib/guard.rb | 6 +++++-
spec/guard_spec.rb | 41 ++++++++++++++++++++++++++++++-----------
2 files changed, 35 insertions(+), 12 deletions(-)
diff --git a/lib/guard.rb b/lib/guard.rb
index 6916f90..311cf32 100644
--- a/lib/guard.rb
+++ b/lib/guard.rb
@@ -56,7 +56,11 @@ module Guard
@guards.find_all { |guard| guard.class.to_s.downcase.sub('guard::', '') =~ filter }
when Hash
filter.inject(@guards) do |matches, (k, v)|
- matches.find_all { |guard| guard.send(k).to_sym == v.to_sym }
+ if k.to_sym == :name
+ matches.find_all { |guard| guard.class.to_s.downcase.sub('guard::', '') == v.to_s.downcase.gsub('-', '') }
+ else
+ matches.find_all { |guard| guard.send(k).to_sym == v.to_sym }
+ end
end
else
@guards
diff --git a/spec/guard_spec.rb b/spec/guard_spec.rb
index 080dd97..0fda959 100644
--- a/spec/guard_spec.rb
+++ b/spec/guard_spec.rb
@@ -63,10 +63,14 @@ describe Guard do
subject do
guard = ::Guard.setup
- @guard_foo_bar = Guard::FooBar.new([], { :group => 'backend' })
- @guard_foo_baz = Guard::FooBaz.new([], { :group => 'frontend' })
- guard.instance_variable_get("@guards").push(@guard_foo_bar)
- guard.instance_variable_get("@guards").push(@guard_foo_baz)
+ @guard_foo_bar_backend = Guard::FooBar.new([], { :group => 'backend' })
+ @guard_foo_bar_frontend = Guard::FooBar.new([], { :group => 'frontend' })
+ @guard_foo_baz_backend = Guard::FooBaz.new([], { :group => 'backend' })
+ @guard_foo_baz_frontend = Guard::FooBaz.new([], { :group => 'frontend' })
+ guard.instance_variable_get("@guards").push(@guard_foo_bar_backend)
+ guard.instance_variable_get("@guards").push(@guard_foo_bar_frontend)
+ guard.instance_variable_get("@guards").push(@guard_foo_baz_backend)
+ guard.instance_variable_get("@guards").push(@guard_foo_baz_frontend)
guard
end
@@ -76,11 +80,11 @@ describe Guard do
describe "find a guard by as string/symbol" do
it "find a guard by a string" do
- subject.guards('foo-bar').should eql @guard_foo_bar
+ subject.guards('foo-bar').should eql @guard_foo_bar_backend
end
it "find a guard by a symbol" do
- subject.guards(:'foo-bar').should eql @guard_foo_bar
+ subject.guards(:'foo-bar').should eql @guard_foo_bar_backend
end
it "returns nil if guard is not found" do
@@ -90,9 +94,9 @@ describe Guard do
describe "find guards matching a regexp" do
it "with matches" do
- subject.guards(/^foo/).should eql [@guard_foo_bar, @guard_foo_baz]
+ subject.guards(/^foobar/).should eql [@guard_foo_bar_backend, @guard_foo_bar_frontend]
end
-
+
it "without matches" do
subject.guards(/foo$/).should eql []
end
@@ -100,16 +104,31 @@ describe Guard do
describe "find guards by their group" do
it "group name is a string" do
- subject.guards(:group => 'backend').should eql [@guard_foo_bar]
+ subject.guards(:group => 'backend').should eql [@guard_foo_bar_backend, @guard_foo_baz_backend]
end
+
it "group name is a symbol" do
- subject.guards(:group => :frontend).should eql [@guard_foo_baz]
+ subject.guards(:group => :frontend).should eql [@guard_foo_bar_frontend, @guard_foo_baz_frontend]
end
it "returns [] if guard is not found" do
subject.guards(:group => :unknown).should eql []
end
end
+
+ describe "find guards by their group & name" do
+ it "group name is a string" do
+ subject.guards(:group => 'backend', :name => 'foo-bar').should eql [@guard_foo_bar_backend]
+ end
+
+ it "group name is a symbol" do
+ subject.guards(:group => :frontend, :name => :'foo-baz').should eql [@guard_foo_baz_frontend]
+ end
+
+ it "returns [] if guard is not found" do
+ subject.guards(:group => :unknown, :name => :'foo-baz').should eql []
+ end
+ end
end
describe ".groups" do
@@ -142,7 +161,7 @@ describe Guard do
it "with matches" do
subject.groups(/^back/).should eql [@group_backend, @group_backflip]
end
-
+
it "without matches" do
subject.groups(/back$/).should eql []
end
From 2f59a1055824f4f620738d0791fead158050bf46 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Re=CC=81my=20Coutable?=
Date: Fri, 23 Sep 2011 00:41:39 +0200
Subject: [PATCH 12/21] Update CHANGELOG
---
CHANGELOG.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index d771a1b..6849eac 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -8,7 +8,7 @@
### New feature:
- Issue [#97](https://github.com/guard/guard/issues/97): Guard dependencies. Task execution can now be halted if a Guard throws `:task_has_failed` and `Guard::Dsl#group` options include `:halt_on_fail => true`. ([@rymai][])
-- Issue [#121](https://github.com/guard/guard/issues/121): `Guard.guards` and `Guard.groups` are now smart accessors. Filters can be passed to find a specific Guard/group or several Guards/groups that match (see YARDoc). ([@rymai][])
+- Issue [#121](https://github.com/guard/guard/issues/121): `Guard.guards` and `Guard.groups` are now smart accessors. Filters can be passed to find a specific Guard/group or several Guards/groups that match (see YARDoc). ([@rymai][] & [@ches][])
- New `Guard::Group` class to store groups defined in Guardfile (with `Guard::Dsl#group`). ([@rymai][])
### Improvement:
From a326c3587576e0c6e5d1600218a99a9ddcc421f1 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Re=CC=81my=20Coutable?=
Date: Fri, 23 Sep 2011 00:53:13 +0200
Subject: [PATCH 13/21] Fix specs for Ruby != 1.9
---
lib/guard.rb | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/guard.rb b/lib/guard.rb
index 311cf32..4a324e7 100644
--- a/lib/guard.rb
+++ b/lib/guard.rb
@@ -79,7 +79,7 @@ module Guard
when String, Symbol
@groups.find { |group| group.name == filter.to_sym }
when Regexp
- @groups.find_all { |group| group.name =~ filter }
+ @groups.find_all { |group| group.name.to_s =~ filter }
else
@groups
end
From a7a6c5c69ec4b95a057878c9cf76e3316be6900b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Re=CC=81my=20Coutable?=
Date: Fri, 23 Sep 2011 10:52:58 +0200
Subject: [PATCH 14/21] Improves yardoc (hopefully) [ci skip]
---
lib/guard.rb | 21 +++++++++++++--------
lib/guard/group.rb | 2 +-
2 files changed, 14 insertions(+), 9 deletions(-)
diff --git a/lib/guard.rb b/lib/guard.rb
index 4a324e7..cc58bfd 100644
--- a/lib/guard.rb
+++ b/lib/guard.rb
@@ -43,10 +43,13 @@ module Guard
# Smart accessor for retrieving a specific guard or several guards at once.
#
- # @param [Object] filter an optional filter to retrieve specific guard(s).
- # @option filter [String, Symbol] return the guard with the given name, or nil if not found
- # @option filter [Regexp] returns all guards matching the Regexp, or [] if no guard match
- # @option filter [NilClass] returns all guards
+ # @param [String, Symbol] filter return the guard with the given name, or nil if not found.
+ # @param [Regexp] filter returns all guards matching the Regexp, or [] if no guard found.
+ # @param [Hash] filter returns all guards matching the given Hash.
+ # Example: `{ :name => 'rspec', :group => 'backend' }, or [] if no guard found.
+ # @param [NilClass] filter returns all guards.
+ #
+ # @see Guard.groups
#
def guards(filter = nil)
case filter
@@ -69,10 +72,11 @@ module Guard
# Smart accessor for retrieving a specific group or several groups at once.
#
- # @param [Object] filter an optional filter to retrieve specific group(s).
- # @option filter [String, Symbol] return the group with the given name, or nil if not found
- # @option filter [Regexp] returns all groups matching the Regexp, or [] if no group match
- # @option filter [NilClass] returns all groups
+ # @param [NilClass] filter returns all groups.
+ # @param [String, Symbol] filter return the group with the given name, or nil if not found.
+ # @param [Regexp] filter returns all groups matching the Regexp, or [] if no group found.
+ #
+ # @see Guard.guards
#
def groups(filter = nil)
case filter
@@ -247,6 +251,7 @@ module Guard
# @param [Hash] options the group options
# @option options [Boolean] halt_on_fail if a task execution
# should be halted for all Guards in this group if one Guard throws `:task_has_failed`
+ # @return [Guard::Group] the group added (or retrieved from the `@groups` variable if already present)
#
def add_group(name, options = {})
group = groups(name)
diff --git a/lib/guard/group.rb b/lib/guard/group.rb
index a044fbd..74ab16a 100644
--- a/lib/guard/group.rb
+++ b/lib/guard/group.rb
@@ -11,7 +11,7 @@ module Guard
# @param [String] name the name of the group
# @param [Hash] options the group options
# @option options [Boolean] halt_on_fail if a task execution
- # should be halted for all Guards in this group if one Guard throws `:task_has_failed`
+ # should be halted for all Guards in this group if one Guard throws `:task_has_failed`
#
def initialize(name, options = {})
@name = name.to_sym
From 5c9ee2afdfbfda87a1606ec557afbf8d44aadaff Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Re=CC=81my=20Coutable?=
Date: Fri, 23 Sep 2011 11:01:52 +0200
Subject: [PATCH 15/21] Yardoc improvements [ci skip]
---
lib/guard.rb | 21 +++++++++------------
lib/guard/dsl.rb | 1 -
lib/guard/group.rb | 1 -
lib/guard/guard.rb | 2 +-
lib/guard/listener.rb | 2 --
lib/guard/notifier.rb | 7 +++----
lib/guard/ui.rb | 4 ----
7 files changed, 13 insertions(+), 25 deletions(-)
diff --git a/lib/guard.rb b/lib/guard.rb
index cc58bfd..bfc3926 100644
--- a/lib/guard.rb
+++ b/lib/guard.rb
@@ -18,7 +18,6 @@ module Guard
# Initialize the Guard singleton.
#
- # @param [Hash] options the Guard options.
# @option options [Boolean] clear if auto clear the UI should be done
# @option options [Boolean] notify if system notifications should be shown
# @option options [Boolean] debug if debug output should be shown
@@ -43,11 +42,11 @@ module Guard
# Smart accessor for retrieving a specific guard or several guards at once.
#
- # @param [String, Symbol] filter return the guard with the given name, or nil if not found.
- # @param [Regexp] filter returns all guards matching the Regexp, or [] if no guard found.
+ # @param [String, Symbol] filter return the guard with the given name, or nil if not found
+ # @param [Regexp] filter returns all guards matching the Regexp, or [] if no guard found
# @param [Hash] filter returns all guards matching the given Hash.
- # Example: `{ :name => 'rspec', :group => 'backend' }, or [] if no guard found.
- # @param [NilClass] filter returns all guards.
+ # Example: `{ :name => 'rspec', :group => 'backend' }`, or [] if no guard found
+ # @param [NilClass] filter returns all guards
#
# @see Guard.groups
#
@@ -72,9 +71,9 @@ module Guard
# Smart accessor for retrieving a specific group or several groups at once.
#
- # @param [NilClass] filter returns all groups.
- # @param [String, Symbol] filter return the group with the given name, or nil if not found.
- # @param [Regexp] filter returns all groups matching the Regexp, or [] if no group found.
+ # @param [NilClass] filter returns all groups
+ # @param [String, Symbol] filter return the group with the given name, or nil if not found
+ # @param [Regexp] filter returns all groups matching the Regexp, or [] if no group found
#
# @see Guard.guards
#
@@ -92,7 +91,6 @@ module Guard
# Start Guard by evaluate the `Guardfile`, initialize the declared Guards
# and start the available file change listener.
#
- # @param [Hash] options the Guard options.
# @option options [Boolean] clear if auto clear the UI should be done
# @option options [Boolean] notify if system notifications should be shown
# @option options [Boolean] debug if debug output should be shown
@@ -233,7 +231,7 @@ module Guard
# @param [String] name the Guard name
# @param [Array] watchers the list of declared watchers
# @param [Array] callbacks the list of callbacks
- # @param [Hash] options the Guard options
+ # @param [Hash] options the Guard options (see the given Guard documentation)
#
def add_guard(name, watchers = [], callbacks = [], options = {})
if name.to_sym == :ego
@@ -248,9 +246,8 @@ module Guard
# Add a Guard group.
#
# @param [String] name the group name
- # @param [Hash] options the group options
# @option options [Boolean] halt_on_fail if a task execution
- # should be halted for all Guards in this group if one Guard throws `:task_has_failed`
+ # should be halted for all Guards in this group if one Guard throws `:task_has_failed`
# @return [Guard::Group] the group added (or retrieved from the `@groups` variable if already present)
#
def add_group(name, options = {})
diff --git a/lib/guard/dsl.rb b/lib/guard/dsl.rb
index a740822..ecb6dbc 100644
--- a/lib/guard/dsl.rb
+++ b/lib/guard/dsl.rb
@@ -81,7 +81,6 @@ module Guard
# Evaluate the DSL methods in the `Guardfile`.
#
- # @param [Hash] options the Guard options
# @option options [Array] groups the groups to evaluate
# @option options [String] guardfile the path to a valid Guardfile
# @option options [String] guardfile_contents a string representing the content of a valid Guardfile
diff --git a/lib/guard/group.rb b/lib/guard/group.rb
index 74ab16a..c8239b1 100644
--- a/lib/guard/group.rb
+++ b/lib/guard/group.rb
@@ -9,7 +9,6 @@ module Guard
# Initialize a Group.
#
# @param [String] name the name of the group
- # @param [Hash] options the group options
# @option options [Boolean] halt_on_fail if a task execution
# should be halted for all Guards in this group if one Guard throws `:task_has_failed`
#
diff --git a/lib/guard/guard.rb b/lib/guard/guard.rb
index f63be8d..1449192 100644
--- a/lib/guard/guard.rb
+++ b/lib/guard/guard.rb
@@ -16,7 +16,7 @@ module Guard
# Initialize a Guard.
#
# @param [Array] watchers the Guard file watchers
- # @param [Hash] options the custom Guard options.
+ # @param [Hash] options the custom Guard options
#
def initialize(watchers = [], options = {})
@group = options[:group] ? options.delete(:group).to_sym : :default
diff --git a/lib/guard/listener.rb b/lib/guard/listener.rb
index 49701ab..a590c2a 100644
--- a/lib/guard/listener.rb
+++ b/lib/guard/listener.rb
@@ -43,7 +43,6 @@ module Guard
# Initialize the listener.
#
# @param [String] directory the root directory to listen to
- # @param [Hash] options the listener options
# @option options [Boolean] relativize_paths use only relative paths
# @option options [Array] ignore_paths the paths to ignore by the listener
#
@@ -187,7 +186,6 @@ module Guard
# Gets a list of files that are in the modified directories.
#
# @param [Array] dirs the list of directories
- # @param [Hash] options the options
# @option options [Symbol] all whether to include all files
#
def potentially_modified_files(dirs, options = {})
diff --git a/lib/guard/notifier.rb b/lib/guard/notifier.rb
index 8f84ed1..1ee20e5 100644
--- a/lib/guard/notifier.rb
+++ b/lib/guard/notifier.rb
@@ -43,7 +43,6 @@ module Guard
# @see .image_path
#
# @param [String] the message to show
- # @param [Hash] options the notification options
# @option options [Symbol, String] image the image symbol or path to an image
# @option options [String] title the notification title
#
@@ -80,7 +79,7 @@ module Guard
# @param [Symbol, String] the image to user
# @param [Hash] options the growl options
#
- def self.notify_mac(title, message, image, options)
+ def self.notify_mac(title, message, image, options = {})
require_growl # need for guard-rspec formatter that is called out of guard scope
default_options = { :title => title, :icon => image_path(image), :name => APPLICATION_NAME }
@@ -104,7 +103,7 @@ module Guard
# @param [Symbol, String] the image to user
# @param [Hash] options the libnotify options
#
- def self.notify_linux(title, message, image, options)
+ def self.notify_linux(title, message, image, options = {})
require_libnotify # need for guard-rspec formatter that is called out of guard scope
default_options = { :body => message, :summary => title, :icon_path => image_path(image), :transient => true }
Libnotify.show default_options.merge(options) if enabled?
@@ -117,7 +116,7 @@ module Guard
# @param [Symbol, String] the image to user
# @param [Hash] options the notifu options
#
- def self.notify_windows(title, message, image, options)
+ def self.notify_windows(title, message, image, options = {})
require_rbnotifu # need for guard-rspec formatter that is called out of guard scope
default_options = { :message => message, :title => title, :type => image_level(image), :time => 3 }
Notifu.show default_options.merge(options) if enabled?
diff --git a/lib/guard/ui.rb b/lib/guard/ui.rb
index 51b2531..80ff7d4 100644
--- a/lib/guard/ui.rb
+++ b/lib/guard/ui.rb
@@ -10,7 +10,6 @@ module Guard
# Show an info message.
#
# @param [String] message the message to show
- # @param [Hash] options the options
# @option options [Boolean] reset whether to clean the output before
#
def info(message, options = { })
@@ -23,7 +22,6 @@ module Guard
# Show a red error message that is prefixed with ERROR.
#
# @param [String] message the message to show
- # @param [Hash] options the options
# @option options [Boolean] reset whether to clean the output before
#
def error(message, options = { })
@@ -36,7 +34,6 @@ module Guard
# Show a red deprecation message that is prefixed with DEPRECATION.
#
# @param [String] message the message to show
- # @param [Hash] options the options
# @option options [Boolean] reset whether to clean the output before
#
def deprecation(message, options = { })
@@ -49,7 +46,6 @@ module Guard
# Show a debug message that is prefixed with DEBUG and a timestamp.
#
# @param [String] message the message to show
- # @param [Hash] options the options
# @option options [Boolean] reset whether to clean the output before
#
def debug(message, options = { })
From 5de287ba95af056dba57dc44c702fd226b9ac6be Mon Sep 17 00:00:00 2001
From: Michael Kessler
Date: Sat, 24 Sep 2011 11:09:32 +0200
Subject: [PATCH 16/21] Make the sleep time for listener specs configurable.
---
spec/support/listener_helper.rb | 18 ++++++++++--------
1 file changed, 10 insertions(+), 8 deletions(-)
diff --git a/spec/support/listener_helper.rb b/spec/support/listener_helper.rb
index 8a7b99e..7e2cd2a 100644
--- a/spec/support/listener_helper.rb
+++ b/spec/support/listener_helper.rb
@@ -1,10 +1,14 @@
private
+ def sleep_time
+ ENV['GUARD_SPEC_SLEEP'] ? ENV['GUARD_SPEC_SLEEP'].to_i : 1
+ end
+
def start
- sleep(@rest_delay || 1)
+ sleep(sleep_time)
@listener.update_last_event
Thread.new { @listener.start }
- sleep(@rest_delay || 1)
+ sleep(sleep_time)
end
def record_results
@@ -17,18 +21,17 @@ private
end
def stop
- sleep(@rest_delay || 1)
+ sleep(sleep_time)
@listener.stop
- sleep(@rest_delay || 1)
+ sleep(sleep_time)
end
def results
@results.flatten
end
-shared_examples_for 'a listener that reacts to #on_change' do |rest_delay|
+shared_examples_for 'a listener that reacts to #on_change' do
before(:each) do
- @rest_delay = rest_delay if rest_delay.is_a?(Integer) || rest_delay.is_a?(Float) # jruby workaround
@listener = described_class.new
record_results
end
@@ -115,9 +118,8 @@ shared_examples_for 'a listener that reacts to #on_change' do |rest_delay|
end
-shared_examples_for "a listener scoped to a specific directory" do |rest_delay|
+shared_examples_for "a listener scoped to a specific directory" do
before :each do
- @rest_delay = rest_delay if rest_delay.is_a?(Integer) || rest_delay.is_a?(Float) # jruby workaround
@wd = @fixture_path.join("folder1")
@listener = described_class.new @wd
end
From 8365d7c429a349c8031b86020dd3b7b6b0a06e27 Mon Sep 17 00:00:00 2001
From: Michael Kessler
Date: Sat, 24 Sep 2011 11:10:01 +0200
Subject: [PATCH 17/21] Set a generous spec sleep time on Travis.
---
.travis.yml | 2 ++
1 file changed, 2 insertions(+)
diff --git a/.travis.yml b/.travis.yml
index 5cc9a5b..519edd4 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -8,6 +8,8 @@ branches:
only:
- master
- guard_dependencies
+env:
+ - GUARD_SPEC_SLEEP=2
notifications:
recipients:
- thibaud@thibaud.me
From 1571292ba7e92aca9b8cbf4591eedcf440f23868 Mon Sep 17 00:00:00 2001
From: Michael Kessler
Date: Sat, 24 Sep 2011 11:35:53 +0200
Subject: [PATCH 18/21] Make spec sleep time a float.
---
.travis.yml | 2 +-
spec/support/listener_helper.rb | 3 ++-
2 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/.travis.yml b/.travis.yml
index 519edd4..351954f 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -9,7 +9,7 @@ branches:
- master
- guard_dependencies
env:
- - GUARD_SPEC_SLEEP=2
+ - GUARD_SLEEP=1.5
notifications:
recipients:
- thibaud@thibaud.me
diff --git a/spec/support/listener_helper.rb b/spec/support/listener_helper.rb
index 7e2cd2a..556c698 100644
--- a/spec/support/listener_helper.rb
+++ b/spec/support/listener_helper.rb
@@ -1,10 +1,11 @@
private
def sleep_time
- ENV['GUARD_SPEC_SLEEP'] ? ENV['GUARD_SPEC_SLEEP'].to_i : 1
+ @sleep_time ||= ENV['GUARD_SLEEP'] ? ENV['GUARD_SLEEP'].to_f : 1
end
def start
+ puts "ST #{sleep_time}"
sleep(sleep_time)
@listener.update_last_event
Thread.new { @listener.start }
From e9eaa39e4d889a244536a2f051b64491cd45bfba Mon Sep 17 00:00:00 2001
From: Michael Kessler
Date: Sat, 24 Sep 2011 12:14:59 +0200
Subject: [PATCH 19/21] Remove Travis debug output.
---
spec/support/listener_helper.rb | 1 -
1 file changed, 1 deletion(-)
diff --git a/spec/support/listener_helper.rb b/spec/support/listener_helper.rb
index 556c698..3d6bcd3 100644
--- a/spec/support/listener_helper.rb
+++ b/spec/support/listener_helper.rb
@@ -5,7 +5,6 @@ private
end
def start
- puts "ST #{sleep_time}"
sleep(sleep_time)
@listener.update_last_event
Thread.new { @listener.start }
From 0936771a9e0478dcfe78746b30e2814da0f43b14 Mon Sep 17 00:00:00 2001
From: Michael Kessler
Date: Sat, 24 Sep 2011 12:20:35 +0200
Subject: [PATCH 20/21] Decrease Travis sleep time.
---
.travis.yml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/.travis.yml b/.travis.yml
index 351954f..0bc846d 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -9,7 +9,7 @@ branches:
- master
- guard_dependencies
env:
- - GUARD_SLEEP=1.5
+ - GUARD_SLEEP=1
notifications:
recipients:
- thibaud@thibaud.me
From a1f37f60d6f722476a6f6b36956dd44922d5fe48 Mon Sep 17 00:00:00 2001
From: Michael Kessler
Date: Sat, 24 Sep 2011 12:58:27 +0200
Subject: [PATCH 21/21] Re-evaluate the Guardfile before reload all Guards
(Fixes #141).
---
lib/guard/interactor.rb | 1 +
1 file changed, 1 insertion(+)
diff --git a/lib/guard/interactor.rb b/lib/guard/interactor.rb
index c6c56b2..c69dc5d 100644
--- a/lib/guard/interactor.rb
+++ b/lib/guard/interactor.rb
@@ -37,6 +37,7 @@ module Guard
when 'stop', 'quit', 'exit', 's', 'q', 'e'
::Guard.stop
when 'reload', 'r', 'z'
+ ::Guard::Dsl.reevaluate_guardfile
::Guard.reload
when 'pause', 'p'
::Guard.pause