Files
modules/init/ruby.rb.in
Xavier Delaruelle 519d08e98d init: shell scripts now rely on autoinit command
Make use of autoinit module command to initialize module command and its
initial surrounding environment (default value for MODULESHOME,
MODULEPATH, LOADEDMODULES and parse of init/.modulespath).

Then if compatibility version is currently activated redefined the
module command to point to the compat binary. But the compat version
will benefit from the surrounding environment initialization made by
autoinit.

With this change, activated compatibility version will also get its
environment initialized by the init/modulerc file whereas before this
change only the main version was affected by this setup file.
2017-10-23 22:35:27 +02:00

18 lines
803 B
Ruby

# define module command and surrounding initial environment (default value
# for MODULESHOME, MODULEPATH, LOADEDMODULES and parse of init/.modulespath)
eval `@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@ 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@ end
@compatversion@ end
@compatversion@end