From 5337d0640bdd35ad2c22d02ad58319a1ca230c84 Mon Sep 17 00:00:00 2001 From: Thomas Reynolds Date: Thu, 17 Mar 2016 13:23:36 -0700 Subject: [PATCH 1/3] Allow skipping sitemap. Helps #1837 --- middleman-cli/bin/middleman | 2 ++ middleman-cli/lib/middleman-cli/config.rb | 2 ++ middleman-core/lib/middleman-core/application.rb | 4 ++++ middleman-core/lib/middleman-core/sitemap/store.rb | 2 ++ 4 files changed, 10 insertions(+) diff --git a/middleman-cli/bin/middleman b/middleman-cli/bin/middleman index 637e5122..c635d220 100755 --- a/middleman-cli/bin/middleman +++ b/middleman-cli/bin/middleman @@ -47,6 +47,8 @@ end ::Middleman::Logger.singleton(3) ::Middleman::Cli.config = ::Middleman::Application.new do config[:exit_before_ready] = true + config[:watcher_disable] = true + config[:disable_sitemap] = true end.config # Require the Middleman version diff --git a/middleman-cli/lib/middleman-cli/config.rb b/middleman-cli/lib/middleman-cli/config.rb index 902ea216..eaa2c6a6 100644 --- a/middleman-cli/lib/middleman-cli/config.rb +++ b/middleman-cli/lib/middleman-cli/config.rb @@ -23,6 +23,8 @@ module Middleman::Cli ::Middleman::Logger.singleton(2, false) app = ::Middleman::Application.new do + config[:disable_sitemap] = true + config[:watcher_disable] = true config[:exit_before_ready] = true config[:environment] = opts[:environment].to_sym if opts[:environment] end diff --git a/middleman-core/lib/middleman-core/application.rb b/middleman-core/lib/middleman-core/application.rb index 590f42ab..8951449d 100644 --- a/middleman-core/lib/middleman-core/application.rb +++ b/middleman-core/lib/middleman-core/application.rb @@ -96,6 +96,10 @@ module Middleman # @return [String] define_setting :source, 'source', 'Name of the source directory' + # If we should not run the sitemap. + # @return [Boolean] + define_setting :disable_sitemap, false, 'If we should not run the sitemap.' + # If we should exit before ready event. # @return [Boolean] define_setting :exit_before_ready, false, 'If we should exit before ready event.' diff --git a/middleman-core/lib/middleman-core/sitemap/store.rb b/middleman-core/lib/middleman-core/sitemap/store.rb index 2871eae5..47e678ba 100644 --- a/middleman-core/lib/middleman-core/sitemap/store.rb +++ b/middleman-core/lib/middleman-core/sitemap/store.rb @@ -216,6 +216,8 @@ module Middleman # rebuild_resource_list! since the last time it was run. This is # very expensive! def ensure_resource_list_updated! + return if @app.config[:disable_sitemap] + @lock.synchronize do return unless @needs_sitemap_rebuild From dfa389bde42512b464ecab041446f48087af6eac Mon Sep 17 00:00:00 2001 From: Thomas Reynolds Date: Thu, 17 Mar 2016 14:47:14 -0700 Subject: [PATCH 2/3] bump --- middleman-core/lib/middleman-core/version.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/middleman-core/lib/middleman-core/version.rb b/middleman-core/lib/middleman-core/version.rb index 78e9c308..0bc748d7 100644 --- a/middleman-core/lib/middleman-core/version.rb +++ b/middleman-core/lib/middleman-core/version.rb @@ -1,5 +1,5 @@ module Middleman # Current Version # @return [String] - VERSION = '4.1.2'.freeze unless const_defined?(:VERSION) + VERSION = '4.1.3'.freeze unless const_defined?(:VERSION) end From d22bd914ae4a90a195fafc1f9b1f46b400e58950 Mon Sep 17 00:00:00 2001 From: Thomas Reynolds Date: Fri, 18 Mar 2016 10:37:02 -0700 Subject: [PATCH 3/3] Add specific test for #1556 --- middleman-core/features/dynamic_pages.feature | 27 ++++++++++--------- .../fixtures/dynamic-pages-app/config.rb | 4 +++ .../source/should_be_ignored9.html | 1 + 3 files changed, 20 insertions(+), 12 deletions(-) create mode 100644 middleman-core/fixtures/dynamic-pages-app/source/should_be_ignored9.html diff --git a/middleman-core/features/dynamic_pages.feature b/middleman-core/features/dynamic_pages.feature index 6d1b59ac..fc886ffd 100644 --- a/middleman-core/features/dynamic_pages.feature +++ b/middleman-core/features/dynamic_pages.feature @@ -31,7 +31,8 @@ Feature: Dynamic Pages | should_be_ignored6.html | | should_be_ignored7.html | | should_be_ignored8.html | - + | should_be_ignored9.html | + Scenario: Preview basic proxy Given the Server is running at "dynamic-pages-app" When I go to "/fake.html" @@ -42,46 +43,46 @@ Feature: Dynamic Pages Then I should see "I am real" When I go to "/fake4.html" Then I should see "I am real" - + Scenario: Preview proxy with variable one Given the Server is running at "dynamic-pages-app" When I go to "/fake/one.html" Then I should see "I am real: one" Then I should see "Global: I am one glob" Then I should see "All: I am all glob" - + When I go to "/fake2/one.html" Then I should see "I am real: one" Then I should see "Global: I am two glob" Then I should see "All: I am all glob" - + When I go to "/fake3/one.html" Then I should see "I am real: one" Then I should see "Global: I am three glob" Then I should see "All: I am all glob" - + When I go to "/fake4/one.html" Then I should see "I am real: one" Then I should see "Global: I am four glob" Then I should see "All: I am all glob" - + Scenario: Preview proxy with variable two Given the Server is running at "dynamic-pages-app" When I go to "/fake/two.html" Then I should see "I am real: two" Then I should see "Global: I am one glob" Then I should see "All: I am all glob" - + When I go to "/fake2/two.html" Then I should see "I am real: two" Then I should see "Global: I am two glob" Then I should see "All: I am all glob" - + When I go to "/fake3/two.html" Then I should see "I am real: two" Then I should see "Global: I am three glob" Then I should see "All: I am all glob" - + When I go to "/fake4/two.html" Then I should see "I am real: two" Then I should see "Global: I am four glob" @@ -101,7 +102,7 @@ Feature: Dynamic Pages Then the file "fake3/one.html" should contain "I am real: one" Then the file "fake3/one.html" should contain "Global: I am three glob" Then the file "fake3/one.html" should contain "All: I am all glob" - + Scenario: Target ignore Given the Server is running at "dynamic-pages-app" When I go to "/target_ignore.html" @@ -112,7 +113,7 @@ Feature: Dynamic Pages Then I should see "Ignore me! 7" When I go to "/target_ignore4.html" Then I should see "Ignore me! 8" - + Scenario: Preview ignored paths Given the Server is running at "dynamic-pages-app" When I go to "/should_be_ignored.html" @@ -130,4 +131,6 @@ Feature: Dynamic Pages When I go to "/should_be_ignored7.html" Then I should see "File Not Found" When I go to "/should_be_ignored8.html" - Then I should see "File Not Found" \ No newline at end of file + Then I should see "File Not Found" + When I go to "/should_be_ignored9.html" + Then I should see "File Not Found" diff --git a/middleman-core/fixtures/dynamic-pages-app/config.rb b/middleman-core/fixtures/dynamic-pages-app/config.rb index 75fab5e0..b195e0f9 100644 --- a/middleman-core/fixtures/dynamic-pages-app/config.rb +++ b/middleman-core/fixtures/dynamic-pages-app/config.rb @@ -28,3 +28,7 @@ page "fake/*", locals: { glob_var: "I am one glob" } page "fake2/*", locals: { glob_var: "I am two glob" } page "fake3/*", locals: { glob_var: "I am three glob" } page "fake4/*", locals: { glob_var: "I am four glob" } + +["tom", "dick", "harry"].each do |name| + proxy "/about/#{name}.html", "/should_be_ignored9.html", locals: { person_name: name }, ignore: true +end diff --git a/middleman-core/fixtures/dynamic-pages-app/source/should_be_ignored9.html b/middleman-core/fixtures/dynamic-pages-app/source/should_be_ignored9.html new file mode 100644 index 00000000..53571d5e --- /dev/null +++ b/middleman-core/fixtures/dynamic-pages-app/source/should_be_ignored9.html @@ -0,0 +1 @@ +

Ignore me! 9