Jean-Sebastien Delfino wrote:
Susanta Datta wrote:
Hi, my composite has a ruby implementation. In my Ruby file I require "rubygems" and some other ruby files. How do I set those folder and files in my sca java project ? I tried with calculator script in eclipse IDE. I works fine but if I add new a "require rubygems" in the .rb file I get an error <unknown>:19: no such file to load -- rubygems (LoadError).

Any idea where and how do I configure Ruby dependencies in the java sca project under eclipse?

thanks a lot Susanta

I am looking into this. To test what happens with "require" statements I changed one of our scripting samples: http://svn.apache.org/repos/asf/incubator/tuscany/java/sca/samples/calculator-script/src/main/resources/calculator/SubtractServiceImpl.rb

and added a "require" as follows:
require 'rexml/document'
include REXML

def subtract(n1, n2)
   doc = Document.new <<-eof
     <Hello xmlns="http://test";>
       <name>Foo</name>
     </Hello>
   eof
   print doc
   return n1 - n2
end

and it works, I'm getting:
<Hello xmlns='http://test'>
 <name>Foo</name>
</Hello>
3 - 2=1.0

REXML is part of the jruby distribution. Next, I'm going to try to require another .rb file in the same project and will let u know what I find.


I made a small change to our JRuby integration code to add the path to the rubygems hiding inside jruby-complete-1.0.jar to the Jruby loadpath. I also made a small change to improve the Exception reporting, you should now see the JRuby exception messages.

The changes are available in SVN revision r580145 of the Tuscany trunk, see:
http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/implementation-script/src/main/java/org/apache/tuscany/sca/implementation/script/engines/TuscanyJRubyScriptEngine.java?view=diff&r1=580144&r2=580145&pathrev=580145

This should allow you to "require 'rubygems'".

You may also have to configure your environment as described in the JRuby Gotchas section there:
http://www.headius.com/jrubywiki/index.php/Java_Integration#Embedding_with_Bean_Scripting_Framework

Why gems are you using? Any Rails by any chance? I think it would be really cool to show Rails working with SCA...

Hope this helps.

--
Jean-Sebastien


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to