Bernard Kenik
2/11/2007 11:25:00 PM
On Feb 11, 11:20 am, "Erik Veenstra" <erikv...@gmail.com> wrote:
> > you need to have "rubyscript2exe.rb" in your working
> > directory and "realstuff.rb" in the parent directory of your
> > working directory.
>
> > This information is not available from the current
> > documentation.
>
> The documentation refers to the original rubyscript2exe.rb, not
> the gem version.
>
> If you use the original rubyscript2exe.rb:
>
> $ ruby rubyscript2exe.rb ...
>
> If you installed the gem, it's:
>
> $ rubyscript2exe ...
>
> Anyway, I fixed the documentation... ;]
>
Thank you for fixing the documentation.
Extract from online manual
########################################################################################################################################
a) Just Scanning, no Running
RubyScript2Exe runs the application (in a child process) and gathers
the require-d files. It's not necessary to run the complete
application when all require-s are done in the first couple of
statements. You might as well exit right after the require statements:
require "rubyscript2exe"
exit if RUBYSCRIPT2EXE.is_compiling?
Sometimes, one or more require-s are done later on, deep down in a
library (e.g. when connecting to a database in DBI). It's not a good
idea to do the above trick under this kind of circumstances. You'll
miss some libraries...
#########################################################################################################################################
when I place the above after my 'require's, this is the result.
K:\ruby\Projects\DDA\lib>df_dda.rb
K:/ruby/Projects/DDA/lib/df_dda.rb:11: uninitialized constant
RUBYSCRIPT2EXE (NameError)
When compiling, the script does exit and compiling takes much less
time.
However, if I place: "exit if defined?(REQUIRE2LIB)"
This allows the script to run to completion when invoked as a ruby
script and when compiling the script does terminate so that compiling
can proceed. The compile time seems to be above the same as the above.
This was documented in a previous version of rubyscript2exe.
I take it that it is still a valid method to prevent a script from
running after all the 'require's have occurred.