summaryrefslogtreecommitdiff
path: root/lib/gitlab/config
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-03-04 12:07:52 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2020-03-04 12:07:52 +0000
commitc6c7437861bff9572747674095c4dfbdfbea4988 (patch)
tree237d1ed922193f19ae326923457344c082003788 /lib/gitlab/config
parentd80f3cd75e700b6e62910865bfd36734644ffa89 (diff)
downloadgitlab-ce-c6c7437861bff9572747674095c4dfbdfbea4988.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'lib/gitlab/config')
-rw-r--r--lib/gitlab/config/entry/configurable.rb12
1 files changed, 10 insertions, 2 deletions
diff --git a/lib/gitlab/config/entry/configurable.rb b/lib/gitlab/config/entry/configurable.rb
index 75e15cd8cb1..3fd562c2904 100644
--- a/lib/gitlab/config/entry/configurable.rb
+++ b/lib/gitlab/config/entry/configurable.rb
@@ -75,7 +75,8 @@ module Gitlab
# rubocop: disable CodeReuse/ActiveRecord
def entry(key, entry, description: nil, default: nil, inherit: nil, reserved: nil, metadata: {})
- raise ArgumentError, "Entry #{key} already defined" if @nodes.to_h[key.to_sym]
+ entry_name = key.to_sym
+ raise ArgumentError, "Entry #{key} already defined" if @nodes.to_h[entry_name]
factory = ::Gitlab::Config::Entry::Factory.new(entry)
.with(description: description)
@@ -84,10 +85,17 @@ module Gitlab
.with(reserved: reserved)
.metadata(metadata)
- (@nodes ||= {}).merge!(key.to_sym => factory)
+ @nodes ||= {}
+ @nodes[entry_name] = factory
+
+ helpers(entry_name)
end
# rubocop: enable CodeReuse/ActiveRecord
+ def dynamic_helpers(*nodes)
+ helpers(*nodes, dynamic: true)
+ end
+
def helpers(*nodes, dynamic: false)
nodes.each do |symbol|
if method_defined?("#{symbol}_defined?") || method_defined?("#{symbol}_value")