Jamis,

Thanks a lot, I appreciate the time you give to the community :)

Just a question regarding "the best way to do things", is this proper,
or would you do it another way?

task :migrate_blah, :hosts => "theurl" do
  run "cd /to/some/directory/of/the/project/; /usr/local/bin/rake
db:migrate"
end

That works and all, but it seems kinda iffy to put it all on one line.
And the reason I did that is because if I put it into two separate run
statements, rake db:migrate wasn't ran in the previous commands
directory.

Thanks again.

On Aug 7, 1:08 pm, "Jamis Buck" <[EMAIL PROTECTED]> wrote:
> On 8/7/07, BigFisch <[EMAIL PROTECTED]> wrote:
>
>
>
> > Sorry to be so newbie regarding this...
>
> > How would I specify #2?
>
> What I mean is this. Instead of doing:
>
>   run "rake db:migrate"
>
> Try:
>
>   run "/usr/local/bin/rake db:migrate"
>
> (Of course, if rake isn't in /usr/local/bin on your remote machine,
> you'll want to specify the real location there.)
>
> - Jamis
>
>
>
> > Regarding #3, I guess I don't really need to worry about a rollback. I
> > just want to do one simple thing, migrate the database in a specific
> > applications directory.
>
> > So all I really need to do is figure out that rake path thing, then go
> > to the proper directory in the server and execute "rake db:migrate".
>
> > Thanks for your help. :)
>
> > On Aug 6, 10:02 pm, "Jamis Buck" <[EMAIL PROTECTED]> wrote:
> > > 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