School Assignment? Project Due Tomorrow? Chat LIVE With A Programming Expert!

Welcome to Dream.In.Code
Become an Expert!

Join 307,090 Programmers for FREE! Get instant access to thousands of experts, tutorials, code snippets, and more! There are 2,043 people online right now. Registration is fast and FREE... Join Now!




Confused about ruby in itself (not rails).

 

Confused about ruby in itself (not rails).

fashionnugget

20 May, 2009 - 02:07 PM
Post #1

D.I.C Head
**

Joined: 25 Nov, 2008
Posts: 149



Thanked: 2 times
My Contributions
The past couple days I've been playing with ruby because I want to learn rails but I feel that if I have a full understanding of ruby then it will make the task of fully understanding rails a lot simpler (I tried learning rails and got about half-way through Sitepoint's Simply Rails 2 2nd Edition and decided I wasn't understanding it well enough). So, I started to write programs, (I've done a little coding in Python and C++ but I never actually used it for anything practical, just playing around as I am now with ruby) and I've noticed that the code is extremely simple and I no longer have to remember things but rather my time is spent thinking logically about how a program should run, which is how I feel it should be. So far, I love ruby.

I've written a program that I want to show my friend who is not a ruby developer and figured I should just make the .rb into a .exe so I could show him. I discovered that (as far as I know) there is no way to change a .rb into a .exe. I looked up how to do it and I came across someone who was asking a similar question on another forum but the only response was one that was basically saying "Why would you want to do that, it's pointless". I don't understand what he meant. Am I misunderstanding the purpose of ruby? What is the actual purpose for ruby if it is not to make programs that can run as standalone projects?

I looked into RubyScript2Exe but it appears to only work with older versions of ruby.

User is offlineProfile CardPM
+Quote Post


xclite

RE: Confused About Ruby In Itself (not Rails).

20 May, 2009 - 06:09 PM
Post #2

LIKE A BOSS
****

Joined: 12 May, 2009
Posts: 655



Thanked: 14 times
My Contributions
QUOTE(fashionnugget @ 20 May, 2009 - 04:07 PM) *

The past couple days I've been playing with ruby because I want to learn rails but I feel that if I have a full understanding of ruby then it will make the task of fully understanding rails a lot simpler (I tried learning rails and got about half-way through Sitepoint's Simply Rails 2 2nd Edition and decided I wasn't understanding it well enough). So, I started to write programs, (I've done a little coding in Python and C++ but I never actually used it for anything practical, just playing around as I am now with ruby) and I've noticed that the code is extremely simple and I no longer have to remember things but rather my time is spent thinking logically about how a program should run, which is how I feel it should be. So far, I love ruby.

I've written a program that I want to show my friend who is not a ruby developer and figured I should just make the .rb into a .exe so I could show him. I discovered that (as far as I know) there is no way to change a .rb into a .exe. I looked up how to do it and I came across someone who was asking a similar question on another forum but the only response was one that was basically saying "Why would you want to do that, it's pointless". I don't understand what he meant. Am I misunderstanding the purpose of ruby? What is the actual purpose for ruby if it is not to make programs that can run as standalone projects?

I looked into RubyScript2Exe but it appears to only work with older versions of ruby.


As of right now, Ruby is a scripting language. I do not see that as pointless, because it is frustrating to tell somebody to download and install the Ruby language to run your program. Many standalone projects are written in Ruby. As I understand it, RubyScript2Exe simply wraps the language around the program, so basically when you run the language, it runs the packaged interpreter which runs your script. This causes the downloads to be pretty large. I'm sure there is some way to deploy Ruby scripts as standalone items, I just haven't looked into it yet.

Tl;dr, Ruby is an excellent language, you might just have to do a little searching to figure out how to pass your scripts around.
User is online!Profile CardPM
+Quote Post

fashionnugget

RE: Confused About Ruby In Itself (not Rails).

21 May, 2009 - 03:58 PM
Post #3

D.I.C Head
**

Joined: 25 Nov, 2008
Posts: 149



Thanked: 2 times
My Contributions
Thanks for the input xclite.

Another response I got from a different forum that helped me was as follows

"Basically languages come in compiled or interpreted flavors (yes, that's perhaps oversimplifting it, but bear with me). Compiled languages are developed in an edit-compile-run cycle, meaning you have to build everything, turn everything into an executable before you can run it. Interpreted languages (often called scripting languages) are developed in an edit-run cycle -- as soon as you finish editing it you can run it.

Compiled languages create a standalone executable (again this is simplified to make the point) while the interpreted languages always need the interpreter, because they are never saved in any form except source.

Ruby is an interpreted language, meaning the programs you write in it never were intended to reach executable form. There are a lot of languages out there like this, starting with the venerable perl, going on through PHP, Java, Python and more other examples than I have time to enumerate. (Note: some of these talk about "compiling" but that's only to a psuedocode that still needs a run-time interpreter to execute.)

Lately there have been some attempts to create portable executables from Ruby (MacRuby comes immediately to mind) that are standalone apps. Maybe there will be some more of these.

Yes, ruby programs are intended to be shared/distributed. In source form, to be run on systems with ruby interpreters. (Ruby interpreters are free downloads, so if the program is good enough, there isn't a problem getting an interpreter to run it.)"

I just thought I would share in case anyone else was looking into the same thing. You can lock this thread now, my questions been answered, albeit elsewhere.
User is offlineProfile CardPM
+Quote Post

xclite

RE: Confused About Ruby In Itself (not Rails).

22 May, 2009 - 07:10 AM
Post #4

LIKE A BOSS
****

Joined: 12 May, 2009
Posts: 655



Thanked: 14 times
My Contributions
If it's any consolation, I have heard that there is an effort to bring Ruby to a Virtual Machine (a la Java), which means you could then package your ruby program as something like a Jar file, and it would be runnable on most machines, since nearly everybody has the JRE installed. You also may want to check out JRuby.
User is online!Profile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic

Time is now: 11/21/09 11:29AM

Live Help!

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter Fan Us On Facebook

Tutorials

Programming

Web Development

Reference Sheets

Code Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month