2010-04-22 70 views
3

我已經寫了一個Capistrano配方去除all.js緩存的JavaScript文件,並告訴服務器重新啓動,但它仍然無法正常工作。不可避免地,我必須手動刪除all.js文件,然後手動重新啓動Apache。 (觸摸restart.txt並不總是有效)。JavaScript緩存,Rails和Apache乘客?

有人有這個問題的工作解決方案?

這裏是當前配方:

desc "Package Javascripts" 
    task :package_javascripts, :roles => :web do 
     sudo %{rm -f #{current_path}/public/javascripts/all.js} 
     javascripts.each do |javascript| 
     run %{/usr/bin/ruby #{current_path}/lib/jsmin.rb < \ 
       #{current_path}/public/javascripts/#{javascript}.js >> \ 
       #{current_path}/public/javascripts/all.js} 
     end 
     run "touch #{current_path}/tmp/restart.txt" 
    end 

回答

0

你有沒有地方掛你的任務:

after "deploy:symlink", :package_javascripts 

而且變化重新啓動行:

run "rm -f #{current_path}/tmp/restart.txt ; touch #{current_path}/tmp/restart.txt"