Sha256: a2c583ed759d317d7e80e4cbd3ffab392ac34ada293236109113e94ae6e6cbec
Contents?: true
Size: 983 Bytes
Versions: 14
Compression:
Stored size: 983 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.exist?(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
14 entries across 14 versions & 1 rubygems