2018-11-19 21:01:13 -05:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2016-06-24 15:43:46 -04:00
|
|
|
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?
|
|
|
|
|
2018-08-14 17:28:46 -04:00
|
|
|
File.join(@base_dir, @categories[category])
|
2016-06-24 15:43:46 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
class << self
|
|
|
|
def filter_regex(extension)
|
|
|
|
/#{Regexp.escape(extension)}\z/
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|