The Rsync Toolkit is a command line tool that facilitates the process of syncing local directories to remote directories using the rsync utility. It provides a simple and intuitive interface for developers to manage syncing multiple directories into multiple sites easily.
Before using this tool, ensure the following software is installed on your system:
- Node.js v16
- rsync
The tool has the following commands:
This command connects to the specified SSH host and adds a configuration entry in ~/.ssh/config
for future use.
alias
- Alias to be used when connecting to the specified hosthostname
- Hostname to connect tousername
- Username to use for authenticationidentityFilePath
(optional) - Path to the identity private key file to use for authentication
woa connect mysite myhost username /path/to/private/key
This command will connect to myhost
using the provided username and private key file, and add a configuration entry to ~/.ssh/config
with the alias mysite
. This will allow you to later connect to the same server simply by running ssh mysite
.
Syncs local directories with remote directories using rsync.
woa sync mysite
Listens for changes in local directories and syncs them with remote directories using rsync.
woa watch mysite
Lists all host aliases present in the ~/.ssh/config
file.
Displays the help menu.
To install this tool, follow the steps below:
- Clone the repository to your local machine
- Navigate to the cloned directory
- Run
npm install
to install dependencies - Run
npm run setup
to configure the tool - Modify the
~/.woa_projects.json
file with a list of projects you want to sync. Here's an example:
[
{
"name": "Project 1",
"value": "project1",
"args": ["--exclude", ".git", "--exclude", ".cache", "--exclude", "node_modules/", "--exclude", "tests/"],
"localDir": "/path/to/project1",
"remoteDir": "/path/to/remote/project1"
},
{
"name": "Project 2",
"value": "project2",
"args": ["--exclude", ".git", "--exclude", ".cache", "--exclude", "node_modules/", "--exclude", "tests/"],
"localDir": "/path/to/project2",
"remoteDir": "/path/to/remote/project2"
}
]
Note: Make sure not to include any trailing commas at the end of each object or property.
- (Optional) Run the
source
command as described to update the shell.
The Rsync Toolkit is a one-way syncing tool, meaning it only supports syncing from local directories to remote directories and not vice versa. We recommend taking appropriate precautions before using the tool to ensure that your data is not lost or corrupted during the syncing process.
Contributions are welcome! Please follow these steps to contribute:
- Create a new branch for your feature or bug fix
- Write your code for your changes
- Commit your changes and push them
- Submit a pull request