Module: RUtilAnts::Platform::PlatformInterface

Included in:
Manager
Defined in:
lib/rUtilAnts/Platform.rb

Class Method Summary collapse

Class Method Details

.includePlatformSpecificModuleObject

Initialize the module



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/rUtilAnts/Platform.rb', line 8

def self.includePlatformSpecificModule
  # Get the OS
  require 'rbconfig'
  real_os ||= (
    host_os = RbConfig::CONFIG['host_os']
    case host_os
    when /cygwin/
      'cygwin'
    when /mswin|msys|mingw|bccwin|wince|emc/
      'windows'
    when /darwin|mac os/
      'macosx'
    when /linux/
      'linux'
    when /solaris|bsd/
      'unix'
    else
      raise RuntimeError, "Unknown os: #{host_os.inspect}"
    end
  )
  # Require the platform info
  begin
    require "rUtilAnts/Platforms/#{real_os}/PlatformInfo"
  rescue Exception
    if (!defined?(log_bug))
      require 'rUtilAnts/Logging'
      RUtilAnts::Logging::install_logger_on_object
    end
    log_bug "Current platform #{real_os} is not supported (#{$!})."
    raise RuntimeError, "Current platform #{real_os} is not supported (#{$!})."
  end
  # Include the platform specific module
  PlatformInterface.module_eval('include RUtilAnts::Platform::PlatformInfo')
end