Ruby-On-Rails(RoR)旅途的第一步

Have you on-rails today? Ruby on Rails or simply Rails are really a hot topic at the weblogers and blogers. This post share with you my direct experience when first step after getting my hand dirty.
我的操作系统是Windows,下载Ruby后点击安装非常简单,假设安装在D:\ruby,其中已经附带了Rubygems软件包管理程序,然后到Rubyforge.org那里下载standalone版本的Rails到本地,记得是个gem文件,然后 d:\RoR> gem install rails
得到安装成功的提示后,

D:\RoR> “d:\ruby\bin\ruby.exe” “d:\ruby\bin\gem” install rails
Attempting local installation of ‘rails’
Successfully installed rails, version 1.0.0

可是这是如果你就急火火得想使用rails生成你的第一个Demo应用时,你会遇到让你沮丧的错误提示,例如可能时缺少rake-0.6.2.gem:

d:\RoR> rails Demo
d:/ruby/lib/ruby/site_ruby/1.8/rubygems.rb:194:in `report_activate_error’: Could
not find RubyGem rake (> 0.6.0) (Gem::LoadError)
from d:/ruby/lib/ruby/site_ruby/1.8/rubygems.rb:136:in `activate’
from d:/ruby/lib/ruby/site_ruby/1.8/rubygems.rb:162:in `activate’
from d:/ruby/lib/ruby/site_ruby/1.8/rubygems.rb:161:in `each’
from d:/ruby/lib/ruby/site_ruby/1.8/rubygems.rb:161:in `activate’
from d:/ruby/lib/ruby/site_ruby/1.8/rubygems.rb:37:in `require_gem_with_options’
from d:/ruby/lib/ruby/site_ruby/1.8/rubygems.rb:31:in `require_gem’
from d:/ruby/bin/rails:17

别慌,其实没什么。不知道为什么没有将这些gem包一起放在rails里面,自己下载过来安装上就可以开心on-rails了。到http://gems.rubyforge.org上下载下面几个gem文件包:

  • rake-0.6.2.gem
  • actionmailer-1.1.5.gem
  • actionpack-1.11.2.gem
  • actionwebservice-1.0.0.gem
  • activerecord-1.13.2.gem
  • activesupport-1.2.5.gem

然后分别使用: d:\RoR> gem install [actionmailer | actionpack |…]将上面的gem安装上。

这样你的Rails第一步就成功了,下面是生成第一个Demo例程框架的提示:

d:\RoR> rails Demo
create
create app/controllers
create app/helpers
create app/models
create app/views/layouts
create config/environments
create components
create db
create doc
create lib
create lib/tasks
create log
create public/images
create public/javascripts
create public/stylesheets
create script/performance
create script/process
create test/fixtures
create test/functional
create test/mocks/development
create test/mocks/test
create test/unit
create vendor
create vendor/plugins
create Rakefile
create README
create app/controllers/application.rb
create app/helpers/application_helper.rb
create test/test_helper.rb
create config/database.yml
create config/routes.rb
create public/.htaccess
create config/boot.rb
create config/environment.rb
create config/environments/production.rb
create config/environments/development.rb
create config/environments/test.rb
create script/about
create script/breakpointer
create script/console
create script/destroy
create script/generate
create script/performance/benchmarker
create script/performance/profiler
create script/process/reaper
create script/process/spawner
create script/process/spinner
create script/runner
create script/server
create script/plugin
create public/dispatch.rb
create public/dispatch.cgi
create public/dispatch.fcgi
create public/404.html
create public/500.html
create public/index.html
create public/favicon.ico
create public/robots.txt
create public/images/rails.png
create public/javascripts/prototype.js
create public/javascripts/effects.js
create public/javascripts/dragdrop.js
create public/javascripts/controls.js
create doc/README_FOR_APP
create log/server.log
create log/production.log
create log/development.log
create log/test.log

technorati tags: , , ,

2 Responses to Ruby-On-Rails(RoR)旅途的第一步

  1. alang says:

    我用的是instant rails,什么都有了。包括Appache,MySql,php,Rails等。

  2. […] Ruby-On-Rails(RoR)旅途的第一步 […]

%d bloggers like this: