Probably because your app config is in a different location than ir.exe.
Try this. Replace:
static void Main(string[] args)
{
var url = "http://www.google.com";
var engine = IronRuby.Ruby.CreateEngine();
var paths = new List<String>();
paths.Add(@"C:\DevTools\ironruby-1.0-rc1\lib");
paths.Add(@"C:\DevTools\ironruby-1.0-rc1\lib\ruby\site_ruby\1.8");
paths.Add(@"C:\DevTools\ironruby-1.0-rc1\lib\ruby\site_ruby");
paths.Add(@"C:\DevTools\ironruby-1.0-rc1\lib\ruby\1.8");
engine.SetSearchPaths(paths);
engine.ExecuteFile("../../screenscraper.rb");
var obj =
engine.Runtime.Globals.GetVariable("ScreenScraper");
var screenScraper = engine.Operations.CreateInstance(obj);
var html = engine.Operations.InvokeMember(screenScraper,
"scrape", url);
Console.WriteLine(html);
}
With:
static void Main(string[] args)
{
var url = "http://www.google.com";
var setup = ScriptRuntimeSetup.ReadConfiguration();
var scriptRuntime = Ruby.CreateRuntime(setup);
var engine = Ruby.GetEngine(Runtime);
//the following line might not be needed in this case
var context = Ruby.GetExecutionContext(Engine);
engine.ExecuteFile("../../screenscraper.rb");
var obj =
engine.Runtime.Globals.GetVariable("ScreenScraper");
var screenScraper = engine.Operations.CreateInstance(obj);
var html = engine.Operations.InvokeMember(screenScraper,
"scrape", url);
Console.WriteLine(html);
}
-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Mohammad Azam
Sent: Monday, March 01, 2010 7:52 AM
To: [email protected]
Subject: Re: [Ironruby-core] Open-Uri Path in App.Config
I copied the ironruby config file into my application's config file and removed
all the path variables from my application but it did not work.
Then I added the "C:\devtools\ironruby-1.0-rc1\lib\ironruby" path and removed
the app.config and then it worked out.
Any ideas that why even copy pasting the app.config from ironruby to my
application app.config did not work?
Jim Deville wrote:
> You need to include the rest of the ironruby search paths. For example.
> "C:\devtools\ironruby-1.0-rc1\lib\ironruby"
>
> Also, the ir.exe.config from c:\devtools\ironruby-1.0-rc1\bin should be
> setup exactly like you want. If you provide that to your app it should
> just work. That's why we install that config file.
>
> JD
--
Posted via http://www.ruby-forum.com/.
_______________________________________________
Ironruby-core mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/ironruby-core
_______________________________________________
Ironruby-core mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/ironruby-core