2010-07-23 20:09:54 +00:00
|
|
|
module Locomotive
|
|
|
|
module Liquid
|
|
|
|
class DbFileSystem
|
|
|
|
|
|
|
|
# Works only with snippets
|
2010-05-30 23:57:33 +00:00
|
|
|
def read_template_file(site, template_path)
|
|
|
|
raise FileSystemError, "Illegal snippet name '#{template_path}'" unless template_path =~ /^[^.\/][a-zA-Z0-9_\/]+$/
|
2010-07-23 20:09:54 +00:00
|
|
|
|
2010-05-30 23:57:33 +00:00
|
|
|
snippet = site.snippets.where(:slug => template_path).first
|
2010-07-23 20:09:54 +00:00
|
|
|
|
2010-05-30 23:57:33 +00:00
|
|
|
raise FileSystemError, "No such snippet '#{template_path}'" if snippet.nil?
|
2010-07-23 20:09:54 +00:00
|
|
|
|
2010-05-30 23:57:33 +00:00
|
|
|
snippet.template
|
2010-07-23 20:09:54 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|