diff options
author | Nick Thomas <nick@gitlab.com> | 2018-10-03 02:00:38 +0300 |
---|---|---|
committer | Nick Thomas <nick@gitlab.com> | 2018-10-05 13:34:43 +0300 |
commit | 25bd49e4f57fe15f9d61dc9376a5b7dc35b30f64 (patch) | |
tree | faef4e9d73e9845413462013c868eace19a11abf /lib/gitlab/template/base_template.rb | |
parent | ae014e189773f7299c12c1050334b3e8fe7b15d8 (diff) |
Backport project template API to CE
Diffstat (limited to 'lib/gitlab/template/base_template.rb')
-rw-r--r-- | lib/gitlab/template/base_template.rb | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/lib/gitlab/template/base_template.rb b/lib/gitlab/template/base_template.rb index 3770f3f250b..4456217017f 100644 --- a/lib/gitlab/template/base_template.rb +++ b/lib/gitlab/template/base_template.rb @@ -12,14 +12,21 @@ module Gitlab def name File.basename(@path, self.class.extension) end - alias_method :id, :name + alias_method :key, :name def content @finder.read(@path) end + # Present for compatibility with license templates, which can replace text + # like `[fullname]` with a user-specified string. This is a no-op for + # other templates + def resolve!(_placeholders = {}) + self + end + def to_json - { name: name, content: content } + { key: key, name: name, content: content } end def <=>(other) |