一、ruby和rails简介
ruby是一种面向对象的动态脚本语言。它的语法很灵活,而且提供了丰富的类库。因此,用ruby编写程序的效率是非常高的。
虽然ruby很早就出现了(1993年诞生于日本),但由于ruby一直缺乏英语文档,而且当时的ruby在web开发上并不怎么出众。因此,在2000年之前,ruby还只在日本流行。但这一切被2000年问世的rails打破。
Rails是使用纯ruby编写的框架(framework)。它对web开发提供了强有力的支持,如支持数据映射、MVC模式、Web Services、安全等。而且这些功能操作起来要比同类的产品容易的多,如MVC模式就比struts更容易使用。除了这些,rails还可以根据模板自动生成web程序。这样可以省去我们很多的时间。在讨论ruby如何借助rails快速开发web程序之前,让我们先看看如何安装和运行ruby和 rails。
二、安装和运行ruby
0、下载:http://rubyforge.org/frs/?group_id=167本处下载为windows版本
1、安装完后ruby185-21.exe后,把安装的文件夹复制到本地目录,比如:D:盘
2、设置PATH:中增加:d:\ruby\bin
3、在D:\ruby\中建立一个文件夹test,测试用
4、建立一个文本文件:first_ruby.rb
5、输入一条ruby语句:
puts Time.now.strftime("%Y-%m-%d %H:%M:%S")
6、执行ruby first_ruby.rb
7、如果输出类似"2006-10-07 19:20:20"的字符串,则说明ruby已经安装成功。
8、用cmd /k "d:\ruby\bin\gem"得到gem运行的相关帮助信息或者用gem -h 或者 gem --help得到相关帮助
9、注:ruby有一个eclipse插件非常不错,如果对其感兴趣,可以使用eclipse的help->Software Updates->Find and Install功能通过http://updatesite.rubypeople.org/release进行安装。
三、安装和运行rails
1、Rails在windows下安装是非常容易的,只需要执行如下命令:
gem install rails --include-dependencies 即可。
注:gem命令在ruby安装目前的bin目录中,运行时要设置path路径。还有在执行这条命令时本机一定要连接internet。因为这条命令是通过internet来下载rails并安装的。
2、在安装完rails后。执行下列命令:
rails first_rails
cd first_rails
ruby script/server
3、然后在IE中输入http://localhost:3000。如果出现欢迎界面,则说明rails安装成功。
参考资料里有图
参考资料:http://sunanjun.blog.hexun.com/6453316_d.html
分享到:
- 2008-12-10 20:29
- 浏览 540
- 评论(0)
- 论坛回复 / 浏览 (0 / 1094)
- 查看更多
相关推荐
NetBeans Ruby and Rails IDE with JRuby 2009,大家看标题就知道了啊。。好东西啊,刚得到就发上来了。。
Pro Active Record. Databases with Ruby and Rails
Pro ActiveRecord Databases with Ruby and Rails.pdf
Apress Pro ActiveRecord Databases with Ruby and Rails.pdf <br>好书一本
《Ruby and Rails报表实例》 英文PDF + 源码
Ruby on Rails is the revolutionary online programming tool that makes creating functional e-commerce web sites faster and easier than ever. With the intuitive, straightforward nature of Ruby and the ...
NULL 博文链接:https://qianjigui.iteye.com/blog/250876
Both Rails 3 and 4, as well as Ruby 1.9 and 2.0, bring hundreds of improvements, including new APIs and substantial performance enhancements. The fourth edition of this award-winning classic has been...
“The author is clearly an expert at the Ruby language and the Rails framework, but more than that, he is a working software engineer who introduces best practices throughout the text.” —Greg ...
3.1 版的 ruby on rails, 开发者必读,两种格式。
Tens of thousands of Rails applications are already live....and outside the Ruby community... Rails has become a standard to which even well-established tools are comparing themselves to.”
学习Ruby on Rails 4.0的逐步指南。 它包括针对Ruby 2.0.0的基本教程,是为至少了解另一种编程语言并熟悉HTML的程序员编写的。
Ruby on Rails and J2EE
This edition now gives new Ruby and Rails users more information on the Ruby language and takes more time to explain key concepts throughout. Best practices on how to apply Rails continue to change, ...
we'll help you get up and running as a Ruby on Rails developer on any operating system: Windows, Mac, or Linux. We start with a gentle introduction to the object-oriented Ruby language with examples ...
在不应该将 Ruby and Rails 作为首选的地方使用 Ruby and Rails。(用 Ruby and Rails 做了不擅长做的工作) 过度的消耗内存导致需要利用大量的时间进行垃圾回收。 Rails 是个令人愉快的框架,而且 Ruby 也是一个...