Adding support for inline Guard classes rather than requiring a gem #48

Merged
merged 1 commit into from Apr 23, 2011

Projects

None yet

2 participants

@jrsacks
Contributor
jrsacks commented Apr 21, 2011

I added the ability to inline a guard class in the guardfile itself rather than going out to a gem for everything. This could be useful when there are complex things you may need to run as opposed to the guard-shell gem which only lets you 'run on change'. I have some custom things I would like to guard and would rather not create a gem for it. Guard will attempt to load the gem as before and then look for a class. If it is inline it will get picked up.

Here is an example of a Guardfile with what I am describing as an inline guard class:

require 'guard/guard'

module ::Guard
class Example < ::Guard::Guard
def run_on_change(paths)
puts 'hello'
end
end
end

guard 'example' do
watch(%r{.*})
end

@thibaudgg
Member

Looks nice, thanks Jeff!

@thibaudgg thibaudgg merged commit a0b6eca into guard:master Apr 23, 2011
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment