天天看点

在windows下安装ruby1.9.2,rails3.0.3和DevKit

1.安装ruby环境

http://rubyforge.org/frs/download.php/73722/rubyinstaller-1.9.2-p136.exe

2.安装rails

gem install rails --no-ri --no-rdoc

Successfully installed activesupport-3.0.3

Successfully installed builder-2.1.2

Successfully installed i18n-0.5.0

Successfully installed activemodel-3.0.3

Successfully installed rack-1.2.1

Successfully installed rack-test-0.5.7

Successfully installed rack-mount-0.6.13

Successfully installed tzinfo-0.3.23

Successfully installed abstract-1.0.0

Successfully installed erubis-2.6.6

Successfully installed actionpack-3.0.3

Successfully installed arel-2.0.7

Successfully installed activerecord-3.0.3

Successfully installed activeresource-3.0.3

Successfully installed mime-types-1.16

Successfully installed polyglot-0.3.1

Successfully installed treetop-1.4.9

Successfully installed mail-2.2.14

Successfully installed actionmailer-3.0.3

Successfully installed thor-0.14.6

Successfully installed railties-3.0.3

Successfully installed bundler-1.0.7

Successfully installed rails-3.0.3

23 gems installed

3.安装SQLite3

http://www.sqlite.org/sqlite-dll-win32-x86-3070400.zip

http://www.sqlite.org/sqlite-shell-win32-x86-3070400.zip

解压copy到:d:\Ruby192\bin目录.

sqlite3 -version

4.Create An Example Rails App

1>.From a command prompt, navigate to a directory where you want the application code to live

cd E:\BASICAPP\ror\apps

2>.Start by creating an empty Rails application called todos:

rails new todos

3>.Change into the todos directory that was created in the previous step:

cd todos

4>.The application doesn't know about todos yet, so we'll use scaffolding to quickly generate all the code for managing a list of todos. Run the scaffold generator by typing

rails g scaffold todo name:string due_on:date completed:boolean

You'll see Rails create a bunch of files, including a migration file for creating a database schema to store todo items in a database (SQLite3 in this case).

5>.Run the database migration by typing

rake db:migrate

6>.Then start the Rails app by typing

rails s

7>.Finally, point your web browser at http://localhost:3000 and you should see a page welcoming you to Rails. To start managing your todos, go to http://localhost:3000/todos.

8>.When you're done, you can stop the Rails app by typing CTRL-C in the command prompt where you started the app.

5.install the DevKit:

http://github.com/oneclick/rubyinstaller/wiki/Development-Kit

1>.Remove artifacts extracted by any of the legacy DevKit’s.

2>.Download the self-extracting DevKit-tdm-32-4.5.1-20101214-1400-sfx.exe archive.

3>.Extract the DevKit contents into a directory with no spaces, e.g. – d:\DevKit.

4>.Run the DevKit’s dk.rb init and install helper scripts to generate config.yml and enhance your installed Rubies.

ruby dk.rb init

ruby dk.rb install

5>.update your PATH

D:\DevKit\bin

6>.Run the gem install rdiscount --platform=ruby smoke test.

gem install rdiscount --platform=ruby

6.问题

1>.can't find executable rake for rake-0.8.7

到ruby1.9.2安装目录 /lib/ruby/gems/1.9.1/specifications/下,找到rake.gemspec这个文件,并删除掉,就恢复正常了

2>.

entry point rb_str2cstr could not be located in msvcrt-ruby191.dll

http://bit.ly/9RWQiW

sqlite3-ruby 1.2.5改为1.3.2