Three things:

1. Settings on a task are not inherited by tasks called from that
task. Thus, you need to specify the :hosts setting for both
:change_directory and :update_db.

2. Capistrano does not read your .profile to discover additional PATH
entries, so if rake is installed somewhere other than /usr/bin, it
wont' find it without a full path. Try specifying the full path to
rake in :update_db.

3. A transaction won't help you at all unless you also specify what
should happen on rollback. For each task that you want to be able to
rollback, add an on_rollback hook (see capistrano/recipes/deploy.rb
for examples). Then, if the transaction fails, all registered
on_rollback hooks get called, to try and put things back together.

Hope that helps,

Jamis

On 8/6/07, BigFisch <[EMAIL PROTECTED]> wrote:
>
> I am wanting to add a task to a rails application, that deals with
> updating the db on another "build". Basically, I wanted to create a
> task for updating the db of a cruise-controled'd version of this app.
> It's annoying to log in to the server and do it manually, so I figured
> cap can do the task for me.
>
> What I'm having trouble doing is having it log in using different
> credentials or something. I also am having trouble using a rakefile?
>
>  No Rakefile found (looking for: rakefile, Rakefile, rakefile.rb,
> Rakefile.rb)
>
> Is my error.
>
> What I'm doing so far is this =>
>
> task :migrate_cc, :hosts => "cruisecontrolapp.myhost.com" do
>   transaction do
>     change_directory
>     update_db
>   end
> end
>
> task :change_directory do
>   run "cd /path/to/the/cruise/control/work"
> end
>
> task :update_db do
>   run "rake db:migrate"
> end
>
>
> The problem when I run migrate_cc is the rake thing, and also the fact
> that it tries to do this on my app's host (app.myhost.com) and also
> cruisecontrolapp.myhost.com.
>
> If I'm doing this wrong, please let me know.
>
> Thanks.
>
>
> >
>

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

Reply via email to