Module: J1::Utils::Platforms

Extended by:
Platforms
Included in:
Platforms
Defined in:
lib/j1/utils/platforms.rb

Instance Method Summary collapse

Instance Method Details

#bash_on_windows?Boolean

Returns:

  • (Boolean)


36
37
38
39
# File 'lib/j1/utils/platforms.rb', line 36

def bash_on_windows?
  RbConfig::CONFIG["host_os"] =~ %r!linux! && \
    proc_version =~ %r!microsoft!i
end

#linux?Boolean

Returns:

  • (Boolean)


49
50
51
52
# File 'lib/j1/utils/platforms.rb', line 49

def linux?
  RbConfig::CONFIG["host_os"] =~ %r!linux! && \
    proc_version !~ %r!microsoft!i
end

#vanilla_windows?Boolean Also known as: really_windows?

– 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. –

Returns:

  • (Boolean)


22
23
24
25
# File 'lib/j1/utils/platforms.rb', line 22

def vanilla_windows?
  RbConfig::CONFIG["host_os"] =~ %r!mswin|mingw|cygwin!i && \
    !proc_version
end

#windows?Boolean

Returns:

  • (Boolean)


43
44
45
# File 'lib/j1/utils/platforms.rb', line 43

def windows?
  vanilla_windows? || bash_on_windows?
end