From ab9e0c720fede323551599aa62e502251d2080a8 Mon Sep 17 00:00:00 2001 From: Lennart Weijl Date: Fri, 17 Jul 2015 15:12:58 +0200 Subject: [PATCH] Gives the opportunity to define some other remote that origin --- CHANGELOG.md | 3 +++ README.md | 1 + lib/capistrano/rsync.rb | 9 ++++++--- lib/capistrano/rsync/version.rb | 2 +- 4 files changed, 11 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e8e7f6b..483814b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,6 @@ +## 1.3.4 (Jul 17, 2015) +- Added ``:git_remote`` option. Gives the opportunity to define some other remote that ``origin``. + ## 1.3.3 (Jul 15, 2015) - Adds support for checking out revisions on top of tags and branches (rsync_checkout_tag is now deprecated) diff --git a/README.md b/README.md index cda35f1..7e07969 100644 --- a/README.md +++ b/README.md @@ -126,6 +126,7 @@ Name | Default | Description --------------|---------|------------ repo_url | `.` | The path or URL to a Git repository to clone from. branch | `master` | The Git branch to checkout. +git_remote | ``origin`` | The remote to use for Git 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`. diff --git a/lib/capistrano/rsync.rb b/lib/capistrano/rsync.rb index 3ade664..91e9592 100644 --- a/lib/capistrano/rsync.rb +++ b/lib/capistrano/rsync.rb @@ -32,6 +32,9 @@ set_if_empty :rsync_target_dir, "." +# Creates opportunity to define remote other than origin +set_if_empty :git_remote, "origin" + set_if_empty :enable_git_submodules, false set_if_empty :reset_git_submodules_before_update, false @@ -50,18 +53,18 @@ rsync_target = lambda do case fetch(:rsync_checkout) when "tag" - target = "tags/#{fetch(:branch)}" + target = "#{fetch(:git_remote)}/tags/#{fetch(:branch)}" when "revision" target = fetch(:branch) else - target = "origin/#{fetch(:branch)}" + target = "#{fetch(:git_remote)}/#{fetch(:branch)}" end target end rsync_branch = lambda do if fetch(:rsync_checkout) == "tag" - branch = "tags/#{fetch(:branch)}" + branch = "#{fetch(:git_remote)}/tags/#{fetch(:branch)}" else branch = fetch(:branch) end diff --git a/lib/capistrano/rsync/version.rb b/lib/capistrano/rsync/version.rb index db55334..4015bd1 100644 --- a/lib/capistrano/rsync/version.rb +++ b/lib/capistrano/rsync/version.rb @@ -1,5 +1,5 @@ module Capistrano module Rsync - VERSION = "1.3.3" + VERSION = "1.3.4" end end