Filesystem Notifications with Threads
A Rails application is generated with three assets directories by default: app/assets, lib/assets, and vendor/assets. Our assets should be split between those directories in the same way we’d split our code: the app directory should contain assets related directly to our application, the lib directory should hold isolated JavaScript or stylesheet components that would be useful beyond our application, and the vendor directory should contain third-party files.
We’d like to watch for filesystem changes in each of these directories. One option is to manually check the modification time of each file in those directories every second or less. This is filesystem polling. Polling may be a good starting point, ...
Get Crafting Rails 4 Applications, 2nd Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.