1
0
Fork 0
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:
Jamis Buck 2006-07-06 04:36:58 +00:00
parent ce047cbe2d
commit 61fc449867
3 changed files with 24 additions and 6 deletions

View file

@ -1,5 +1,13 @@
*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]
* Symlink and setup for shared/pids to tmp/pids [DHH]

View file

@ -366,7 +366,7 @@ module Capistrano
# Returns the release immediately before the currently deployed one
def previous_release
release_path(releases[-2])
release_path(releases[-2]) if releases[-2]
end
# Invoke a set of tasks in a transaction. If any task fails (raises an

View file

@ -55,11 +55,16 @@ class ActorTest < Test::Unit::TestCase
end
end
class MockConfiguration
class MockConfiguration < Capistrano::Configuration
Role = Struct.new(:host, :options)
attr_accessor :gateway, :pretend
def initialize(*args)
super
@logger = Capistrano::Logger.new(:output => StringIO.new)
end
def delegated_method
"result of method"
end
@ -78,10 +83,6 @@ class ActorTest < Test::Unit::TestCase
def roles
ROLES
end
def logger
@logger ||= Capistrano::Logger.new(:output => StringIO.new)
end
end
module CustomExtension
@ -97,6 +98,15 @@ class ActorTest < Test::Unit::TestCase
ENV["HOSTS"] = nil
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
@actor.define_task :hello do
"result"