Forward port some stable changes

This commit is contained in:
Thomas Reynolds 2015-09-17 09:41:17 -07:00
parent a251c82562
commit 409a892da7
19 changed files with 49 additions and 39 deletions

View file

@ -86,8 +86,8 @@ module Middleman
end
class Resource
def proxy_to(path)
throw "Resource#proxy_to has been removed. Use ProxyResource class instead."
def proxy_to(_path)
throw 'Resource#proxy_to has been removed. Use ProxyResource class instead.'
end
end

View file

@ -48,9 +48,7 @@ module Middleman
@app = @store.app
@path = path
if source && source.is_a?(String)
source = Pathname(source)
end
source = Pathname(source) if source && source.is_a?(String)
if source && source.is_a?(Pathname)
@file_descriptor = ::Middleman::SourceFile.new(source.relative_path_from(@app.source_dir), source, @app.source_dir, Set.new([:source]))

View file

@ -187,23 +187,24 @@ module Middleman
@app.logger.debug '== Rebuilding resource list'
@resources = @resource_list_manipulators.reduce([]) do |result, m|
@resources = []
@resource_list_manipulators.each do |m|
@app.logger.debug "== Running manipulator: #{m[:name]}"
newres = m[:manipulator].send(m[:custom_name] || :manipulate_resource_list, result)
@resources = m[:manipulator].send(m[:custom_name] || :manipulate_resource_list, @resources)
# Reset lookup cache
reset_lookup_cache!
# Rebuild cache
newres.each do |resource|
@resources.each do |resource|
@_lookup_by_path[resource.path] = resource
@_lookup_by_destination_path[resource.destination_path] = resource
end
newres
invalidate_resources_not_ignored_cache!
end
invalidate_resources_not_ignored_cache!
@update_count += 1
end
end
@ -223,7 +224,7 @@ module Middleman
Contract String => String
def remove_templating_extensions(path)
# Strip templating extensions as long as Tilt knows them
path = path.sub(File.extname(path), '') while ::Tilt[path]
path = path.sub(/#{::Regexp.escape(File.extname(path))}$/, '') while ::Tilt[path]
path
end