Forum: IronRuby Executing an Ironruby file from a console app.

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
5b9872f3076db04cb2ffb516091d80d0?d=identicon&s=25 Paul Cowan (dagda1)
on 2009-03-21 21:33
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
1e39a948a58f4569c53d971c2e120920?d=identicon&s=25 Ivan Porto carrero (casualjim)
on 2009-03-21 23:50
(Received via mailing list)
You can set load paths.

var engine = Ruby.CreateEngine();
var context = Ruby.GetExecutionContext(engine);
context.Loader.SetPaths("C:\ironruby\lib");
Cb51033949ffccd982ae32c9f890f25a?d=identicon&s=25 Tomas Matousek (Guest)
on 2009-03-22 04:51
(Received via mailing list)
ScriptEngine.SetSearchPaths should also work.

Tomas

From: ironruby-core-bounces@rubyforge.org
[mailto:ironruby-core-bounces@rubyforge.org] On Behalf Of Ivan Porto
Carrero
Sent: Saturday, March 21, 2009 3:41 PM
To: ironruby-core@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@ruby-forum.com<mailto:lists@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@rubyforge.org<mailto:Ironruby-core@rubyforge.org>
http://rubyforge.org/mailman/listinfo/ironruby-core
This topic is locked and can not be replied to.