Daniel Lopes escribió:
> Hello, i'm new in capistrano. I have a rails website deployed via
> capistrano. Some times I need to change something in my code and to
> deploy again i run git push origin and cap deploy. Cool, everything
> works fine, but the problem is when users of the site upload new
> images this images are stored in public/images/upload and when i do
> cap deploy this will overwrite public/images/upload and images of
> user's will be deleted.
>
> How can I add this folder in shared directory instead of release
> folder?
>
> Thanks, and sorry for that stupid question.
> >
>
>   
The idea is that you create a symlink from  
shared/files/public/images/uploads to public/images/uploads. Before 
delete uploads directory to recreate it with the symlink.

For example:
    desc "Creates symlinks from shared_path to upload directories for 
ideas, problems, comics, ..."
    task :symlink_upload_directories , :roles => :app do
      [
        'public/images/uploads'
      ].each do |upload_path|
        run "mkdir -p #{shared_path}/files/#{upload_path}"
        run "rm -rf #{current_path}/#{upload_path} && ln -nfs 
#{shared_path}/files/#{upload_path} #{current_path}/#{upload_path}"
      end
    end

Note: I put the path in an array because if you need more paths only 
push them into the array

Regards

ps: backup your uploads the first time to move them into shared path.

-- 
Rafael Garcia Ortega


--~--~---------~--~----~------------~-------~--~----~
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/capistrano
-~----------~----~----~----~------~----~------~--~---

begin:vcard
fn;quoted-printable:Rafael Garc=C3=ADa Ortega
n;quoted-printable:Garc=C3=ADa Ortega;Rafael
org:ASPgems S.L.
email;internet:[EMAIL PROTECTED]
tel;work:692686533
x-mozilla-html:FALSE
url:http://www.aspgems.com
version:2.1
end:vcard

Reply via email to