From 470e76333916dbcee3b81382247611025403e3e2 Mon Sep 17 00:00:00 2001 From: Thibaud Guillaume-Gentil Date: Wed, 27 Oct 2010 22:14:21 +0200 Subject: [PATCH] Updated guard methods readme --- README.rdoc | 10 +++++++++- lib/guard/guard.rb | 5 +++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/README.rdoc b/README.rdoc index dccfa04..c04dda4 100644 --- a/README.rdoc +++ b/README.rdoc @@ -127,11 +127,17 @@ lib/guard/guard-name.rb inherit from guard/guard and should overwrite at least o module Guard class GuardName < Guard + def initialize(watchers = [], options = {}) + super + # init stuff here, thx! + end + # ================ # = Guard method = # ================ # Call once when guard starts + # Please override initialize method to init stuff def start true end @@ -144,11 +150,13 @@ lib/guard/guard-name.rb inherit from guard/guard and should overwrite at least o end # Call with Ctrl-Z signal + # This method should be mainly used for "reload" (really!) actions like reloading passenger/spork/bundler/... def reload true end # Call with Ctrl-/ signal + # This method should be principally used for long action like running all specs/tests/... def run_all true end @@ -179,7 +187,7 @@ Guardfile DSL consists of just two simple methods: guard & watch. Example: == TODO -- Add more specs, help are welcome because I'm not sure about how to test stuff like this :-) +- Add more specs! Shame on me :) == Development diff --git a/lib/guard/guard.rb b/lib/guard/guard.rb index f0c8646..5dad41a 100644 --- a/lib/guard/guard.rb +++ b/lib/guard/guard.rb @@ -26,19 +26,24 @@ module Guard # = Guard method = # ================ + # Call once when guard starts + # Please override initialize method to init stuff def start true end + # Call once when guard quit # Retrieve a true value if the instance successfuly stopped def stop true end + # Should be mainly used for "reload" (really!) actions like reloading passenger/spork/bundler/... def reload true end + # Should be principally used for long action like running all specs/tests/... def run_all true end