Nevermind... sorry to have bothered. The following worked.
task :clear_sessions, { :roles => :app, :only => { :primary => true }}
do
set :task_to_run, "db:sessions:clear"
rake_tasks.run_on_primary_app
end
On Feb 1, 11:06 pm, Justin Diana <[email protected]> wrote:
> Hey all,
>
> I've got a task that can be run from the command line with a task_to_run
> parameter specified:
>
> cap admin_server rake_tasks:run_rake_on_app -s task_to_run="db:migrate"
>
> That will execute:
>
> task :run_on_app, :roles => :app do
> run <<-CMD
> cd #{current_path} &&
> rake #{task_to_run} RAILS_ENV=#{rails_env}
> CMD
> end
>
> That runs just fine.
>
> However, I have another task (within my deploy.rb file) that I would also
> like to run this task. How do I format the command so that it essentially
> passes the equivalent of the "-s task_to_run=" to it?
>
> I tried:
>
> task :clear_sessions, { :roles => :app, :only => { :primary => true }} do
> rake_tasks.run_on_primary_app task_to_run="db:sessions:clear"
> end
>
> and
>
> task :clear_sessions, { :roles => :app, :only => { :primary => true }} do
> task_to_run = "db:sessions:clear"
> rake_tasks.run_on_primary_app(task_to_run)
> end
>
> What am I doing wrong?
--
* 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