- Shell 97.4%
- Makefile 2.6%
| .gitignore | ||
| LICENSE | ||
| Makefile | ||
| README.md | ||
| ssync.sh | ||
Smart syncing with support for profiles and ignore files
The ssync utility is designed to make manual deployment easier and more
convenient. Based on rsync.
Synopsis
Local
ssync [OPTION...] [SRC...]
Access via remote shell
Pull
ssync [OPTION...] --reverse --host USER@HOST [-d DEST] [SRC...]
Push
ssync [OPTION...] --host USER@HOST [SRC...] [-d DEST]
Example
This example will sync the contents of ~/prod/mysite/ with ~/src/mysite/.
You can specify files to ignore in the ./.signore file.
cd ~/src/mysite
ssync -d ~/prod/
Options
-h,--help— show help;-n,--dry-run— perform a trial run with no changes made;-d,--dest— specify the destination directory;-c,--config— specify the config file (default:./.src);-H,--host— specify the remote host for syncing;-p,--profile— use the profile defined in the config;-m,--chmod— affect file and/or directory permissions (default:ug+rwX);-i,--interactive— prompt before syncing;-r,--reverse— reverse syncing;-v,--verbose— verbose mode (multiple -v options increase the verbosity).
Ignore file
You can filter files using .signore. The syntax is basically the same as
.gitignore. Example:
# ignore all .src files in project root
/.src
# unignore all .jar files in project root
!/*.jar
# ignore all .git directories
.git
Configuration
The utility can be configured via the ./.src (sync run command)
file or a custom file specified using --config.
The configuration syntax is key value. A configuration can contain global
options and profile-specific options. Global options come first, then
profile-specific options. Example:
# add additional ignore files. Note: .signore will always be included
ignore_file .gitignore .myignore
# similar to --host command option
host myprodhost1.example.com
# similar to --dest command option
dest /srv/myprod
# similar to --chmod command option
chmod u+rwX
# note: The line indents below don't affect anything, they're just for human
# readability. Options after 'profile develop' will only be used when using
# the '--profile develop' command option
profile develop
host mytesthost2.example.com
dest /srv/mydevelop
You can use a profile via the --profile option. Configuration options
specified after profile will be overridden, while others will be inherited.
Examples:
ssync --profile develop
ssync -p develop
# 'develop' starts with 'd'
ssync -pd
Installation
Clone the repository and chdir into it:
git clone https://git.zhira.net/zhdev/ssync.git
cd ./ssync
Install ssync into /usr/local/bin directory:
sudo make PREFIX=/usr/local install
It can also be installed in the user's home directory:
make PREFIX=$HOME/.local install