Class: Server::Sys
- Inherits:
-
Object
- Object
- Server::Sys
- Defined in:
- lib/server/sys.rb
Class Method Summary collapse
- .init ⇒ Object
- .running_as_sudo? ⇒ Boolean
- .running_on_windows? ⇒ Boolean
- .sysdir_writable? ⇒ Boolean
Class Method Details
.init ⇒ Object
8 9 10 11 12 |
# 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? ⇒ Boolean
21 22 23 24 25 26 |
# 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? ⇒ Boolean
14 15 16 17 18 19 |
# 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? ⇒ Boolean
28 29 30 31 32 33 34 35 36 |
# 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 |