Capistrano: copying directory from previous release

Hi all,

I’m using capistrano to deploy my application. But I have to copy the
images/* directory manually each time to the current release. Is there a
way to make capistrano do this for me?

Something like:
run "cp -r ~/#{previous_release}/public/images/users/*
~/current/public/images/users/

Thanks in advance!

Leon B. wrote:

Thanks in advance!

The usual way of solving this (for images generated by the app, rather
than ones for the layout, which may be in the svn repository) is to put
the images in the shared folder with a symlink to them, and then add
have capistrano add the symlink after updating the code. I also do the
same for fragment cach files.

Something like:
run <<-EOF
cd #{release_path} &&
ln -s #{shared_path}/photos #{release_path}/public/photos
EOF

Hope this helps,
Chris

Autopendium :: Stuff about old cars
http://autopendium.com

Chris T. wrote:

Leon B. wrote:

Thanks in advance!

The usual way of solving this (for images generated by the app, rather
than ones for the layout, which may be in the svn repository) is to put
the images in the shared folder with a symlink to them, and then add
have capistrano add the symlink after updating the code. I also do the
same for fragment cach files.

Something like:
run <<-EOF
cd #{release_path} &&
ln -s #{shared_path}/photos #{release_path}/public/photos
EOF

Hope this helps,
Chris

Autopendium :: Stuff about old cars
http://autopendium.com
Ah thanks, gonna try that. I now have something like:

namespace :deploy do
task :copy_user_images do
run “cp #{previous_release}/public/images/users/*.jpg
current/public/images/users/”
end

task :after_deploy do
copy_user_images
end
end

On Nov 21, 2007, at 12:20 AM, Leon B. wrote:

have capistrano add the symlink after updating the code. I also do
Chris
current/public/images/users/"
end

task :after_deploy do
copy_user_images
end
end

I’d really discourage you to continue doing that. This slows down your
deployment process as your image directory gets larger.

You do have a shared directory somewhere right? For logs, database.yml
and the like? This is where you should store images as well and then
you just symlink it, which is instantaneous and doesn’t unnecessarily
duplicate images on your filesystem.

Hope that helps…

Cheers,
Robby


Robby R.
Founder and Executive Director

PLANET ARGON, LLC
Design, Development, and Hosting with Ruby on Rails

http://www.robbyonrails.com/

+1 503 445 2457
+1 877 55 ARGON [toll free]
+1 815 642 4068 [fax]