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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e3bffa7c743856eaf4e95146f1f113282e185874
4
- data.tar.gz: 3108aa72d20619cf5edabf19f58647d25b9764cb
3
+ metadata.gz: c4615cf068078a3d3a85f9fa103e49a8e5638211
4
+ data.tar.gz: 5bc4b85e0e535ec07f43fb3c3541115164cea9b3
5
5
  SHA512:
6
- metadata.gz: fad703fc0ab1689f650dc534f8a4636468464c99ec711431fede61a84dcd0c4aafd5014223a9bf7c5e9795972128b76e3857e22f4e219a489209372366047937
7
- data.tar.gz: 36c81df6aa347c7747f726d1955f8ded3723a3e212b04b4a2e7ff266e73fd256d95a6210b0752c699bb7efc862c1ff814b6aaabea1c02d817e42cb97551844f8
6
+ metadata.gz: b5a3daa8ab41b154219f3707ee0eb42b439d00a9df7990367c099330b6d1afeded2ad13082842888dbf45bea473674aeef5099c1562c1cd1d166ab68db8bd3d9
7
+ data.tar.gz: d3cf7aca34633ccc485153f992549c13aa450df642b29364cb7fed76dbad0e1a0dca42c5babd236c4eb35829c572f596fa565488261402881d3e22f713df4918
data/CHANGELOG CHANGED
@@ -1,3 +1,8 @@
1
+ ## 2.15.4 / April 29 2013
2
+
3
+ * Fix parallel command logging (@gnufied)
4
+ * Fix a double-asset manifest problem on Rails upgrades. (@jimryan)
5
+
1
6
  ## 2.15.3 / April 25 2012
2
7
 
3
8
  * For deploy:cleanup, use try_sudo with rm command. (@joshstaiger)
data/Gemfile CHANGED
@@ -9,4 +9,5 @@ gemspec
9
9
  #
10
10
  group :development do
11
11
  gem "rake"
12
+ gem "pry"
12
13
  end
@@ -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.map{|server| tree.branches_for(server)}.compact
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 {|maybe_branch|
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} #{shared_manifest_path.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
@@ -2,7 +2,7 @@ module Capistrano
2
2
  class Version
3
3
  MAJOR = 2
4
4
  MINOR = 15
5
- PATCH = 3
5
+ PATCH = 4
6
6
 
7
7
  def self.to_s
8
8
  "#{MAJOR}.#{MINOR}.#{PATCH}"
@@ -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
@@ -5,6 +5,7 @@ require 'test/unit'
5
5
  require 'mocha'
6
6
 
7
7
  require 'capistrano/server_definition'
8
+ require 'pry'
8
9
 
9
10
  module TestExtensions
10
11
  def server(host, options={})
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.3
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-25 00:00:00.000000000 Z
12
+ date: 2013-04-29 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: highline