mirror of
https://github.com/envmodules/modules.git
synced 2026-06-10 00:56:30 +08:00
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.
18 lines
803 B
Ruby
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
|