Files
modules/init/ruby.rb.in
2018-01-03 08:33:22 +01:00

43 lines
1.7 KiB
Ruby

# define modules runtine quarantine configuration
@setquarvars@ENV['MODULES_RUN_QUARANTINE'] = '@RUN_QUARANTINE@'
@setquarvars@@ENV['RUNENV_VAR'] = 'RUNENV_VAL'@
@notsetquarvars@#ENV['MODULES_RUN_QUARANTINE'] = 'ENVVARNAME'
@notsetquarvars@
# setup quarantine if defined
_mlre = ''
if ENV.has_key?('MODULES_RUN_QUARANTINE') then
ENV['MODULES_RUN_QUARANTINE'].split(' ').each do |_mlv|
if _mlv =~ /^[A-Za-z_][A-Za-z0-9_]*$/ then
if ENV.has_key?(_mlv) then
_mlre << _mlv + "_modquar='" + ENV[_mlv].to_s + "' "
end
_mlrv = 'MODULES_RUNENV_' + _mlv
_mlre << _mlv + "='" + ENV[_mlrv].to_s + "' "
end
end
unless _mlre.empty?
_mlre = 'env ' + _mlre
end
end
# define module command and surrounding initial environment (default value
# for MODULESHOME, MODULEPATH, LOADEDMODULES and parse of init/.modulespath)
eval `#{_mlre}@TCLSH@ @libexecdir@/modulecmd.tcl ruby autoinit`
@compatversion@
@compatversion@# redefine module command if compat version has been activated
@compatversion@if ENV['MODULES_USE_COMPAT_VERSION'] == '1' then
@compatversion@ ENV['MODULES_CMD'] = '@libexecdir@/modulecmd-compat'
@compatversion@ class ENVModule
@compatversion@ def ENVModule.module(*args)
@compatversion@ if args[0].kind_of?(Array) then
@compatversion@ args = args[0].join(' ')
@compatversion@ else
@compatversion@ args = args.join(' ')
@compatversion@ end
@compatversion@ eval `@libexecdir@/modulecmd-compat ruby #{args}`
@compatversion@ # return value as done on new main version
@compatversion@ return true
@compatversion@ end
@compatversion@ end
@compatversion@end