I can't get RUBYSCRIPT2EXE_LIB to work

P

Phlip

Erik et al:

I need to package MiniRubyWiki. When I run it, with a healthy chain of
'require's into its modules, rubyscript2exe can't read them.

I need to add many more .rb files, so pages can load them dynamically, so I
add everything to a big list like

RUBYSCRIPT2EXE_LIB = [
'cgi-bin/conf/validateWikiConfig.rb',
'cgi-bin/MiniRubyWiki.rb',
....
'YamlToHtml.rb',
'cgi-bin/testResult.xslt',
'cgi-bin/transcludeXML.xslt',
]

rubyscript2exe seems to ignore this list, and ./miniWiki.exe --eee-list does
not print them out.

Any ideas? I put RUBYSCRIPT2EXE_LIB into the lead file, miniWiki.rb, above
the first require...
 
A

Alex Fenton

Phlip said:
Erik et al:

I need to package MiniRubyWiki. When I run it, with a healthy chain
of 'require's into its modules, rubyscript2exe can't read them.

You should normally just need to create a runnable .rb that requires the
libraries in the normal way. If you want to be able to create a
rubyscript.exe from within your project tree (ie not loading your custom
library from ruby's standard library directories), just prefix 'lib' to
ruby's library load path before doing the requires.

$:.unshift('lib')

when rs2exe runs, it should notice these requires of your custom library
files and bundle them in the package.
I need to add many more .rb files, so pages can load them
dynamically, so I add everything to a big list like

The circumstances you should need to use RUBYSCRIPT2EXE_LIB are usually
only when the
- libraries, such as adapters for specific databases, are loaded
dynamically after program startup, eg with autoload, such as when a
connection is made
- files are required conditionally during program execution
if today.is_monday?
require 'medication/prozac'
else
require 'medication/paracetamol'
end
- you want to bundle files that aren't ruby scripts into the lib tree. I
use this to bundle .xpm icons into the library tree; this isn't necessarily
the best way of bundling auxiliary files though.
Any ideas? I put RUBYSCRIPT2EXE_LIB into the lead file, miniWiki.rb,
above the first require...

When you run rubyscript2exe.rb it should list what it's bundled - what
output do you get?

Eric helped me with some of these probs for my project Weft; you might
find some ideas in there
runnable ruby script, ready to be packaged using rubyscript2exe.rb -
does the requires, exits if an exe is being made
http://rubyforge.org/cgi-bin/viewcv...weft-qda&content-type=text/vnd.viewcvs-markup
rubyscriptfiles.rb - used when converting into a .exe
http://rubyforge.org/cgi-bin/viewcv...weft-qda&content-type=text/vnd.viewcvs-markup
Rakefile - automates creation of exe - see the :executable target
http://rubyforge.org/cgi-bin/viewcv...weft-qda&content-type=text/vnd.viewcvs-markup

a
 
P

Phlip

Alex said:
You should normally just need to create a runnable .rb that requires the
libraries in the normal way.

Right. It's an application, not a library, so we have the equivalent of this
structure:

../main.rb
../src/module.rb
If you want to be able to create a
rubyscript.exe from within your project tree (ie not loading your custom
library from ruby's standard library directories), just prefix 'lib' to
ruby's library load path before doing the requires.

$:.unshift('lib')

Ah - I didn't notice the system put them in there. So when I say...

$:.unshift('src')
require 'module.rb'

....Ruby inside the EXE still complains no such file to load --
src/module.rb.

Why does Ruby insist on looking for src/module.rb when lib/module.rb is also
an option?

So I dyke out the second unshift:

$:.unshift('src') if not defined?(RUBYSCRIPT2EXE)
require 'module.rb'

Now the program gets past the require, and I get all sorts of other errors,
probably indicating the program can't see all the data files.

I don't understand why this stuff worked a year ago, even if I had a flatter
folder hierarchy. It found files in the current folder.

Thanks for the tip.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,188
Messages
2,571,002
Members
47,591
Latest member
WoodrowBut

Latest Threads

Top