aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_view/helpers/asset_tag_helper.rb
diff options
context:
space:
mode:
authorDavid Heinemeier Hansson <david@loudthinking.com>2007-02-21 15:28:37 +0000
committerDavid Heinemeier Hansson <david@loudthinking.com>2007-02-21 15:28:37 +0000
commit7f55931f80162937b344eb200ca62f2d58c6c59d (patch)
treecfec756316241a560a657721a4ffe04a8c050241 /actionpack/lib/action_view/helpers/asset_tag_helper.rb
parentde0a0d700e8c3959a3503152b9a495616afbeae5 (diff)
downloadrails-7f55931f80162937b344eb200ca62f2d58c6c59d.tar.gz
rails-7f55931f80162937b344eb200ca62f2d58c6c59d.tar.bz2
rails-7f55931f80162937b344eb200ca62f2d58c6c59d.zip
Make sure that the filesystem is not involved with asset hosting
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@6187 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'actionpack/lib/action_view/helpers/asset_tag_helper.rb')
-rw-r--r--actionpack/lib/action_view/helpers/asset_tag_helper.rb27
1 files changed, 19 insertions, 8 deletions
diff --git a/actionpack/lib/action_view/helpers/asset_tag_helper.rb b/actionpack/lib/action_view/helpers/asset_tag_helper.rb
index e72e23b20b..9d98ebefdf 100644
--- a/actionpack/lib/action_view/helpers/asset_tag_helper.rb
+++ b/actionpack/lib/action_view/helpers/asset_tag_helper.rb
@@ -148,7 +148,10 @@ module ActionView
if !File.exists?(joined_javascript_path)
File.open(joined_javascript_path, "w+") do |cache|
- javascript_paths = expand_javascript_sources(sources).collect { |source| javascript_path(source) }
+ javascript_paths = expand_javascript_sources(sources).collect do |source|
+ compute_public_path(source, 'javascripts', 'js', false)
+ end
+
cache.write(join_asset_file_contents(javascript_paths))
end
end
@@ -240,7 +243,10 @@ module ActionView
if !File.exists?(joined_stylesheet_path)
File.open(joined_stylesheet_path, "w+") do |cache|
- stylesheet_paths = expand_stylesheet_sources(sources).collect { |source| stylesheet_path(source) }
+ stylesheet_paths = expand_stylesheet_sources(sources).collect do |source|
+ compute_public_path(source, 'stylesheets', 'css', false)
+ end
+
cache.write(join_asset_file_contents(stylesheet_paths))
end
end
@@ -318,7 +324,7 @@ module ActionView
# roots. Rewrite the asset path for cache-busting asset ids. Include
# a single or wildcarded asset host, if configured, with the correct
# request protocol.
- def compute_public_path(source, dir, ext)
+ def compute_public_path(source, dir, ext, include_host = true)
source += ".#{ext}" if File.extname(source).blank?
if source =~ %r{^[-a-z]+://}
@@ -328,12 +334,17 @@ module ActionView
source = "#{@controller.request.relative_url_root}#{source}"
rewrite_asset_path!(source)
- host = compute_asset_host(source)
- unless host.blank? or host =~ %r{^[-a-z]+://}
- host = "#{@controller.request.protocol}#{host}"
- end
+ if include_host
+ host = compute_asset_host(source)
- "#{host}#{source}"
+ unless host.blank? or host =~ %r{^[-a-z]+://}
+ host = "#{@controller.request.protocol}#{host}"
+ end
+
+ "#{host}#{source}"
+ else
+ source
+ end
end
end