Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

capistrano-rsync-local

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

capistrano-rsync-local

  • 2.0.1
  • Rubygems
  • Socket score

Version published
Maintainers
1
Created
Source

Capistrano::Rsync for Capistrano v3

Gem Version

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 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%.
  • Works with git and svn.

Using Mina instead of Capistrano? I've (actuall not me, but Moll) built Mina::Rsync as well.

Using

Install with:

gem install capistrano-rsync-local

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 .svn*
  --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.

NameDefaultDescription
rsync_scmgitAvailable options: git, svn.
rsync_scm_usernamenilUsed for Svn (Optional).
rsync_scm_passwordnilUsed for Svn (Optional).
repo_url.The path or URL to a SCM repository to clone from.
branchmasterThe Git branch to checkout. This is ignored for Svn.
rsync_stagetmp/deployPath where to clone your repository for staging, checkouting and rsyncing. Can be both relative or absolute.
rsync_cacheshared/deployPath 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.
rsync_local_repofalseThe flag of the local repository, it disables any request to the scm
rsync_with_extfalseEnables checking out an external project
repo_ext_urlnilThe URL of the external project. Required if rsync_with_ext is true.
rsync_ext_stagetmp/deploy_extPath where to clone the external project.

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.

FAQs

Package last updated on 25 Dec 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc