1.1 开始起步,配置ruby on rails运行环境
这是个复习用的傻瓜式教程。
现在才开始学的ruby on rails,我的第一次配置以失败告终,因为连一个应用程序都创建不了。后来发现rails里面的ruby版本竟然和装的不一样,原来一开始装了两个版本的ruby。
而我之前并没有学过编程,连cmd都没接触过。感觉入门真难。
好了,要一步一步的完善过程。
我的系统是win7,所看的教材上用的是xp,手里只有一本教材,名字是《Raby on Rails入门权威经典》。
将在这里下载ruby,rails等等的地方。
2,下载并安装ruby.
http://rubyforge.org/frs/download.php/75679/rubyinstaller-1.8.7-p357.exe
我下载的是1,9,3,书上的因为时间差,已经没有了,安装上的界面也和书本上的不一样。


这是完成后的目录:

然后在开始/所有程序/附录里,打开命令提示符,直接输入一个 ruby -v 来确认是否安装。

跳出来的是版本号,安装成功,谢天谢地。
安装完后,请确认本机的windows的path中添加Ruby的bin目录,如你安装的路径为D:\ruby,请确认我的电脑 → 属性 → 高级 → 环境变量 → 系统变量 → Path中包含D:\ruby\bin的值。
3,下载并安装Rails.
首先要下载4个不知道是什么东西的东西,不管了先下载再说。
①active support http://rubyforge.org/frs/download.php/64422/activesupport-2.2.3.gem
②action pack http://rubyforge.org/frs/download.php/64423/actionpack-2.2.3.gem
③active record http://rubyforge.org/frs/download.php/64425/activerecord-2.2.3.gem
④action mailer http://rubyforge.org/frs/download.php/64424/actionmailer-2.2.3.gem
然后在D盘新建一个叫ror的文件夹。把这一堆4个文件放进去。

然后在刚刚的命令提示符中输入 d: (打开d盘)
然后输入 cd ror (打开文件夹‘ror’)
一个的的输入进去 例如第一个是 gem install activesupport --local
然后出来一长串
例如:
Successfully installed activesupport-2.2.3
1 gem installed
Installing ri documentation for activesupport-2.2.3...
unable to convert U+00F4 from UTF-8 to GBK for lib/active_support/multibyte/char
s.rb, skipping
Installing RDoc documentation for activesupport-2.2.3...
unable to convert U+00F4 from UTF-8 to GBK for lib/active_support/multibyte/char
s.rb, skipping
就说明完成了。
接着一个个的输入 gem install activerecord --local
然后 gem install actionpack --local
再 gem install actionmailer --local
完整命令的是这样:
D:\ror>gem install activesupport --local
Successfully installed activesupport-2.2.3
1 gem installed
Installing ri documentation for activesupport-2.2.3...
unable to convert U+00F4 from UTF-8 to GBK for lib/active_support/multibyte/char
s.rb, skipping
Installing RDoc documentation for activesupport-2.2.3...
unable to convert U+00F4 from UTF-8 to GBK for lib/active_support/multibyte/char
s.rb, skipping
D:\ror>gem install activerecord --local
Successfully installed activerecord-2.2.3
1 gem installed
Installing ri documentation for activerecord-2.2.3...
Installing RDoc documentation for activerecord-2.2.3...
D:\ror>gem install actionpack --local
Successfully installed actionpack-2.2.3
1 gem installed
Installing ri documentation for actionpack-2.2.3...
Installing RDoc documentation for actionpack-2.2.3...
D:\ror>gem install actionmailer --local
Successfully installed actionmailer-2.2.3
1 gem installed
Installing ri documentation for actionmailer-2.2.3...
Installing RDoc documentation for actionmailer-2.2.3...
随后我又安装了ruby gems和action web service,方法和上面是一样的,虽然不知道什么用,但是上一次的时候这些没能安装成功,rails也没有成功安装,所以一定要装这些东西。官网地址http://rubyforge.org/
最后才是rails!http://rubyforge.org/frs/?group_id=307&release_id=39559
把下载的rails的zip压缩包和gem依旧扔进刚刚的文件夹,然后安装。
输入 gem install rails

发现出错。
一看原来是版本不对。
后来我重新下载了一个actionpack 2.1.2的版本安装进去,没错我只去安装了一个,出来了一堆,结果再重新输入gem install rails,居然成功了。
总结一下安装的几样必需品:
actionmailer
actionpack
activerecord
activeresource
actionwebservice
ruby gems
rails
然后又到了喜闻乐见的验证时间…向刚刚一样输入rails -v

出现了版本号。over~
浙公网安备 33010602011771号