Hi,
I'd be grateful for some hints on how to install a Ruby extension library for in-house usage. The library consists of both native + Ruby code. The library will be used by a number of utility scripts that ideally would just have to be copied onto the hard drive and run.
It's not feasible to require the users to compile the extension, as it has quite a lot of dependencies (and it should also be built using VC.NET anyway). Therefore I'd like the extension to be delivered pre-built, including any run-time dependency DLLs. The platform that it should run on is (at least for now) Windows only, but I'm working to get the extension to work under linux as well.
I'll try to give a more concrete (simplified) example:
myext/myextrb.rb <= requires myext.dll
myext/myext.dll <= requires myext-dep.dll
<somepath>/myext-dep.dll <= no special dependencies
(user's should only have to use "require 'myext/myextrb'" to use the library)
Ideally I'd like to stay out of adding the myext-dep.dll to any system path, so what I've tried to do is to put it in the same directory as the other stuff, and adding the following at the very top of myextrb.rb (before "require 'myext'"):
ENV['PATH'] = ENV['PATH'] + File::PATH_SEPARATOR + File.dirname(__FILE__)
Might be hackish, but it works - any better way?
And, back to the real question: what tools can I use to make an installation script for this kind of thing? Is there already something available? Sorry it the answer's obvious, but it's my first attempt at such a thing.
Thanks in advance // Johan
Hi,
Johan Nilsson wrote:
<snip>
And, back to the real question: what tools can I use to make an installation script for this kind of thing? Is there already something available?
As long as you are on Windows only, take a look at rubyscript2exe:
http://www.erikveen.dds.nl/rubyscript2exe/index.html
I use it precisely for this kind of packaging my app into a single executable. Works like a charm. It even has a "hack on location" feature
which is extremely useful if you have installations on machines which
do not have ruby.
HTH,
-- shanko
Hi,
"Shashank Date" <sdate@everestkc.net> wrote in message news:41DBF2C4.40603@everestkc.net...
Hi,
Johan Nilsson wrote:
<snip>
And, back to the real question: what tools can I use to make an installation script for this kind of thing? Is there already something available?
As long as you are on Windows only, take a look at rubyscript2exe:
http://www.erikveen.dds.nl/rubyscript2exe/index.html
I use it precisely for this kind of packaging my app into a single executable. Works like a charm. It even has a "hack on location" feature
which is extremely useful if you have installations on machines which
do not have ruby.
Took some time, but I've now tried it and it didn't work. I get the following errors when running rubyscript2exe <myscript>.rb (posting it here in case this is something you recognize):
Gathering files...
D:\Tools\Ruby1.8.2-14\lib\ruby\1.8/ftools.rb:67:in `initialize': Permission denied - C:/DOCUME~1/jni/LOCALS~1/Temp/oldan
dnewlocation.3452/lib/nmea/nmearb.rb (Errno::EACCES)
from D:\Tools\Ruby1.8.2-14\lib\ruby\1.8/ftools.rb:67:in `open'
from D:\Tools\Ruby1.8.2-14\lib\ruby\1.8/ftools.rb:67:in `syscopy'
from D:\Tools\Ruby1.8.2-14\lib\ruby\1.8/ftools.rb:92:in `copy'
from C:\DOCUME~1\jni\LOCALS~1\Temp\tar2rubyscript.d.3452.1\rubyscript2exe\require2lib.rb:60:in `gatherlibs'
from C:\DOCUME~1\jni\LOCALS~1\Temp\tar2rubyscript.d.3452.1\rubyscript2exe\require2lib.rb:48:in `each'
from C:\DOCUME~1\jni\LOCALS~1\Temp\tar2rubyscript.d.3452.1\rubyscript2exe\require2lib.rb:48:in `gatherlibs'
from C:\DOCUME~1\jni\LOCALS~1\Temp\tar2rubyscript.d.3452.1\rubyscript2exe\require2lib.rb:47:in `catch'
from C:\DOCUME~1\jni\LOCALS~1\Temp\tar2rubyscript.d.3452.1\rubyscript2exe\require2lib.rb:47:in `gatherlibs'
from C:\DOCUME~1\jni\LOCALS~1\Temp\tar2rubyscript.d.3452.1\rubyscript2exe\require2lib.rb:44:in `each'
from C:\DOCUME~1\jni\LOCALS~1\Temp\tar2rubyscript.d.3452.1\rubyscript2exe\require2lib.rb:44:in `gatherlibs'
from C:\DOCUME~1\jni\LOCALS~1\Temp\tar2rubyscript.d.3452.1\rubyscript2exe\require2lib.rb:34
from C:\DOCUME~1\jni\LOCALS~1\Temp\tar2rubyscript.d.3452.1\rubyscript2exe\require2lib.rb:31
Copying files...
Copying D:/Tools/Ruby1.8.2-14/bin/msvcrt-ruby18.dll ...
Copying D:/Tools/Ruby1.8.2-14/bin/MSVCR71.dll ...
Copying D:/Tools/Ruby1.8.2-14/bin/ruby.exe ...
Copying D:/Tools/Ruby1.8.2-14/bin/rubyw.exe ...
Copying D:/Data/scripts/posnet/utils/logcvt/logcvt.rb ...
Creating logcvt.exe ...
C:/DOCUME~1/jni/LOCALS~1/Temp/tar2rubyscript.d.3452.1/rubyscript2exe/ev/ftools.rb:52:in `delete': Permission denied - ap
p.rb (Errno::EACCES)
from C:/DOCUME~1/jni/LOCALS~1/Temp/tar2rubyscript.d.3452.1/rubyscript2exe/ev/ftools.rb:52:in `rm_rf'
from C:/DOCUME~1/jni/LOCALS~1/Temp/tar2rubyscript.d.3452.1/rubyscript2exe/ev/ftools.rb:46:in `rm_rf'
from C:/DOCUME~1/jni/LOCALS~1/Temp/tar2rubyscript.d.3452.1/rubyscript2exe/ev/ftools.rb:45:in `each'
from C:/DOCUME~1/jni/LOCALS~1/Temp/tar2rubyscript.d.3452.1/rubyscript2exe/ev/ftools.rb:45:in `rm_rf'
from C:/DOCUME~1/jni/LOCALS~1/Temp/tar2rubyscript.d.3452.1/rubyscript2exe/ev/ftools.rb:46:in `rm_rf'
from C:/DOCUME~1/jni/LOCALS~1/Temp/tar2rubyscript.d.3452.1/rubyscript2exe/ev/ftools.rb:45:in `each'
from C:/DOCUME~1/jni/LOCALS~1/Temp/tar2rubyscript.d.3452.1/rubyscript2exe/ev/ftools.rb:45:in `rm_rf'
from C:/DOCUME~1/jni/LOCALS~1/Temp/tar2rubyscript.d.3452.1/rubyscript2exe/ev/oldandnewlocation.rb:80
from C:/DOCUME~1/jni/LOCALS~1/Temp/tar2rubyscript.d.3452.1/rubyscript2exe/ev/oldandnewlocation.rb:76
[sorry for the excess of information]
// Johan