Ruby creates a project and the first hello World

Source: Internet
Author: User
Tags ruby on rails
From: http://developer.51cto.com/art/200908/147276.htm

It is difficult to install Ruby on Rails, but it is also very convenient. To develop applications based on Ruby, we must install Ruby, Gem, rails, and mongrel.

How to install Ruby on Rails

First, download the latest Ruby one-click installer version on the official website (a ruby standard package manager already comes with rubygems), which is.

Second, install Ruby, double-click it, and then click Next... to complete the installation, which will be installed in the C:/Ruby directory by default.

Open the command line again and enter ruby-V to query the ruby version.

Third, download rails, this article download is rails2.0.2 version (the downloaded file name is: rails-2.0.2.zip), for: http://rubyforge.org/frs/download.php/29361/rails-2.0.2.zip

Fourth, to install rails, we recommend that you do not use the gem install rails -- include-dependencies in command line mode, because this installation method needs to be connected to the network and installation often fails. Instead, download a stand-alone packages version and install it locally. Copy the file rails-2.0.2.zip to the rubyinstallation directory and rename rails-2.0.2.zip to rails.zip. Otherwise, go to the Internet to find it during installation.

Run gem install rails in the command line to complete the installation in seconds. Note: The compressed files do not need to be decompressed. Of course, you can also decompress the files. It is not a problem to go To the plug-in directories and install them one by one.

Install rails in sequence:

1. activesupport

2, activerecord

3. actionpack

4, actionmailer

5. actionwebservice

6. rails

These gemfiles can all be found in the file vendor/rails in rails.zip.

After installation, enter rails-V in the command line to view the rails version.

Fifth, download mongrel, the latest version is: 1.1.4, for: http://rubyforge.org/frs/download.php/33195/mongrel-1.1.4-x86-mswin32-60.gem

To install mogrel, you also need to download the gem plugin, daemons, fastthread, cgi_multipart_eof_fix, which is

Gen_plugin: http://rubyforge.org/frs/download.php/27044/gem_plugin-0.2.3.gem

Daemons: http://rubyforge.org/frs/download.php/34222/daemons-1.0.10.gem

Fastthread: http://rubyforge.org/frs/download.php/29508/fastthread-1.0.1-i386-mswin32.gem

Cgi_multipart_eof_fix: http://rubyforge.org/frs/download.php/27040/cgi_multipart_eof_fix-2.5.0.gem

Sixth, install mongrel.

Gem install gem_plugin-0.2.3.gem

Gem install daemons-1.0.10.gem

Gem install fastthread-1.0.1-i386-mswin32.gem

Gem install cgi_multipart_eof_fix-2.5.0.gem

Gem install mongrel-1.1.4-x86-mswin32-60.gem

7. Create a rails application for testing.

Go to the directory where you want to create the project. If the project name is "hello", run "Rails hello" in the command line.

At this point, the system will automatically create Ruby on Rails Applications, automatically initialize the directory structure and some basic stuff.

Eighth, start rails

Enter the hello directory and enter mongrel_rails start-D in the command line to start the mongrel server.

The default server occupies port 3000. Finally, open IE and test whether the main interface of Ruby on Rails can be displayed.

At this point, Ruby on Rails is successfully installed.

Of course, you can also download some integrated development environments, which can be omitted in a lot of work. However, if you use the most common command line mode, you may be able to experience more. Although there is a lot of sweat in the middle and how many brain cells are murdered, you are happy! Haha

Last, if you install instantrails directly, it is http://rubyforge.org/frs/download.php/29867/instantrails-2.0-win.zip. You don't need to do anything, Because Ruby, rails, mongrel, and Apache are all packaged together. However, to understand the entire installation process, we recommend that you install it one by one. It is recommended that you do it several times at the beginning!

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.