Fixes #615. Tracks should work even when SUPPRESS_ASSET_PACKAGER is not defined. SUPPRESS_ASSET_PACKAGER is a (now) optional constant that when set to true will suppress the asset_packager plugin from using the single packaged version. Useful for selenium testing.

git-svn-id: http://www.rousette.org.uk/svn/tracks-repos/trunk@673 a4c988fc-2ded-0310-b66e-134b36920a42
This commit is contained in:
lukemelia 2007-12-04 20:56:25 +00:00
parent 36c35a7a86
commit 413fcb4db7

View file

@ -1,6 +1,6 @@
module Synthesis
module AssetPackageHelper
def javascript_include_merged(*sources)
options = sources.last.is_a?(Hash) ? sources.pop.stringify_keys : { }
@ -13,10 +13,11 @@ module Synthesis
end
sources.collect!{|s| s.to_s}
sources = (RAILS_ENV != "development" || SUPPRESS_ASSET_PACKAGER ?
AssetPackage.targets_from_sources("javascripts", sources) :
AssetPackage.sources_from_targets("javascripts", sources))
sources = if suppress_packaging?
AssetPackage.sources_from_targets("javascripts", sources)
else
AssetPackage.targets_from_sources("javascripts", sources)
end
sources.collect {|source| javascript_include_tag(source, options) }.join("\n")
end
@ -24,9 +25,11 @@ module Synthesis
options = sources.last.is_a?(Hash) ? sources.pop.stringify_keys : { }
sources.collect!{|s| s.to_s}
sources = (RAILS_ENV != "development" || SUPPRESS_ASSET_PACKAGER ?
AssetPackage.targets_from_sources("stylesheets", sources) :
AssetPackage.sources_from_targets("stylesheets", sources))
sources = if suppress_packaging?
AssetPackage.sources_from_targets("stylesheets", sources)
else
AssetPackage.targets_from_sources("stylesheets", sources)
end
sources.collect { |source|
source = stylesheet_path(source)
@ -35,6 +38,13 @@ module Synthesis
end
private
def suppress_packaging?
return true if RAILS_ENV == "development"
return true if SUPPRESS_ASSET_PACKAGER == true rescue nil
return false
end
# rewrite compute_public_path to allow us to not include the query string timestamp
# used by ActionView::Helpers::AssetTagHelper
def compute_public_path(source, dir, ext, add_asset_id=true)