summaryrefslogtreecommitdiff
path: root/spec/support/platform_helpers.rb
blob: 735cc8fb2a19fa4159bc6eba4f4f11b72611e4d6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
def windows?
  !!(RUBY_PLATFORM =~ /mswin|mingw|windows/)
end

def unix?
  !windows?
end

if windows?
  LINE_ENDING = "\r\n".freeze
  ECHO_LC_ALL = "echo %LC_ALL%".freeze
else
  LINE_ENDING = "\n".freeze
  ECHO_LC_ALL = "echo $LC_ALL".freeze
end

def root?
  return false if windows?

  Process.euid == 0
end