Skip to content

Commit

Permalink
fix files named layout again
Browse files Browse the repository at this point in the history
  • Loading branch information
tdreyno committed Aug 6, 2011
1 parent b5a9b78 commit d441b91
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
17 changes: 13 additions & 4 deletions lib/middleman/builder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ def revoke!
end

protected
def handle_directory(lookup)
def handle_directory(lookup, &block)
lookup = File.join(lookup, '*')

results = Dir[lookup].sort do |a, b|
Expand All @@ -121,14 +121,14 @@ def handle_directory(lookup)
end
end

results = results.select(&block) if block_given?

results.each do |file_source|
if File.directory?(file_source)
handle_directory(file_source)
next
end

next if file_source.include?('layout') && !file_source.include?('.css')

# Skip partials prefixed with an underscore
next unless file_source.gsub(SHARED_SERVER.root, '').split('/').select { |p| p[0,1] == '_' }.empty?

Expand All @@ -146,7 +146,16 @@ def handle_directory(lookup)
end

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
2 changes: 1 addition & 1 deletion lib/middleman/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module Middleman
VERSION = "2.0.0.rc98"
VERSION = "2.0.0.rc99"
end

0 comments on commit d441b91

Please sign in to comment.