Author |
Message |
[Gandalf]
|
Posted: Fri Aug 26, 2005 2:54 am Post subject: Ruby Script to .exe |
|
|
Well, I finally got around to trying this out, and it works like a charm .
All you need is a single ruby file, and you just add it before your own ruby program to compile:
code: | ruby rubyscript2exe.rb HelloWorld.rb |
You have the option of adding some parameters if you like, but they are not neccessary as default is fine.
Anways, I was just going to ask someone to test out the .exe (someone who doesn't have Ruby installed) to see if it works. The final executable is smaller than a Turing executable, at least under windows - the following code "compiled" to 665kb as opposed to Turing's 709kb. I could probably minimize the by using some parameters though (not sure).
Ruby: | puts "Hello"
print "Enter your name: "
name = gets
puts "Hello, #{name}"
exit = gets |
Attached is the exe .rar'ed. |
|
|
|
|
|
Sponsor Sponsor
|
|
|
wtd
|
Posted: Fri Aug 26, 2005 2:59 am Post subject: (No subject) |
|
|
Note: when you run "ruby rubyscript2exe.rb HelloWorld.rb", you're not passing "HelloWorld.rb" to ruby itself. You're passing it to the application created by running "ruby rubyscript2exe.rb". |
|
|
|
|
|
Hikaru79
|
Posted: Fri Aug 26, 2005 8:15 am Post subject: (No subject) |
|
|
Works great for me Now, what I'm curious about is, if you use some third-party libraries that you install, will it be smart enough to package those too by default, or do you have to manually specify those to the program? |
|
|
|
|
|
wtd
|
Posted: Fri Aug 26, 2005 3:50 pm Post subject: (No subject) |
|
|
I would further suggest installing this via the gem.
Just:
code: | gem install rubyscript2exe.gem |
Then you should just be able to call:
code: | rubyscript2exe HelloWorld.rb |
|
|
|
|
|
|
wtd
|
Posted: Fri Aug 26, 2005 3:54 pm Post subject: (No subject) |
|
|
Hikaru79 wrote: Works great for me Now, what I'm curious about is, if you use some third-party libraries that you install, will it be smart enough to package those too by default, or do you have to manually specify those to the program?
code: | ~/Desktop $ cat > hello.rb
def say_hello
puts "Hello!"
end
~/Desktop $ cat > application.rb
require "hello"
say_hello
~/Desktop $ rubyscript2exe application.rb
Tracing application ...
Hello!
Gathering files...
Copying files...
Stripping...
Creating application_linux ...
~/Desktop $ ./application_linux
Hello!
~/Desktop $ |
|
|
|
|
|
|
[Gandalf]
|
Posted: Fri Aug 26, 2005 7:34 pm Post subject: (No subject) |
|
|
Well then looks good .
Now I have to try some other things with it, like with that tar2rubyscript and some other things.
I noticed that although the executable is smaller than Turing's, the reason is that it is already heavily compressed, while Turing's is not. Therefore, if you try to compress the Ruby .exe, it will not seem as effective as with a Turing .exe. |
|
|
|
|
|
wtd
|
Posted: Fri Aug 26, 2005 7:51 pm Post subject: (No subject) |
|
|
In an era of widespread broadband and large hard drives... does it really matter? |
|
|
|
|
|
[Gandalf]
|
Posted: Fri Aug 26, 2005 8:08 pm Post subject: (No subject) |
|
|
Well... It's always nice to have something smaller. If I compiled my whole programming directory on this comp that would be a gigabyte instead of a managable 25mb of source. If I had each of those compressed though, that would be 4 times less to carry around, and 4 times faster to store, download, move, scan, or whatever you are doing.
There are also cases like when you have a cheap website, say 20mb, where having a 100kb file is better than a 1mb one. |
|
|
|
|
|
Sponsor Sponsor
|
|
|
wtd
|
Posted: Fri Aug 26, 2005 8:11 pm Post subject: (No subject) |
|
|
Then just store the Ruby script there and simply ask people to install Ruby. |
|
|
|
|
|
Tony
|
Posted: Fri Aug 26, 2005 8:33 pm Post subject: (No subject) |
|
|
[Gandalf] wrote: Well... It's always nice to have something smaller.
Unless we're not talking about space your program takes up
Seriously though, just keep Ruby as is and let users install the interpreter. Not everybody can run .exe's anyways. |
|
|
|
|
|
wtd
|
Posted: Fri Aug 26, 2005 8:41 pm Post subject: (No subject) |
|
|
Tony wrote: [Gandalf] wrote: Well... It's always nice to have something smaller.
Unless we're not talking about space your program takes up
Seriously though, just keep Ruby as is and let users install the interpreter. Not everybody can run .exe's anyways.
Indeed. You'd have to store versions for Windows, Linux, and Mac OS X, as well as probably having versions on hand for numerous other *nixes. |
|
|
|
|
|
[Gandalf]
|
Posted: Sat Aug 27, 2005 3:41 am Post subject: (No subject) |
|
|
Well... Ya... It was in my comparison to Turing though, and the same applies to it.
I'm not going to be making commercial programs with it (obviously), but I just like to have the reassurance that I can use my program on another computer without installing Ruby.
Anyways, tomorrow I will try to learn a bit more Ruby to try and put all this to use . |
|
|
|
|
|
wtd
|
Posted: Sat Aug 27, 2005 3:52 am Post subject: (No subject) |
|
|
[Gandalf] wrote: I'm not going to be making commercial programs with it (obviously)
Why not?
Ruby's certainly capable. |
|
|
|
|
|
[Gandalf]
|
Posted: Sat Aug 27, 2005 3:57 am Post subject: (No subject) |
|
|
It's myself that's not capable .
No, but my point was that I will not be distributing my programs to many people in the near future, so it doesn't matter as much. |
|
|
|
|
|
wtd
|
Posted: Sat Aug 27, 2005 4:15 am Post subject: (No subject) |
|
|
[Gandalf] wrote: It's myself that's not capable .
That'll change. |
|
|
|
|
|
|