Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

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

Merged
merged 1 commit into from Apr 23, 2011

Conversation

Projects
None yet
2 participants
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

Owner

thibaudgg commented Apr 23, 2011

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