mirror of
https://github.com/capistrano/capistrano
synced 2023-03-27 23:21:18 -04:00
parent
0d7d950e61
commit
682ed3b2d0
4 changed files with 11 additions and 4 deletions
|
@ -41,7 +41,7 @@ module Capistrano
|
||||||
end
|
end
|
||||||
|
|
||||||
def fetch_roles(names, options)
|
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)
|
filter(servers, options)
|
||||||
else
|
else
|
||||||
role_servers = Array(names).flat_map { |name| fetch name }.uniq
|
role_servers = Array(names).flat_map { |name| fetch name }.uniq
|
||||||
|
@ -70,7 +70,7 @@ module Capistrano
|
||||||
if servers_with_filter.any?
|
if servers_with_filter.any?
|
||||||
servers_with_filter
|
servers_with_filter
|
||||||
else
|
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
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,7 @@ en = {
|
||||||
mirror_exists: "The repository mirror is at %{at}",
|
mirror_exists: "The repository mirror is at %{at}",
|
||||||
revision_log_message: 'Branch %{branch} deployed as release %{release} by %{user}',
|
revision_log_message: 'Branch %{branch} deployed as release %{release} by %{user}',
|
||||||
rollback_log_message: '%{user} rolled back to release %{release}',
|
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: {
|
console: {
|
||||||
welcome: 'capistrano console - enter command to execute on %{stage}',
|
welcome: 'capistrano console - enter command to execute on %{stage}',
|
||||||
bye: 'bye'
|
bye: 'bye'
|
||||||
|
|
|
@ -59,7 +59,7 @@ namespace :deploy do
|
||||||
namespace :symlink do
|
namespace :symlink do
|
||||||
desc 'Symlink release to current'
|
desc 'Symlink release to current'
|
||||||
task :release do
|
task :release do
|
||||||
on roles([:web, :app]) do
|
on roles(:web, :app) do
|
||||||
execute :rm, '-rf', current_path
|
execute :rm, '-rf', current_path
|
||||||
execute :ln, '-s', release_path, current_path
|
execute :ln, '-s', release_path, current_path
|
||||||
end
|
end
|
||||||
|
|
|
@ -21,6 +21,13 @@ describe Capistrano::DSL do
|
||||||
end
|
end
|
||||||
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
|
describe 'fetching servers by role' do
|
||||||
subject { dsl.roles(:app) }
|
subject { dsl.roles(:app) }
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue