mirror of
https://github.com/capistrano/capistrano
synced 2023-03-27 23:21:18 -04:00
Allow introspection of configuration values.
Add a 'keys' method to capistrano/configuration. This method can be used to introspect on all currently set configuration keys to allow configuration dumps, for instance.
This commit is contained in:
parent
e47c7456f5
commit
863d860968
3 changed files with 20 additions and 0 deletions
|
@ -6,6 +6,9 @@ Reverse Chronological Order:
|
|||
|
||||
https://github.com/capistrano/capistrano/compare/v3.2.0...HEAD
|
||||
|
||||
* Minor changes:
|
||||
* Added `keys` method to Configuration to allow introspection of configuration options. (@juanibiapina)
|
||||
|
||||
## `3.2.0`
|
||||
|
||||
The changelog entries here are incomplete, because many authors choose not to
|
||||
|
|
|
@ -36,6 +36,10 @@ module Capistrano
|
|||
return value
|
||||
end
|
||||
|
||||
def keys
|
||||
config.keys
|
||||
end
|
||||
|
||||
def role(name, hosts, options={})
|
||||
if name == :all
|
||||
raise ArgumentError.new("#{name} reserved name for role. Please choose another name")
|
||||
|
|
|
@ -112,6 +112,19 @@ module Capistrano
|
|||
end
|
||||
end
|
||||
|
||||
describe 'keys' do
|
||||
subject { config.keys }
|
||||
|
||||
before do
|
||||
config.set(:key1, :value1)
|
||||
config.set(:key2, :value2)
|
||||
end
|
||||
|
||||
it 'returns all set keys' do
|
||||
expect(subject).to match_array [:key1, :key2]
|
||||
end
|
||||
end
|
||||
|
||||
describe 'deleting' do
|
||||
before do
|
||||
config.set(:key, :value)
|
||||
|
|
Loading…
Reference in a new issue