module OS
Utility class to determine the underlying operating system.
Public Class Methods
linux?()
click to toggle source
# File lib/fluent/plugin/os.rb, line 22 def self.linux? unix? and !mac? end
mac?()
click to toggle source
# File lib/fluent/plugin/os.rb, line 14 def self.mac? (/darwin/ =~ RUBY_PLATFORM) != nil end
os_name_ubuntu?()
click to toggle source
# File lib/fluent/plugin/os.rb, line 30 def self.os_name_ubuntu? os_name = 'not_found' file_name = '/etc/os-release' if File.exists?(file_name) IO.foreach(file_name).each do |line| if line.start_with?('ID=') os_name = line.split('=')[1].strip end end else logger.info('Unknown linux distribution detected') end os_name == 'ubuntu' ? true : false rescue StandardError => e log.error "Unable to detect ubuntu platform due to: #{e.message}" false end
ubuntu?()
click to toggle source
# File lib/fluent/plugin/os.rb, line 26 def self.ubuntu? linux? and os_name_ubuntu? end
unix?()
click to toggle source
# File lib/fluent/plugin/os.rb, line 18 def self.unix? !OS.windows? end
windows?()
click to toggle source
# File lib/fluent/plugin/os.rb, line 10 def self.windows? (/cygwin|mswin|mingw|bccwin|wince|emx/ =~ RUBY_PLATFORM) != nil end