fix broken specs

This commit is contained in:
tdreyno 2010-02-02 17:11:09 -08:00
parent 859182b21f
commit 7ee181f2f0

View file

@ -3,7 +3,7 @@ class Middleman::Base
::Compass.configuration do |config| ::Compass.configuration do |config|
config.asset_host(&self.asset_host) config.asset_host(&self.asset_host)
end end
end if self.enabled?(:asset_host) end if self.enabled?(:asset_host) && self.asset_host && self.asset_host.is_a?(Proc)
end end
class << Middleman::Base class << Middleman::Base
@ -13,15 +13,11 @@ class << Middleman::Base
valid_extensions = %w(.png .gif .jpg .jpeg .js .css) valid_extensions = %w(.png .gif .jpg .jpeg .js .css)
if !self.enabled?(:asset_host) || path.include?("://") || !valid_extensions.include?(File.extname(path)) || !self.asset_host if !self.enabled?(:asset_host) || path.include?("://") || !valid_extensions.include?(File.extname(path)) || !self.asset_host || !self.asset_host.is_a?(Proc) || !self.asset_host.respond_to?(:call)
return original_output return original_output
end end
asset_prefix = if self.asset_host.is_a?(Proc) || self.asset_host.respond_to?(:call) asset_prefix = self.asset_host.call(original_output)
self.asset_host.call(original_output)
else
(self.asset_host =~ /%d/) ? self.asset_host % (original_output.hash % 4) : self.asset_host
end
return File.join(asset_prefix, original_output) return File.join(asset_prefix, original_output)
end end