fixing require bug; updating documentation and version

This commit is contained in:
Jeff Sacks 2011-04-25 09:18:59 -05:00
parent a0b6ecacdb
commit 38c371272d
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. 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 == Development
- Source hosted at {GitHub}[https://github.com/guard/guard]. - Source hosted at {GitHub}[https://github.com/guard/guard].

View File

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

View File

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

View File

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