fix files named layout again

This commit is contained in:
Thomas Reynolds 2011-08-05 21:37:33 -07:00
parent b5a9b78f42
commit d441b9122c
2 changed files with 14 additions and 5 deletions

View file

@ -102,7 +102,7 @@ module Middleman
end end
protected protected
def handle_directory(lookup) def handle_directory(lookup, &block)
lookup = File.join(lookup, '*') lookup = File.join(lookup, '*')
results = Dir[lookup].sort do |a, b| results = Dir[lookup].sort do |a, b|
@ -121,14 +121,14 @@ module Middleman
end end
end end
results = results.select(&block) if block_given?
results.each do |file_source| results.each do |file_source|
if File.directory?(file_source) if File.directory?(file_source)
handle_directory(file_source) handle_directory(file_source)
next next
end end
next if file_source.include?('layout') && !file_source.include?('.css')
# Skip partials prefixed with an underscore # Skip partials prefixed with an underscore
next unless file_source.gsub(SHARED_SERVER.root, '').split('/').select { |p| p[0,1] == '_' }.empty? next unless file_source.gsub(SHARED_SERVER.root, '').split('/').select { |p| p[0,1] == '_' }.empty?
@ -146,7 +146,16 @@ module Middleman
end end
def execute! def execute!
handle_directory(source) handle_directory(source) do |path|
file_name = path.gsub(SHARED_SERVER.views + "/", "")
if file_name == "layouts"
false
elsif file_name.include?("layout.") && file_name.split(".").length == 2
false
else
true
end
end
end end
end end
end end

View file

@ -1,3 +1,3 @@
module Middleman module Middleman
VERSION = "2.0.0.rc98" VERSION = "2.0.0.rc99"
end end