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

Fix #542. Also revert issues introduced in c18029e.

This commit is contained in:
Lee Hambley 2013-07-05 16:21:53 +02:00
parent 0d7d950e61
commit 682ed3b2d0
4 changed files with 11 additions and 4 deletions

View file

@ -41,7 +41,7 @@ module Capistrano
end
def fetch_roles(names, options)
if Array(names).map(&:to_sym).include?(:all)
if Array(names).flatten.map(&:to_sym).include?(:all)
filter(servers, options)
else
role_servers = Array(names).flat_map { |name| fetch name }.uniq
@ -70,7 +70,7 @@ module Capistrano
if servers_with_filter.any?
servers_with_filter
else
fail I18n.t(:filter_removes_all_servers, scope: :capistrano, filter: key )
fail I18n.t(:filter_removes_all_servers, scope: :capistrano, filter: key || '(no filter)' )
end
end

View file

@ -18,7 +18,7 @@ en = {
mirror_exists: "The repository mirror is at %{at}",
revision_log_message: 'Branch %{branch} deployed as release %{release} by %{user}',
rollback_log_message: '%{user} rolled back to release %{release}',
filter_removes_all_servers: 'Your filter `:%{filter}` would remove all matching servers',
filter_removes_all_servers: 'Your filter `%{filter}` would remove all matching servers',
console: {
welcome: 'capistrano console - enter command to execute on %{stage}',
bye: 'bye'

View file

@ -59,7 +59,7 @@ namespace :deploy do
namespace :symlink do
desc 'Symlink release to current'
task :release do
on roles([:web, :app]) do
on roles(:web, :app) do
execute :rm, '-rf', current_path
execute :ln, '-s', release_path, current_path
end

View file

@ -21,6 +21,13 @@ describe Capistrano::DSL do
end
end
describe 'fetching servers by multiple roles' do
it "does not confuse the last role with options" do
expect(dsl.roles(:app, :web).count).to eq 4
expect(dsl.roles(:app, :web, filter: :active).count).to eq 2
end
end
describe 'fetching servers by role' do
subject { dsl.roles(:app) }