class Server::Sys

Public Class Methods

init() click to toggle source
# File lib/server/sys.rb, line 8
def self.init
  self.running_on_windows?
  self.running_as_sudo?
  self.sysdir_writable?
end
running_as_sudo?() click to toggle source
# File lib/server/sys.rb, line 21
def self.running_as_sudo?
  if( Process.euid == 0 )
    $Log.fatal("Cowardly avoiding sudo. Re-run without sudo.")
    abort()
  end
end
running_on_windows?() click to toggle source
# File lib/server/sys.rb, line 14
def self.running_on_windows?
  if RbConfig::CONFIG['host_os'] =~ /mswin|windows|cygwin/i
    $Log.fatal("This gem and its tools are currently useless for Windows users. Maybe someday...")
    abort()
  end
end
sysdir_writable?() click to toggle source
# File lib/server/sys.rb, line 28
def self.sysdir_writable?
  sysdir = Pathname.new(Server.sys_dir)

  $Log.info("#{sysdir} is writable") if sysdir.writable?
  $Log.fatal("#{sysdir} is not writable!") if !sysdir.writable?
  abort() if !sysdir.writable?

  sysdir.writable?
end