summaryrefslogtreecommitdiff
path: root/lib/gitlab/template/base_template.rb
diff options
context:
space:
mode:
authorNick Thomas <nick@gitlab.com>2018-10-03 00:00:38 +0100
committerNick Thomas <nick@gitlab.com>2018-10-05 11:34:43 +0100
commit25bd49e4f57fe15f9d61dc9376a5b7dc35b30f64 (patch)
treefaef4e9d73e9845413462013c868eace19a11abf /lib/gitlab/template/base_template.rb
parentae014e189773f7299c12c1050334b3e8fe7b15d8 (diff)
downloadgitlab-ce-25bd49e4f57fe15f9d61dc9376a5b7dc35b30f64.tar.gz
Backport project template API to CE
Diffstat (limited to 'lib/gitlab/template/base_template.rb')
-rw-r--r--lib/gitlab/template/base_template.rb11
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)