Skip to content

Instantly share code, notes, and snippets.

@splattael
Created June 1, 2016 13:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save splattael/1068c4755fd40e3531a1c07fd798f1aa to your computer and use it in GitHub Desktop.
Save splattael/1068c4755fd40e3531a1c07fd798f1aa to your computer and use it in GitHub Desktop.
Makes middleman work on Docker on Windows!
#!/bin/bash
# Touches changed files in order to make it work
# on Docker and Windows.
#
# Usage: bin/touch_changed [<sleep every>]
EVERY=${1:-1}
RELOAD="tmp/reload"
DIRS="source"
# Initial touch
touch $RELOAD
find_changed() {
find $DIRS -type f -newer $RELOAD
}
while :; do
files=$(find_changed)
if [ "$files" != "" ]; then
echo "Changed: $files"
touch $RELOAD
touch -r $RELOAD $files
fi
sleep $EVERY
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment