2011-12-10 20:17:47 +01:00
|
|
|
# Local templates
|
2011-04-17 01:23:10 +02:00
|
|
|
class Middleman::Templates::Local < Middleman::Templates::Base
|
2011-12-10 20:17:47 +01:00
|
|
|
|
|
|
|
# Look for templates in ~/.middleman
|
2011-04-17 01:23:10 +02:00
|
|
|
def self.source_root
|
|
|
|
Middleman.templates_path
|
|
|
|
end
|
|
|
|
|
2011-12-10 20:17:47 +01:00
|
|
|
# Just copy from the template path
|
2011-04-17 01:23:10 +02:00
|
|
|
def build_scaffold
|
|
|
|
directory options[:template].to_s, location
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2011-12-10 20:17:47 +01:00
|
|
|
# Iterate over the directories in the templates path and register each one.
|
2011-04-17 01:23:10 +02:00
|
|
|
Dir[File.join(Middleman.templates_path, "*")].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
|