SimpleSync

A simple script that rsnycs the given list of files and directories to the specified output directory.

Build Status

Installation

Add this line to your application's Gemfile:

gem 'simple_sync'

And then execute:

$ bundle

Or install it yourself as:

$ gem install simple_sync

Configuration

SimpleSync looks in the current directory for a json configuration file named .simple_sync.

Example

{ "configurations" : [ 
  { "config" : { 
    "name" : "1st configuration",
    "rsync" : "-azv",
    "sources" : ["test/test_source/file1.txt", "test/test_source/file2.txt"], 
    "destination" : "test/test_destination/first_config/" 
    }},
  { "config" : {
    "name" : "2nd configuration",
    "rsync" : "-azrv",
    "rsync_suffix" : "2>&1", 
    "sources" : ["test/test_source/somedirectory"] , 
    "destination" : "test/test_destination/second_config" 
    }},
  { "config" : { 
    "name" : "ssh configuration",
    "rsync" : "-azrv --recursive -e ssh -i /Users/someuser/.ssh/backup_server",
    "sources" : ["test_source/file1.txt", "test_source/file2.txt", "test_source/somedirectory"] , 
    "destination" : "someuser@backupserver:/BACKUP/personal" 
    }}
  ]
}

rsync

If the rsync configuration option is given it is passed unmodified to rsync.

rsync_suffix

The rsync_suffix option provides a method to redirect the rsync stdio

sources

A list of files and/or directories that are to be rsynced to a single directory

destination

A destination for the synced files

Usage

SimpleSync is meant to be run from cron or another script. To run it from the command line, simpley type in

simple_sync

SimpleSync can also be used as a library

require 'simple_sync'
sync = SimpleSync.new
sync.load_config
sync.copy_to_destination

Contributing

  1. Fork it ( https://github.com/[my-github-username]/simple_sync/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request