• Stars
    star
    125
  • Rank 277,399 (Top 6 %)
  • Language
    Ruby
  • License
    Other
  • Created over 10 years ago
  • Updated 10 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Deploy with Rsync from any local (or remote) repository when using Capistrano. Capistrano v3 ready!

Capistrano::Rsync for Capistrano v3

![Gem version][gem-badge] [gem-badge]: https://badge.fury.io/rb/capistrano-rsync.png

Deploy with Rsync to your server from any local (or remote) repository when using Capistrano. Saves you from having to install Git on your production machine and allows you to customize which files you want to deploy. Also allows you to easily precompile things on your local machine before deploying.

Tour

  • Works with the new Capistrano v3 (source code) versions >= 3.0.0pre14 and < 4.
  • Suitable for deploying any apps, be it Ruby, Rails, Node.js or others.
  • Exclude files from being deployed with Rsync's --exclude options.
  • Precompile files or assets easily before deploying, like JavaScript or CSS.
  • Caches your previously deployed code to speed up deployments ~1337%.
  • Currently works only with Git (as does Capistrano v3), so please shout out your interest in other SCMs.

Using Mina instead of Capistrano? I've built Mina::Rsync as well.

Using

Install with:

gem install capistrano-rsync

Require it at the top of your Capfile (or config/deploy.rb):

require "capistrano/rsync"

Set some rsync_options to your liking:

set :rsync_options, %w[--recursive --delete --delete-excluded --exclude .git*]

And after setting regular Capistrano options, deploy as usual!

cap deploy

Implementation

  1. Clones and updates your repository to rsync_stage (defaults to tmp/deploy) on your local machine.
  2. Checks out the branch set in the branch variable (defaults to master).
  3. If rsync_cache set (defaults to shared/deploy), rsyncs to that directory on the server.
  4. If rsync_cache set, copies the content of that directory to a new release directory.
  5. If rsync_cache is nil, rsyncs straight to a new release directory.

After that, Capistrano takes over and runs its usual tasks and symlinking.

Exclude files from being deployed

If you don't want to deploy everything you've committed to your repository, pass some --exclude options to Rsync:

set :rsync_options, %w[
  --recursive --delete --delete-excluded
  --exclude .git*
  --exclude /config/database.yml
  --exclude /test/***
]

Precompile assets before deploy

Capistrano::Rsync runs rsync:stage before rsyncing. Hook to that like this:

task :precompile do
  Dir.chdir fetch(:rsync_stage) do
    system "rake", "assets:precompile"
  end
end

after "rsync:stage", "precompile"

Deploy release without symlinking the current directory

cap rsync:release

Configuration

Set Capistrano variables with set name, value.

Name Default Description
repo_url . The path or URL to a Git repository to clone from.
branch master The Git branch to checkout.
rsync_stage tmp/deploy Path where to clone your repository for staging, checkouting and rsyncing. Can be both relative or absolute.
rsync_cache shared/deploy Path where to cache your repository on the server to avoid rsyncing from scratch each time. Can be both relative or absolute.
Set to nil if you want to disable the cache.
rsync_options [] Array of options to pass to rsync.

License

Capistrano::Rsync is released under a Lesser GNU Affero General Public License, which in summary means:

  • You can use this program for no cost.
  • You can use this program for both personal and commercial reasons.
  • You do not have to share your own program's code which uses this program.
  • You have to share modifications (e.g bug-fixes) you've made to this program.

For more convoluted language, see the LICENSE file.

About

Andri MΓΆll made this happen.
Monday Calendar was the reason I needed this.

If you find Capistrano::Rsync needs improving, please don't hesitate to type to me now at [email protected] or create an issue online.

More Repositories

1

vim-node

Tools and environment to make Vim superb for developing with Node.js. Like Rails.vim for Node.
Ruby
808
star
2

vim-bbye

Delete buffers and close files in Vim without closing your windows or messing up your layout. Like Bclose.vim, but rewritten and well maintained.
Vim Script
637
star
3

node-mitm

Intercept and mock outgoing Node.js network TCP connections and HTTP requests for testing. Intercepts and gives you a Net.Socket, Http.IncomingMessage and Http.ServerResponse to test and respond with. Super useful when testing code that hits remote servers.
JavaScript
635
star
4

json-stringify-safe

Like JSON.stringify, but doesn't throw on circular references
JavaScript
543
star
5

js-must

An assertion library for JavaScript and Node.js with a friendly BDD syntax (awesome.must.be.true()). It ships with many expressive matchers and is test runner and framework agnostic. Follows RFC 2119 with its use of MUST. Good stuff and well tested.
JavaScript
334
star
6

js-ddl

Gets you a JSON Schema from PostgreSQL or SQLite3. Also supports arrays and default values. Use it for introspection or preparing your domain models like with Rails's Active Record.
JavaScript
68
star
7

js-fetch-defaults

Fetch API mixin to set a default base URL and options. Functional and immutable.
JavaScript
55
star
8

mina-rsync

Deploy with Rsync from any local (or remote) repository when using Mina.
Ruby
50
star
9

js-concert

An event library for JavaScript and Node.js that implements the observer pattern (a.k.a publish/subscribe). Similar to Node's EventEmitter and Backbone.Events, but independent, minimal and light-weight.
JavaScript
43
star
10

js-standard-error

Tiny JavaScript library that simplifies subclassing and inheriting from Error while keeping the correct name and stack. Also supports constructing from an object of properties. Saves you from boilerplate.
JavaScript
41
star
11

js-undersign

A JavaScript library for creating eIDAS compatible XAdES signatures, incl. support for OCSP, timestamps and ASIC-E. Works also with the Estonian Id-card, Mobile-Id and Smart-Id out of the box.
JavaScript
29
star
12

js-strange

Range object for JavaScript. Supports exclusive and infinite ranges. Stringifies to PostgreSQL compatible format.
JavaScript
26
star
13

node-pg-error

An error class for Node.js that parses PostgreSQL's ErrorResponse format and sets human readable field names. Works with node-pg, too.
JavaScript
22
star
14

sh-chnode

Change between installed Node versions in your current shell.
Shell
22
star
15

js-promise-defer

JavaScript Polyfill for Promise.defer. Uses the native ES6 Promise. Supports other Promises/A+ implementations.
JavaScript
22
star
16

js-standard-http-error

Standard HTTP error class for Node.js. Proper serialization, no bloat. Extensible.
JavaScript
19
star
17

js-element-from-point

A consistent cross-browser document.elementFromPoint function. Works around idiosyncracies of old WebKits et al.
Makefile
11
star
18

node-require-guard

Prevent files and modules being required more than once. Helps with auto-reloaders or test runners that insist.
JavaScript
9
star
19

js-oolong

Object utility library for JavaScript. Simple, tasteful and plentiful. Supports inherited properties.
JavaScript
8
star
20

js-hugml

An XML parsing and serializing library based on Google's GDATA and BadgerFish conventions. Supports namespaces.
JavaScript
7
star
21

js-j6pack

JavaScript library to render JSX to JavaScript and HTML on the web or on Node.js. Works with Express.js. No React dependency, no virtual DOM.
JavaScript
7
star
22

js-co-next

JavaScript function to use generators for request handlers and middleware. Calls next only if there was an error. Useful for Express routes.
JavaScript
7
star
23

js-internet-message

Library for JavaScript to parse and stringify RFC 822 ARPA Internet Text Messages. Useful format for messages with headers and body. Similar to HTTP.
JavaScript
6
star
24

js-sqlate

A tiny tagged template string function library for JavaScript to write SQL safely. Works with Mapbox's SQLite3 library, Brian Carlson's PostgreSQL library and others.
JavaScript
6
star
25

js-lazy-object

JavaScript library to define lazy properties on objects that are initialized once and only when accessed. Also known as a lazy initialization and cached/memoized getters.
JavaScript
6
star
26

js-medium-type

JavaScript library for parsing, stringifying and manipulating media types. Useful for content negotiation. Follows RFC2045, supports quoted parameters, all allowed characters etc.
JavaScript
5
star
27

js-kindof

A proper typeof that works with primitives, built-in value objects and those from other execution contexts.
JavaScript
5
star
28

js-syslog-protocol

Syslog (RFC 3164) parser. Works with RFC 3339/ISO 8601 timestamps.
JavaScript
5
star
29

nutikaitse

CSS
5
star
30

js-fetch-parse

Fetch API mixin to buffer and parse response bodies. Supports media type patterns for content type specific custom parsers.
JavaScript
4
star
31

node-selenium-dom

SeleniumDom.js is a mixin library for Node.js's Selenium WebDriver that adds **DOM methods** to Selenium's `WebDriver` and `WebElement`.
JavaScript
4
star
32

js-square-batman

A small JavaScript scheduling algorithm library. Useful for round-robin etc.
JavaScript
4
star
33

js-fetch-jsonify

Fetch API mixin for stringifying JSON and setting Content-Type if unset. Functional and immutable.
JavaScript
3
star
34

js-egal

Strict equality test (like ===) for JavaScript that handles both built-in and custom value objects (those with a valueOf function).
JavaScript
3
star
35

node-syslogh

Log to your system's Syslog from within Node.js. Provides simple native bindings to <syslog.h> and syslog(3). Works on Node v0.10 up to v4 and beyond.
C++
3
star
36

browserify-substitution-mass-confusion

Browserify plugin for substituting modules everywhere. It expands the package.json "browser" field to work for nested dependencies.
JavaScript
3
star
37

node-fetch-off

Fetch API polyfill and facade. Its request and response wrappers can be used separately: use fetch for request yet get back Node's Http.get response (IncomingMessage) for streaming.
JavaScript
2
star
38

js-internet-message-type

Library for JavaScript to parse RFC 822 ARPA Internet Text Messages types and bodies. Works well with InternetMessage.js.
JavaScript
2
star
39

exportjs

A tool that helps you publish and export your JavaScripts to other environments by wrapping them in an IIFE. Or UMD in the future.
JavaScript
1
star
40

js-fetch-error

A JavaScript library for an error class for use with the Fetch API.
JavaScript
1
star
41

js-soul

Soul.js is a simple yet extensible mutable model library for JavaScript.
JavaScript
1
star
42

js-descend

Function to set up an inherited class that calls its ancestor constructors automatically. Can also be attached to constructors.
JavaScript
1
star
43

js-fetch-throw

A JavaScript Fetch API mixin to throw FetchError when the request fails or response has an error.
JavaScript
1
star
44

node-flash-fiction

Flash messages middleware for Express/Connect with support for redirects and immediate use. Useful for informational or errors messages. Like Rails's Flash.
JavaScript
1
star
45

js-overstrike

A utility library in the style of Underscore.js with consistent inherited property handling, the simplest implementation and curation by yours truly.
JavaScript
1
star
46

js-fetch-formify

Fetch API mixin for urlencoding an object and setting Content-Type if unset. Functional and immutable.
JavaScript
1
star