This TextMate bundle will let you keep a directory on a remote server in sync with your local work directory.
All you have to do, is these three things:
- Install the bundle in TextMate
- Add your ssh public key1 to
~/.ssh/authorized_keyson the remote server you wish to copy your files to.
If you have a password on your key, then you need to add it to the Keychain using
ssh-add -K, once this is done OS X will use the
ssh-agentto query the Keychain for your password.
- Configure bundle settings for your project via the bundle menu.
The first time you call configure, a new config file will be generated for you with explaining comments.
Please note that it only works within projects as we need to have a directory to hold our
.tm_sync.config config file.
To configure this bundle, bring up the
Select Bundle Item by pressing
^⌘T and start typing
An item called
Configure - Synchronize remote directory [rsync+ssh] should appear at the top. Selecting that will generate a config file for you that looks something like this:
Now you just need to change it to fit your needs.
The first half of the config deals with
This is the host you want to upload your project to
sshwill use to connect to - You rarely have to change this.
The username of the user on the remote host that should receive the files.
The full path to the directory where your project files will be rsync’ed to. Note that this directory will be overwritten and any existing content will be removed if you specify2 the
When we sync the project to the remote host we pass the
This means that you can pass any command line option you want to rsync. Want to exclude more files, just add an extra
Configuring post commands
In version 1.1, I added the ability to run any command on the remote host after a successful rsync. You can use this to build and install or build and test your code on the remote host.
You have to create a one-liner with all the commands you want to run chained together by
&& like so:
Please note that the command will be run in a non-interactive shell and therefore might have a different set of environment variables that if you login normally via ssh.