Module: Precious::Views::TemplateCascade

Included in:
Layout
Defined in:
lib/gollum/views/template_cascade.rb

Instance Method Summary collapse

Instance Method Details

#first_path_available(name) ⇒ Object



13
14
15
16
17
18
19
20
21
# File 'lib/gollum/views/template_cascade.rb', line 13

def first_path_available(name)
  default = File.join(template_path, "#{name}.#{template_extension}")
  priority =
    if template_priority_path
      File.join(template_priority_path, "#{name}.#{template_extension}")
    end

  priority && File.exist?(priority) ? priority : default
end

#template_fileObject

Method should track lib/mustache/settings.rb from Mustache project.



24
25
26
# File 'lib/gollum/views/template_cascade.rb', line 24

def template_file
  @template_file || first_path_available(template_name)
end

#template_priority_pathObject



4
5
6
# File 'lib/gollum/views/template_cascade.rb', line 4

def template_priority_path
  @@template_priority_path ||= nil
end

#template_priority_path=(path) ⇒ Object



8
9
10
11
# File 'lib/gollum/views/template_cascade.rb', line 8

def template_priority_path=(path)
  @@template_priority_path = File.expand_path(path)
  @template = nil
end