class Aruba::Platforms::WindowsEnvironmentVariables
# => nil
env[“PATH”]
# => “.;.bin;c:rubysruby-2.1.6-p336bin;”
env[“Path”]
}
APPDATA“ => ”C:\Users\blorf\AppData\Roaming“, .…
”ANSICON_DEF“=>”7“,
”ANSICON“=>”119x1000 (119x58)“,
”C:\ProgramData“,
”ALLUSERSPROFILE“=>
# => {
env_copy = ENV.to_hash
@example But if you copy the ENV to a hash, Ruby treats the keys as case sensitive:<br><br>ENV # => ”.;.bin;c:rubysruby-2.1.6-p336bin;“<br>ENV # => ”.;.bin;c:rubysruby-2.1.6-p336bin;“
values no matter the case of the key:
@example If you access environment variables through ENV, you can access
C:>Path=.;.bin;c:rubysruby-2.1.6-p336bin;
C:>set PATH
C:>Path=.;.bin;c:rubysruby-2.1.6-p336bin;
C:>set Path
@example Setting Windows environment variables using mixed case
with upper-case keys will always work. See the following examples.
upper-case so that aruba is ensured that accessing environment variables
To work around this we turn all of the environment variable keys to
Windows is case-insensitive when it accesses its environment variables.
def self.hash_from_env
def self.hash_from_env upcase_env(ENV) end
def self.upcase_env(env)
def self.upcase_env(env) env.to_h.transform_keys { |k| k.to_s.upcase } end
def [](name)
def [](name) super(name.upcase) end
def []=(name, value)
def []=(name, value) super(name.upcase, value) end
def append(name, value)
def append(name, value) super(name.upcase, value) end
def delete(name)
def delete(name) super(name.upcase) end
def fetch(name, default = UnixEnvironmentVariables::UNDEFINED)
def fetch(name, default = UnixEnvironmentVariables::UNDEFINED) super(name.upcase, default) end
def initialize(env = ENV)
def initialize(env = ENV) super(upcase_env env) end
def key?(name)
def key?(name) super(name.upcase) end
def prepend(name, value)
def prepend(name, value) super(name.upcase, value) end
def upcase_env(env)
def upcase_env(env) self.class.upcase_env(env) end
def update(other_env, &block)
def update(other_env, &block) super(upcase_env(other_env), &block) end