summaryrefslogtreecommitdiff
path: root/spec/support/platform_helpers.rb
blob: a03a0e06009100b484dbd8986202777207de9718 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
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