capistrano 2.5.19 → 2.5.20

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 2.5.19
1
+ 2.5.20
data/bin/capify CHANGED
@@ -38,7 +38,7 @@ end
38
38
  files = {
39
39
  "Capfile" => unindent(<<-FILE),
40
40
  load 'deploy' if respond_to?(:namespace) # cap2 differentiator
41
- Dir['vendor/plugins/*/recipes/*.rb'].each { |plugin| load(plugin) }
41
+ Dir['vendor/gems/*/recipes/*.rb','vendor/plugins/*/recipes/*.rb'].each { |plugin| load(plugin) }
42
42
 
43
43
  load 'config/deploy' # remove this line to skip loading any of the default tasks
44
44
  FILE
@@ -54,10 +54,10 @@ role :app, "your app-server here" # This may be the sam
54
54
  role :db, "your primary db-server here", :primary => true # This is where Rails migrations will run
55
55
  role :db, "your slave db-server here"
56
56
 
57
- # If you are using Passenger mod_rails uncomment this:
58
- # if you\'re still using the script/reapear helper you will need
57
+ # if you\'re still using the script/reaper helper you will need
59
58
  # these http://github.com/rails/irs_process_scripts
60
59
 
60
+ # If you are using Passenger mod_rails uncomment this:
61
61
  # namespace :deploy do
62
62
  # task :start do ; end
63
63
  # task :stop do ; end
@@ -1,3 +1,4 @@
1
+ require 'benchmark'
1
2
  require 'capistrano/errors'
2
3
  require 'capistrano/processable'
3
4
 
@@ -159,11 +160,13 @@ module Capistrano
159
160
  # fails (non-zero return code) on any of the hosts, this will raise a
160
161
  # Capistrano::CommandError.
161
162
  def process!
162
- loop do
163
- break unless process_iteration { @channels.any? { |ch| !ch[:closed] } }
163
+ elapsed = Benchmark.realtime do
164
+ loop do
165
+ break unless process_iteration { @channels.any? { |ch| !ch[:closed] } }
166
+ end
164
167
  end
165
168
 
166
- logger.trace "command finished" if logger
169
+ logger.trace "command finished in #{(elapsed * 1000).round}ms" if logger
167
170
 
168
171
  if (failed = @channels.select { |ch| ch[:status] != 0 }).any?
169
172
  commands = failed.inject({}) { |map, ch| (map[ch[:command]] ||= []) << ch[:server]; map }
@@ -1,3 +1,4 @@
1
+ require 'benchmark'
1
2
  require 'yaml'
2
3
  require 'capistrano/recipes/deploy/scm'
3
4
  require 'capistrano/recipes/deploy/strategy'
@@ -27,6 +28,9 @@ _cset :deploy_via, :checkout
27
28
  _cset(:deploy_to) { "/u/apps/#{application}" }
28
29
  _cset(:revision) { source.head }
29
30
 
31
+ # Maintenance base filename
32
+ _cset :maintenance_basename, "maintenance"
33
+
30
34
  # =========================================================================
31
35
  # These variables should NOT be changed unless you are very confident in
32
36
  # what you are doing. Make sure you understand all the implications of your
@@ -51,13 +55,13 @@ _cset(:shared_path) { File.join(deploy_to, shared_dir) }
51
55
  _cset(:current_path) { File.join(deploy_to, current_dir) }
52
56
  _cset(:release_path) { File.join(releases_path, release_name) }
53
57
 
54
- _cset(:releases) { capture("ls -x #{releases_path}").split.sort }
58
+ _cset(:releases) { capture("ls -x #{releases_path}", :except => { :no_release => true }).split.sort }
55
59
  _cset(:current_release) { File.join(releases_path, releases.last) }
56
60
  _cset(:previous_release) { releases.length > 1 ? File.join(releases_path, releases[-2]) : nil }
57
61
 
58
- _cset(:current_revision) { capture("cat #{current_path}/REVISION").chomp }
59
- _cset(:latest_revision) { capture("cat #{current_release}/REVISION").chomp }
60
- _cset(:previous_revision) { capture("cat #{previous_release}/REVISION").chomp }
62
+ _cset(:current_revision) { capture("cat #{current_path}/REVISION", :except => { :no_release => true }).chomp }
63
+ _cset(:latest_revision) { capture("cat #{current_release}/REVISION", :except => { :no_release => true }).chomp }
64
+ _cset(:previous_revision) { capture("cat #{previous_release}/REVISION", :except => { :no_release => true }).chomp if previous_release }
61
65
 
62
66
  _cset(:run_method) { fetch(:use_sudo, true) ? :sudo : :run }
63
67
 
@@ -95,10 +99,14 @@ end
95
99
  # returns the command output as a string
96
100
  def run_locally(cmd)
97
101
  logger.trace "executing locally: #{cmd.inspect}" if logger
98
- output_on_stdout = `#{cmd}`
102
+ output_on_stdout = nil
103
+ elapsed = Benchmark.realtime do
104
+ output_on_stdout = `#{cmd}`
105
+ end
99
106
  if $?.to_i > 0 # $? is command exit code (posix style)
100
107
  raise Capistrano::LocalArgumentError, "Command #{cmd} returned status code #{$?}"
101
108
  end
109
+ logger.trace "command finished in #{(elapsed * 1000).round}ms" if logger
102
110
  output_on_stdout
103
111
  end
104
112
 
@@ -224,7 +232,8 @@ namespace :deploy do
224
232
  public/stylesheets, and public/javascripts so that the times are \
225
233
  consistent (so that asset timestamping works). This touch process \
226
234
  is only carried out if the :normalize_asset_timestamps variable is \
227
- set to true, which is the default.
235
+ set to true, which is the default The asset directories can be overridden \
236
+ using the :public_children variable.
228
237
  DESC
229
238
  task :finalize_update, :except => { :no_release => true } do
230
239
  run "chmod -R g+w #{latest_release}" if fetch(:group_writable, true)
@@ -242,7 +251,7 @@ namespace :deploy do
242
251
 
243
252
  if fetch(:normalize_asset_timestamps, true)
244
253
  stamp = Time.now.utc.strftime("%Y%m%d%H%M.%S")
245
- asset_paths = %w(images stylesheets javascripts).map { |p| "#{latest_release}/public/#{p}" }.join(" ")
254
+ asset_paths = fetch(:public_children, %w(images stylesheets javascripts)).map { |p| "#{latest_release}/public/#{p}" }.join(" ")
246
255
  run "find #{asset_paths} -exec touch -t #{stamp} {} ';'; true", :env => { "TZ" => "UTC" }
247
256
  end
248
257
  end
@@ -382,11 +391,10 @@ namespace :deploy do
382
391
 
383
392
  directory = case migrate_target.to_sym
384
393
  when :current then current_path
385
- when :latest then current_release
394
+ when :latest then latest_release
386
395
  else raise ArgumentError, "unknown migration target #{migrate_target.inspect}"
387
396
  end
388
397
 
389
- puts "#{migrate_target} => #{directory}"
390
398
  run "cd #{directory}; #{rake} RAILS_ENV=#{rails_env} #{migrate_env} db:migrate"
391
399
  end
392
400
 
@@ -536,7 +544,7 @@ namespace :deploy do
536
544
  namespace :web do
537
545
  desc <<-DESC
538
546
  Present a maintenance page to visitors. Disables your application's web \
539
- interface by writing a "maintenance.html" file to each web server. The \
547
+ interface by writing a "#{maintenance_basename}.html" file to each web server. The \
540
548
  servers must be configured to detect the presence of this file, and if \
541
549
  it is present, always display it instead of performing the request.
542
550
 
@@ -552,18 +560,18 @@ namespace :deploy do
552
560
  DESC
553
561
  task :disable, :roles => :web, :except => { :no_release => true } do
554
562
  require 'erb'
555
- on_rollback { run "rm #{shared_path}/system/maintenance.html" }
563
+ on_rollback { run "rm #{shared_path}/system/#{maintenance_basename}.html" }
556
564
 
557
565
  warn <<-EOHTACCESS
558
-
566
+
559
567
  # Please add something like this to your site's htaccess to redirect users to the maintenance page.
560
568
  # More Info: http://www.shiftcommathree.com/articles/make-your-rails-maintenance-page-respond-with-a-503
561
-
562
- ErrorDocument 503 /system/maintenance.html
569
+
570
+ ErrorDocument 503 /system/#{maintenance_basename}.html
563
571
  RewriteEngine On
564
572
  RewriteCond %{REQUEST_URI} !\.(css|gif|jpg|png)$
565
- RewriteCond %{DOCUMENT_ROOT}/system/maintenance.html -f
566
- RewriteCond %{SCRIPT_FILENAME} !maintenance.html
573
+ RewriteCond %{DOCUMENT_ROOT}/system/#{maintenance_basename}.html -f
574
+ RewriteCond %{SCRIPT_FILENAME} !#{maintenance_basename}.html
567
575
  RewriteRule ^.*$ - [redirect=503,last]
568
576
  EOHTACCESS
569
577
 
@@ -573,17 +581,17 @@ namespace :deploy do
573
581
  template = File.read(File.join(File.dirname(__FILE__), "templates", "maintenance.rhtml"))
574
582
  result = ERB.new(template).result(binding)
575
583
 
576
- put result, "#{shared_path}/system/maintenance.html", :mode => 0644
584
+ put result, "#{shared_path}/system/#{maintenance_basename}.html", :mode => 0644
577
585
  end
578
586
 
579
587
  desc <<-DESC
580
588
  Makes the application web-accessible again. Removes the \
581
- "maintenance.html" page generated by deploy:web:disable, which (if your \
589
+ "#{maintenance_basename}.html" page generated by deploy:web:disable, which (if your \
582
590
  web servers are configured correctly) will make your application \
583
591
  web-accessible again.
584
592
  DESC
585
593
  task :enable, :roles => :web, :except => { :no_release => true } do
586
- run "rm #{shared_path}/system/maintenance.html"
594
+ run "rm #{shared_path}/system/#{maintenance_basename}.html"
587
595
  end
588
596
  end
589
597
  end
@@ -43,6 +43,12 @@ module Capistrano
43
43
  self
44
44
  end
45
45
 
46
+ def deb(name, version, options={})
47
+ @message ||= "package `#{name}' #{version} could not be found"
48
+ try("dpkg -s #{name} | grep '^Version: #{version}'", options)
49
+ self
50
+ end
51
+
46
52
  def match(command, expect, options={})
47
53
  expect = Regexp.new(Regexp.escape(expect.to_s)) unless expect.is_a?(Regexp)
48
54
 
@@ -69,7 +69,8 @@ module Capistrano
69
69
  def query_revision(revision)
70
70
  return revision if revision_type(revision) == :date
71
71
  revision = yield(scm(cvs_root, :log, "-r#{revision}")).
72
- grep(/^date:/).
72
+ split("\n").
73
+ select { |line| line =~ /^date:/ }.
73
74
  map { |line| line[/^date: (.*?);/, 1] }.
74
75
  sort.last + " UTC"
75
76
  return revision
@@ -152,7 +152,7 @@ module Capistrano
152
152
  if variable(:git_enable_submodules)
153
153
  execute << "#{git} submodule #{verbose} init"
154
154
  execute << "#{git} submodule #{verbose} sync"
155
- execute << "#{git} submodule #{verbose} update"
155
+ execute << "#{git} submodule #{verbose} update --recursive"
156
156
  end
157
157
 
158
158
  execute.join(" && ")
@@ -52,7 +52,7 @@ module Capistrano
52
52
  # executed (svn info), and will extract the revision from the response.
53
53
  def query_revision(revision)
54
54
  return revision if revision =~ /^\d+$/
55
- command = scm(:info, repository, authentication, "-r#{revision}")
55
+ command = scm(:info, arguments, repository, authentication, "-r#{revision}")
56
56
  result = yield(command)
57
57
  yaml = YAML.load(result)
58
58
  raise "tried to run `#{command}' and got unexpected result #{result.inspect}" unless Hash === yaml
@@ -1,3 +1,4 @@
1
+ require 'benchmark'
1
2
  require 'capistrano/recipes/deploy/dependencies'
2
3
 
3
4
  module Capistrano
@@ -49,16 +50,24 @@ module Capistrano
49
50
  # A wrapper for Kernel#system that logs the command being executed.
50
51
  def system(*args)
51
52
  cmd = args.join(' ')
53
+ result = nil
52
54
  if RUBY_PLATFORM =~ /win32/
53
55
  cmd = cmd.split(/\s+/).collect {|w| w.match(/^[\w+]+:\/\//) ? w : w.gsub('/', '\\') }.join(' ') # Split command by spaces, change / by \\ unless element is a some+thing://
54
56
  cmd.gsub!(/^cd /,'cd /D ') # Replace cd with cd /D
55
57
  cmd.gsub!(/&& cd /,'&& cd /D ') # Replace cd with cd /D
56
58
  logger.trace "executing locally: #{cmd}"
57
- super(cmd)
59
+ elapsed = Benchmark.realtime do
60
+ result = super(cmd)
61
+ end
58
62
  else
59
63
  logger.trace "executing locally: #{cmd}"
60
- super
64
+ elapsed = Benchmark.realtime do
65
+ result = super
66
+ end
61
67
  end
68
+
69
+ logger.trace "command finished in #{(elapsed * 1000).round}ms"
70
+ result
62
71
  end
63
72
 
64
73
  private
@@ -86,7 +86,7 @@ module Capistrano
86
86
  if copy_exclude.any?
87
87
  logger.debug "processing exclusions..."
88
88
  if copy_exclude.any?
89
- copy_exclude.each do |pattern|
89
+ copy_exclude.each do |pattern|
90
90
  delete_list = Dir.glob(File.join(destination, pattern), File::FNM_DOTMATCH)
91
91
  # avoid the /.. trap that deletes the parent directories
92
92
  delete_list.delete_if { |dir| dir =~ /\/\.\.$/ }
@@ -101,8 +101,7 @@ module Capistrano
101
101
  logger.trace "compressing #{destination} to #{filename}"
102
102
  Dir.chdir(tmpdir) { system(compress(File.basename(destination), File.basename(filename)).join(" ")) }
103
103
 
104
- upload(filename, remote_filename)
105
- run "cd #{configuration[:releases_path]} && #{decompress(remote_filename).join(" ")} && rm #{remote_filename}"
104
+ distribute!
106
105
  ensure
107
106
  FileUtils.rm filename rescue nil
108
107
  FileUtils.rm_rf destination rescue nil
@@ -184,21 +183,21 @@ module Capistrano
184
183
  # Commands are arrays, where the first element is the utility to be
185
184
  # used to perform the compression or decompression.
186
185
  Compression = Struct.new(:extension, :compress_command, :decompress_command)
187
-
186
+
188
187
  # The compression method to use, defaults to :gzip.
189
188
  def compression
190
189
  remote_tar = configuration[:copy_remote_tar] || 'tar'
191
190
  local_tar = configuration[:copy_local_tar] || 'tar'
192
-
191
+
193
192
  type = configuration[:copy_compression] || :gzip
194
193
  case type
195
- when :gzip, :gz then Compression.new("tar.gz", [local_tar, 'czf'], [remote_tar, 'xzf'])
196
- when :bzip2, :bz2 then Compression.new("tar.bz2", [local_tar, 'cjf'], [remote_tar, 'xjf'])
194
+ when :gzip, :gz then Compression.new("tar.gz", [local_tar, 'chzf'], [remote_tar, 'xzf'])
195
+ when :bzip2, :bz2 then Compression.new("tar.bz2", [local_tar, 'chjf'], [remote_tar, 'xjf'])
197
196
  when :zip then Compression.new("zip", %w(zip -qr), %w(unzip -q))
198
197
  else raise ArgumentError, "invalid compression type #{type.inspect}"
199
198
  end
200
199
  end
201
-
200
+
202
201
  # Returns the command necessary to compress the given directory
203
202
  # into the given file.
204
203
  def compress(directory, file)
@@ -211,6 +210,12 @@ module Capistrano
211
210
  def decompress(file)
212
211
  compression.decompress_command + [file]
213
212
  end
213
+
214
+ # Distributes the file to the remote servers
215
+ def distribute!
216
+ upload(filename, remote_filename)
217
+ run "cd #{configuration[:releases_path]} && #{decompress(remote_filename).join(" ")} && rm #{remote_filename}"
218
+ end
214
219
  end
215
220
 
216
221
  end
@@ -18,6 +18,7 @@ module Capistrano
18
18
 
19
19
  def check!
20
20
  super.check do |d|
21
+ d.remote.command("rsync") unless copy_exclude.empty?
21
22
  d.remote.writable(shared_path)
22
23
  end
23
24
  end
@@ -37,6 +37,12 @@ class RemoteDependencyTest < Test::Unit::TestCase
37
37
  assert_equal "gem `capistrano' 9.9 could not be found (host)", @dependency.message
38
38
  end
39
39
 
40
+ def test_should_use_standard_error_message_for_deb
41
+ setup_for_a_configuration_deb_run("dpkg", "1.15", false)
42
+ @dependency.deb("dpkg", "1.15")
43
+ assert_equal "package `dpkg' 1.15 could not be found (host)", @dependency.message
44
+ end
45
+
40
46
  def test_should_fail_if_directory_not_found
41
47
  setup_for_a_configuration_run("test -d /data", false)
42
48
  assert !@dependency.directory("/data").pass?
@@ -52,7 +58,7 @@ class RemoteDependencyTest < Test::Unit::TestCase
52
58
  assert !@dependency.file("/data/foo.txt").pass?
53
59
  end
54
60
 
55
- def test_should_pas_if_file_found
61
+ def test_should_pass_if_file_found
56
62
  setup_for_a_configuration_run("test -f /data/foo.txt", true)
57
63
  assert @dependency.file("/data/foo.txt").pass?
58
64
  end
@@ -87,6 +93,16 @@ class RemoteDependencyTest < Test::Unit::TestCase
87
93
  assert @dependency.gem("capistrano", 9.9).pass?
88
94
  end
89
95
 
96
+ def test_should_pass_if_deb_found
97
+ setup_for_a_configuration_deb_run("dpkg", "1.15", true)
98
+ assert @dependency.deb("dpkg", "1.15").pass?
99
+ end
100
+
101
+ def test_should_fail_if_deb_not_found
102
+ setup_for_a_configuration_deb_run("dpkg", "1.15", false)
103
+ assert !@dependency.deb("dpkg", "1.15").pass?
104
+ end
105
+
90
106
  def test_should_use_alternative_message_if_provided
91
107
  setup_for_a_configuration_run("which cat", false)
92
108
  @dependency.command("cat").or("Sorry")
@@ -111,4 +127,9 @@ class RemoteDependencyTest < Test::Unit::TestCase
111
127
  find_gem_cmd = "gem specification --version '#{version}' #{name} 2>&1 | awk 'BEGIN { s = 0 } /^name:/ { s = 1; exit }; END { if(s == 0) exit 1 }'"
112
128
  setup_for_a_configuration_run(find_gem_cmd, passing)
113
129
  end
130
+
131
+ def setup_for_a_configuration_deb_run(name, version, passing)
132
+ find_deb_cmd = "dpkg -s #{name} | grep '^Version: #{version}'"
133
+ setup_for_a_configuration_run(find_deb_cmd, passing)
134
+ end
114
135
  end
@@ -40,7 +40,7 @@ class DeploySCMGitTest < Test::Unit::TestCase
40
40
 
41
41
  # with submodules
42
42
  @config[:git_enable_submodules] = true
43
- assert_equal "#{git} clone -q git@somehost.com:project.git /var/www && cd /var/www && #{git} checkout -q -b deploy #{rev} && #{git} submodule -q init && #{git} submodule -q sync && #{git} submodule -q update", @source.checkout(rev, dest)
43
+ assert_equal "#{git} clone -q git@somehost.com:project.git /var/www && cd /var/www && #{git} checkout -q -b deploy #{rev} && #{git} submodule -q init && #{git} submodule -q sync && #{git} submodule -q update --recursive", @source.checkout(rev, dest)
44
44
  end
45
45
 
46
46
  def test_checkout_with_verbose_should_not_use_q_switch
@@ -138,7 +138,7 @@ class DeploySCMGitTest < Test::Unit::TestCase
138
138
  @config[:git_enable_submodules] = true
139
139
  dest = "/var/www"
140
140
  rev = 'c2d9e79'
141
- assert_equal "git clone -q -o username git@somehost.com:project.git /var/www && cd /var/www && git checkout -q -b deploy #{rev} && git submodule -q init && git submodule -q sync && git submodule -q update", @source.checkout(rev, dest)
141
+ assert_equal "git clone -q -o username git@somehost.com:project.git /var/www && cd /var/www && git checkout -q -b deploy #{rev} && git submodule -q init && git submodule -q sync && git submodule -q update --recursive", @source.checkout(rev, dest)
142
142
  end
143
143
 
144
144
  # Tests from base_test.rb, makin' sure we didn't break anything up there!
@@ -14,16 +14,16 @@ class DeployStrategyCopyTest < Test::Unit::TestCase
14
14
  @config.stubs(:source).returns(@source)
15
15
  @strategy = Capistrano::Deploy::Strategy::Copy.new(@config)
16
16
  end
17
-
17
+
18
18
  def test_deploy_with_defaults_should_use_remote_gtar
19
19
  @config[:copy_remote_tar] = 'gtar'
20
-
20
+
21
21
  Dir.expects(:tmpdir).returns("/temp/dir")
22
22
  @source.expects(:checkout).with("154", "/temp/dir/1234567890").returns(:local_checkout)
23
23
  @strategy.expects(:system).with(:local_checkout)
24
24
 
25
25
  Dir.expects(:chdir).with("/temp/dir").yields
26
- @strategy.expects(:system).with("tar czf 1234567890.tar.gz 1234567890")
26
+ @strategy.expects(:system).with("tar chzf 1234567890.tar.gz 1234567890")
27
27
  @strategy.expects(:upload).with("/temp/dir/1234567890.tar.gz", "/tmp/1234567890.tar.gz")
28
28
  @strategy.expects(:run).with("cd /u/apps/test/releases && gtar xzf /tmp/1234567890.tar.gz && rm /tmp/1234567890.tar.gz")
29
29
 
@@ -33,19 +33,19 @@ class DeployStrategyCopyTest < Test::Unit::TestCase
33
33
 
34
34
  FileUtils.expects(:rm).with("/temp/dir/1234567890.tar.gz")
35
35
  FileUtils.expects(:rm_rf).with("/temp/dir/1234567890")
36
-
36
+
37
37
  @strategy.deploy!
38
38
  end
39
-
39
+
40
40
  def test_deploy_with_defaults_should_use_local_gtar
41
41
  @config[:copy_local_tar] = 'gtar'
42
-
42
+
43
43
  Dir.expects(:tmpdir).returns("/temp/dir")
44
44
  @source.expects(:checkout).with("154", "/temp/dir/1234567890").returns(:local_checkout)
45
45
  @strategy.expects(:system).with(:local_checkout)
46
46
 
47
47
  Dir.expects(:chdir).with("/temp/dir").yields
48
- @strategy.expects(:system).with("gtar czf 1234567890.tar.gz 1234567890")
48
+ @strategy.expects(:system).with("gtar chzf 1234567890.tar.gz 1234567890")
49
49
  @strategy.expects(:upload).with("/temp/dir/1234567890.tar.gz", "/tmp/1234567890.tar.gz")
50
50
  @strategy.expects(:run).with("cd /u/apps/test/releases && tar xzf /tmp/1234567890.tar.gz && rm /tmp/1234567890.tar.gz")
51
51
 
@@ -55,9 +55,9 @@ class DeployStrategyCopyTest < Test::Unit::TestCase
55
55
 
56
56
  FileUtils.expects(:rm).with("/temp/dir/1234567890.tar.gz")
57
57
  FileUtils.expects(:rm_rf).with("/temp/dir/1234567890")
58
-
58
+
59
59
  @strategy.deploy!
60
- end
60
+ end
61
61
 
62
62
  def test_deploy_with_defaults_should_use_tar_gz_and_checkout
63
63
  Dir.expects(:tmpdir).returns("/temp/dir")
@@ -130,7 +130,7 @@ class DeployStrategyCopyTest < Test::Unit::TestCase
130
130
  @source.expects(:checkout).with("154", "/temp/dir/1234567890").returns(:local_checkout)
131
131
 
132
132
  @strategy.expects(:system).with(:local_checkout)
133
- @strategy.expects(:system).with("tar cjf 1234567890.tar.bz2 1234567890")
133
+ @strategy.expects(:system).with("tar chjf 1234567890.tar.bz2 1234567890")
134
134
  @strategy.expects(:upload).with("/temp/dir/1234567890.tar.bz2", "/tmp/1234567890.tar.bz2")
135
135
  @strategy.expects(:run).with("cd /u/apps/test/releases && tar xjf /tmp/1234567890.tar.bz2 && rm /tmp/1234567890.tar.bz2")
136
136
 
@@ -143,17 +143,17 @@ class DeployStrategyCopyTest < Test::Unit::TestCase
143
143
 
144
144
  @strategy.deploy!
145
145
  end
146
-
146
+
147
147
  def test_deploy_with_unknown_compression_type_should_error
148
148
  @config[:copy_compression] = :bogus
149
149
  Dir.expects(:tmpdir).returns("/temp/dir")
150
150
  @source.expects(:checkout).with("154", "/temp/dir/1234567890").returns(:local_checkout)
151
151
  @strategy.stubs(:system)
152
152
  File.stubs(:open)
153
-
153
+
154
154
  assert_raises(ArgumentError) { @strategy.deploy! }
155
155
  end
156
-
156
+
157
157
  def test_deploy_with_custom_copy_dir_should_use_that_as_tmpdir
158
158
  Dir.expects(:tmpdir).never
159
159
  Dir.expects(:chdir).with("/other/path").yields
@@ -161,7 +161,7 @@ class DeployStrategyCopyTest < Test::Unit::TestCase
161
161
  @source.expects(:checkout).with("154", "/other/path/1234567890").returns(:local_checkout)
162
162
 
163
163
  @strategy.expects(:system).with(:local_checkout)
164
- @strategy.expects(:system).with("tar czf 1234567890.tar.gz 1234567890")
164
+ @strategy.expects(:system).with("tar chzf 1234567890.tar.gz 1234567890")
165
165
  @strategy.expects(:upload).with("/other/path/1234567890.tar.gz", "/tmp/1234567890.tar.gz")
166
166
  @strategy.expects(:run).with("cd /u/apps/test/releases && tar xzf /tmp/1234567890.tar.gz && rm /tmp/1234567890.tar.gz")
167
167
 
@@ -182,7 +182,7 @@ class DeployStrategyCopyTest < Test::Unit::TestCase
182
182
  @source.expects(:checkout).returns(:local_checkout)
183
183
 
184
184
  @strategy.expects(:system).with(:local_checkout)
185
- @strategy.expects(:system).with("tar czf 1234567890.tar.gz 1234567890")
185
+ @strategy.expects(:system).with("tar chzf 1234567890.tar.gz 1234567890")
186
186
  @strategy.expects(:upload).with("/temp/dir/1234567890.tar.gz", "/somewhere/else/1234567890.tar.gz")
187
187
  @strategy.expects(:run).with("cd /u/apps/test/releases && tar xzf /somewhere/else/1234567890.tar.gz && rm /somewhere/else/1234567890.tar.gz")
188
188
 
@@ -288,7 +288,7 @@ class DeployStrategyCopyTest < Test::Unit::TestCase
288
288
 
289
289
  def prepare_standard_compress_and_copy!
290
290
  Dir.expects(:chdir).with("/temp/dir").yields
291
- @strategy.expects(:system).with("tar czf 1234567890.tar.gz 1234567890")
291
+ @strategy.expects(:system).with("tar chzf 1234567890.tar.gz 1234567890")
292
292
  @strategy.expects(:upload).with("/temp/dir/1234567890.tar.gz", "/tmp/1234567890.tar.gz")
293
293
  @strategy.expects(:run).with("cd /u/apps/test/releases && tar xzf /tmp/1234567890.tar.gz && rm /tmp/1234567890.tar.gz")
294
294