GitSync

GitSync is a ridiculously simple gem for Rails that simplifies the process of transferring your content managed files.

Suppose you are using Paperclip to store your file uploads under public/system. Like a good developer you have added this directory to your .gitignore file, because content doesn't belong in the repo. So you have a bunch of avatars or documents in one place and you need to get them somewhere else. What do you do? Rsync to the rescue!

GitSync will search your git remotes for a valid connection string and build the appropriate rsync command.

Requirements

GitSync assumes you are using git for deployment, and have remotes named staging and/or production. This strategy works well with the Mislav git-deploy system, for example.

git remote add staging [email protected]:/path/to/application

The only other requirement is that you have a working copy of rsync on your system.

Usage

Add git_sync to your Gemfile. For most use cases it makes sense to stick it in the :development group.

group :development do
  gem 'git_sync'
end

Push local public/system assets to the server

rake git_sync:push:staging
rake git_sync:push:production

Pull remote public/system assets to local

rake git_sync:pull:staging
rake git_sync:pull:production