lib/cli/ui/os.rb in cli-ui-1.4.0 vs lib/cli/ui/os.rb in cli-ui-1.5.0
- old
+ new
@@ -1,19 +1,23 @@
+require 'rbconfig'
+
module CLI
module UI
module OS
# Determines which OS is currently running the UI, to make it easier to
# adapt its behaviour to the features of the OS.
def self.current
- @current_os ||= case RUBY_PLATFORM
+ @current_os ||= case RbConfig::CONFIG['host_os']
when /darwin/
Mac
when /linux/
Linux
- when /mingw32/
- Windows
else
- raise "Could not determine OS from platform #{RUBY_PLATFORM}"
+ if RUBY_PLATFORM !~ /cygwin/ && ENV['OS'] == 'Windows_NT'
+ Windows
+ else
+ raise "Could not determine OS from host_os #{RbConfig::CONFIG["host_os"]}"
+ end
end
end
class Mac
class << self