On this page:
By default, JRuby is not included in the modeling tool, however, you can add it manually. In addition, you can also install Gems for JRuby.
Adding JRuby to the modeling tool
To add JRuby to the modeling tool
- Copy the JRuby engine jar file (e.g. jruby-complete-126.96.36.199.jar) to <tool_installation_directory>\plugins\com.nomagic.magicdraw.automaton\lib.
Add the entry below to the file <tool_installation_directory>\plugins\com.nomagic.magicdraw.automaton\enginedescriptor.xml.
Append a library entry in file <tool_installation_directory>\plugins\com.nomagic.magicdraw.automaton\plugin.xml.
Installing Gems for JRuby
To install a gem for Ruby engine inside MagicDraw
- Open the command line.
- Go to the folder <tool_installation_directory>\plugins\com.nomagic.magicdraw.automaton\lib.
- Enter the following command to install a gem.
- <version> is the JRuby version, e.g. 188.8.131.52.
- <gem name> is the name of a gem.
- The three dots (...) mean that you can type a list of gem names there.
Once the gem has been installed, you can use it in the MagicDraw Macro Engine. The example below shows how to create a macro that can generate a unique ID by using a gem.
To install a gem for the existing Ruby environment on your machine and use it in the Macro Engine
- Add the following properties to specify the home and library of JRuby in <tool_installation_directory>/bin/mduml.properties under JAVA_ARGS section (assuming you have JRuby installed in C:/jruby-184.108.40.206 on your machine).
2. Change the JRuby library path to navigate to your jruby.jar in <tool_installation_directory>/plugins/com.nomagic.magicdraw.automaton/plugin.xml.
- The command in this section should run in <tool_installation_directory>/plugins/com.nomagic.magicdraw.automaton/engine.
- If you have a whitespace in the property file path, you need to type a double quote to wrap both the property and its value, for each property, for example:
“-Djruby.home=C:/my white space/jruby-220.127.116.11" “-Djruby.lib=C:/my white space/jruby-18.104.22.168/lib”