This is a Grunt configuration to watch a folder for code changes, and then deploy that code to multiple servers after a change has been made. Then, you can execute a command once those files have been uploaded to the server, such as clearing cache and such.
There are some variables at the start of the Gruntfile.js that you will want to change to get this working for your use case. Hopefully it is self explanatory.
You may also need to add some server configurations to your ~/.ssh/config
file, like the following.
~/.ssh/config
Host server1
HostName server1.com
User travist
IdentityFile /Users/travist/.ssh/id_rsa
Host server2
HostName server2.com
User travist
IdentityFile /Users/travist/.ssh/id_rsa
Copy all of the files in this Gist to a separate folder, and then type.
npm install
To run this, simply type
grunt
This will then watch the folder that you specified and if any files change, it will execute the rsync to the servers that you provide.