capistrano 2.15.3 → 2.15.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG +5 -0
- data/Gemfile +1 -0
- data/lib/capistrano/configuration/actions/invocation.rb +14 -8
- data/lib/capistrano/recipes/deploy/assets.rb +17 -1
- data/lib/capistrano/version.rb +1 -1
- data/test/configuration/actions/invocation_test.rb +32 -0
- data/test/utils.rb +1 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c4615cf068078a3d3a85f9fa103e49a8e5638211
|
4
|
+
data.tar.gz: 5bc4b85e0e535ec07f43fb3c3541115164cea9b3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b5a3daa8ab41b154219f3707ee0eb42b439d00a9df7990367c099330b6d1afeded2ad13082842888dbf45bea473674aeef5099c1562c1cd1d166ab68db8bd3d9
|
7
|
+
data.tar.gz: d3cf7aca34633ccc485153f992549c13aa450df642b29364cb7fed76dbad0e1a0dca42c5babd236c4eb35829c572f596fa565488261402881d3e22f713df4918
|
data/CHANGELOG
CHANGED
data/Gemfile
CHANGED
@@ -163,10 +163,11 @@ module Capistrano
|
|
163
163
|
|
164
164
|
if tree.branches.any? || tree.fallback
|
165
165
|
_, servers = filter_servers(options)
|
166
|
-
branches = servers
|
166
|
+
branches = branches_for_servers(tree,servers)
|
167
167
|
case branches.size
|
168
168
|
when 0
|
169
169
|
branches = tree.branches.dup + [tree.fallback]
|
170
|
+
branches.compact!
|
170
171
|
case branches.size
|
171
172
|
when 1
|
172
173
|
logger.debug "no servers for #{branches.first}"
|
@@ -178,13 +179,7 @@ module Capistrano
|
|
178
179
|
logger.debug "executing #{branches.first}" unless options[:silent]
|
179
180
|
else
|
180
181
|
logger.debug "executing multiple commands in parallel"
|
181
|
-
branches.each {|
|
182
|
-
if(maybe_branch.is_a?(Array))
|
183
|
-
maybe_branch.each {|branch| logger.trace "-> #{branch.to_s(true)}"}
|
184
|
-
else
|
185
|
-
logger.trace "-> #{maybe_branch.to_s(true)}"
|
186
|
-
end
|
187
|
-
}
|
182
|
+
branches.each {|branch| logger.trace "-> #{branch.to_s(true)}" }
|
188
183
|
end
|
189
184
|
else
|
190
185
|
raise ArgumentError, "attempt to execute without specifying a command"
|
@@ -317,6 +312,17 @@ module Capistrano
|
|
317
312
|
exit(-1)
|
318
313
|
end
|
319
314
|
end
|
315
|
+
|
316
|
+
private
|
317
|
+
def branches_for_servers(tree,servers)
|
318
|
+
servers.inject([]) do |branches,server|
|
319
|
+
if server_branches = tree.branches_for(server)
|
320
|
+
branches += server_branches
|
321
|
+
end
|
322
|
+
branches
|
323
|
+
end
|
324
|
+
end
|
325
|
+
|
320
326
|
end
|
321
327
|
end
|
322
328
|
end
|
@@ -64,6 +64,10 @@ namespace :deploy do
|
|
64
64
|
#{rake} RAILS_ENV=#{rails_env.to_s.shellescape} #{asset_env} assets:precompile
|
65
65
|
CMD
|
66
66
|
|
67
|
+
if capture("ls -1 #{shared_path.shellescape}/#{shared_assets_prefix}/manifest* | wc -l").to_i > 1
|
68
|
+
raise "More than one asset manifest file was found in '#{shared_path.shellescape}/#{shared_assets_prefix}'. If you are upgrading a Rails 3 application to Rails 4, follow these instructions: http://github.com/capistrano/capistrano/wiki/Upgrading-to-Rails-4#asset-pipeline"
|
69
|
+
end
|
70
|
+
|
67
71
|
# Sync manifest filenames across servers if our manifest has a random filename
|
68
72
|
if shared_manifest_path =~ /manifest-.+\./
|
69
73
|
run <<-CMD.compact
|
@@ -174,9 +178,21 @@ namespace :deploy do
|
|
174
178
|
puts "#{previous_manifest} is missing! Cannot roll back assets. " <<
|
175
179
|
"Please run deploy:assets:precompile to update your assets when the rollback is finished."
|
176
180
|
else
|
181
|
+
# If the user is rolling back a Rails 4 app to Rails 3
|
182
|
+
if File.extname(previous_manifest) == '.yml' && File.extname(shared_manifest_path) == '.json'
|
183
|
+
# Remove the existing JSON manifest
|
184
|
+
run "rm -f -- #{shared_manifest_path.shellescape}"
|
185
|
+
|
186
|
+
# Restore the manifest to the Rails 3 path
|
187
|
+
restored_manifest_path = "#{shared_path.shellescape}/#{shared_assets_prefix}/manifest.yml"
|
188
|
+
else
|
189
|
+
# If the user is not rolling back from Rails 4 to 3, we just want to replace the current manifest
|
190
|
+
restored_manifest_path = shared_manifest_path
|
191
|
+
end
|
192
|
+
|
177
193
|
run <<-CMD.compact
|
178
194
|
cd -- #{previous_release.shellescape} &&
|
179
|
-
cp -f -- #{previous_manifest.shellescape} #{
|
195
|
+
cp -f -- #{previous_manifest.shellescape} #{restored_manifest_path.shellescape} &&
|
180
196
|
[ -z "$(#{rake} -P | grep assets:precompile:nondigest)" ] || #{rake} RAILS_ENV=#{rails_env.to_s.shellescape} #{asset_env} assets:precompile:nondigest
|
181
197
|
CMD
|
182
198
|
end
|
data/lib/capistrano/version.rb
CHANGED
@@ -9,6 +9,7 @@ class ConfigurationActionsInvocationTest < Test::Unit::TestCase
|
|
9
9
|
attr_accessor :dry_run
|
10
10
|
attr_accessor :preserve_roles
|
11
11
|
attr_accessor :servers
|
12
|
+
attr_accessor :roles
|
12
13
|
|
13
14
|
def initialize
|
14
15
|
@options = {}
|
@@ -226,6 +227,37 @@ class ConfigurationActionsInvocationTest < Test::Unit::TestCase
|
|
226
227
|
@config.invoke_command("ls", :once => true, :via => :foobar)
|
227
228
|
end
|
228
229
|
|
230
|
+
def test_parallel_command_execution_with_no_match
|
231
|
+
assert_block("should not raise argument error") do
|
232
|
+
begin
|
233
|
+
@config.parallel do |session|
|
234
|
+
session.when("in?(:app)", "ls") {|ch,stream,data| puts "noop"}
|
235
|
+
session.when("in?(:db)", "pwd") {|ch,stream,data| puts "noop"}
|
236
|
+
end
|
237
|
+
true
|
238
|
+
rescue
|
239
|
+
false
|
240
|
+
end
|
241
|
+
end
|
242
|
+
end
|
243
|
+
|
244
|
+
def test_parallel_command_execution_with_matching_servers
|
245
|
+
@config.expects(:execute_on_servers)
|
246
|
+
assert_block("should not raise Argument error") do
|
247
|
+
begin
|
248
|
+
@config.servers = [:app, :db]
|
249
|
+
@config.roles = {:app => [:app], :db => [:db] }
|
250
|
+
@config.parallel do |session|
|
251
|
+
session.when("in?(:app)", "ls") {|ch,stream,data| puts "noop"}
|
252
|
+
session.when("in?(:db)", "pwd") {|ch,stream,data| puts "noop"}
|
253
|
+
end
|
254
|
+
true
|
255
|
+
rescue
|
256
|
+
false
|
257
|
+
end
|
258
|
+
end
|
259
|
+
end
|
260
|
+
|
229
261
|
private
|
230
262
|
|
231
263
|
def make_config
|
data/test/utils.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: capistrano
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.15.
|
4
|
+
version: 2.15.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jamis Buck
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-04-
|
12
|
+
date: 2013-04-29 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: highline
|