You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi,
I would like to initialize Environment Modules from a ruby script.
I have tried to import the file "/usr/share/modules/init/ruby.rb".
After that, I can't call the module function because it is a reserved keyword in ruby.
To Reproduce
Steps to reproduce the behavior:
1 - Create a test.rb script with the following content
# Load the Environment Modules system into Ruby
require '/usr/share/modules/init/ruby.rb'
# Example usage: Load a module
module('load python')
2 - Execute the script
$ruby test.rb
test.rb:5: syntax error, unexpected '\n', expecting '.' or &. or :: or '['
module('load python')
Activity
xdelaruelle commentedon Aug 22, 2024
Hello Florian,
As you say,
moduleis a specific keyword in Ruby. So module is defined for this language as amodulemethod from theENVModuleclass.Some usage example:
Output of this script
I will update the documentation to provide this example.
[-]Ruby initialization script does not work[/-][+]How to run `module` from Ruby script[/+]doc: desc. in man how to init Modules in Ruby script