您的位置:首页 > 编程语言 > Ruby

安装配置Ruby for Eclipse

2009-11-04 09:01 274 查看

安装配置Ruby for Eclipse

document.body.oncopy = function() {
if (window.clipboardData) {
setTimeout(function() {
var text = clipboardData.getData("text");
if (text && text.length>300) {
text = text + "/r/n/n本文来自CSDN博客,转载请标明出处:" + location.href;
clipboardData.setData("text", text);
}
}, 100);
}
}

function StorePage(){d=document;t=d.selection?(d.selection.type!='None'?d.selection.createRange().text:''):(d.getSelection?d.getSelection():'');void(keyit=window.open('http://www.365key.com/storeit.aspx?t='+escape(d.title)+'&u='+escape(d.location.href)+'&c='+escape(t),'keyit','scrollbars=no,width=475,height=575,left=75,top=20,status=no,resizable=yes'));keyit.focus();}

一、安装前的准备工作:


1. 下载Ruby:http://www.ruby-lang.org/en/downloads/

2. 下载RDT(Ruby Development Tools) for Eclipse:http://sourceforge.net/project/showfiles.php?group_id=50233

3. 下载RadRails for Eclipse:http://update.aptana.com/install/rails/3.2/

建议大家尽量把所有插件都下载回来再安装,原因很简单,用Eclipse的New Remote Site安装时经常会因为网络问题安装不下去。下载下来再安装就方便多了。

二、安装Ruby环境及插件:


1. 安装Ruby解释器:直接双击下载下来的EXE文件,按安装向导安装即可;

2. 安装Rails:在CMD窗口中输入以下命令"gem install rails --include-dependencies
";

2. 安装RDT插件:在Eclipse>Help>Software updates>Find and install...>Search for new feature to install>New local Site
下,选择RDT插件的解压目录,按向导指示安装插件;

3. 安装RadRails插件:在Eclipse>Help>Software updates>Find and install...>Search for new feature to install>New local Site
下,选择下载的文件,按向导指示安装;

三、配置Ruby环境:


1. 我使用的Ruby版本是1.86,Eclipse版本是3.3.1,安装完成基本上不用再做任何配置,打开Eclispe>Windowns>Preferences>Ruby>Installed Interpreters
,可以看到缺省已经设置了JRuby做为虚拟机;



2. 如果你希望使用原生的Ruby做为虚拟机,则可以点击“Add”按钮设定Ruby的运行目录。到此时设置即告完成,不必像先以前的版本那样设置其它的系统路径。



四、Hello Ruby:


1. 选择菜单Eclispe>New>Project>Ruby>Ruby project
,建立一个Ruby工程“HelloRuby”;
2. 在新建的Ruby工程上右击鼠标,选择New>Ruby Class,建立一个新的Ruby类,类名为HelloRuby;



3. 在新类中写入下列代码,Hello Ruby就完成了。在工程上右击菜单Run as>Ruby Application
即可输出结果。



class HelloRuby



print

"
Hello Ruby!
"



end
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: