summaryrefslogtreecommitdiff
path: root/lib/gitlab/template/finders/base_template_finder.rb
diff options
context:
space:
mode:
authorConnor Shea <connor.james.shea@gmail.com>2016-08-16 16:59:19 -0600
committerConnor Shea <connor.james.shea@gmail.com>2016-08-16 16:59:19 -0600
commit1d3aa59f99a72f613b84286eef948dfbad20925e (patch)
tree0061000ff2226f3bc4e88ce8133a65403de9f37e /lib/gitlab/template/finders/base_template_finder.rb
parent1e7cbe0b05ddd9c72987730323e63d612d429ab9 (diff)
parent76aa85cc8023e1a8176f0b783a52154f98a5be8f (diff)
downloadgitlab-ce-1d3aa59f99a72f613b84286eef948dfbad20925e.tar.gz
Merge branch 'master' into diff-line-comment-vuejs
Diffstat (limited to 'lib/gitlab/template/finders/base_template_finder.rb')
-rw-r--r--lib/gitlab/template/finders/base_template_finder.rb35
1 files changed, 35 insertions, 0 deletions
diff --git a/lib/gitlab/template/finders/base_template_finder.rb b/lib/gitlab/template/finders/base_template_finder.rb
new file mode 100644
index 00000000000..473b05257c6
--- /dev/null
+++ b/lib/gitlab/template/finders/base_template_finder.rb
@@ -0,0 +1,35 @@
+module Gitlab
+ module Template
+ module Finders
+ class BaseTemplateFinder
+ def initialize(base_dir)
+ @base_dir = base_dir
+ end
+
+ def list_files_for
+ raise NotImplementedError
+ end
+
+ def read
+ raise NotImplementedError
+ end
+
+ def find
+ raise NotImplementedError
+ end
+
+ def category_directory(category)
+ return @base_dir unless category.present?
+
+ @base_dir + @categories[category]
+ end
+
+ class << self
+ def filter_regex(extension)
+ /#{Regexp.escape(extension)}\z/
+ end
+ end
+ end
+ end
+ end
+end