middleman/middleman-core/lib/middleman-core/templates/local.rb

22 lines
643 B
Ruby
Raw Normal View History

# Local templates
class Middleman::Templates::Local < Middleman::Templates::Base
# Look for templates in ~/.middleman
2011-12-18 05:12:13 +01:00
# @return [String]
def self.source_root
File.join(File.expand_path("~/"), ".middleman")
end
# Just copy from the template path
2011-12-18 05:12:13 +01:00
# @return [void]
def build_scaffold!
directory options[:template].to_s, location
end
end
# Iterate over the directories in the templates path and register each one.
Dir[File.join(Middleman::Templates::Local.source_root, "*")].each do |dir|
next unless File.directory?(dir)
Middleman::Templates.register(File.basename(dir).to_sym, Middleman::Templates::Local)
2011-08-08 23:01:04 +02:00
end