Try:

Rake::Task["stop"].invoke

There might be some shorthand that Tom Clements implemented, but I can't
say what it might be., a better way to implement this idiomatically is this:

desc "restart the server"
task :restart => [:stop, :start]

Which simply defines `restart` as running stop, then start.

Lee Hambley
--
http://lee.hambley.name/
+49 (0) 170 298 5667


On 15 October 2013 19:14, Иван Бишевац <[email protected]> wrote:

> I have tasks stop and start and want to make restart task which calls stop
> and start. What's syntax for it in Capistrano 3?
>
> namespace :server do
>
>   desc "Start server"
>   task :start do
>     on roles :app do
>       # start server
>     end
>   end
>
>   desc "Stop server"
>   task :stop do
>     on roles :app do
>       # stop server
>     end
>   end
>
>   desc "Restart server"
>   task :restart do
>     on roles :app do
>       stop
>       start
>     end
>   end
> end
>
>
> I'm getting error:
> cap aborted!
> undefined local variable or method `stop' for
> #<SSHKit::Backend::Netssh:0x007f840811c130>
> config/deploy/dev.rb:40:in `block (3 levels) in <top (required)>'
> Tasks: TOP => server:restart
> (See full trace by running task with --trace)
>
> --
> --
> * 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 unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/groups/opt_out.
>

-- 
-- 
* 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 unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to