From: Vassilis Rizopoulos Date: 2007-10-26T19:15:19+09:00 Subject: Re: Ruby and C# Integration Jayson Bailey wrote: > Does anyone know of a way or have any links for how to integrate c# and > ruby? I'd like to be able to write ruby scripts for testing and have > them talk to my c# program. > > Thanks. > I've been wrestling this problem quite a bit lately. The Ruby Bridge plugin by the Saphire Steel guys looks pretty good but it has one drawback: It expects the interpreter to be installed somewhere. This makes distribution of your app a two step process (install ruby, install app). This has proven a reason *not* to use the plugin in my work, even though it gives you complete access to the Ruby objects. I opted for making an exe out of my ruby code (with rubyscript2exe) and using System.Diagnostics.Process to call it. Interaction is in one case through stdin, stdout (make sure you use the events of Process and read asynchronously otherwise the stdout buffer gets full and blocks the process) . In the other case it was trivial (from the Ruby side...from the C# side it took a bit more - but then I am more accomplished in Ruby than C#) to setup a TCP connection and pipe data through. One crazy idea that comes to mind is to make the inner Ruby app host a webserver and imlpement a REST interface to call from the C# code. More of an intresting exercise than a very practical implementation method I guess. Until IronRuby reaches 1.0Cheers, V.- -- http://www.braveworld.net/riva