我的资产在/home/name/apps/myapp/shared/assets"上的生产服务器上
我看到这个目录正在快速增长。现在,权重文件夹是40 Mb,但我的当前资产的权重为3.2mb。
,我的问题是如何使用capistrano自定义任务清除这个文件夹中的旧资产。我只需要最后的资产时,我作出最后的cap deploy
编辑:
Capistrano任务用于预编译:
namespace :assets do
task :precompile, :roles => :web, :except => { :no_release => true } do
from = source.next_revision(current_revision)
if capture("cd #{latest_release} && #{source.local.log(from)} vendor/assets/ app/assets/ | wc -l").to_i > 0
run_locally("rm -rf public/assets/*")
run_locally "bundle exec rake assets:precompile"
find_servers_for_task(current_task).each do |server|
run_locally "rsync -vr --exclude='.DS_Store' --recursive --times --rsh=ssh --compress --human-readable --progress public/assets #{user}@#{server.host}:#{shared_path}/"
end
else
puts.info "Skipping asset pre-compilation because there were no asset changes"
end
end
end我是生产服务器上的预编译资产,但已更改为使用rsync将资产预编译为本地机器。
发布于 2013-01-04 20:57:16
在rsync命令中尝试使用--delete。
来自rsync手册页:--delete delete extraneous files from dest dirs.
https://stackoverflow.com/questions/14162477
复制相似问题