Re: adding rubygem as dependency in ruby file
Hi Susanta, you mentioned I'm writing a meshup sample using SCA. Here I'm using one composite written in Ruby which requires rubygem. would you like to contribute your sample to Tuscany? Good samples are always helpful to other users. Thanks, Haleh On 9/27/07, Jean-Sebastien Delfino [EMAIL PROTECTED] wrote: Susanta Datta wrote: Jean, Thanks a lot. I'm writing a meshup sample using SCA. Here I'm using one composite written in Ruby which requires rubygem. regards Susanta Cool! I did a little more testing, as I really wanted to see a Ruby gem in action before declaring victory. Here's what I did: I installed JRuby 1.0.1. From the command line, ran jirb gem install progressbar, the progressbar Gem got installed under jruby-install/lib/ruby/gems I copied jruby-install/lib/ruby/gems to $HOME/.jruby/lib/ruby/gems. I'm running Linux, on Windows the .jruby home directory is probably somewhere under Documents And Settings. I changed SubtractServiceImpl.rb in the Tuscany calculator-script sample as follows: require 'rubygems' require 'progressbar' def subtract(n1, n2) bar = ProgressBar.new(Example progress, 50) total = 0 until total = 50 sleep(rand(2)/2.0) increment = (rand(6) + 3) bar.inc(increment) total += increment end print \n return n1 - n2 end Ran the calculator sample and saw: Example progr: 14% |o | ETA: 00:00:00 Example progr: 20% || ETA: 00:00:02 Example progr: 36% |oo | ETA: 00:00:01 Example progr: 48% |ooo | ETA: 00:00:01 Example progr: 64% |o | ETA: 00:00:00 Example progr: 80% || ETA: 00:00:00 Example progr: 96% |oo | ETA: 00:00:00 Example progr: 100% || ETA: 00:00:00 3 - 2=1.0 So I can confirm that Ruby Gems should work if you follow similar steps. Let me know how it goes... Thanks. - Original Message - From: Jean-Sebastien Delfino [EMAIL PROTECTED] To: tuscany-user@ws.apache.org Sent: Thursday, September 27, 2007 4:44 PM Subject: Re: adding rubygem as dependency in ruby file 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; nameFoo/name /Hello eof print doc return n1 - n2 end and it works, I'm getting: Hello xmlns='http://test' nameFoo/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=diffr1=580144r2=580145pathrev=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] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional
Re: adding rubygem as dependency in ruby file
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; nameFoo/name /Hello eof print doc return n1 - n2 end and it works, I'm getting: Hello xmlns='http://test' nameFoo/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. -- Jean-Sebastien - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: adding rubygem as dependency in ruby file
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; nameFoo/name /Hello eof print doc return n1 - n2 end and it works, I'm getting: Hello xmlns='http://test' nameFoo/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=diffr1=580144r2=580145pathrev=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]
Re: adding rubygem as dependency in ruby file
Susanta Datta wrote: Jean, Thanks a lot. I'm writing a meshup sample using SCA. Here I'm using one composite written in Ruby which requires rubygem. regards Susanta Cool! I did a little more testing, as I really wanted to see a Ruby gem in action before declaring victory. Here's what I did: I installed JRuby 1.0.1. From the command line, ran jirb gem install progressbar, the progressbar Gem got installed under jruby-install/lib/ruby/gems I copied jruby-install/lib/ruby/gems to $HOME/.jruby/lib/ruby/gems. I'm running Linux, on Windows the .jruby home directory is probably somewhere under Documents And Settings. I changed SubtractServiceImpl.rb in the Tuscany calculator-script sample as follows: require 'rubygems' require 'progressbar' def subtract(n1, n2) bar = ProgressBar.new(Example progress, 50) total = 0 until total = 50 sleep(rand(2)/2.0) increment = (rand(6) + 3) bar.inc(increment) total += increment end print \n return n1 - n2 end Ran the calculator sample and saw: Example progr: 14% |o | ETA: 00:00:00 Example progr: 20% || ETA: 00:00:02 Example progr: 36% |oo | ETA: 00:00:01 Example progr: 48% |ooo | ETA: 00:00:01 Example progr: 64% |o | ETA: 00:00:00 Example progr: 80% || ETA: 00:00:00 Example progr: 96% |oo | ETA: 00:00:00 Example progr: 100% || ETA: 00:00:00 3 - 2=1.0 So I can confirm that Ruby Gems should work if you follow similar steps. Let me know how it goes... Thanks. - Original Message - From: Jean-Sebastien Delfino [EMAIL PROTECTED] To: tuscany-user@ws.apache.org Sent: Thursday, September 27, 2007 4:44 PM Subject: Re: adding rubygem as dependency in ruby file 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; nameFoo/name /Hello eof print doc return n1 - n2 end and it works, I'm getting: Hello xmlns='http://test' nameFoo/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=diffr1=580144r2=580145pathrev=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] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Jean-Sebastien - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
adding rubygem as dependency in ruby file
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