Ruby on Rails on Debian  Hot PDF Print E-mail
Tag it:
Delicious
Furl it!
Digg
NewsVine
Reddit
YahooMyWeb
Technorati
Articles Reviews Ruby
Written by Adi Bach   
Thursday, 07 June 2007

{mos_sb_discuss:50}

Most of you have probably heard of Ruby on Rails and may be wondering what exactly it does and how you can try it for yourself. Put simply, Rails is a web application framework that uses the model-view-controller software design pattern to allow for rapid development of web applications.

This article will cover how to install Rails on Debian and how to configure it to work with Apache and a relational database of your choice.



Introduction and Key Terms

Ruby is an interpreted, object-oriented language inspired by Ada and Perl and shares some features with Python and LISP. Rails is a web application framework written in Ruby. Rails uses the model-view-controller software design pattern and provides a framework for the fast development of maintainable web-based, database-driven applications. Rails supports: advanced views using AJAX; many different databases, including MySQL, PostgreSQL and Oracle; and many different web servers, including Apache and lighttpd.

Key Terms

    * Ruby
          o interpreted, object-oriented language
          o over ten years old
    * Rails
          o web application framework
    * Model View Controller
          o software design pattern
          o data model, user interface, and control logic
    * AJAX
          o Asynchronous Javascript And XML
          o e.g. GMail and Google Maps
    * Gems
          o package management for Ruby


Installing Ruby, Gems and Rails


Ruby

Debian Stable contains a prepackaged version of Ruby. In addition to installing Ruby, you also need to install the zlib compression libraries for Ruby, the Ruby Documentation program that generates documentation from ruby source files, and the command-line Ruby interface. Run the following command to install the needed packages:

                        aptitude install ruby libzlib-ruby rdoc irb

(You might prefer to use "apt-get install ruby libzlib-ruby rdoc irb" if you don't use aptitude.)

If you want to test-drive Ruby from the command line you can run the irb program and execute Ruby commands:

                        # irb
                        rb(main):001:0> 3+5
                        => 8
                        irb(main):002:0> 4*20
                        => 80
                        irb(main):003:0> foo="bar"
                        => "bar"
                        irb(main):004:0> foo.reverse
                        => "rab"
                        irb(main):005:0> bar=40
                        => 40
                        irb(main):006:0> bar.to_s.reverse
                        => "04"
                        irb(main):007:0> exit


Gems

Now that you have Ruby installed you need to manually download the Gems package management software for Ruby. The latest version of Gems can be downloaded from the RubyForge web site.

From the command line, cd into the directory where you downloaded the Gems tarball and run the following command to extract the contents of the archive:

                        tar zxvf rubygems-0.8.11.tgz

Please note that the version number may be different if you downloaded a different version. You now need to cd into the newly created Gems directory and run the setup program for Gems:

                        cd rubygems-0.8.11
                        ruby setup.rb all


Notice how even the setup program for Gems is written in Ruby. These people take their language seriously. 

Read more


User reviews

There are no user reviews for this item.

Add new review




Powered by jReviews

Last Updated ( Thursday, 07 June 2007 )
 
< Prev   Next >