From 2beb774eb96070f7ba5960d6ed352796686fa127 Mon Sep 17 00:00:00 2001 From: Ben Hollis Date: Fri, 30 May 2014 22:46:15 -0700 Subject: [PATCH] Put back request_path, I get it now --- middleman-cli/lib/middleman-cli/build.rb | 2 +- .../middleman-core/sitemap/extensions/request_endpoints.rb | 7 ++++--- middleman-core/lib/middleman-core/sitemap/resource.rb | 5 +++++ 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/middleman-cli/lib/middleman-cli/build.rb b/middleman-cli/lib/middleman-cli/build.rb index 80916a02..60538431 100644 --- a/middleman-cli/lib/middleman-cli/build.rb +++ b/middleman-cli/lib/middleman-cli/build.rb @@ -254,7 +254,7 @@ module Middleman::Cli FileUtils.cp(resource.source_file, output_file) else begin - response = @rack.get(URI.escape(resource.destination_path)) + response = @rack.get(URI.escape(resource.request_path)) if response.status == 200 base.create_file(output_file, binary_encode(response.body)) diff --git a/middleman-core/lib/middleman-core/sitemap/extensions/request_endpoints.rb b/middleman-core/lib/middleman-core/sitemap/extensions/request_endpoints.rb index 18bc996e..b89ec083 100644 --- a/middleman-core/lib/middleman-core/sitemap/extensions/request_endpoints.rb +++ b/middleman-core/lib/middleman-core/sitemap/extensions/request_endpoints.rb @@ -49,12 +49,13 @@ module Middleman class EndpointResource < ::Middleman::Sitemap::Resource attr_accessor :output - def initialize(store, path, source_file) - @request_path = ::Middleman::Util.normalize_path(source_file) - + def initialize(store, path, request_path) super(store, path) + @request_path = ::Middleman::Util.normalize_path(request_path) end + attr_reader :request_path + def template? true end diff --git a/middleman-core/lib/middleman-core/sitemap/resource.rb b/middleman-core/lib/middleman-core/sitemap/resource.rb index 16ac10f0..62551ad5 100644 --- a/middleman-core/lib/middleman-core/sitemap/resource.rb +++ b/middleman-core/lib/middleman-core/sitemap/resource.rb @@ -20,6 +20,11 @@ module Middleman # @return [String] attr_accessor :destination_path + # The path to use when requesting this resource. Normally it's + # the same as {#destination_path} but it can be overridden in subclasses. + # @return [String] + alias_method :request_path, :destination_path + # Set the on-disk source file for this resource # @return [String] def source_file