Merged pull request #50 from jrsacks/master.

Updating docs to describe inline guards
This commit is contained in:
Thibaud Guillaume-Gentil 2011-04-25 11:19:18 -07:00
commit 42288ece11
4 changed files with 22 additions and 6 deletions

View File

@ -215,6 +215,22 @@ Creating a new guard is very easy, just create a new gem (<tt>bundle gem</tt> if
Please take a look at the existing guards' source code (see the list above) for more concrete example.
Alternatively, a new guard can be added inline to a Guardfile with this basic structure:
require 'guard/guard'
module ::Guard
class Example < ::Guard::Guard
def run_all
true
end
def run_on_change(paths)
true
end
end
end
== Development
- Source hosted at {GitHub}[https://github.com/guard/guard].
@ -225,4 +241,4 @@ you make.
== Authors
{Thibaud Guillaume-Gentil}[https://github.com/thibaudgg]
{Thibaud Guillaume-Gentil}[https://github.com/thibaudgg]

View File

@ -90,7 +90,7 @@ module Guard
end
def try_to_load_gem(name)
Kernel.require "guard/#{name.downcase}"
require "guard/#{name.downcase}"
rescue LoadError
end

View File

@ -1,3 +1,3 @@
module Guard
VERSION = "0.3.3"
end
VERSION = "0.3.4"
end

View File

@ -37,8 +37,8 @@ describe Guard do
context 'loaded some nested classes' do
it "should find and return loaded class" do
Kernel.should_receive(:require) { |file_name|
file_name.should == 'guard/classname'
Guard.should_receive(:try_to_load_gem) { |className|
className.should == 'classname'
class Guard::Classname
end
}