class ENVModule def ENVModule.module(*args) if args[0].kind_of?(Array) then args = args[0].join(' ') else args = args.join(' ') end eval `@TCLSH@ @libexecdir@/modulecmd.tcl ruby #{args}` end end ENV['MODULESHOME'] = '@prefix@' if !ENV.has_key?('MODULEPATH') then if File.readable?('@initdir@/.modulespath') then ENV['MODULEPATH'] = File.open('@initdir@/.modulespath','r').readlines.reject {|e| e =~ /^(\s*#|$)/}.select {|s| s.sub!(/^\s*(.*?)[\s#].*$/, '\\1').chop! }.join(':') else ENV['MODULEPATH'] = '' end end if !ENV.has_key?('LOADEDMODULES') then ENV['LOADEDMODULES'] = '' end # load modulerc only if module environment is empty if File.readable?('@initdir@/modulerc') and ENV['MODULEPATH'].empty? and ENV['LOADEDMODULES'].empty? then ENVModule.module('source', '@initdir@/modulerc') end