Watching files outside the rails root

252 views
Skip to first unread message

Levi

unread,
Apr 12, 2012, 9:12:49 PM4/12/12
to guard-dev
Hi all,
I am looking for some help with watching directories outside the rails
root.

in my case my i have views and css etc in a directory next to my rails
app directory.

Is there a strait forward way of changing the root directory so that I
can do something like this:


watch(%r{\/containing-folder\/clients\/.+\.(css|js|html)})


the "containing" folder holds both the "rails app" and "clients"
folder


thanks in advance!

Rémy Coutable

unread,
Apr 13, 2012, 4:31:34 AM4/13/12
to guar...@googlegroups.com
Hi,

have you tried using the -w/--watchdir option: https://github.com/guard/guard#usage-start ?

Best regards,
Rémy

Michael Kessler

unread,
Apr 13, 2012, 4:42:33 AM4/13/12
to guar...@googlegroups.com
You can symlink the folder into the project root.

Levi

unread,
Apr 14, 2012, 12:27:15 AM4/14/12
to guar...@googlegroups.com
yes, i have that and that works... i was just trying to keep my setup simpler and utilize the regex r% that is normally used with "watch".

thanks

Levi

unread,
Apr 14, 2012, 12:30:26 AM4/14/12
to guar...@googlegroups.com
symlink is an option too.  wanted to make sure there wasnt a better way with configuring the root path first.

Rémy Coutable

unread,
Apr 14, 2012, 8:16:44 AM4/14/12
to guar...@googlegroups.com
Hi!

The string or regex passed to the "watch" method are relative to the watched directory. It defaults to Dir.pwd, but you can change it with the -w option, or symlink the clients folder inside the rails app folder.

Best,
Rémy

Levi

unread,
Apr 14, 2012, 5:26:52 PM4/14/12
to guar...@googlegroups.com
Thanks for the clarification Rémy!  

Put me on the right track.
Reply all
Reply to author
Forward
0 new messages