GithubHelp home page GithubHelp logo

cynch's Introduction

Cynch

Asynchronous synchronization in a cinch. Multi-target file uploading with rsync!

Note: Cynch takes advantage of several ES6 features (classes, arrow functions, etc). You may need to run Node with Harmony flags (or upgrade to a newer version).

What is this?

Certain IDEs (I won't name any) have pretty lame remote development support, especially if you have a need to sync with multiple remote environments. Cynch fixes that. Just specify your source and target(s) and you're ready to go.

Installation

npm install -g cynch

Usage

cynch /path/to/my/config.json

If no config file is provided, Cynch will look for cynch.json in the current working directory.

Configuration

The following are possible configuration values.

Name Required? Type Description
source x string Source directory to sync. May be relative to the configuration path.
targets x string[] Target objects (see below)
exclusions string[] Patterns to exclude from the sync (equivalent to passing --exclude options to rsync)
inclusions string[] Patterns to include in the sync (equivalent to passing --include options to rsync)
rsyncOptions string[] Any additional options to pass to rsync
watch boolean Enable watch mode, watch for file changes and trigger sync
watchOptions object Watcher Options, See Chokidar
watchOptions.waitTimeout int Number of milliseconds to wait for all file change events to finish (default: 300)
watchOptions.path string Path to watch for changes (default: source from config file)
debug boolean Debug mode
growl boolean Allow Growl Notifications (default: true)

Target objects

Tip: rsync uses your machine's ssh config; you may substitute full user@host strings with an entry from your ssh config. (e.g.: "host": "mybox")

{
  "host": "[email protected]",
  "path": "/some/example/deployment/path"
}

Example config

{
  "source": "~/src/myProject",
  "targets": [
    {
      "host": "pinky",
      "path": "/srv/myProject"
    },
    {
      "host": "jewel",
      "path": "/srv/myProject"
    },
    {
      "host": "arvinne",
      "path": "/srv/myProject"
    }
  ],
  "exclusions": [
    ".git",
    ".idea",
    "node_modules/*"
  ]
}

Watch Mode

If watch mode is enabled, Cynch will function as a long-running process that watches for file changes and synchronizes accordingly (as opposed to exiting immediately once the sync is complete). This can be used with any daemon tool (i.e. launchd, systemd) to ease deployment.

By default, your source directory is watched. If this is not preferable, you may specify the watch directory via watchOptions.path.

Growl Notifications

With growl notifications, you can not get notified when Cynch succesffully uploads or errors out. In order for notifications to work you will need to install a notifier library.

Mac OSX (Darwin)

Install growlnotify(1). On OS X 10.8, Notification Center is supported using terminal-notifier. To install:

  $ sudo gem install terminal-notifier

Ubuntu (Linux)

Install notify-send through the libnotify-bin package:

  $ sudo apt-get install libnotify-bin

Windows

Download and install Growl for Windows

Download growlnotify - IMPORTANT : Unpack growlnotify to a folder that is present in your path!

Special Considerations

Windows

Cynch can be used on Windows using rsync from Cygwin, however there are some special requirements.

  • Cygwin's rsync does not seem to like Windows-style paths (e.g. c:\src\myProject); attempting to use them will result in error messages from rsync such as The source and destination cannot both be remote. To fix this, use Cygwin-style paths (e.g. /cygdrive/c/src/myProject). HOWEVER...
  • The file watcher does not like Cygwin-style paths. Therefore, the watchOptions.path config option must be set to the respective Windows-style path (e.g. c:\src\myProject).

##License ISC

cynch's People

Contributors

pmarrapese avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

cynch's Issues

High CPU usage

Hi Paul

For big projects, cynch seems to be using a large % of cpu and significantly slows down my 2013 mbp (osx 10.11.6). Probably related to chokidar but Kevin also suggested it might be cool to have cynch be able to watch several projects, instead of having a new process for each project (which may or may not help with the load).

Either way, it seems like it's the file watching that's expensive.

CPU load before and after stopping a bunch of cynch processes:
screen shot 2017-02-23 at 12 31 50 pm

Just wanted to let you know, thanks for cynch.

Start time should not be global

Start time is global for when the script started, so if the script was around for a while and synced again then the time will be really long

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.