diff --git a/bin/middleman b/bin/middleman index e055fbe3..15e70f55 100755 --- a/bin/middleman +++ b/bin/middleman @@ -14,7 +14,7 @@ module Middleman if !in_middleman_project? && !in_middleman_project_subdirectory? $stderr.puts "== Error: Could not find a Middleman project config, perhaps you are in the wrong folder?" - return + exit(1) end if in_middleman_project? @@ -57,8 +57,7 @@ module Middleman end ARGV << "server" if ARGV.length < 1 - -if %w(server build migrate).include?(ARGV) +if %w(server s build b).include?(ARGV[0]) Middleman::ProjectLocator.locate_middleman_root! else Middleman::ProjectLocator.start_cli! diff --git a/features/builder.feature b/features/builder.feature index c5b23f20..0fbeeb04 100644 --- a/features/builder.feature +++ b/features/builder.feature @@ -45,6 +45,10 @@ Feature: Builder Scenario: Build with errors Given a built app at "build-with-errors-app" Then the exit status should be 1 + + Scenario: Build empty errors + Given a built app at "empty-app" + Then the exit status should be 1 Scenario: Build alias (b) Given a fixture app "test-app" diff --git a/features/nested_layouts.feature b/features/nested_layouts.feature index a591f240..124e684d 100644 --- a/features/nested_layouts.feature +++ b/features/nested_layouts.feature @@ -12,8 +12,13 @@ Feature: Allow nesting of layouts Given the Server is running at "nested-layout-app" When I go to "/data-one.html" Then I should see "Page Number One" + And I should see "Inner" When I go to "/data-two.html" Then I should see "Page Number Two" + And I should not see "Inner" When I go to "/data-one.html" Then I should see "Page Number One" + And I should see "Inner" When I go to "/data-two.html" + Then I should see "Page Number Two" + And I should not see "Inner" diff --git a/fixtures/empty-app/not-config.rb b/fixtures/empty-app/not-config.rb new file mode 100644 index 00000000..e69de29b diff --git a/fixtures/nested-layout-app/source/data-one.html.erb b/fixtures/nested-layout-app/source/data-one.html.erb index 7dfb5840..51912a12 100644 --- a/fixtures/nested-layout-app/source/data-one.html.erb +++ b/fixtures/nested-layout-app/source/data-one.html.erb @@ -1,5 +1,5 @@ --- title: Page Number One -layout: outer +layout: inner --- Page #1 \ No newline at end of file diff --git a/lib/middleman/core_extensions/front_matter.rb b/lib/middleman/core_extensions/front_matter.rb index 1d0cc331..e8fa0a36 100644 --- a/lib/middleman/core_extensions/front_matter.rb +++ b/lib/middleman/core_extensions/front_matter.rb @@ -38,22 +38,18 @@ module Middleman::CoreExtensions::FrontMatter provides_metadata matcher do |path| relative_path = path.sub(source_dir, "") - data = if frontmatter.has_data?(relative_path) + fmdata = if frontmatter.has_data?(relative_path) frontmatter.data(relative_path)[0] else {} end - # Forward remaining data to helpers - data_content("page", data) - + data = {} %w(layout layout_engine).each do |opt| - if data.has_key?(opt) - data[opt.to_sym] = data.delete(opt) - end + data[opt.to_sym] = fmdata[opt] if fmdata.has_key?(opt) end - { :options => data } + { :options => data, :page => fmdata } end end diff --git a/lib/middleman/sitemap/template.rb b/lib/middleman/sitemap/template.rb index 31267924..e845d742 100644 --- a/lib/middleman/sitemap/template.rb +++ b/lib/middleman/sitemap/template.rb @@ -36,7 +36,7 @@ module Middleman::Sitemap def metadata metadata = app.cache.fetch(:metadata, source_file) do - data = { :options => {}, :locals => {} } + data = { :options => {}, :locals => {}, :page => {} } app.provides_metadata.each do |callback, matcher| next if !matcher.nil? && !source_file.match(matcher) @@ -57,8 +57,14 @@ module Middleman::Sitemap end def render(opts={}, locs={}, &block) - opts = options.deep_merge(metadata[:options]).deep_merge(opts) - locs = locals.deep_merge(metadata[:locals]).deep_merge(locs) + md = metadata.dup + opts = options.deep_merge(md[:options]).deep_merge(opts) + locs = locals.deep_merge(md[:locals]).deep_merge(locs) + + # Forward remaining data to helpers + if md.has_key?(:page) + app.data_content("page", md[:page]) + end blocks.compact.each do |block| app.instance_eval(&block)