mirror of
https://github.com/capistrano/capistrano
synced 2023-03-27 23:21:18 -04:00
Added keys method to Server properties
When generating servers programmatically this provides a method of determining what properties have been added. Includes simple spec test
This commit is contained in:
parent
ff187476ff
commit
28d8cfdaa5
3 changed files with 11 additions and 0 deletions
|
@ -2,6 +2,12 @@
|
|||
|
||||
Reverse Chronological Order:
|
||||
|
||||
## master
|
||||
|
||||
* Minor changes:
|
||||
* Added `keys` method to Server properties to allow introspection of automatically added
|
||||
properties.
|
||||
|
||||
## `3.1.0`
|
||||
|
||||
Breaking changes:
|
||||
|
|
|
@ -86,6 +86,10 @@ module Capistrano
|
|||
@roles ||= Set.new
|
||||
end
|
||||
|
||||
def keys
|
||||
@properties.keys
|
||||
end
|
||||
|
||||
def method_missing(key, value=nil)
|
||||
if value
|
||||
set(lvalue(key), value)
|
||||
|
|
|
@ -104,6 +104,7 @@ module Capistrano
|
|||
expect(servers.roles_for([:app]).first.hostname).to eq '1'
|
||||
expect(servers.roles_for([:web]).first.hostname).to eq '1'
|
||||
expect(servers.roles_for([:all]).first.properties.test).to eq :value
|
||||
expect(servers.roles_for([:all]).first.properties.keys).to eq [:test]
|
||||
end
|
||||
|
||||
it 'can accept multiple servers with the same hostname but different ports or users' do
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue