SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Enthusiast
    Join Date
    Jun 2003
    Location
    Coventry, UK
    Posts
    55
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Starting out with Ruby..

    Hi all,

    I've been looking into Ruby over the past couple of days. I downloaded and am running the interpreter from the windows command prompt. It seems like a nice language to pick up. I have Apache installed on my Windows XP machine. I tried to download mod_ruby but I'm getting an error when opening the .tar file in winzip.

    What do I need to do to get started? I know the file extension for ruby files is .rb but when I have saved a file, how do I run it?

    Also, how do I integrate the program to a webpage?

    - can you tell I've literally been looking at it?

    Cheers for your help...

  2. #2
    SitePoint Guru
    Join Date
    Aug 2005
    Posts
    986
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    If you want to create a command line Ruby script you have to create a file with an .rb extension. Then you can double click it (if you used the Ruby one click installer) or you can open a command line and type: ruby yourscript.rb in the directory of your script.

    If you want to use Ruby to build web sites I really recommend Rails.

    The setup is:

    gem install rails

    It has a builtin webserver so it's very easy to get it to work. It's also a lot more productive than mod_ruby.

    If you want to use mod_ruby anyway you'll have to intall it first. Maybe you should download the file again?

  3. #3
    SitePoint Addict
    Join Date
    Mar 2005
    Posts
    314
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Thumbs up

    Yeah, I just installed Ruby, eRuby, mod_ruby and everything seems to be working fine on my cpanel.

    I'm looking into writing some apps in ruby to get a feel for it. However, I just installed Rails and it appears this rails program needs to run it's own "WebBrick" server/service similar to Apache on a port like 3000. What gives with this?

    Why the heck would we want to run a seperate server on a seperate port to install a ruby on rails app? I figured rails would be something like "Zend Framework" where neat functions would be available .. you know.. the smalltalk coding stuff. I'm deeply confused but what else is new.

    I'm good with PHP, but this Ruby appears to be quite different. Just not sure how much I like the rails having to be on a new "service" to accept requests. I do have eRuby and mod_ruby installed as well.. and I'm able to parse .rhtml scripts with rubycode in them on any domain.. this is working fine at least.

    Just not sure how I make "Ruby" available to customers that request it. From the looks of things now, it appears any client on the server would be able to create .rhtml and add their ruby code which would work fine .. so I guess I need to figure out how to only allow certain domains to parse .rhtml files. Maybe in the httpd.conf somewhere is the answer.

    So, I'm excited to dig in. Need to know how to install "premade" scripts then I can get the feel for doing my own.

  4. #4
    SitePoint Addict
    Join Date
    Mar 2005
    Posts
    251
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The first thing to understand is that Rails is a framework, as opposed to a language. Now the benefit of using a framework is that it expects your applications to be organised in a certain way and for this convention gives you a load of free functionality.

    So firstly Rails is not really ideal for quick web scripts, the overhead of running a rails app is not worth it when a 50k PHP script does the job, use the right tools for the job.

    However for when you need to do something that would be termed an application as opposed to a script, that's when Rails will start paying dividends.

    You are right about Webrick running on its own port. Remember though that Webrick is only for development. When you deploy your application to a server you will need a different setup, it's there purely as a really simple way to get your app running... you literally type rails myapp and script/server and out of the box you have an application running and ready to go which can't be bad.

  5. #5
    Web developer Carl's Avatar
    Join Date
    Sep 2003
    Location
    sweden
    Posts
    320
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by agajic
    Hi all,

    I've been looking into Ruby over the past couple of days. I downloaded and am running the interpreter from the windows command prompt. It seems like a nice language to pick up. I have Apache installed on my Windows XP machine. I tried to download mod_ruby but I'm getting an error when opening the .tar file in winzip.

    What do I need to do to get started? I know the file extension for ruby files is .rb but when I have saved a file, how do I run it?

    Also, how do I integrate the program to a webpage?

    - can you tell I've literally been looking at it?

    Cheers for your help...
    Read some of the tutorials in my signature. They will get you started. I wrote from a Windows user perspective. If you have any problems or additions that would make things easier for the next person let me know and I will update the tutorials.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •