mirror of
https://github.com/capistrano/capistrano
synced 2023-03-27 23:21:18 -04:00
Make previous_release return nil if there are no previous releases (closes #4959)
git-svn-id: http://svn.rubyonrails.org/rails/tools/capistrano@4565 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
This commit is contained in:
parent
ce047cbe2d
commit
61fc449867
3 changed files with 24 additions and 6 deletions
|
@ -1,5 +1,13 @@
|
||||||
*SVN*
|
*SVN*
|
||||||
|
|
||||||
|
* Make previous_release return nil if there are no previous releases (closes #4959) [bdabney@cavoksolutions.com]
|
||||||
|
|
||||||
|
* Uncache releases list after update_code is called so that newly released dir is included (closes #3766) [Jamis Buck]
|
||||||
|
|
||||||
|
* Allow the subversion scm to accept HTTPS certificates (closes #4792) [Jamis Buck]
|
||||||
|
|
||||||
|
* Make sure rollbacks occur within the scope of the task that triggered them [Jamis Buck]
|
||||||
|
|
||||||
* Fixed the default recipe to work with setups that haven't yet gone pids [DHH]
|
* Fixed the default recipe to work with setups that haven't yet gone pids [DHH]
|
||||||
|
|
||||||
* Symlink and setup for shared/pids to tmp/pids [DHH]
|
* Symlink and setup for shared/pids to tmp/pids [DHH]
|
||||||
|
|
|
@ -366,7 +366,7 @@ module Capistrano
|
||||||
|
|
||||||
# Returns the release immediately before the currently deployed one
|
# Returns the release immediately before the currently deployed one
|
||||||
def previous_release
|
def previous_release
|
||||||
release_path(releases[-2])
|
release_path(releases[-2]) if releases[-2]
|
||||||
end
|
end
|
||||||
|
|
||||||
# Invoke a set of tasks in a transaction. If any task fails (raises an
|
# Invoke a set of tasks in a transaction. If any task fails (raises an
|
||||||
|
|
|
@ -55,11 +55,16 @@ class ActorTest < Test::Unit::TestCase
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
class MockConfiguration
|
class MockConfiguration < Capistrano::Configuration
|
||||||
Role = Struct.new(:host, :options)
|
Role = Struct.new(:host, :options)
|
||||||
|
|
||||||
attr_accessor :gateway, :pretend
|
attr_accessor :gateway, :pretend
|
||||||
|
|
||||||
|
def initialize(*args)
|
||||||
|
super
|
||||||
|
@logger = Capistrano::Logger.new(:output => StringIO.new)
|
||||||
|
end
|
||||||
|
|
||||||
def delegated_method
|
def delegated_method
|
||||||
"result of method"
|
"result of method"
|
||||||
end
|
end
|
||||||
|
@ -78,10 +83,6 @@ class ActorTest < Test::Unit::TestCase
|
||||||
def roles
|
def roles
|
||||||
ROLES
|
ROLES
|
||||||
end
|
end
|
||||||
|
|
||||||
def logger
|
|
||||||
@logger ||= Capistrano::Logger.new(:output => StringIO.new)
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
module CustomExtension
|
module CustomExtension
|
||||||
|
@ -97,6 +98,15 @@ class ActorTest < Test::Unit::TestCase
|
||||||
ENV["HOSTS"] = nil
|
ENV["HOSTS"] = nil
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_previous_release_returns_nil_with_one_release
|
||||||
|
class << @actor
|
||||||
|
def releases
|
||||||
|
["1234567890"]
|
||||||
|
end
|
||||||
|
end
|
||||||
|
assert_equal @actor.previous_release, nil
|
||||||
|
end
|
||||||
|
|
||||||
def test_define_task_creates_method
|
def test_define_task_creates_method
|
||||||
@actor.define_task :hello do
|
@actor.define_task :hello do
|
||||||
"result"
|
"result"
|
||||||
|
|
Loading…
Reference in a new issue