summaryrefslogtreecommitdiff
path: root/lib/gitlab/template
diff options
context:
space:
mode:
authorZ.J. van de Weg <zegerjan@gitlab.com>2016-06-17 08:37:19 +0200
committerAlfredo Sumaran <alfredo@gitlab.com>2016-06-20 14:48:28 -0500
commitbbfd62bc34061089f753e4170912be64bae16f84 (patch)
tree3ed2d54d4afc4449933d97ce3c992a2682a0d3e7 /lib/gitlab/template
parenta18df1d15af68be4d129412ad2a6145277ca43d3 (diff)
downloadgitlab-ce-bbfd62bc34061089f753e4170912be64bae16f84.tar.gz
fixup! override content method
Diffstat (limited to 'lib/gitlab/template')
-rw-r--r--lib/gitlab/template/base_template.rb28
-rw-r--r--lib/gitlab/template/gitlab_ci_yml.rb5
2 files changed, 18 insertions, 15 deletions
diff --git a/lib/gitlab/template/base_template.rb b/lib/gitlab/template/base_template.rb
index 4086d8701bf..760ff3e614a 100644
--- a/lib/gitlab/template/base_template.rb
+++ b/lib/gitlab/template/base_template.rb
@@ -1,8 +1,6 @@
module Gitlab
module Template
class BaseTemplate
- attr_writer :content
-
def initialize(path)
@path = path
end
@@ -12,19 +10,7 @@ module Gitlab
end
def content
- @content ||= File.read(@path)
- end
-
- def categories
- raise NotImplementedError
- end
-
- def extension
- raise NotImplementedError
- end
-
- def base_dir
- raise NotImplementedError
+ File.read(@path)
end
class << self
@@ -39,6 +25,18 @@ module Gitlab
directory ? new(File.join(category_directory(directory), file_name)) : nil
end
+ def categories
+ raise NotImplementedError
+ end
+
+ def extension
+ raise NotImplementedError
+ end
+
+ def base_dir
+ raise NotImplementedError
+ end
+
def by_category(category)
templates_for_directory(category_directory(category))
end
diff --git a/lib/gitlab/template/gitlab_ci_yml.rb b/lib/gitlab/template/gitlab_ci_yml.rb
index f1e96d22d64..7f480fe33c0 100644
--- a/lib/gitlab/template/gitlab_ci_yml.rb
+++ b/lib/gitlab/template/gitlab_ci_yml.rb
@@ -1,6 +1,11 @@
module Gitlab
module Template
class GitlabCiYml < BaseTemplate
+ def content
+ explanation = "# This file is a template, and might need editing before it works on your project."
+ [explanation, super].join("\n")
+ end
+
class << self
def extension
'.gitlab-ci.yml'