allow guards to specify their templates #369

Merged
merged 2 commits into from Dec 2, 2012

Conversation

Projects
None yet
4 participants
Contributor

schmurfy commented Dec 1, 2012

I was playing with the idea of embedding the guard in the gem it supports and while it works "guard init" does not because guard expects the guard to live in a separate gem and hardcode its search path.

Why hardcode something that does not need to be ?
Once the guard class has been found no magic should happen to find any related location or files...

What do you think ?

lib/guard/guard.rb
@@ -58,6 +58,11 @@ def initialize(watchers = [], options = {})
@watchers, @options = watchers, options
end
+
+ def self.template(name)
@rymai

rymai Dec 1, 2012

Owner

Could you please add inline documentation as for the other methods? Thanks!

Owner

rymai commented Dec 1, 2012

I think this is a good idea, thank you. WDYT @guard/core-team ?

Contributor

netzpirat commented Dec 1, 2012

Yes, looks fine from my side.

Contributor

schmurfy commented Dec 1, 2012

documentation added !

The only thing left which is not working is "guard list" but I am sure how to best handle this, except by searching a guard in every gem in path.

lib/guard/guard.rb
@@ -58,6 +58,15 @@ def initialize(watchers = [], options = {})
@watchers, @options = watchers, options
end
+ # Specify the source for the Guardfile template.
+ # Each guard can redefine this method to add its onw logic.
@rymai

rymai Dec 1, 2012

Owner

"Each guard" => "Each Guard plugin" (for consistency with the rest of the docs)
"onw" => "own" ;)

Owner

rymai commented Dec 1, 2012

Thanks for the doc. Regarding guard list, this has nothing to do with this pull-request, right?

Contributor

schmurfy commented Dec 1, 2012

yes... and no ;)
The only reason for this pull request to exists is to be able to embed a guard into another gem, so why not discuss this here further ? ^^
I can create a separate issue to discuss this if you prefer.

Owner

thibaudgg commented Dec 1, 2012

All that is fine for me too, thanks! Just by curiosity on which gem do you want to embed Guard?

Contributor

schmurfy commented Dec 1, 2012

https://github.com/schmurfy/eetee
I just did not felt the need to create one more gem for the guard for a project that will most likely be used only be myself ;)

Owner

thibaudgg commented Dec 2, 2012

ok nice!

Contributor

schmurfy commented Dec 2, 2012

@rymal I forgot to say but I did the changes to the documentation.

Owner

rymai commented Dec 2, 2012

Wow, I was sure I had left a comment yesterday... Anyways, yes please open a new issue for your specific need.

Thank you for this pull-request, merging it now!

rymai added a commit that referenced this pull request Dec 2, 2012

Merge pull request #369 from schmurfy/template_location
Allow Guard plugins to specify their template location

@rymai rymai merged commit 907e34c into guard:master Dec 2, 2012

1 check was pending

default The Travis build is in progress
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment