From fcbc77d0cd4d55d775ab83fb52e59018dc3a45ca Mon Sep 17 00:00:00 2001 From: Sam Date: Tue, 19 Mar 2013 18:12:19 -0700 Subject: [PATCH] pre-stage our locales as well --- lib/tasks/cdn.rake | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/lib/tasks/cdn.rake b/lib/tasks/cdn.rake index 9d7b9bc7f8b..82064c1abac 100644 --- a/lib/tasks/cdn.rake +++ b/lib/tasks/cdn.rake @@ -5,16 +5,21 @@ task 'assets:prestage' => :environment do |t| require "net/https" require "uri" + def get_assets(path) + a = Dir.glob("#{Rails.root}/public/assets/#{path}*").map do |f| + if f =~ /[a-f0-9]{16}\.(css|js)$/ + "/assets/#{path}#{f.split('/')[-1]}" + end + end.compact + end + + # pre-stage css/js only for now + a = get_assets("locales/") + get_assets("") + puts "pre staging: #{a.join(' ')}" + + # makes testing simpler leaving this here config = YAML::load(File.open("#{Rails.root}/config/cdn.yml")) - # pre-stage css/js only for now - a = Dir.glob("#{Rails.root}/public/assets/*").map do |f| - if f =~ /[a-f0-9]{16}\.(css|js)$/ - "/assets/#{f.split('/')[-1]}" - end - end.compact - - puts "pre staging: #{a.join(' ')}" start = Time.now uri = URI.parse("https://client.cdn77.com/api/prefetch")