Paul Cowan
2009-Mar-21 20:33 UTC
[Ironruby-core] Executing an Ironruby file from a console app.
Hi all, I have the following ruby code which runs in a console application: require File.dirname(__FILE__) + ''/lib/horn'' require File.dirname(__FILE__) + ''/lib/dsl'' The file is named hornbuild.rb. The main ruby file has a require directive for this hornbuild.rb like so: require ''hornbuild'' I then execute the ruby file like this: var engine = Ruby.CreateEngine(); engine.ExecuteFile(buildFilePath); The problem is that I can only get this scenario to work by copying the hornbuild.rb file and lib folder into the bin directory of the console application. Can I not put these files in the gems folder or something so they are globally accessible. If so, how can I achieve this? Cheers Paul -- Posted via http://www.ruby-forum.com/.
Ivan Porto Carrero
2009-Mar-21 22:40 UTC
[Ironruby-core] Executing an Ironruby file from a console app.
You can set load paths.
var engine = Ruby.CreateEngine();
var context = Ruby.GetExecutionContext(engine);
context.Loader.SetPaths("C:\ironruby\lib");
On Sat, Mar 21, 2009 at 9:33 PM, Paul Cowan <lists at ruby-forum.com>
wrote:
> Hi all,
>
> I have the following ruby code which runs in a console application:
>
> require File.dirname(__FILE__) + ''/lib/horn''
> require File.dirname(__FILE__) + ''/lib/dsl''
>
> The file is named hornbuild.rb.
>
> The main ruby file has a require directive for this hornbuild.rb like
> so:
>
> require ''hornbuild''
>
> I then execute the ruby file like this:
>
> var engine = Ruby.CreateEngine();
> engine.ExecuteFile(buildFilePath);
>
> The problem is that I can only get this scenario to work by copying the
> hornbuild.rb file and lib folder into the bin directory of the console
> application.
>
> Can I not put these files in the gems folder or something so they are
> globally accessible.
>
> If so, how can I achieve this?
>
> Cheers
>
> Paul
> --
> Posted via http://www.ruby-forum.com/.
> _______________________________________________
> Ironruby-core mailing list
> Ironruby-core at rubyforge.org
> http://rubyforge.org/mailman/listinfo/ironruby-core
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://rubyforge.org/pipermail/ironruby-core/attachments/20090321/84e6a08e/attachment.html>
Tomas Matousek
2009-Mar-22 03:30 UTC
[Ironruby-core] Executing an Ironruby file from a console app.
ScriptEngine.SetSearchPaths should also work.
Tomas
From: ironruby-core-bounces at rubyforge.org [mailto:ironruby-core-bounces at
rubyforge.org] On Behalf Of Ivan Porto Carrero
Sent: Saturday, March 21, 2009 3:41 PM
To: ironruby-core at rubyforge.org
Subject: Re: [Ironruby-core] Executing an Ironruby file from a console app.
You can set load paths.
var engine = Ruby.CreateEngine();
var context = Ruby.GetExecutionContext(engine);
context.Loader.SetPaths("C:\ironruby\lib");
On Sat, Mar 21, 2009 at 9:33 PM, Paul Cowan <lists at
ruby-forum.com<mailto:lists at ruby-forum.com>> wrote:
Hi all,
I have the following ruby code which runs in a console application:
require File.dirname(__FILE__) + ''/lib/horn''
require File.dirname(__FILE__) + ''/lib/dsl''
The file is named hornbuild.rb.
The main ruby file has a require directive for this hornbuild.rb like
so:
require ''hornbuild''
I then execute the ruby file like this:
var engine = Ruby.CreateEngine();
engine.ExecuteFile(buildFilePath);
The problem is that I can only get this scenario to work by copying the
hornbuild.rb file and lib folder into the bin directory of the console
application.
Can I not put these files in the gems folder or something so they are
globally accessible.
If so, how can I achieve this?
Cheers
Paul
--
Posted via http://www.ruby-forum.com/.
_______________________________________________
Ironruby-core mailing list
Ironruby-core at rubyforge.org<mailto:Ironruby-core at rubyforge.org>
http://rubyforge.org/mailman/listinfo/ironruby-core
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://rubyforge.org/pipermail/ironruby-core/attachments/20090321/3276ff3f/attachment.html>