1
0
Fork 0
mirror of https://github.com/middleman/middleman.git synced 2022-11-09 12:20:27 -05:00

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|
config.asset_host(&self.asset_host)
end
end if self.enabled?(:asset_host)
end if self.enabled?(:asset_host) && self.asset_host && self.asset_host.is_a?(Proc)
end
class << Middleman::Base
@ -13,15 +13,11 @@ class << Middleman::Base
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
end
asset_prefix = if self.asset_host.is_a?(Proc) || self.asset_host.respond_to?(:call)
self.asset_host.call(original_output)
else
(self.asset_host =~ /%d/) ? self.asset_host % (original_output.hash % 4) : self.asset_host
end
asset_prefix = self.asset_host.call(original_output)
return File.join(asset_prefix, original_output)
end