As Lee mentioned File.exists? checks your local filesystem not the
remote filesystem you need to do something like:

run "if [ -f #{previous_release}/db/promotions ]; then cp -r
#{previous_release}/db/promotions #{latest_release}/db/; fi"

But really it looks like you might want to consider making promotions
a symlink to the shared directory. That way you don't have to copy it
each time. Just make sure a symlink is created to the new
release_path. (Note that if you convert to this, you have to copy over
your promotions to the new shared directory.

run "mkdir -p #{shared_path}/promotions; ln -sfT
#{shared_path}/promotions #{latest_release}/db/promotions'"

On Thu, Aug 12, 2010 at 11:58 PM, harm <[email protected]> wrote:
>
> Dear all,
>
> I ran into a truly vexing problem. My code:
>    after("deploy:symlink") do
>        if File.exists? "#{previous_release}/db/promotions"
>            run "cp -r #{previous_release}/db/promotions
> #{current_release}/db/"
>        else
>            raise
>        end
>    end
>
> The if-condition _always_ returns false. And I know for a fact that
> directory exists. The 'releases' variable contains the correct
> directory, I checked.
> I'm doing something horribly wrong. Can someone shed some light on
> this? I'm using capistrano 2.5.19.
> As a side note, this problem only occurred after I upgraded my
> computer, in the past this script worked. So it might be so that the
> capistrano version changed.
>
> Thanks,
>
> --
> * You received this message because you are subscribed to the Google Groups 
> "Capistrano" group.
> * To post to this group, send email to [email protected]
> * To unsubscribe from this group, send email to 
> [email protected] For more options, visit this group at 
> http://groups.google.com/group/capistrano?hl=en

-- 
* You received this message because you are subscribed to the Google Groups 
"Capistrano" group.
* To post to this group, send email to [email protected]
* To unsubscribe from this group, send email to 
[email protected] For more options, visit this group at 
http://groups.google.com/group/capistrano?hl=en

Reply via email to