Created
January 27, 2016 13:33
-
-
Save Themitchell/21baa9978e99df3f5e48 to your computer and use it in GitHub Desktop.
sk-vm-sync.sh
This file contains 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
export DEV_VM_USERNAME=myusername | |
export DEV_VM_HOST=my.host.name | |
export DEV_VM_CODE_DIR=directory | |
sync() { | |
echo "Syncing $(basename $(pwd)) from $(pwd) to $DEV_VM_USERNAME@$DEV_VM_HOST:$DEV_VM_CODE_DIR/$(basename $(pwd))/" | |
rsync -avrx --delete --exclude=log --exclude=tmp --exclude=vendor/bundle --filter='P vendor/bundle' --exclude=.bundle --filter='P .bundle' --exclude=.git -e ssh . $DEV_VM_USERNAME@$DEV_VM_HOST:$DEV_VM_CODE_DIR/$(basename $(pwd))/ | |
} | |
watch-sync() { | |
filewatcher_path=$(which filewatcher) | |
if [ -x $filewatcher_path ]; then | |
echo "Watching for changes and waiting to sync..." | |
filewatcher -i 0.2 '**/*' "rsync -avrx --delete --exclude=log --exclude=tmp --exclude=vendor/bundle --filter='P vendor/bundle' --exclude=.bundle --filter='P .bundle' --exclude=.git -e ssh . $DEV_VM_USERNAME@$DEV_VM_HOST:$DEV_VM_CODE_DIR/$(basename $(pwd))/" | |
else | |
echo "Cannot find filewatcher; Install using 'gem install filewatcher' and make sure it's in your path" | |
exit 1 | |
fi | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment