Ruby - keep track of file updates with the extension

I am trying to auto-compile my fewer files on centos.

Is it possible in ruby ​​to browse the directory for changes in files ending in a certain extension, and then execute the command when this happens?

I tried inotify in a simple shell script, but there are always problems when ide creates temporary files, etc.

+4
source share
2 answers

You want to inotify . Ruby shell available, rb-notify .

+3
source

ZenTest gem includes an autotest command line autotest that monitors the test directory and runs tests when one of the files changes.

See how this tool works. Using inotify is useful, but not necessary.

The main idea for this is to write a loop with sleep inside it. Use the Ruby Find class to find files that are candidates for processing. The Search documentation has sample code to run this part.

0
source

Source: https://habr.com/ru/post/1496580/


All Articles