class Vanity::Templates
Public Class Methods
new()
click to toggle source
# File lib/vanity/templates.rb, line 3 def initialize @template_directory = determine_template_directory end
Public Instance Methods
path(name)
click to toggle source
Path to template.
# File lib/vanity/templates.rb, line 8 def path(name) File.join(@template_directory, name) end
Private Instance Methods
custom_template_path_valid?()
click to toggle source
Check to make sure we set a custome path, it exists, and there are non- dotfiles in the directory.
# File lib/vanity/templates.rb, line 24 def custom_template_path_valid? Vanity.playground.custom_templates_path && File.exist?(Vanity.playground.custom_templates_path) && !Dir[File.join(Vanity.playground.custom_templates_path, '*')].empty? end
determine_template_directory()
click to toggle source
# File lib/vanity/templates.rb, line 14 def determine_template_directory if custom_template_path_valid? Vanity.playground.custom_templates_path else gem_templates_path end end
gem_templates_path()
click to toggle source
# File lib/vanity/templates.rb, line 30 def gem_templates_path File.expand_path(File.join(File.dirname(__FILE__), 'templates')) end