Sha256: 173a80f2fb2c10da239038401f90369a1e4f64dc3a10c60c53858bf734393a23
Contents?: true
Size: 984 Bytes
Versions: 13
Compression:
Stored size: 984 Bytes
Contents
module Vanity class Templates def initialize @template_directory = determine_template_directory end # Path to template. def path(name) File.join(@template_directory, name) end private def determine_template_directory if custom_template_path_valid? Vanity.playground.custom_templates_path else gem_templates_path end end # Check to make sure we set a custome path, it exists, and there are non- # dotfiles in the directory. def custom_template_path_valid? Vanity.playground.custom_templates_path && File.exists?(Vanity.playground.custom_templates_path) && !Dir[File.join(Vanity.playground.custom_templates_path, '*')].empty? end def gem_templates_path File.expand_path(File.join(File.dirname(__FILE__), 'templates')) end end class << self def template(name) @templates ||= Templates.new @templates.path(name) end end end
Version data entries
13 entries across 13 versions & 1 rubygems