The SitePoint Forums have moved.

You can now find them here.
This forum is now closed to new posts, but you can browse existing content.
You can find out more information about the move and how to open a new account (if necessary) here.
If you get stuck you can get support by emailing forums@sitepoint.com

If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

Confused about ruby in itself (not rails).

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.

What is the actual purpose for ruby if it is not to make programs that can run as standalone projects?

Any website you create with Ruby on Rails won't be a standalone executable; every single page request has to run through a Ruby interpreter. So there's an example of a purpose other than a standalone executable.

It's not uncommon. This website, along with every other site built with PHP, only works when a PHP interpreter is available on the computer running the site.

Well, I appreciate you're response but read my subject title again. I'm asking about the plane programming language ruby not ruby on rails. Does ruby also only exist for the purpose of web development?

Basically I am asking what was ruby for prior to the release of ruby on rails.

Yes I read your subject, I never mentioned Rails (you don't need Rails to run Ruby code on a web server), and the answer is the same. Ruby is an interpreted language, it was made to be run in an interpreter.

Bash and Perl are also almost always run as interpreted code, yet programs written in these languages make up a large portion of the standard software in any Linux/Unix system. Those computers only run the Bash/Perl code because the Bash and Perl interpreters are installed. Same goes for Java programs and the Java VM (a bytecode interpreter), C# code and the .NET libraries, etc.

*Most* desktop software has external dependencies, that's why software comes with installer programs. The installers are written in native executable code, and put all those dependencies on the computer the actual program needs to run, since it's not really self-contained at all.

You can write non-web software in Ruby, it just requires the Ruby interpreter be available on the computers you want to run it on.

You could write an installer for your friend, in a language that you can compile into a Windows binary, which installs the Ruby interpreter and creates a shortcut to run your program which launches the interpreter with your code as the input.

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