don't load local templates if no HOME is set
This commit is contained in:
parent
ad14766278
commit
845d529a50
1 changed files with 14 additions and 11 deletions
|
@ -88,8 +88,10 @@ end
|
||||||
# Register all official templates
|
# Register all official templates
|
||||||
Dir.glob(File.expand_path('../middleman-templates/*.rb', __FILE__), &method(:require))
|
Dir.glob(File.expand_path('../middleman-templates/*.rb', __FILE__), &method(:require))
|
||||||
|
|
||||||
# Iterate over directories in the templates path and register each one.
|
# Sometimes HOME doesn't exist, in which case there's no point to local templates
|
||||||
Dir[File.join(Middleman::Templates::Local.source_root, '*')].each do |dir|
|
if ENV['HOME']
|
||||||
|
# Iterate over 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)
|
next unless File.directory?(dir)
|
||||||
template_file = File.join(dir, 'template.rb')
|
template_file = File.join(dir, 'template.rb')
|
||||||
|
|
||||||
|
@ -100,4 +102,5 @@ Dir[File.join(Middleman::Templates::Local.source_root, '*')].each do |dir|
|
||||||
else
|
else
|
||||||
Middleman::Templates.register(File.basename(dir).to_sym, Middleman::Templates::Local)
|
Middleman::Templates.register(File.basename(dir).to_sym, Middleman::Templates::Local)
|
||||||
end
|
end
|
||||||
|
end
|
||||||
end
|
end
|
Loading…
Add table
Reference in a new issue