Either script/runner or a rake task.

A common misconception is that Cap somehow runs your tasks on remote -- it
doesn't. All the tasks are run locally, sending standard Unix commands over
SSH. So if you want to run any Ruby code at all on remote, the usual way is
to put it there somehow (usually a Rake task), and create a Cap task which
basically does

run "RAILS_ENV=#{fetch :rails_env, 'production'} cd #{current_path} && rake
mytask"

I'm not entirely sure that will work (my cap-fu is rusty), but you get the
idea.

You probably could make script/console work, but it would actually be more
work for you, and having a task/runner isn't a bad thing for local
development, either.

On Fri, Oct 24, 2008 at 5:35 PM, Wes Gamble <[EMAIL PROTECTED]> wrote:

>
> I have a special piece of setup that I would like to do only on certain
> deploys.  This code is dependent on the Rails environment for the
> application being loaded so that I have access to Rails stuff.
>
> How do I build a task that will execute this code that basically needs
> to run within the Rails environment (same as if I were to type it in via
> script/console).  Is there a pre-existing task that will allow me to do
> this?  Is there an easy way to basically run script/console from within
> a cap task?  Or should I just put my stuff in a file and make a task
> that can run it with script/runner?
>
> Thanks,
> Wes
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
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