Michael Delaney
2009-Jul-30  14:12 UTC
[Ironruby-core] updating the search paths dynamically in script
hi, i''ve been including my libs using the RUBYLIB env variable, doing SET RUBYLIB=''some path'' then running ir program.rb and it now has access to the files in ''some path'' i also tried to do this dynamically in the ruby script using ''system''. i.e. system ''SET RUBYLIB=''some path'''' require ''some.dll'' (where that file is in the path above''. but it doesnt find the file. i assume ir is setting up the search paths when it starts up, is there anyway to achieve? what i want is to be able to include a ruby file in my C# project, which can include all the dll''s in the projects bin easily. i guess i could just traverse the directory and do a require ''file'' but the RUBYLIB path seems more flexible. -- Posted via http://www.ruby-forum.com/.
Michael Delaney
2009-Jul-30  14:18 UTC
[Ironruby-core] updating the search paths dynamically in script
ok, i managed to get this to work. $: << "some path" require ''some.dll'' not sure if its recommended.. -- Posted via http://www.ruby-forum.com/.
Ivan Porto Carrero
2009-Jul-30  14:34 UTC
[Ironruby-core] updating the search paths dynamically in script
$LOAD_PATH << "./lib"will add lib to the end of the list giving
other
libraries precedence
$LOAD_PATH.unshift("./lib")
will add the lib folder at the start of the list making it take precedence
over other libraries
a shortcut for $LOAD_PATH is $:
$: << "./lib"
$:.unshift("./lib")
---
Met vriendelijke groeten - Best regards - Salutations
Ivan Porto Carrero
Blog: http://flanders.co.nz
Twitter: http://twitter.com/casualjim
Author of IronRuby in Action (http://manning.com/carrero)
On Thu, Jul 30, 2009 at 4:12 PM, Michael Delaney <lists at
ruby-forum.com>wrote:
> hi,
>
> i''ve been including my libs using the RUBYLIB env variable, doing
> SET RUBYLIB=''some path''
>
> then running ir program.rb and it now has access to the files in
''some
> path''
>
> i also tried to do this dynamically in the ruby script using
''system''.
>
> i.e.
>
> system ''SET RUBYLIB=''some path''''
> require ''some.dll''   (where that file is in the path
above''.
>
> but it doesnt find the file. i assume ir is setting up the search paths
> when it starts up, is there anyway to achieve?
>
>
> what i want is to be able to include a ruby file in my C# project, which
> can include all the dll''s in the projects bin easily. i guess i
could
> just traverse the directory and do a require ''file'' but
the RUBYLIB path
> seems more flexible.
> --
> 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/20090730/4aa7ccf6/attachment.html>