Friday, July 16, 2010

Installing RadRails Plug-in in the MyEclipse

Preparation: Before installing it, I suggest you'd better install ruby, rails and MySQL at first. The installer package for ruby that I choose is rubyinstaller for windows version, you can download it from http://rubyinstaller.org. The process of installing is very simple, you only need to follow the wizard and do it(Notice: During installing, you must make sure the checkbox of Enable RubyGems option is checked. It's the default value):

image

After installing completed, you can open the command window and input the command line: Ruby –v. If the version of ruby can be displayed normally, it proved the installing was sucessful!(The installer would add the system path for ruby automatically. And my version of ruby is 1.8.6.)

Next, we should update Gem system. You can execute the command on the command windows: gem update –system; then we should execute the command "gem install -v=2.3.5 rails" to install Rails. After installed, you can execute the command "rails –v" to check the version of Rails.

Now, you need to install MySQL. Please pay attention to the version number of MySQL. It seams like the MySQL adapter that ruby provided is just for 5.0 version. The version of MySQL DB that I installed is 5.0.18 for windows. You can download it from MySQL official website. Here I omitted the process of installing for MySQL. If you want to verify whether the installing is sucessful, you might input the command line as below (Suppose the username and password all are "root"):

02

Then we need to install the gem for mysql. The gem I choosed is mysql-2.8.1-x86-mswin32.gem. After you fetch this file and save it in the installing directory for ruby(Suppose it is c:\ruby), you can switch the current directory to c:\ruby, and execute command line:

gem install mysql-2.8.1-x86-mswin32.gem

03 The system will give the result it showed "Sucessfully installed". But I don't know the specfic reason that the gem installer cann't install the related document and give the error message "No definition for …".

Now, we are going to install the RadRails plug-in, it is my topic of this article. The version of MyEclipse is 8.5. The installing steps are as below:

1. Start MyEclipse application, and choose "MyEclipse" menu, go to "MyEclipse Configuration Center" item.

04

2. Choose "Software" tag, and click the "add site" on the left side:

05 It will pop up the dialog box:

06

3. Input the name of site(The naming is up to you, I choose the name "Rails") and URL:

http://download.aptana.com/tools/radrails/plugin/install/radrails-bundle

4. Now, the section which name is "Personal Site" emerges from the left side. There is the name of new site "Rails":

07 5. Click the site name, the system will connect to the URL and download the remoted data. It will last about one minute, then it will show the treeview structure of Rails-Aptana RadRails. Now you can click it, there should be show the message "Managed Changes:1 Change" in the Pending Changes section which locates in the bottom and right of the screen. 

08

6. Click "Apply 1 Change" button, the system will validate the MyEclipse at first:

 0910 Then, It will pop up the dialog box "Accept Software License". We might select it and click "Next" button:

11Then, click "Update" button, it is executing update operation:

12 

The process will progress slowly. It is very strange that it is normal at the beginning of update operation, but the error occurs frequently at the end of operation:

13 Don't worry! Please wait for a few minutes, it will pop up the dialog box to show the error information:

14 At this time, you must click "Back" button to back the dialog box, and click "update" button again, it will restart to update. It will skip the sucessful operation and repeat the wrong operation. Unfortunally, only one wrong operation can be corrected every time, the error diaglog box is popped up as ghost. I don't know how to handle this issue, the one way that I know is to repeat the process until it corrected all wrong operation. I try to find out the reason, but I failed. The error is not related to bandwidth of network.

This terrible process will be lasted for about two hours andsuccessful final. The system requires to restart MyEclipse.

After installing the plug-in, the system maybe notices the user to auto-install gems, the diagram is as below:

15 Although I didn't try these, but I strongly suggest not to install these gems because these gems with the latest version will be conflicted with the existed version.

To validate whether the plug-in had been installed sucessfully, and integrated with ruby, rails and MySQL, we might create the sample project to check it. At first, we will change the view in MyEclipse into RadRails:

16 Then, you can create a new rails project on the ruby explorer:

17 Input the project name "Sample" in the pop-up dialog box, and select mysql database:

18Click the "Finish" button, it will execute the rails command automaticlly and generate the related folders and files with Rails. The directory structure is as below:

19  Now, please open the database.yaml file in the directory with "config", and modify the configuration like this(The precondition is that I had create the database "oa" in the MySQL):

20 Then switch to the server window in MyEclipse, and start the server of Sample project(using WebRick server) with the default port number 3000. After server is running, you can open the explorer such as Internet Explorer or Firefox, and input the URL:http://localhost:3000:

21 Click the link "About your application's environment", if the information related to ruby can be display correctly, it proved the plug-in had been installed sucessfully and the development environment was prepared normally.

No comments: