capistrano-rsync-bladrak 1.1.0 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 791363f9b4401035fac5812216e69f4ff4e22ffa
4
- data.tar.gz: be0a78abd93cfad6ae1fe1b5dddfc545282a0f2e
3
+ metadata.gz: 8b4ce35e20b912842770c2d3cdfae5edf02e20c0
4
+ data.tar.gz: 43ebd569060a8bba0321d301923b1c96f2ad5618
5
5
  SHA512:
6
- metadata.gz: 8bb79f4dce51ef3cdbafc311240e97dc78d6284cf54ce7f285f2a6359253cd7bdf7a8db62a87fce24c17ca76e2c08a04e10b21c88c63c965424deec3810c8b75
7
- data.tar.gz: fd13d028dd808f8379f4803578933f0caef2f6edb37195c68849e4b1508bd2e03828fc1d6a5d587a33eba0fbd981453c261cc93f720cd4cc304ac4c935c7eccc
6
+ metadata.gz: c7f4b12954ad33f4e847084a7fcdceaf5a6c002c642da82c500a648feaef6dcb883ea832f979ab8bac06a10e13f0d1377838f31be5927724861cc0391bc2cfcc
7
+ data.tar.gz: 31929e6a29d2f52018bf8bfcb310979e258345068b0a13f36c834777e196b573f798ab6ecbdda141db8c981121a5ab3e153ef4ef870728adb8c5ead0fb64e630
data/README.md CHANGED
@@ -100,6 +100,7 @@ rsync_stage | `tmp/deploy` | Path where to clone your repository for staging,
100
100
  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.<br> Set to `nil` if you want to disable the cache.
101
101
  rsync_options | `[]` | Array of options to pass to `rsync`.
102
102
  rsync_sparse_checkout | `[]` | Array of directories to checkout (checks out all if empty)
103
+ rsync_depth | `1` | Sets the --depth argument value for the git operations; this is set to 1 by default as you won't need the git history
103
104
 
104
105
 
105
106
  License
@@ -5,8 +5,13 @@ namespace :load do
5
5
 
6
6
  set :rsync_options, []
7
7
  set :rsync_copy, "rsync --archive --acls --xattrs"
8
+
9
+ # Sparse checkout allows to checkout only part of the repository
8
10
  set :rsync_sparse_checkout, []
9
11
 
12
+ # You may not need the whole history, put to false to get it whole
13
+ set :rsync_depth, 1
14
+
10
15
  # Stage is used on your local machine for rsyncing from.
11
16
  set :rsync_stage, "tmp/deploy"
12
17
 
@@ -32,6 +37,11 @@ rsync_cache = lambda do
32
37
  cache
33
38
  end
34
39
 
40
+ rsync_target = lambda do
41
+ target = !!fetch(:rsync_checkout_tag, false) ? "tags/#{fetch(:branch)}" : "origin/#{fetch(:branch)}"
42
+ target
43
+ end
44
+
35
45
  Rake::Task["deploy:check"].enhance ["rsync:hook_scm"]
36
46
  # Rake::Task["deploy:updating"].enhance ["rsync:hook_scm"]
37
47
 
@@ -82,10 +92,16 @@ namespace :rsync do
82
92
  Kernel.system *init
83
93
 
84
94
  Dir.chdir fetch(:rsync_stage) do
85
- remote = %W[git remote add -f origin]
95
+ remote = %W[git remote add origin --quiet]
86
96
  remote << fetch(:repo_url)
87
97
  Kernel.system *remote
88
98
 
99
+ fetch = %W[git fetch --quiet --prune --all -t]
100
+ if !!fetch(:rsync_depth, false)
101
+ fetch << "--depth=#{fetch(:rsync_depth)}"
102
+ end
103
+ Kernel.system *fetch
104
+
89
105
  sparse = %W[git config core.sparsecheckout true]
90
106
  Kernel.system *sparse
91
107
 
@@ -100,16 +116,23 @@ namespace :rsync do
100
116
  Kernel.system *sparse_checkout
101
117
  end
102
118
 
103
- pull = %W[git pull origin]
104
- pull << fetch(:rsync_stage)
119
+ pull = %W[git pull --quiet]
120
+ if !!fetch(:rsync_depth, false)
121
+ pull << "--depth=#{fetch(:rsync_depth)}"
122
+ end
123
+ pull << "origin"
124
+ pull << rsync_target.call
105
125
  Kernel.system *pull
106
126
  end
107
127
  end
108
128
 
109
129
  task :clone do
110
- clone = %W[git clone]
130
+ clone = %W[git clone --quiet]
111
131
  clone << fetch(:repo_url, ".")
112
132
  clone << fetch(:rsync_stage)
133
+ if !!fetch(:rsync_depth, false)
134
+ clone << "--depth=#{fetch(:rsync_depth)}"
135
+ end
113
136
  Kernel.system *clone
114
137
  end
115
138
  end
@@ -118,11 +141,12 @@ namespace :rsync do
118
141
  task :stage => %w[create_stage] do
119
142
  Dir.chdir fetch(:rsync_stage) do
120
143
  update = %W[git fetch --quiet --all --prune]
144
+ if !!fetch(:rsync_depth, false)
145
+ update << "--depth=#{fetch(:rsync_depth)}"
146
+ end
121
147
  Kernel.system *update
122
148
 
123
- target = !!fetch(:rsync_checkout_tag, false) ? "tags/#{fetch(:branch)}" : "origin/#{fetch(:branch)}"
124
- checkout = %W[git reset --hard #{target}]
125
-
149
+ checkout = %W[git reset --quiet --hard #{rsync_target.call}]
126
150
  Kernel.system *checkout
127
151
  end
128
152
  end
@@ -1,5 +1,5 @@
1
1
  module Capistrano
2
2
  module Rsync
3
- VERSION = "1.1.0"
3
+ VERSION = "1.2.0"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: capistrano-rsync-bladrak
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andri Möll, Hugo Briand