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 +4 -4
- data/README.md +1 -0
- data/lib/capistrano/rsync.rb +31 -7
- data/lib/capistrano/rsync/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8b4ce35e20b912842770c2d3cdfae5edf02e20c0
|
4
|
+
data.tar.gz: 43ebd569060a8bba0321d301923b1c96f2ad5618
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
data/lib/capistrano/rsync.rb
CHANGED
@@ -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
|
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
|
104
|
-
|
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
|
-
|
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
|