1
0
Fork 0
mirror of https://github.com/capistrano/capistrano synced 2023-03-27 23:21:18 -04:00

Cleaning up the repository preparing for the move to GemCutter, and implementing #95 (Move to formally deprecate before_task and after_task callbacks)

This commit is contained in:
Lee Hambley 2009-11-03 21:27:58 +01:00
parent 203fe8ba60
commit 1c7acac6fe
7 changed files with 25 additions and 159 deletions

View file

@ -1,94 +0,0 @@
## Capistrano Release Notes - Version 2.5.9
Thank you to the community for their massive contribution to Capistrano 2.5.9. I am pleased to ship this release with no fewer than 9 incredibly important bug fixes from the community.
### Tickets Resolved In This Release
- #105 - Add skip_hostfilter option to find_servers()
- #103 - Using non-master branch fails with Ruby 1.9
- #96 - Tweak for 1.9 Compatibility
- #79 - Capistrano hangs on shell command for many computers
- #77 - Copy command doesn't work on Solaris due to tar/gtar
- #76 - Invalid Subversion URL
- #50 - Configuration Logger Options
### Other Improvements
- Improved web:disable task
#### Improvements Explained
##### #105 - Add skip_hostfilter option to find_servers()
Thanks to Eric, we can now ignore the HOSTFILTER environmental variable when calling find servers; consider the following:
role :app, 'app1.example.com', 'app2.example.com', 'app3.example.com'
task :test do
find_servers(:app)
end
You would correctly expect `find_servers()` to return all three servers; when using the host filter environmental variable you can restrict operations to certain hosts
cap HOSTFILTER=app2.example.com deploy
Which can be used to act on a single host, ignoring the others, in this instance `find_servers()` will only return `app2.example.com`; Eric's patch allows you to call `find_servers()` with an optional argument which will ensure that it ignores the HOSTFILTER, and returns everything listed for that role; here's the code:
find_servers(:app, :skip_hostfilter => true)
##### #103 - Using non-master branch fails with Ruby 1.9
Suraj Kurapati discovered that under Ruby 1.9 when setting your branch name like this:
set :branch, :some-branch-you-want-to-use
That there is a problem comparing the symbol provided against the string that the SCM module returns. This appears only to be a problem under Ruby 1.9, we have a cross-platform fix in the shape of a `.to_s` on the branch name where the comparison takes place.
The work around if you cannot upgrade to 2.5.9 is to specify the branch name as a string.
##### #96 - Tweak for 1.9 Compatibility
Here on [IsItRuby1.9](http://isitruby19.com/capistrano) we've had reports that Capistrano would work fine if we swapped a `retry` for a `redo`, there are [subtle differences](http://blog.commonthread.com/2007/12/15/tip-ruby-break-redo-next-and-retry) but we think it is acceptable to perform this way, and doesn't seem to cause any problems.
This bug would also have manifested under some circumstances for anyone capifying a new application with Ruby 1.9, this has also been fixed.
Regrettably without upgrading there is no workaround; save for rolling back to Ruby 1.8x.
##### #79 - Capistrano hangs on shell command for many computers
We apologise to anyone that has suffered at the hand of this bug; it really had us stumped, we were fortunate to meet Daniel Azuma who was working in isolation and came up with a fix, this has been applied to Net:SSH (see *Other News* for more info) and they have shipped a new release `2.0.14` which contains the fix. There are a selection of links with more info for those who're interested below, rest assured though that this is fixed.
If you do not want to upgrade Capistrano, **you can simply upgrade Net:SSH**, version `2.0.14` should be working now.
- [http://net-ssh.lighthouseapp.com/projects/36253/tickets/1-ioselect-threading-bug-in-ruby-18](http://net-ssh.lighthouseapp.com/projects/36253/tickets/1-ioselect-threading-bug-in-ruby-18)
##### #77 - Copy command doesn't work on Solaris due to tar/gtar
Solaris 10 by default has a gtar command that provides the normal tar functionality, and the tar command works slightly differently. Thanks to Jeremy we have a patch, if you are affected you can specify which command to use now using:
set :copy_local_tar, 'gtar'
set :copy_remote_tar, 'gtar'
These are then used by :copy_compression
If you want to workaround this issue in previous releases of Capistrano, you can try:
set :copy_compression, :zip
##### #76 - Invalid Subversion URL
Somewhere between 2.5.0 and 2.5.5 we think [this bug](https://capistrano.lighthouseapp.com/projects/8716-capistrano/tickets/76) related to paths for Subversion on Windows, and possibly others came to light. This has been patched and fixed in this release we hope; Thank you to David Mitchell and Rafa Garcia for the suggestion, and patch.
##### #50 - Configuration Logger Options
Now when calling `cap` on the command line, you should be able to send it a `--logger` (`-l`) option:
--logger [STDERR|STDOUT|file]
##### - Improved web:disable task
Now when calling web:disable you will see output for the code block to insert into your .htaccess, this should mean we don't need to worry about people being confused and forgetting to put this in!
### Other News
Net::SSH, the library upon which Capistrano is built is now being managed by Delano Mandelbaum, there is a bug tracker at [http://net-ssh.lighthouseapp.com/](http://net-ssh.lighthouseapp.com/) - for related issues, we still suggest using the Capistrano Google Groups mailing list; as many issues are cross-over and both communities can contribute; Delano is on the list, and

View file

@ -2,6 +2,7 @@
* Fixes Darcs remote repository problem when using the copy strategy [Alex `regularfry` Young]
* Documentation improvements for embedding Capistrano [Lee Hambley]
* Fixes ticket #95 -formally deprecating the before_something and after_something methods [Lee Hambley]
== 2.5.9 / 1 August 2009

View file

@ -1,47 +0,0 @@
# -*- encoding: utf-8 -*-
Gem::Specification.new do |s|
s.name = %q{capistrano}
s.version = "2.5.9"
s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
s.authors = ["Jamis Buck, Lee Hambley"]
s.date = %q{2009-10-08}
s.description = %q{Capistrano is a utility and framework for executing commands in parallel on multiple remote machines, via SSH.}
s.email = ["jamis@jamisbuck.org", "lee.hambley@gmail.com"]
s.executables = ["cap", "capify"]
s.extra_rdoc_files = ["CHANGELOG.rdoc", "lib/capistrano/callback.rb", "lib/capistrano/cli/execute.rb", "lib/capistrano/cli/help.rb", "lib/capistrano/cli/help.txt", "lib/capistrano/cli/options.rb", "lib/capistrano/cli/ui.rb", "lib/capistrano/cli.rb", "lib/capistrano/command.rb", "lib/capistrano/configuration/actions/file_transfer.rb", "lib/capistrano/configuration/actions/inspect.rb", "lib/capistrano/configuration/actions/invocation.rb", "lib/capistrano/configuration/callbacks.rb", "lib/capistrano/configuration/connections.rb", "lib/capistrano/configuration/execution.rb", "lib/capistrano/configuration/loading.rb", "lib/capistrano/configuration/namespaces.rb", "lib/capistrano/configuration/roles.rb", "lib/capistrano/configuration/servers.rb", "lib/capistrano/configuration/variables.rb", "lib/capistrano/configuration.rb", "lib/capistrano/errors.rb", "lib/capistrano/extensions.rb", "lib/capistrano/logger.rb", "lib/capistrano/processable.rb", "lib/capistrano/recipes/compat.rb", "lib/capistrano/recipes/deploy/dependencies.rb", "lib/capistrano/recipes/deploy/local_dependency.rb", "lib/capistrano/recipes/deploy/remote_dependency.rb", "lib/capistrano/recipes/deploy/scm/accurev.rb", "lib/capistrano/recipes/deploy/scm/base.rb", "lib/capistrano/recipes/deploy/scm/bzr.rb", "lib/capistrano/recipes/deploy/scm/cvs.rb", "lib/capistrano/recipes/deploy/scm/darcs.rb", "lib/capistrano/recipes/deploy/scm/git.rb", "lib/capistrano/recipes/deploy/scm/mercurial.rb", "lib/capistrano/recipes/deploy/scm/none.rb", "lib/capistrano/recipes/deploy/scm/perforce.rb", "lib/capistrano/recipes/deploy/scm/subversion.rb", "lib/capistrano/recipes/deploy/scm.rb", "lib/capistrano/recipes/deploy/strategy/base.rb", "lib/capistrano/recipes/deploy/strategy/checkout.rb", "lib/capistrano/recipes/deploy/strategy/copy.rb", "lib/capistrano/recipes/deploy/strategy/export.rb", "lib/capistrano/recipes/deploy/strategy/remote.rb", "lib/capistrano/recipes/deploy/strategy/remote_cache.rb", "lib/capistrano/recipes/deploy/strategy.rb", "lib/capistrano/recipes/deploy/templates/maintenance.rhtml", "lib/capistrano/recipes/deploy.rb", "lib/capistrano/recipes/standard.rb", "lib/capistrano/recipes/templates/maintenance.rhtml", "lib/capistrano/recipes/upgrade.rb", "lib/capistrano/role.rb", "lib/capistrano/server_definition.rb", "lib/capistrano/shell.rb", "lib/capistrano/ssh.rb", "lib/capistrano/task_definition.rb", "lib/capistrano/transfer.rb", "lib/capistrano/version.rb", "lib/capistrano.rb", "README.rdoc"]
s.files = ["bin/cap", "bin/capify", "CHANGELOG.rdoc", "examples/sample.rb", "lib/capistrano/callback.rb", "lib/capistrano/cli/execute.rb", "lib/capistrano/cli/help.rb", "lib/capistrano/cli/help.txt", "lib/capistrano/cli/options.rb", "lib/capistrano/cli/ui.rb", "lib/capistrano/cli.rb", "lib/capistrano/command.rb", "lib/capistrano/configuration/actions/file_transfer.rb", "lib/capistrano/configuration/actions/inspect.rb", "lib/capistrano/configuration/actions/invocation.rb", "lib/capistrano/configuration/callbacks.rb", "lib/capistrano/configuration/connections.rb", "lib/capistrano/configuration/execution.rb", "lib/capistrano/configuration/loading.rb", "lib/capistrano/configuration/namespaces.rb", "lib/capistrano/configuration/roles.rb", "lib/capistrano/configuration/servers.rb", "lib/capistrano/configuration/variables.rb", "lib/capistrano/configuration.rb", "lib/capistrano/errors.rb", "lib/capistrano/extensions.rb", "lib/capistrano/logger.rb", "lib/capistrano/processable.rb", "lib/capistrano/recipes/compat.rb", "lib/capistrano/recipes/deploy/dependencies.rb", "lib/capistrano/recipes/deploy/local_dependency.rb", "lib/capistrano/recipes/deploy/remote_dependency.rb", "lib/capistrano/recipes/deploy/scm/accurev.rb", "lib/capistrano/recipes/deploy/scm/base.rb", "lib/capistrano/recipes/deploy/scm/bzr.rb", "lib/capistrano/recipes/deploy/scm/cvs.rb", "lib/capistrano/recipes/deploy/scm/darcs.rb", "lib/capistrano/recipes/deploy/scm/git.rb", "lib/capistrano/recipes/deploy/scm/mercurial.rb", "lib/capistrano/recipes/deploy/scm/none.rb", "lib/capistrano/recipes/deploy/scm/perforce.rb", "lib/capistrano/recipes/deploy/scm/subversion.rb", "lib/capistrano/recipes/deploy/scm.rb", "lib/capistrano/recipes/deploy/strategy/base.rb", "lib/capistrano/recipes/deploy/strategy/checkout.rb", "lib/capistrano/recipes/deploy/strategy/copy.rb", "lib/capistrano/recipes/deploy/strategy/export.rb", "lib/capistrano/recipes/deploy/strategy/remote.rb", "lib/capistrano/recipes/deploy/strategy/remote_cache.rb", "lib/capistrano/recipes/deploy/strategy.rb", "lib/capistrano/recipes/deploy/templates/maintenance.rhtml", "lib/capistrano/recipes/deploy.rb", "lib/capistrano/recipes/standard.rb", "lib/capistrano/recipes/templates/maintenance.rhtml", "lib/capistrano/recipes/upgrade.rb", "lib/capistrano/role.rb", "lib/capistrano/server_definition.rb", "lib/capistrano/shell.rb", "lib/capistrano/ssh.rb", "lib/capistrano/task_definition.rb", "lib/capistrano/transfer.rb", "lib/capistrano/version.rb", "lib/capistrano.rb", "Rakefile", "README.rdoc", "setup.rb", "test/cli/execute_test.rb", "test/cli/help_test.rb", "test/cli/options_test.rb", "test/cli/ui_test.rb", "test/cli_test.rb", "test/command_test.rb", "test/configuration/actions/file_transfer_test.rb", "test/configuration/actions/inspect_test.rb", "test/configuration/actions/invocation_test.rb", "test/configuration/callbacks_test.rb", "test/configuration/connections_test.rb", "test/configuration/execution_test.rb", "test/configuration/loading_test.rb", "test/configuration/namespace_dsl_test.rb", "test/configuration/roles_test.rb", "test/configuration/servers_test.rb", "test/configuration/variables_test.rb", "test/configuration_test.rb", "test/deploy/local_dependency_test.rb", "test/deploy/remote_dependency_test.rb", "test/deploy/scm/accurev_test.rb", "test/deploy/scm/base_test.rb", "test/deploy/scm/git_test.rb", "test/deploy/scm/mercurial_test.rb", "test/deploy/strategy/copy_test.rb", "test/extensions_test.rb", "test/fixtures/cli_integration.rb", "test/fixtures/config.rb", "test/fixtures/custom.rb", "test/logger_test.rb", "test/role_test.rb", "test/server_definition_test.rb", "test/shell_test.rb", "test/ssh_test.rb", "test/task_definition_test.rb", "test/transfer_test.rb", "test/utils.rb", "Manifest", "capistrano.gemspec", "test/deploy/scm/none_test.rb", "test/deploy/scm/subversion_test.rb"]
s.homepage = %q{http://www.capify.org}
s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Capistrano", "--main", "README.rdoc"]
s.require_paths = ["lib"]
s.rubyforge_project = %q{capistrano}
s.rubygems_version = %q{1.3.4}
s.summary = %q{Capistrano is a utility and framework for executing commands in parallel on multiple remote machines, via SSH.}
s.test_files = ["test/cli/execute_test.rb", "test/cli/help_test.rb", "test/cli/options_test.rb", "test/cli/ui_test.rb", "test/cli_test.rb", "test/command_test.rb", "test/configuration/actions/file_transfer_test.rb", "test/configuration/actions/inspect_test.rb", "test/configuration/actions/invocation_test.rb", "test/configuration/callbacks_test.rb", "test/configuration/connections_test.rb", "test/configuration/execution_test.rb", "test/configuration/loading_test.rb", "test/configuration/namespace_dsl_test.rb", "test/configuration/roles_test.rb", "test/configuration/servers_test.rb", "test/configuration/variables_test.rb", "test/configuration_test.rb", "test/deploy/local_dependency_test.rb", "test/deploy/remote_dependency_test.rb", "test/deploy/scm/accurev_test.rb", "test/deploy/scm/base_test.rb", "test/deploy/scm/git_test.rb", "test/deploy/scm/mercurial_test.rb", "test/deploy/scm/none_test.rb", "test/deploy/scm/subversion_test.rb", "test/deploy/strategy/copy_test.rb", "test/extensions_test.rb", "test/logger_test.rb", "test/role_test.rb", "test/server_definition_test.rb", "test/shell_test.rb", "test/ssh_test.rb", "test/task_definition_test.rb", "test/transfer_test.rb"]
if s.respond_to? :specification_version then
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
s.specification_version = 3
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
s.add_runtime_dependency(%q<net-ssh>, [">= 2.0.14"])
s.add_runtime_dependency(%q<net-sftp>, [">= 2.0.0"])
s.add_runtime_dependency(%q<net-scp>, [">= 1.0.0"])
s.add_runtime_dependency(%q<net-ssh-gateway>, [">= 1.0.0"])
s.add_runtime_dependency(%q<highline>, [">= 0"])
else
s.add_dependency(%q<net-ssh>, [">= 2.0.14"])
s.add_dependency(%q<net-sftp>, [">= 2.0.0"])
s.add_dependency(%q<net-scp>, [">= 1.0.0"])
s.add_dependency(%q<net-ssh-gateway>, [">= 1.0.0"])
s.add_dependency(%q<highline>, [">= 0"])
end
else
s.add_dependency(%q<net-ssh>, [">= 2.0.14"])
s.add_dependency(%q<net-sftp>, [">= 2.0.0"])
s.add_dependency(%q<net-scp>, [">= 1.0.0"])
s.add_dependency(%q<net-ssh-gateway>, [">= 1.0.0"])
s.add_dependency(%q<highline>, [">= 0"])
end
end

View file

@ -1,14 +0,0 @@
# set :user, "flippy"
# set :password, "hello-flippy"
# set :gateway, "gateway.example.com"
role :web, "web1.example.com"
role :app, "app1.example.com", "app2.example.com"
desc <<-DESC
This is a sample task. It is only intended to be used as a demonstration of \
how you can define your own tasks.
DESC
task :sample_task, :roles => :app do
run "ls -l"
end

View file

@ -4,8 +4,13 @@ module Capistrano
# Represents the definition of a single task.
class TaskDefinition
attr_reader :name, :namespace, :options, :body, :desc, :on_error, :max_hosts
def initialize(name, namespace, options={}, &block)
if name.to_s =~ /^(?:before_|after_)/
Kernel.warn("[Deprecation Warning] Naming tasks with before_ and after_ is deprecated, please see the new before() and after() methods. (Offending task name was #{name})")
end
@name, @namespace, @options = name, namespace, options
@desc = @options.delete(:desc)
@on_error = options.delete(:on_error)
@ -24,7 +29,7 @@ module Capistrano
end
end
end
# Returns the description for this task, with newlines collapsed and
# whitespace stripped. Returns the empty string if there is no
# description for this task.
@ -32,7 +37,7 @@ module Capistrano
@description = nil if rebuild
@description ||= begin
description = @desc || ""
indentation = description[/\A\s+/]
if indentation
reformatted_description = ""

View file

@ -1,6 +1,9 @@
require "utils"
require 'capistrano/task_definition'
# Silences the wanrnings raised in the two deprecation tests
$VERBOSE = nil
class TaskDefinitionTest < Test::Unit::TestCase
def setup
@namespace = namespace
@ -22,6 +25,18 @@ class TaskDefinitionTest < Test::Unit::TestCase
assert_equal "default", task.fully_qualified_name
end
def test_deprecation_warning_on_method_name_beginning_with_before_underscore
name = "before_test"
Kernel.expects(:warn).with("[Deprecation Warning] Naming tasks with before_ and after_ is deprecated, please see the new before() and after() methods. (Offending task name was #{name})")
new_task(name)
end
def test_deprecation_warning_on_method_name_beginning_with_after_underscore
name = "after_test"
Kernel.expects(:warn).with("[Deprecation Warning] Naming tasks with before_ and after_ is deprecated, please see the new before() and after() methods. (Offending task name was #{name})")
new_task(name)
end
def test_fqn_in_namespace_when_default_should_be_namespace_fqn
ns = namespace("outer:inner")
task = new_task(:default, ns)

View file

@ -1,6 +1,6 @@
begin
require 'rubygems'
require 'redgreen'
require 'redgreen' unless ENV['TM_FILENAME']
gem 'mocha'
rescue LoadError
end