require 'fileutils' module Pyro module Assets def self.included(base) base.extend(ClassMethods) end module ClassMethods def template *args args = args.first templates = [] templates << "./lib/#{args[:src]}" if args[:src] if args[:dir] Dir.glob("./lib/#{args[:dir]}/**/*.{hbs, handlebars,x-handlebars}").each do |f| templates << f end end tags = '' templates.each do |t| contents = File.read t if args[:name] name = args[:name] elsif args[:src] name = t.split('/').last.split('.').first elsif args[:dir] name = t.sub("./lib/#{args[:dir]}/", '').split('.').first else name = 'name-not-found' end tags << "\n\n" end tags end end end end