mirror of
https://github.com/capistrano/capistrano
synced 2023-03-27 23:21:18 -04:00
Allow roles to be fetched with an array
For the case where the array may be stored in a variable, for example: set :my_roles, [:app, :web] on roles fetch(:my_roles) do # end This will allow https://github.com/capistrano/rails/pull/30 to be refactored
This commit is contained in:
parent
aa4902784c
commit
ac95f5147b
3 changed files with 18 additions and 1 deletions
|
@ -25,6 +25,7 @@ Reverse Chronological Order:
|
||||||
* Add command line option to control role filtering (@andytinycat)
|
* Add command line option to control role filtering (@andytinycat)
|
||||||
* Make use of recent changes in Rake to over-ride the application name (@shime)
|
* Make use of recent changes in Rake to over-ride the application name (@shime)
|
||||||
* Readme corrections (@nathanstitt)
|
* Readme corrections (@nathanstitt)
|
||||||
|
* Allow roles to be fetched with a variable containing an array (@seenmyfate)
|
||||||
|
|
||||||
## `3.0.1`
|
## `3.0.1`
|
||||||
|
|
||||||
|
|
|
@ -40,7 +40,7 @@ module Capistrano
|
||||||
end
|
end
|
||||||
|
|
||||||
def roles(*names)
|
def roles(*names)
|
||||||
env.roles_for(names)
|
env.roles_for(names.flatten)
|
||||||
end
|
end
|
||||||
|
|
||||||
def release_roles(*names)
|
def release_roles(*names)
|
||||||
|
|
|
@ -60,6 +60,14 @@ describe Capistrano::DSL do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
describe 'fetching servers by an array of roles' do
|
||||||
|
subject { dsl.roles([:app]) }
|
||||||
|
|
||||||
|
it 'returns the servers' do
|
||||||
|
expect(subject.map(&:hostname)).to eq %w{example3.com example4.com}
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
describe 'fetching filtered servers by role' do
|
describe 'fetching filtered servers by role' do
|
||||||
subject { dsl.roles(:app, filter: :active) }
|
subject { dsl.roles(:app, filter: :active) }
|
||||||
|
|
||||||
|
@ -148,6 +156,14 @@ describe Capistrano::DSL do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
describe 'fetching servers by an array of roles' do
|
||||||
|
subject { dsl.roles([:app]) }
|
||||||
|
|
||||||
|
it 'returns the servers' do
|
||||||
|
expect(subject.map(&:hostname)).to eq %w{example3.com example4.com}
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
describe 'fetching filtered servers by role' do
|
describe 'fetching filtered servers by role' do
|
||||||
subject { dsl.roles(:app, filter: :active) }
|
subject { dsl.roles(:app, filter: :active) }
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue