RubyScript2EXE Not Functioning

  • Thread starter Richard Manning
  • Start date
R

Richard Manning

I've just downloaded Erik Veenstra's RubyScript2EXE, but it does not
seem to work correctly at all. Here's what I've done:

1. I downloaded the latest rubyscript2exe.rb to my working folder, with
the .RB to be packaged (in this case, hello-world.rb).

2. I opened a command prompt, navigated to the working folder, and ran
the command "ruby rubyscript2exe.rb hello-world.rb".

3. There is a very brief pause, and the line "Tracing hello-world ..."
appears. Whatever process that seemed briefly to be running appears to
quit, and a glance at the Windows Task Manager shows no activity. I'm
left with just a blank line, as though the program is asking for input,
though nothing I type elicits a response except CTRL-C, at which point
the following is spit out:

Couldn't execute this command (rc=256):
c:\ruby\bin\ruby -r 'rubyscript2exe.rb' -I
'C:/DOCUME~1/Owner/LOCALS~1/Temp/tar2
rubyscript.d.3712.1/rubyscript2exe' -I
'C:/DOCUME~1/Owner/LOCALS~1/Temp/tar2ruby
script.d.3712.1' -I 'c:/ruby/lib/ruby/site_ruby/1.8' -I
'c:/ruby/lib/ruby/site_r
uby/1.8/i386-msvcrt' -I 'c:/ruby/lib/ruby/site_ruby' -I
'c:/ruby/lib/ruby/1.8' -
I 'c:/ruby/lib/ruby/1.8/i386-mswin32' -I '.' -I 'C:/Documents and
Settings/Owner
/My Documents/Rick's/Ruby' -I
'C:/DOCUME~1/Owner/LOCALS~1/Temp/tar2rubyscript.d.
3712.1/rubyscript2exe' -I
'C:/DOCUME~1/Owner/LOCALS~1/Temp/tar2rubyscript.d.3712
1/rubyscript2exe' -I
'C:/DOCUME~1/Owner/LOCALS~1/Temp/tar2rubyscript.d.3712.1/r
ubyscript2exe/lib' -r
'C:/DOCUME~1/Owner/LOCALS~1/Temp/tar2rubyscript.d.3712.1/r
ubyscript2exe/require2lib.rb' 'hello-world.rb'
Stopped.

I've found no similar problem to this anywhere online, so I'm tempted to
think I've made an egregious oversight somewhere.

Thank you very much!
:Rick:.
 
M

mully

I've just downloaded Erik Veenstra's RubyScript2EXE, but it does not
seem to work correctly at all. Here's what I've done:

1. I downloaded the latest rubyscript2exe.rb to my working folder, with
the .RB to be packaged (in this case, hello-world.rb).

2. I opened a command prompt, navigated to the working folder, and ran
the command "ruby rubyscript2exe.rb hello-world.rb".

3. There is a very brief pause, and the line "Tracing hello-world ..."
appears. Whatever process that seemed briefly to be running appears to
quit, and a glance at the Windows Task Manager shows no activity. I'm
left with just a blank line, as though the program is asking for input,
though nothing I type elicits a response except CTRL-C, at which point
the following is spit out:

Couldn't execute this command (rc=256):
c:\ruby\bin\ruby -r 'rubyscript2exe.rb' -I
'C:/DOCUME~1/Owner/LOCALS~1/Temp/tar2
rubyscript.d.3712.1/rubyscript2exe' -I
'C:/DOCUME~1/Owner/LOCALS~1/Temp/tar2ruby
script.d.3712.1' -I 'c:/ruby/lib/ruby/site_ruby/1.8' -I
'c:/ruby/lib/ruby/site_r
uby/1.8/i386-msvcrt' -I 'c:/ruby/lib/ruby/site_ruby' -I
'c:/ruby/lib/ruby/1.8' -
I 'c:/ruby/lib/ruby/1.8/i386-mswin32' -I '.' -I 'C:/Documents and
Settings/Owner
/My Documents/Rick's/Ruby' -I
'C:/DOCUME~1/Owner/LOCALS~1/Temp/tar2rubyscript.d.
3712.1/rubyscript2exe' -I
'C:/DOCUME~1/Owner/LOCALS~1/Temp/tar2rubyscript.d.3712
1/rubyscript2exe' -I
'C:/DOCUME~1/Owner/LOCALS~1/Temp/tar2rubyscript.d.3712.1/r
ubyscript2exe/lib' -r
'C:/DOCUME~1/Owner/LOCALS~1/Temp/tar2rubyscript.d.3712.1/r
ubyscript2exe/require2lib.rb' 'hello-world.rb'
Stopped.

I've found no similar problem to this anywhere online, so I'm tempted to
think I've made an egregious oversight somewhere.

Thank you very much!
:Rick:.

You might try including the following at the end of your require
statements:

require "rubyscript2exe"
exit if RUBYSCRIPT2EXE.is_compiling?

This is per section 3.4 of Erik's documentation:

http://www.erikveen.dds.nl/rubyscript2exe/index.html

Mully
 
B

bbiker

Please cat your hello-world.rb.

gegroet,
Erik V. -http://www.erikveen.dds.nl/

This may be slightly off-topic

On a WindowsXP box, with ruby 1.8.5 (2006-12-25 patchlevel 12) [i386-
mswin32] and rubyscript2exe 0.5.1

the way to use the compiler is as follows:

rubyscript2exe <script_to_compile.rb> [parameters] from your working
directory

if you use
ruby rubyscript2exe.rb <script_to_compile.rb> [parameters]

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.
 
E

Erik Veenstra

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... ;]

Thanks.

gegroet,
Erik V. - http://www.erikveen.dds.nl/
 
B

bbiker

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.
 
B

bbiker

Did you add "require rubyscript2exe"?

yes, I have the following 2 lines:

require "rubyscript2exe"
exit if RUBYSCRIPT2EXE.is_compiling?

This works if I am compiling the script. I get the error message when
I run the uncompiled script (script.rb), no problem when running the
compiled script (script.exe).

"exit if defined?(REQUIRE2LIB)" does not interfer while running an
uncompiled script. It appears to work correctly when compiling a
script.
The above works without the 'require "rubyscript2exe"' statement.
 
E

Erik Veenstra

require "rubygems"
require "rubyscript2exe"
exit if RUBYSCRIPT2EXE.is_compiling?
 
B

bbiker

require "rubygems"
require "rubyscript2exe"
exit if RUBYSCRIPT2EXE.is_compiling?


I am using ruby 1.8.5 (2006-12-25 patchlevel 12) [i386-mswin32]
installed via the one-click installer.
'require "rubygens"' statement is not needed, since I chose to enable
rubygems during the installation.

gem -v 0.9.2

echo %RUBYOP% => -rubygems

Adding 'require "rubygems"' yied the same result.
 
R

Richard Manning

Erik said:
Please cat your hello-world.rb.

gegroet,
Erik V. - http://www.erikveen.dds.nl/

My script originally consisted of the following line:

puts "Hello World!"

However, it still does not work when I insert these lines at the top:

require "rubyscript2exe"
exit if RUBYSCRIPT2EXE.is_compiling?

I would love to get this to work -- rubyscript2exe seems like a great
program.

Thanks!

:Rick:.
 
B

bbiker

My script originally consisted of the following line:

puts "Hello World!"

However, it still does not work when I insert these lines at the top:

require "rubyscript2exe"
exit if RUBYSCRIPT2EXE.is_compiling?

I would love to get this to work -- rubyscript2exe seems like a great
program.

Thanks!

:Rick:.

rubyscript2exe works.

For example: type in the following program
#---------------------------------------------
#!c:/ruby/bin/ruby
require "rubyscript2exe"
exit if RUBYSCRIPT2EXE.is_compiling?

puts "Hello Ruby World"
#---------------------------------------------

Note that for such a short program the require and exit statements are
not needed!!!
They are only needed if the script has a long running time.

The problem with these two lines comes when you want to run the
hello.rb script.

compile the program.
C:\Documents and Settings\...\default_project>rubyscript2exe hello.rb
Tracing hello ...
Gathering files...
Copying files...
Creating hello.exe ...

invoke the executable
C:\Documents and Settings\...\default_project>hello
Hello Ruby World

please note the sizes of the files.
dir hello.*
Directory of C:\Documents and Settings\..\default_project

02/12/2007 04:42 PM 1,553,436 hello.exe
02/12/2007 04:33 PM 143 hello.rb
 
R

Richard Manning

bbiker said:
rubyscript2exe works.

I'm not claiming that the program doesn't work -- I just can seem to get
it working for me!

I've tried the above example, step-by-step, but it still hangs on
"Tracing hello ..." Is there some sort of configuration or file
placement that I've overlooked, or something like that?

Thanks, and sorry for the trouble.
:Rick:.
 
B

bbiker

I'm not claiming that the program doesn't work -- I just can seem to get
it working for me!

I've tried the above example, step-by-step, but it still hangs on
"Tracing hello ..." Is there some sort of configuration or file
placement that I've overlooked, or something like that?

Thanks, and sorry for the trouble.
:Rick:.

Should work right out of the box .. no configuration needed as far as
I know.

Suggest that you uninstall the rubyscript2exe gem and reinstall it.

bbiker
 

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

Forum statistics

Threads
473,968
Messages
2,570,153
Members
46,701
Latest member
XavierQ83

Latest Threads

Top