module Bunto::Utils::Platforms

Public Instance Methods

bash_on_windows?() click to toggle source
# File lib/bunto/utils/platforms.rb, line 36
def bash_on_windows?
  RbConfig::CONFIG["host_os"] =~ %r!linux! && \
    proc_version =~ %r!microsoft!i
end
linux?() click to toggle source
# File lib/bunto/utils/platforms.rb, line 49
def linux?
  RbConfig::CONFIG["host_os"] =~ %r!linux! && \
    proc_version !~ %r!microsoft!i
end
really_windows?()

– XXX: Remove in 4.0 –

Alias for: vanilla_windows?
vanilla_windows?() click to toggle source

– Allows you to detect “real” Windows, or what we would consider “real” Windows. That is, that we can pass the basic test and the /proc/version returns nothing to us. –

# File lib/bunto/utils/platforms.rb, line 22
def vanilla_windows?
  RbConfig::CONFIG["host_os"] =~ %r!mswin|mingw|cygwin!i && \
    !proc_version
end
Also aliased as: really_windows?
windows?() click to toggle source
# File lib/bunto/utils/platforms.rb, line 43
def windows?
  vanilla_windows? || bash_on_windows?
end

Private Instance Methods

proc_version() click to toggle source
# File lib/bunto/utils/platforms.rb, line 69
def proc_version
  @cached_proc_version ||= begin
    Pathutil.new(
      "/proc/version"
    ).read
  rescue Errno::ENOENT
    nil
  end
end