我有一个由宝石上传资产的文件夹(通过回形针),这些资料存储在不同的文件夹ckeditor_assets
中。
我想使用capistrano处理此文件夹的方式与处理回形针上传的system
文件夹完全相同。
我怎样才能做到这一点?它将包含客户数据,因此非常重要。
答案 0 :(得分:1)
我解决了这个问题:http://www.simonecarletti.com/blog/2009/02/capistrano-uploads-folder/
为了将来的参考,我报告了一部分博客帖子,它基本上在capistrano shared
文件夹中创建了一个目录,并且每次都有符号链接。
# ==============================
# Uploads
# ==============================
namespace :uploads do
desc <<-EOD
Creates the upload folders unless they exist
and sets the proper upload permissions.
EOD
task :setup, :except => { :no_release => true } do
dirs = uploads_dirs.map { |d| File.join(shared_path, d) }
run "#{try_sudo} mkdir -p #{dirs.join(' ')} && #{try_sudo} chmod g+w #{dirs.join(' ')}"
end
desc <<-EOD
[internal] Creates the symlink to uploads shared folder
for the most recently deployed version.
EOD
task :symlink, :except => { :no_release => true } do
run "rm -rf #{release_path}/public/uploads"
run "ln -nfs #{shared_path}/uploads #{release_path}/public/uploads"
end
desc <<-EOD
[internal] Computes uploads directory paths
and registers them in Capistrano environment.
EOD
task :register_dirs do
set :uploads_dirs, %w(uploads uploads/partners)
set :shared_children, fetch(:shared_children) + fetch(:uploads_dirs)
end
after "deploy:finalize_update", "uploads:symlink"
on :start, "uploads:register_dirs"
end
请参阅博客文章了解多阶段支持和一些说明。