Skip to content

Commit

Permalink
First public release of sman
Browse files Browse the repository at this point in the history
  • Loading branch information
rogerhub committed Aug 1, 2016
0 parents commit 75fcd1d
Show file tree
Hide file tree
Showing 53 changed files with 4,263 additions and 0 deletions.
11 changes: 11 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
.DS_Store

*.pbxuser
!default.pbxuser
*.mode1v3
!default.mode1v3
*.mode2v3
!default.mode2v3
*.perspectivev3
!default.perspectivev3
xcuserdata/
10 changes: 10 additions & 0 deletions LICENSE.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
Copyright (c) 2016, Roger Chen
All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.

2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
87 changes: 87 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
# Super Mega Awesome NYAN

A macOS application for continuously syncing folders to servers via rsync.

## Description

This app lets you sync a folder from your macOS computer to any SSH/rsync-capable server. When you make changes to the source folder, SMAN will automatically trigger another sync. SMAN is designed to sync files quickly, so you can push source code to a server without interrupting your workflow.

The SMAN user interface lets you create one or more *sync jobs*. Each job has a source directory, which can be any directory on your file system. Each job also has a SSH hostname and a destination path. You can configure rsync to exclude certain files or file patterns from the sync job. Exclude patterns follow the same syntax as in rsync.

## Installation

You can download SMAN with [Homebrew Cask](https://caskroom.github.io/) or download the source code and build it with Xcode. Here are instructions for installing SMAN using Homebrew Cask:

```bash
# Add the SMAN software source
brew tap rogerhub/sman

# Install the latest stable version of SMAN
brew cask install sman
```

## Screenshots

<img src="doc/MainUI.png" width="200" title="The main UI" alt="The main UI" />
<img src="doc/CreateUI.png" width="200" title="Creating a new sync job" alt="Creating a new sync job" />
<img src="doc/PreferencesUI.png" width="200" title="Editing preferences" alt="Editing preferences" />

## Compatible servers

SMAN uses rsync to transfer files efficiently. Rsync comes with macOS, and it's also preinstalled on virtually all Linux, Solaris, and BSD distributions. **You must set up SSH key authentication** on your servers, so rsync can connect to them without prompting you for a password. The server must also already be registered with your own `known_hosts` list.

## Reduce sync latency

You can speed up SMAN even more by enabling SSH connection sharing with your `ssh_config`. Connection sharing allows you to use a single TCP stream to multiplex many SSH sessions to a single server. Using SSH connection sharing will allow rsync to avoid setting up a new SSH connection every time a sync occurs.

You can enable SSH connection sharing using the `ControlMaster` and `ControlPath` options in your `.ssh/config` file.

```
Host my-server
User roger
Hostname my-server.example.com
ControlMaster auto
ControlPath ~/.ssh/ctl/%L-%r@%h:%p
```

## Exclude patterns

Here are some examples of exclude patterns you can use:

* `.DS_Store` &mdash; A simple pattern to match an exact file name
* `/.git` &mdash; Only matches when ".git" is matched at the root of the source directory
* `cache/` &mdash; Only matches directories named "cache". Files named "cache" are not matched
* `*.tmp` &mdash; Matches anything that ends in ".tmp"
* `build/*.S` &mdash; The asterisk matches anything, except slashes. So, this rule matches anything that ends in ".S" directly inside a "build" folder.
* `build/**.S` &mdash; The double-star matches anything, including slashes. So, this rule matches anything that ends in ".S" anywhere inside a "build" folder.

## Troubleshooting

To troubleshoot problems with syncing, try running rsync from the terminal. For example, if your sync job has hostname `Host` and destination path `/Path/`, then run:

```bash
# Print a directory listing of /Path/ on the server
rsync Host:/Path/
```

This step should address any connection problems. You should also verify that your SSH user account has permission to write to the destination path.

You can find more details about SMAN failures by right clicking a single job and selecting **View logs**. The logs will show you the full rsync parameters and any error messages that were displayed. A short error message may also be visible in the "Status" column of the SMAN user interface.

## Technical details

SMAN uses the macOS FSEvents API to efficiently receive notifications of changes to the source directory. If a directory changes because of an external event (like a remote directory mounted with SSHFS), then SMAN will not notice the change. However, you can manually sync any job.

The SMAN user interface is written in Objective C. Some source code from rsync's exclude pattern matcher is included in SMAN to optimize its automatic syncing. For example, if FSEvents reports that a file has changed, but the file matches one of the user's exclude patterns, then SMAN will not request another sync.

By default, SMAN will ask rsync to checksum every file in the source and destination. You can turn off this behavior in SMAN preferences. If you turn off this behavior, then rsync will assume that the contents of 2 files are identical if they have the same name, modification time, and file size. This may improve performance for directories with very large files.

By default, SMAN will attempt to optimize syncing latency when FSEvents only reports that 1 file has changed. (When editing source code, most FSEvents notifications originate from saving changes to a single file.) You can turn this feature off in SMAN preferences, but there's usually no reason to.

## Acknowledgements

I'm not an artist. Thank you to pixabay user <a href="https://pixabay.com/en/users/rosanegra_1-432510/" rel="nofollow">rosanegra_1</a> for the app icon, which is licensed under Creative Commons CC0.

## License

BSD 2-clause license (see LICENSE.txt)
Binary file added doc/CreateUI.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added doc/MainUI.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added doc/PreferencesUI.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 75fcd1d

Please sign in to comment.