capistrano 2.5.10 → 2.5.11

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.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 2.5.10
1
+ 2.5.11
data/bin/capify CHANGED
@@ -59,8 +59,8 @@ role :db, "your slave db-server here"
59
59
  # these http://github.com/rails/irs_process_scripts
60
60
 
61
61
  # namespace :deploy do
62
- # task :start {}
63
- # task :stop {}
62
+ # task :start do ; end
63
+ # task :stop do ; end
64
64
  # task :restart, :roles => :app, :except => { :no_release => true } do
65
65
  # run "#{try_sudo} touch #{File.join(current_path,\'tmp\',\'restart.txt\')}"
66
66
  # end
@@ -1,2 +1,2 @@
1
1
  require 'capistrano/configuration'
2
- require 'capistrano/extensions'
2
+ require 'capistrano/extensions'
@@ -1,15 +1,19 @@
1
1
  module Capistrano
2
- class Error < RuntimeError; end
2
+
3
+ Error = Class.new(RuntimeError)
3
4
 
4
- class CaptureError < Error; end
5
- class NoSuchTaskError < Error; end
6
- class NoMatchingServersError < Error; end
5
+ CaptureError = Class.new(Capistrano::Error)
6
+ NoSuchTaskError = Class.new(Capistrano::Error)
7
+ NoMatchingServersError = Class.new(Capistrano::Error)
7
8
 
8
9
  class RemoteError < Error
9
10
  attr_accessor :hosts
10
11
  end
11
12
 
12
- class ConnectionError < RemoteError; end
13
- class TransferError < RemoteError; end
14
- class CommandError < RemoteError; end
13
+ ConnectionError = Class.new(Capistrano::RemoteError)
14
+ TransferError = Class.new(Capistrano::RemoteError)
15
+ CommandError = Class.new(Capistrano::RemoteError)
16
+
17
+ LocalArgumentError = Class.new(Capistrano::Error)
18
+
15
19
  end
@@ -1,5 +1,4 @@
1
1
  require 'yaml'
2
- require 'mkmf'
3
2
  require 'capistrano/recipes/deploy/scm'
4
3
  require 'capistrano/recipes/deploy/strategy'
5
4
 
@@ -39,6 +38,7 @@ _cset(:real_revision) { source.local.query_revision(revision) { |cmd| with_e
39
38
 
40
39
  _cset(:strategy) { Capistrano::Deploy::Strategy.new(deploy_via, self) }
41
40
 
41
+ # If overriding release name, please also select an appropriate setting for :releases below.
42
42
  _cset(:release_name) { set :deploy_timestamped, true; Time.now.utc.strftime("%Y%m%d%H%M%S") }
43
43
 
44
44
  _cset :version_dir, "releases"
@@ -51,7 +51,7 @@ _cset(:shared_path) { File.join(deploy_to, shared_dir) }
51
51
  _cset(:current_path) { File.join(deploy_to, current_dir) }
52
52
  _cset(:release_path) { File.join(releases_path, release_name) }
53
53
 
54
- _cset(:releases) { capture("ls -xt #{releases_path}").split.reverse }
54
+ _cset(:releases) { capture("ls -x #{releases_path}").split.reverse }
55
55
  _cset(:current_release) { File.join(releases_path, releases.last) }
56
56
  _cset(:previous_release) { releases.length > 1 ? File.join(releases_path, releases[-2]) : nil }
57
57
 
@@ -95,18 +95,14 @@ end
95
95
  # returns the command output as a string
96
96
  def run_locally(cmd)
97
97
  logger.trace "executing locally: #{cmd.inspect}" if logger
98
- command_present?(cmd)
99
- `#{cmd}`
100
- end
101
-
102
- # tests if the given command is present on the local system
103
- def command_present?(cmd)
104
- executable = cmd.to_s.split(" ").first
105
- unless find_executable(executable)
106
- logger.important "executable '#{executable}' not present or not in $PATH on the local system!"
98
+ output_on_stdout = `#{cmd}`
99
+ if $?.to_i > 0 # $? is command exit code (posix style)
100
+ raise Capistrano::LocalArgumentError, "Command #{cmd} returned status code #{$?}"
107
101
  end
102
+ output_on_stdout
108
103
  end
109
104
 
105
+
110
106
  # If a command is given, this will try to execute the given command, as
111
107
  # described below. Otherwise, it will return a string for use in embedding in
112
108
  # another command, for executing that command as described below.
@@ -59,7 +59,10 @@ module Capistrano
59
59
  # If the 'revision' argument, on the other hand, is not :head, it is
60
60
  # simply returned.
61
61
  def query_revision(revision)
62
- revision
62
+ return revision unless :head == revision
63
+
64
+ command = scm('revno', repository)
65
+ result = yield(command)
63
66
  end
64
67
 
65
68
  # Increments the given revision number and returns it.
@@ -0,0 +1,51 @@
1
+ require "utils"
2
+ require 'capistrano/recipes/deploy/scm/bzr'
3
+
4
+ class DeploySCMBzrTest < Test::Unit::TestCase
5
+ class TestSCM < Capistrano::Deploy::SCM::Bzr
6
+ default_command "bzr"
7
+ end
8
+
9
+ def setup
10
+ @config = { :repository => "." }
11
+
12
+ def @config.exists?(name); key?(name); end # is this actually needed?
13
+
14
+ @source = TestSCM.new(@config)
15
+ end
16
+
17
+ # The bzr scm does not support pseudo-ids. The bzr adapter uses symbol :head
18
+ # to refer to the recently committed revision.
19
+ def test_head_revision
20
+ assert_equal(:head,
21
+ @source.head,
22
+ "Since bzr doesn't know a real head revision, symbol :head is used instead.")
23
+ end
24
+
25
+ # The bzr scm does support many different ways to specify a revision. Only
26
+ # symbol :head triggers the bzr command 'revno'.
27
+ def test_query_revision
28
+ assert_equal("bzr revno #{@config[:repository]}",
29
+ @source.query_revision(:head) { |o| o },
30
+ "Query for :head revision should call bzr command 'revno' in repository directory.")
31
+
32
+ # Many valid revision specifications, some invalid on the last line
33
+ revision_samples = [ 5, -7, '2', '-4',
34
+ 'revid:revid:aaaa@bbbb-123456789',
35
+ 'submit:',
36
+ 'ancestor:/path/to/branch',
37
+ 'date:yesterday',
38
+ 'branch:/path/to/branch',
39
+ 'tag:trunk',
40
+ 'revno:3:/path/to/branch',
41
+ 'before:revid:aaaa@bbbb-1234567890',
42
+ 'last:3',
43
+ nil, {}, [], true, false, 1.34, ]
44
+
45
+ revision_samples.each do |revivsion_spec|
46
+ assert_equal(revivsion_spec,
47
+ @source.query_revision(revivsion_spec),
48
+ "Any revision specification other than symbol :head should simply by returned.")
49
+ end
50
+ end
51
+ end
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.5.10
4
+ version: 2.5.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jamis Buck
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2009-11-11 00:00:00 +01:00
13
+ date: 2009-12-29 00:00:00 +00:00
14
14
  default_executable:
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
@@ -175,6 +175,7 @@ files:
175
175
  - test/deploy/remote_dependency_test.rb
176
176
  - test/deploy/scm/accurev_test.rb
177
177
  - test/deploy/scm/base_test.rb
178
+ - test/deploy/scm/bzr_test.rb
178
179
  - test/deploy/scm/darcs_test.rb
179
180
  - test/deploy/scm/git_test.rb
180
181
  - test/deploy/scm/mercurial_test.rb
@@ -244,6 +245,7 @@ test_files:
244
245
  - test/deploy/remote_dependency_test.rb
245
246
  - test/deploy/scm/accurev_test.rb
246
247
  - test/deploy/scm/base_test.rb
248
+ - test/deploy/scm/bzr_test.rb
247
249
  - test/deploy/scm/darcs_test.rb
248
250
  - test/deploy/scm/git_test.rb
249
251
  - test/deploy/scm/mercurial_test.rb