Forum: Ruby RubyScript2EXE Not Functioning

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Richard M. (Guest)
on 2007-02-07 05:16
I've just downloaded Erik V.'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:.
David M. (Guest)
on 2007-02-07 16:55
(Received via mailing list)
On Feb 6, 10:16 pm, Richard M. <removed_email_address@domain.invalid>
wrote:
> appears. Whatever process that seemed briefly to be running appears to
> script.d.3712.1' -I 'c:/ruby/lib/ruby/site_ruby/1.8' -I
> 'C:/DOCUME~1/Owner/LOCALS~1/Temp/tar2rubyscript.d.3712.1/r
>
> --
> Posted viahttp://www.ruby-forum.com/.

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
Erik V. (Guest)
on 2007-02-07 17:57
(Received via mailing list)
Please cat your hello-world.rb.

gegroet,
Erik V. - http://www.erikveen.dds.nl/
bbiker (Guest)
on 2007-02-07 20:11
(Received via mailing list)
On Feb 7, 10:57 am, "Erik V." <removed_email_address@domain.invalid> wrote:
> 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.
Erik V. (Guest)
on 2007-02-11 18:25
(Received via mailing list)
> 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/
bbiker (Guest)
on 2007-02-12 01:25
(Received via mailing list)
On Feb 11, 11:20 am, "Erik V." <removed_email_address@domain.invalid> wrote:
> 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.
Erik V. (Guest)
on 2007-02-12 13:07
(Received via mailing list)
> 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.

Did you add "require rubyscript2exe"?

gegroet,
Erik V. - http://www.erikveen.dds.nl/
bbiker (Guest)
on 2007-02-12 18:50
(Received via mailing list)
On Feb 12, 4:21 am, "Erik V." <removed_email_address@domain.invalid> wrote:
> > 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.
>
> 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.
Erik V. (Guest)
on 2007-02-12 19:33
(Received via mailing list)
require "rubygems"
require "rubyscript2exe"
exit if RUBYSCRIPT2EXE.is_compiling?
bbiker (Guest)
on 2007-02-12 21:20
(Received via mailing list)
On Feb 12, 12:32 pm, "Erik V." <removed_email_address@domain.invalid> wrote:
> 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.
Richard M. (Guest)
on 2007-02-12 22:35
Erik V. wrote:
> 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:.
bbiker (Guest)
on 2007-02-13 00:05
(Received via mailing list)
On Feb 12, 3:35 pm, Richard M. <removed_email_address@domain.invalid>
wrote:
> However, it still does not work when I insert these lines at the top:
>
> --
> Posted viahttp://www.ruby-forum.com/.

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
Richard M. (Guest)
on 2007-02-18 01:55
bbiker wrote:
> 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:.
bbiker (Guest)
on 2007-02-18 18:50
(Received via mailing list)
On Feb 17, 6:55 pm, Richard M. <removed_email_address@domain.invalid>
wrote:
> Thanks, and sorry for the trouble.
> :Rick:.
>
> --
> Posted viahttp://www.ruby-forum.com/.

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
This topic is locked and can not be replied to.