Ruby on Rails Environment building

Source: Internet
Author: User
Tags ruby on rails

Note: Now the http://rubyforge.org website has stopped running, replaced by the https://rubygems.org this website, the following in the need of the gem package can go to this site search download. The rest is done exactly as you say below.

Ruby on Rails Experience Tour (i)--Install

The latest whim to learn a new thing, I heard that with ROR development efficiency will be very high, so the choice of Ruby on Rails, the installation is really uncomfortable, here to put their own installation experience to write down:

1) Install Ruby

Download the installation package: http://rubyforge.org/frs/?group_id=167, I downloaded Rubyinstaller-1.8.7-p302.exe

After loading, you can use RUBY-V to test whether the installation is successful, and if a version appears, the installation is successful.

2) Install RubyGems

RubyGems is a Ruby Package Manager tool that makes it easy to install a Ruby package, requiring only one command to download the appropriate package from a remote server, and if the corresponding app contains additional extensions, RubyGems will also prompt you to rely on extensions from the remote installation. After installation RubyGems will run the appropriate program to generate the RDoc help document (similar to Javadoc). It has become the de facto Package manager standard for Ruby.

: http://rubyforge.org/projects/rubygems/,

I downloaded the rubygems-1.3.7, after extracting the directory under the SETUP.RB, after the installation is completed, with the following command to check:

Gem–v

3. Install Rails

A) Remote Installation: Gem install Rails–remote

The following instructions from the Internet I did not use this way to install, because my home network speed is too slow.

It then automatically outputs:

Install Required Dependency ActiveRecord?

Install Required Dependency Actionpack?

Install Required Dependency Actionmailer?

Install Required Dependency Activeresource?

Yes depends on the file and then displays:

Successfully installed rails-2.1.0

Successfully installed activerecord-2.1.0

Successfully installed actionpack-2.1.0

Successfully installed actionmailer-2.1.0

Successfully installed activeresource-2.1.0

Installing RI documentation for activerecord-2.1.0 ...

Installing RI documentation for actionpack-2.1.0 ...

Installing RI documentation for actionmailer-2.1.0 ...

Installing RI documentation for activeresource-2.1.0 ...

Installing RDOC documentation for activerecord-2.1.0 ...

Installing RDOC documentation for actionpack-2.1.0 ...

Installing RDOC documentation for actionmailer-2.1.0 ...

Installing RDOC documentation for activeresource-2.1.0 ...

See version: Rails-v

Output: Rails 2.1.0

Get

b) Local manual installation:

Need to download

Activesupport

Http://files.rubyforge.vm.bytemark.co.uk/activesupport/activesupport-2.2.3.gem

ActiveRecord

Http://files.rubyforge.vm.bytemark.co.uk/activerecord/activerecord-2.2.3.gem

Actionpack

Http://files.rubyforge.vm.bytemark.co.uk/actionpack/actionpack-2.2.3.gem

Actionmailer

Http://rubyforge.org/frs/download.php/64424/actionmailer-2.2.3.gem

Rake

Http://files.rubyforge.vm.bytemark.co.uk/rake/rake-0.8.7.gem

Activeresource

Http://rubyforge.org/frs/download.php/64419/activeresource-2.2.3.gem

Rails Http://rubyforge.org/frs/download.php/64426/rails-2.2.3.gem

After the download is complete, place all the files in the same folder and install them in turn: (Eg:d:\ruby)

Then execute the command.

(D:--D:\>CD D:\ruby)

Gem Install Activesupport

Gem Install ActiveRecord

Gem Install Actionpack

Gem Install Actionmailer

Gem Install Rake

Gem Install Rails

Check command after successful installation

Rails–v

Proof of Successful Installation

4. Create a web App

Entering Rails HelloWorld at the command line, such as the current path is E:\Ruby on Rails>rails HelloWorld, creates a E:\Ruby folder under HelloWorld on Rails.

If you need to specify a path can be rails c://test, specifically can see the official api:http://api.rubyonrails.org/

5, under the current directory (HelloWorld), run the Ruby script\server boot service, more information about the Webrick server can be accessed http://www.webrick.org/

6, enter http://localhost:3000/in the browser, if you see the following page, instructions OK

7, write a HelloWorld Web program, Ruby script\generate Controller HelloWorld command

and find HELLO_WORLD_CONTROLLER.RB.

      • Class Helloworldcontroller < Applicationcontroller
      • def index
      • Render:text=> "Hello World"
      • End
      • End

Enter the following code to save

    • If the service does not start, restart the fifth step.

Open Http://localhost:3000/hello_world in the browser, you will see the result, but I have an error here:

See a workaround on the Web:

This is because there is no Sqlite3 database installed, Http://files.cnblogs.com/geek007/sqlite3.rar here to download,

Then extract to Ruby's Bin directory: D:\ruby\bin, command line execution: Gem install "D:\Program Files\ruby187\bin\sqlite3-ruby-1.2.3-mswin32.gem"

After successful installation, follow the fifth step to restart the server, access in the browser

Http://localhost:3000/hello_World

Ok, done ~ hehe, happy ~ ~ ~

PS: Manual installation is very troublesome, can download instantrails from http://instantrails.rubyforge.org/, all done.

Reference resources:

http://rubyforge.org

http://api.rubyonrails.org/

Category: Ruby on Rails

From

Ruby on Rails Environment building

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.