Class: Restart

Inherits:
Object
  • Object
show all
Defined in:
lib/yodel/command/restart.rb

Class Method Summary collapse

Class Method Details

.can_restart?Boolean

Returns:

  • (Boolean)


4
5
6
# File 'lib/yodel/command/restart.rb', line 4

def self.can_restart?
  `uname -a` =~ /Darwin/
end

.restart!Object



8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/yodel/command/restart.rb', line 8

def self.restart!
  Feedback.report('starting', 'dns server')
  if `sudo launchctl list` =~ /\d+.+com.yodelcms.dns$/
    `sudo launchctl unload /Library/LaunchDaemons/com.yodelcms.dns.plist`
  end
  `sudo launchctl load /Library/LaunchDaemons/com.yodelcms.dns.plist`
  
  Feedback.report('starting', 'web server')
  if `sudo launchctl list` =~ /\d+.+com.yodelcms.server$/
    `sudo launchctl unload /Library/LaunchDaemons/com.yodelcms.server.plist`
  end
  `sudo launchctl load /Library/LaunchDaemons/com.yodelcms.server.plist`
end