Class: GDK::Command::Restart

Inherits:
BaseCommand show all
Defined in:
lib/gdk/command/restart.rb

Overview

Stop and restart all enabled services or specified ones only

Instance Attribute Summary

Attributes inherited from BaseCommand

#stderr, #stdout

Instance Method Summary collapse

Methods inherited from BaseCommand

#config, #display_help_message, #initialize, #print_help, #print_ready_message, #ready_messages, validate_config?

Constructor Details

This class inherits a constructor from GDK::Command::BaseCommand

Instance Method Details

#helpObject



7
8
9
# File 'lib/gdk/command/restart.rb', line 7

def help
  GDK::Command::Start.new.help.gsub('gdk start', 'gdk restart')
end

#run(args = []) ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/gdk/command/restart.rb', line 11

def run(args = [])
  return true if print_help(args)

  # Stop does not support --<arg> being passed in, so we need to strip
  # them here.
  GDK::Command::Stop.new.run(args.reject { |x| x.start_with?('--') })

  # Give services a little longer to shutdown.
  sleep(3)

  GDK::Command::Start.new.run(args)
end