diff options
author | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2019-01-14 14:22:13 +0100 |
---|---|---|
committer | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2019-01-14 14:22:13 +0100 |
commit | 8b185467e4e9d1ef09143964b8a0f5fada2852f3 (patch) | |
tree | 8d2f6e9068f7cafed789c91ddb02661939eb3274 /lib/gitlab/config | |
parent | 3e9c9f97273efab6b623966597242811f8896024 (diff) | |
download | gitlab-ce-8b185467e4e9d1ef09143964b8a0f5fada2852f3.tar.gz |
Refactor only/except configuration policies
This commit refactors only/except policies so that these policies could
be self-contained. This also adds some changes to YAML configuration
library to provide more context to default entry value fabrication
process.
Diffstat (limited to 'lib/gitlab/config')
-rw-r--r-- | lib/gitlab/config/entry/factory.rb | 4 | ||||
-rw-r--r-- | lib/gitlab/config/entry/node.rb | 2 | ||||
-rw-r--r-- | lib/gitlab/config/entry/simplifiable.rb | 5 |
3 files changed, 7 insertions, 4 deletions
diff --git a/lib/gitlab/config/entry/factory.rb b/lib/gitlab/config/entry/factory.rb index 30d43c9f9a1..39edfa332b4 100644 --- a/lib/gitlab/config/entry/factory.rb +++ b/lib/gitlab/config/entry/factory.rb @@ -53,10 +53,10 @@ module Gitlab # If entry has a default value we fabricate concrete node # with default value. # - if @entry.default.nil? + if @entry.default(@attributes).nil? fabricate(Entry::Undefined) else - fabricate(@entry, @entry.default) + fabricate(@entry, @entry.default(@attributes)) end end diff --git a/lib/gitlab/config/entry/node.rb b/lib/gitlab/config/entry/node.rb index 30357b2c95b..fe05158a73c 100644 --- a/lib/gitlab/config/entry/node.rb +++ b/lib/gitlab/config/entry/node.rb @@ -85,7 +85,7 @@ module Gitlab "#<#{self.class.name} #{unspecified}{#{key}: #{val.inspect}}>" end - def self.default + def self.default(**) end def self.aspects diff --git a/lib/gitlab/config/entry/simplifiable.rb b/lib/gitlab/config/entry/simplifiable.rb index 3e148fe2e91..213a7c35f4b 100644 --- a/lib/gitlab/config/entry/simplifiable.rb +++ b/lib/gitlab/config/entry/simplifiable.rb @@ -17,7 +17,7 @@ module Gitlab entry = self.class.entry_class(strategy) - super(entry.new(config, metadata)) + super(@subject = entry.new(config, metadata)) end def self.strategy(name, **opts) @@ -37,6 +37,9 @@ module Gitlab self::UnknownStrategy end end + + def self.default(**) + end end end end |