Sha256: e2155bafe92ae1b725b4fe2fa5fc84b5f13e176f3010afe8945e3fea2189a289
Contents?: true
Size: 660 Bytes
Versions: 79
Compression:
Stored size: 660 Bytes
Contents
require 'mspec/guards/guard' class Object def env env = "" if SpecGuard.windows? env = Hash[*`cmd.exe /C set`.split("\n").map { |e| e.split("=", 2) }.flatten] else env = Hash[*`env`.split("\n").map { |e| e.split("=", 2) }.flatten] end env end def windows_env_echo(var) `cmd.exe /C ECHO %#{var}%`.strip end def username user = "" if SpecGuard.windows? user = windows_env_echo('USERNAME') else user = `whoami`.strip end user end def home_directory return ENV['HOME'] unless SpecGuard.windows? windows_env_echo('HOMEDRIVE') + windows_env_echo('HOMEPATH') end end
Version data entries
79 entries across 55 versions & 2 rubygems