mirror of
https://github.com/capistrano/capistrano
synced 2023-03-27 23:21:18 -04:00
parent
a4db00e77e
commit
51d5d1ecd9
3 changed files with 13 additions and 0 deletions
|
@ -34,6 +34,10 @@ module Capistrano
|
|||
end
|
||||
|
||||
def role(name, hosts, options={})
|
||||
if name == :all
|
||||
raise ArgumentError.new("#{name} reserved name for role. Please choose another name")
|
||||
end
|
||||
|
||||
servers.add_role(name, hosts, options)
|
||||
end
|
||||
|
||||
|
|
|
@ -5,6 +5,7 @@ set :stage, :<%= stage %>
|
|||
# Supports bulk-adding hosts to roles, the primary
|
||||
# server in each group is considered to be the first
|
||||
# unless any hosts have the primary property set.
|
||||
# Don't declare `role :all`, it's a meta role
|
||||
role :app, %w{deploy@example.com}
|
||||
role :web, %w{deploy@example.com}
|
||||
role :db, %w{deploy@example.com}
|
||||
|
|
|
@ -70,6 +70,14 @@ describe Capistrano::DSL do
|
|||
|
||||
end
|
||||
|
||||
describe 'when defining role with reserved name' do
|
||||
it 'fails with ArgumentError' do
|
||||
expect {
|
||||
dsl.role :all, %w{example1.com}
|
||||
}.to raise_error(ArgumentError, "all reserved name for role. Please choose another name")
|
||||
end
|
||||
end
|
||||
|
||||
describe 'when defining hosts using the `role` syntax' do
|
||||
before do
|
||||
dsl.role :web, %w{example1.com example2.com example3.com}
|
||||
|
|
Loading…
Reference in a new issue