Rubyonrails installation and eclipse plugin

Source: Internet
Author: User

Development Environment Construction in Windows
This article describes how to build an ROR development environment in a Windows operating system.
1. Remote Installation
A. Step 1: download and install the ruby one-click installation package
Download the latest Ruby 1.8.4-16 one-click installation package for http://rubyforge.org/projects/rubyinstaller/
Download and run the installation file.
After the installation is complete, open the command line window and enter and run the ruby-V command. After the installation is successful, the ruby version is displayed.
B. Step 2: Use rubygems to install rails
Rubygems is a standard Ruby Package Manager, which features similar to Apt-get in Linux. You can use rubygems to conveniently download and install rails from a remote server.
Open the command line window, enter and execute the command gem install rails -- remote or gem install rails -- include-dependencies.
Open the command line window and enter and run rails-v. The displayed rails version is 1.0.0. After rails is installed successfully, the ROR development environment is successfully set up.
Note that to install rails using gem install rails--remote, you can directly download the rails installation package file from a remote server, and use the gem install rails--include-dependencies command to install rails, the system first checks whether the rails installation package exists on the local host. If not, the system downloads and installs the package from the remote server.

2. Local Installation
A. Step 1: download and install the ruby one-click installation package. For detailed steps, see "Remote Installation.
B. Step 2: Obtain the rails installation plug-in package
Http://rubyforge.org/frs/ from URL address? Group_id = 307 & release_id = 4878 download rails-1.0.0.gemand rails-1.0.0.zip. Save the downloaded file to the same directory (D: \ ROR ). Note: you do not need to decompress the compressed file.
C. Step 3: Install the rails plug-in package
Open the command line window, go to the D: \ ror directory, and run the gem install rails command to complete the installation.

Build a development environment in Linux
This section describes how to build an ROR development environment in Linux. Although Linux has multiple Release versions, the basic principle and installation process are the same. Here we use the Debian system as an example to describe how to install the ROR development environment in Linux.
A. Step 1: Download Ruby Source code File
Enter and run the wget http://rubyforge.org/frs/download.php/7858/ruby-1.8.4.tar.gz command in shell or ftp://ftp.ruby-lang.org/pub/ruby/ruby-1.8.4.tar.gzcommand to download the ruby-1.8.4 Source Code Program , The installation file will be downloaded to the current directory.
B. Step 2: Install Ruby
To install Ruby, run the following commands in sequence.
1 tar zxvf ruby-1.8.4.tar.gz
2 CD ruby-1.8.4
3./configure-Prefix = $ home
4 make
5 make install
The execution result of command 1 is to extract the source code file from the compressed package to the ruby-1.8.4 folder in the current directory; the execution result of command 2 is to jump to the ruby-1.8.4 directory; commands 3 to 5 are used to compile and execute source code files. After the preceding five commands are executed, enter and execute the ruby-V command in shell. The ruby installation is successful.
C. Step 3: download and install rubygems
Execute the following commands in sequence to download and install rubygems.
1 wget http://rubyforge.org/frs/download.php/5207/rubygems-0.8.11.tgz
2 tar xzf rubygems-0.8.11.tgz
3 CD rubygems-0.8.11
4 Ruby setup. Rb
Command 1 is used to remotely download the rubygems installation package; command 2 is used for decompression; command 3 is used to jump to the specified directory; command 4 is used to install the rubygems Package Manager. The preceding four commands are successfully executed, indicating that rubygems is successfully installed.
D. Step 4: Use rubygems to install rails
In the shell, enter and execute the command gem install rails -- include-dependencies to install the rails framework. After the command is executed, enter rails-V in the shell, if version information is displayed, the ROR development environment is successfully set up.

Ii. Ide eclipse plugin
You must select an easy-to-use tool for development. I searched the internet and found many tools supporting Ruby development, but I still want to use eclipse. Therefore, check whether Eclipse plug-ins are available to support Ruby development. It's really good. I found it. Ruby also has the eclipse-based development environment plug-in RDT.
We recommend that you install the plug-in remotely through eclipse updates.
Choose Help> Software Updates> Find and install from the eclipse menu.
Select search for new features to install.
You need to install two plug-ins:
1, RDT
Http://updatesite.rubypeople.org/release
2, radrails
Http://radrails.sourceforge.net/update
After installation, you need to set the location of the Ruby interpreter.

You can also download the zip package from these two websites. Decompress the package to eclipse/plugins.
Http://www.radrails.org/, download the modified idea on eclipsebasic. Applicable to Windows, lnx, and Mac

Use the eclipse menu windows> preferences to open the preferences dialog box and set the ruby location in the installed interpreters item under the ruby title.
Start a name, and then point the "location" text field to your ruby version of bin/Ruby. For example,/usr/bin/Ruby

This completes the ruby environment. Create a ruby project in eclipse, create a ruby file, write puts "OK", and click "run" to view the "OK" string output on the eclipse console.

**************************************** **************************************** ***************

Out of curiosity about Ruby, good morning. Let's take a look at it. The syntax is concise and it's a good language,

Have time to learn more

Http://www.ruby-lang.org/zh_CN/documentation/ help documentation

--- The following installation configuration is reprinted

I. Preparations before installation:

1. Download RUBY: http://www.ruby-lang.org/en/downloads/

2. Download RDT (Ruby development tools) for Eclipse: http://sourceforge.net/project/showfiles.php? Group_id = 50233

3. Download radrails for Eclipse: http://update.aptana.com/install/rails/3.2/

We recommend that you download all the plug-ins and install them again. The reason is very simple. The new remote site of eclipse often fails to be installed due to network problems. It is much easier to download and install it.

Ii. Install the ruby environment and plug-ins:

1. Install the Ruby interpreter: double-click the downloaded EXE file and follow the Installation Wizard to install it;

2. Install rails: Enter the following command in the CMD window: "Gem install rails -- include-dependencies ";

2. install the RDT plug-in: Go to eclipse> help> Software Updates> Find and install...> search for new feature to install> new local site, select the extract directory of the RDT plug-in, and follow the instructions in the Wizard to install the plug-in;

3. install the radrails plug-in: Go to eclipse> help> Software Updates> Find and install...> search for new feature to install> new local site, select the downloaded file and follow the instructions in the Wizard to install the file;

3. Configure the ruby environment:

1. the ruby version I used is 1.86, And the eclipse version is 3.3.1. Basically, no configuration is required after installation. Open eclispe> windowns> preferences> Ruby> installed interpreters, we can see that jruby has been set as a virtual machine by default;

2. If you want to use native Ruby as a virtual machine, you can click "add" to set the ruby running directory. At this time, the setting is completed, and you do not need to set other system paths as in the previous version.

4. Hello Ruby:

1. Select the menu eclispe> New> Project> Ruby project to create a ruby project "helloruby ";

2. Right-click the new Ruby project and choose new> Ruby class to create a new Ruby class named helloruby;

3. Write the following code into the new class, and hello Ruby is complete. Right-click the project and choose run as> Ruby application to output the result.

Class helloruby
Print "Hello Ruby! "
End

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.