To install a gem for Ruby engine inside MagicDraw
java -jar jruby-complete-<version>.jar -S gem install [--user-install] <gem name1> <gem name2> ... |
|
Once the gem has been installed, you can use it in MagicDraw Macro Engine, for example
require 'java' require 'rubygems' require 'uuid' Application = com.nomagic.magicdraw.core.Application uuid = UUID.new Application.getInstance().getGUILog().log(uuid.generate); |
The above example 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 Macro Engine
-Djruby.home\="C:/jruby-1.5.3" -Djruby.lib\="C:/jruby-1.5.3/lib" |
For example:
..JAVA_ARGS=-Xmx800M -Djruby.home\="C:/jruby-1.5.3" -Djruby.lib\="C:/jruby-1.5.3/lib" |
2. Change the JRuby library path to navigate to your jruby.jar in <MDdir>/plugins/com.nomagic.magicdraw.automaton/plugin.xml.
... <library name="c:/jruby-1.5.3/lib/jruby.jar"/> |
|