[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

[ANN] RubyScript2Exe 0.3.3

Erik Veenstra

3/26/2005 7:51:00 PM


RubyScript2Exe 0.3.3 is released!

RubyScript2Exe transforms your Ruby script into a standalone,
compressed Windows, Linux or Max OS X (Darwin) executable. You
can look at it as a "compiler". Not in the sense of a
source-code-to-byte-code compiler, but as a "collector", for it
collects all necessary files to run your script on an other
machine: the Ruby script, the Ruby interpreter and the Ruby
runtime library (stripped down for this script). Anyway, the
result is the same: a standalone executable (application.exe).
And that's what we want!

gegroet,
Erik V.

----------------------------------------------------------------

Changes:

* newlocation is an absolute path.

* ENV["TEMP"] is an absolute path.

* Added REQUIRE2LIB.

* Added RUBYSCRIPT2EXE.

* Added --rubyscript2exe-nostrip.

* Added RUBYSCRIPT2EXE_BIN.

* Added RUBYSCRIPT2EXE_LIB.

* Fixed the non-SH-compatible shell (e.g. TCSH) bug.

* Changed the name of the generated executable on Linux from
application.bin to application_linux.

* Added (experimental) support for Mac OS X (Darwin).

----------------------------------------------------------------

16 Answers

Phlip

3/26/2005 8:16:00 PM

0

Erik Veenstra wrote:

> RubyScript2Exe 0.3.3 is released!

~/minirubywiki> rubyscript2exe.cmd miniWiki.rb
Tracing miniWiki ...
(offline mode: enter name=value pairs on standard input)

My application is demanding CGI input variables that your app cannot
provide.

(I suppose I'l push them on the command line, then run your app.)

Otherwise, preemptive congrats are probably in order!

--
Phlip
http://industrialxp.org/community/bin/view/Main/TestFirstUser...


meruby

3/26/2005 9:18:00 PM

0

This is one of the most needed project for ruby. Thanks a million. I am
trying to create an executable for simple tkhello program under
windows. It creates an exe but when I execute it, it throws following
error: Can't find usuable init.tcl

Here is program:

---------------------------------------------------------------------
require "tk"
TkButton.new(nil,
:text => 'hello',
:command => proc{print "hello\n"}).pack(:fill=>'x')
TkButton.new(nil,
:text => 'quit',
:command => proc{exit}).pack(:fill=>'x')
Tk.mainloop
---------------------------------------------------------------------

And I made an executable by typing following in command prompt:
ruby init.rb tkhello.rb

---------------------------------------------------------------------


Erik Veenstra wrote:
> RubyScript2Exe 0.3.3 is released!
>
> RubyScript2Exe transforms your Ruby script into a standalone,
> compressed Windows, Linux or Max OS X (Darwin) executable. You
> can look at it as a "compiler". Not in the sense of a
> source-code-to-byte-code compiler, but as a "collector", for it
> collects all necessary files to run your script on an other
> machine: the Ruby script, the Ruby interpreter and the Ruby
> runtime library (stripped down for this script). Anyway, the
> result is the same: a standalone executable (application.exe).
> And that's what we want!
>
> gegroet,
> Erik V.
>
> ----------------------------------------------------------------
>
> Changes:
>
> * newlocation is an absolute path.
>
> * ENV["TEMP"] is an absolute path.
>
> * Added REQUIRE2LIB.
>
> * Added RUBYSCRIPT2EXE.
>
> * Added --rubyscript2exe-nostrip.
>
> * Added RUBYSCRIPT2EXE_BIN.
>
> * Added RUBYSCRIPT2EXE_LIB.
>
> * Fixed the non-SH-compatible shell (e.g. TCSH) bug.
>
> * Changed the name of the generated executable on Linux from
> application.bin to application_linux.
>
> * Added (experimental) support for Mac OS X (Darwin).
>
> ----------------------------------------------------------------

james_b

3/26/2005 9:43:00 PM

0

meruby@gmail.com wrote:
> This is one of the most needed project for ruby. Thanks a million. I am
> trying to create an executable for simple tkhello program under
> windows. It creates an exe but when I execute it, it throws following
> error: Can't find usuable init.tcl

I haven't looked at this latest release, and perhaps this is not really
the issue, but about a month ago I assembled a Web testing app that
kicked off WEBrick, launched a browser, and gave the user a choice of
test scripts to load and run. However, because these test script were
dynamically loaded, RubyScript2Exe did not know to include them in the
exe bundle.

I added in some code that did some (gratuitous) calls to 'require' so
that all needed code and resources were available.

This likely isn't an option for 'init.tcl', but is there some other way
to tell RubyScript2Exe to bundle up an explicit set of files?


James

--

http://www.ru...
http://www.r...
http://catapult.rub...
http://orbjson.rub...
http://ooo4r.rub...
http://www.jame...


meruby

3/26/2005 9:49:00 PM

0

Few further testing on GUI application under windows:
tcl based application throws same error as tk based application
opengl base application hangs and hence it does not even create exe
file

Good news is: wxRuby based application works great. Just one execuable,
small enough size and runs perfectly fine. I will test few things under
linux and will report them here.

Phlip

3/27/2005 5:35:00 PM

0

> Erik Veenstra wrote:
>
> > RubyScript2Exe 0.3.3 is released!
>
> ~/minirubywiki> rubyscript2exe.cmd miniWiki.rb
> Tracing miniWiki ...
> (offline mode: enter name=value pairs on standard input)
>
> My application is demanding CGI input variables that your app cannot
> provide.
>
> (I suppose I'l push them on the command line, then run your app.)

Nooope:

~/minirubywiki> QUERY_STRING=query1=value1
~/minirubywiki> REQUEST_METHOD=GET
~/minirubywiki> rubyscript2exe.cmd miniWiki.rb
Tracing miniWiki ...
(offline mode: enter name=value pairs on standard input)

CGI.rb ain't seeing those environmental variables. I have to Ctrl+C the run;
then the rest of rubyscript2exe.cmd works.

BTW the EXE works great - on my populated notebook. I'l congratulate again
when I run it on a virgin 'puter!

> --
> Phlip
> http://industrialxp.org/community/bin/view/Main/TestFirstUser...


vruz

3/27/2005 5:54:00 PM

0

> Few further testing on GUI application under windows:
> tcl based application throws same error as tk based application
> opengl base application hangs and hence it does not even create exe
> file
>

would something like this quick'n dirty hack do the trick ?

begin
require "/path/to/your/init.tcl"
rescue
end

But then I haven't been able to use WinXP's .manifest files
for SWin to use the WinXP native look and feel


Erik Veenstra

3/28/2005 8:30:00 AM

0

> Few further testing on GUI application under windows: tcl
> based application throws same error as tk based application

You still need to install TK itself on the second machine. TK
is not part of Ruby and, as such, is not embedded by
RubyScript2Exe. The bindings between Ruby and TK are part of
the Ruby environment and are embedded by RubyScript2Exe.

If you have a look at init.rb in rubyscript2exe.tar.gz [1], you
find an unused piece of code which tries to handle tk. Because
I don't know how to build TK applications, I'm not quiet sure
whether this works under all circumstances. At least, it used
to work with some of the demos... Is somebody able and willing
to test and correct this code?

> Good news is: wxRuby based application works great. Just one
> execuable, small enough size and runs perfectly fine. I will
> test few things under linux and will report them here.

WxRuby (on Windows) does native calls to the OS to show the
widgets. It doesn't depend on additional libraries. Although it
does depend on such libraries on Linux (e.g. Motif or GTK, (or
is it GDK?)), because there is no such thing as "native
widgets" on Linux...

RubyWebDialogs [2] is pure Ruby, so it works perfectly in
combination with RubyScript2Exe.

gegroet,
Erik V.

[1]
http://www.erikveen.dds.nl/rubyscript2exe/download/rubyscript2...
[2] http://www.erikveen.dds.nl/rubywebdialogs/...

Erik Veenstra

3/28/2005 11:31:00 AM

0

> > Few further testing on GUI application under windows: tcl
> > based application throws same error as tk based application
>
> You still need to install TK itself on the second machine. TK
> is not part of Ruby and, as such, is not embedded by
> RubyScript2Exe. The bindings between Ruby and TK are part of
> the Ruby environment and are embedded by RubyScript2Exe.
>
> If you have a look at init.rb in rubyscript2exe.tar.gz [1],
> you find an unused piece of code which tries to handle tk.
> Because I don't know how to build TK applications, I'm not
> quiet sure whether this works under all circumstances. At
> least, it used to work with some of the demos... Is somebody
> able and willing to test and correct this code?

I activated the TK-code, "compiled" you example (on Linux),
uploaded it to the compile farm of SourceForge (no Ruby, even
no X), started the application and voila: it works!

Shell A:

$ ruby rubyscript2exe.rb test.rb
$ tar c test_linux | nc -l -p -w 5

Shell B:

$ ssh -X -R 1234:localhost:1234 .....
$ nc localhost 1234 | tar x
$ ./test_linux

I've no Windows at hand, so I can't test it. Anybody?

gegroet,
Erik V.

meruby

3/28/2005 2:52:00 PM

0

Under Linux:
tcl/tk application compiles to executable fine.
qtruby base application throws following error during compilation:

-------------------program-----------------------
[spatel@taamportable rubyscript2exe]$ cat t1.rb
require 'Qt'
a = Qt::Application.new(ARGV)
hello = Qt::PushButton.new('Hello World!', nil)
hello.resize(100, 30)
a.setMainWidget(hello)
hello.show()
a.exec()
---------------------------------------------------


[spatel@taamportable rubyscript2exe]$ ruby init.rb t1.rb
Tracing t1 ...
Gathering files...
/usr/lib/ruby/1.8/ftools.rb:209:in `method_missing': mkdir is not a
class method (ArgumentError)
from /usr/lib/ruby/1.8/ftools.rb:209:in `makedirs'
from /usr/lib/ruby/1.8/ftools.rb:202:in `each'
from /usr/lib/ruby/1.8/ftools.rb:202:in `makedirs'
from /home/spatel/rubyscript2exe/require2lib.rb:44:in
`gatherlibs'
from /home/spatel/rubyscript2exe/require2lib.rb:38
from /home/spatel/rubyscript2exe/require2lib.rb:35
init.rb:99:in `load': No such file to load --
/tmp/oldandnewlocation.7482/require2lib2rubyscript2exe.rb (LoadError)
from init.rb:99

Erik Veenstra

3/28/2005 3:46:00 PM

0

> /usr/lib/ruby/1.8/ftools.rb:209:in `method_missing': mkdir is
> not a class method (ArgumentError)

Qt defines Dir in its own module. Ruby's ftools.rb somehow uses
this Dir, instead of the top level Dir.

I reduced this test to this little script. Just try to run it
without RubyScript2Exe. It refuses to create directory test4.

If you change "class << File" to "class File", it just works
fine. What's the difference, anyway?

Unfortunately, it has nothing to do with RubyScript2Exe itself.
If it did, I could easily change it...

gegroet,
Erik V.

----------------------------------------------------------------

puts "START"

Dir.rmdir "test1" if File.directory?("test1")
Dir.rmdir "test2" if File.directory?("test2")
Dir.rmdir "test3" if File.directory?("test3")
Dir.rmdir "test4" if File.directory?("test4")

Dir.mkdir "test1"

class << File
Dir.mkdir "test2"
end

require "Qt"

Dir.mkdir "test3"

class << File
Dir.mkdir "test4"
end

puts "END"

----------------------------------------------------------------