Created
July 12, 2011 10:16
-
-
Save michaelneale/1077729 to your computer and use it in GitHub Desktop.
Call make when files change
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# | |
# Will monitor a directory for changes, call make when picked up (after a tiny pause) | |
# | |
def new_timestamp() | |
timestamps = Dir.glob("./src/*.erl").map do |m| File.atime(m).to_i end | |
timestamps.inject { |i,j| i + j } | |
end | |
previous = 0 | |
while(true) | |
newtime = new_timestamp() | |
if newtime != previous then | |
sleep(0.1) | |
puts `make` | |
previous = new_timestamp() | |
end | |
sleep(1) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment