# filename: uuid_sample.py from java.lang import System from org.jruby.embed import ScriptingContainer c = ScriptingContainer() paths = [System.getProperty("user.dir") + "/jython/lib/jruby/1.8/gems/uuidtools-2.1.1/lib"] c.setLoadPaths(paths) c.runScriptlet("require 'rubygems'; require 'uuidtools'") print c.runScriptlet("UUIDTools::UUID.timestamp_create")
# filename: redbridge_cucumber.py import sys from java.io import StringWriter from java.lang import System from org.jruby.embed import ScriptingContainer, PathType, EvalFailedException c = ScriptingContainer() feature = [sys.argv[1]] c.setArgv(feature) errors = StringWriter() c.setError(errors) path = "ENV['GEM_PATH']='" + System.getProperty("user.dir") + "/jython/lib/jruby/1.8'" c.runScriptlet(path) try: c.runScriptlet(PathType.ABSOLUTE, System.getProperty("user.dir") + "/jython/lib/jruby/1.8/bin/cucumber") except EvalFailedException, err: print "Oops, Cuke did ", errors