Merged pull request #50 from jrsacks/master.
Updating docs to describe inline guards
This commit is contained in:
commit
42288ece11
18
README.rdoc
18
README.rdoc
@ -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]
|
||||
|
@ -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
|
||||
|
||||
|
@ -1,3 +1,3 @@
|
||||
module Guard
|
||||
VERSION = "0.3.3"
|
||||
end
|
||||
VERSION = "0.3.4"
|
||||
end
|
||||
|
@ -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
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user