LoginSignup
0
0

More than 5 years have passed since last update.

Install Ruby2.0 and Rails 4.0 on OX S Part 2

Posted at

接上文《Install Ruby2.0 and Rails 4.0 on OX S Part 1》,本文接着介绍如何安装rails4.0 。

1. 安装bundle

需要注意bundle版本问题

$ gem install bundler --no-ri --no-rdoc

$ bundle -v
Bundler version 1.3.5

必要时可能需要rbenv rehash操作。

2. 安装rails4.0

安装过程很简单,也很顺利。

按照rails官方说法,如下安装:

$ gem install rails --version 4.0.0.rc1 --no-ri --no-rdoc

最新的rails版本是4.0.0.rc1

本文采用bundle方式安装:

$ mkdir /tmp/rails4
$ cd /tmp/rails4
$ bundle init

然后编辑Gemfile,让它内容像下面这样:

$ cat Gemfile
# A sample Gemfile
source "https://rubygems.org"
gem "rails","~> 4.0.0.rc1"

然后运行安装命令:

$ bundle install

不出意外的话,即可以确认rails版本:

$ rails -v
Rails 4.0.0.rc1

3. 启动rails

首先建立个rails项目:

$ rails new foo --edge
create

create README.rdoc
create Rakefile
create config.ru
create .gitignore
create Gemfile
… ...
create vendor/assets/stylesheets/.keep
run bundle install
… ...
Your bundle is complete!
Use bundle show [gemname] to see where a bundled gem is installed.
Post-install message from rdoc:
Depending on your version of ruby, you may need to install ruby rdoc/ri data:
… ...
<= 1.8.6 : unsupported
= 1.8.7 : gem install rdoc-data; rdoc-data --install
= 1.9.1 : gem install rdoc-data; rdoc-data --install
= 1.9.2 : nothing to do! Yay!

然后启动服务器:

$ bundle exec rails server
[2013-06-01 16:42:10] INFO WEBrick 1.3.1
[2013-06-01 16:42:10] INFO ruby 2.0.0 (2013-05-14) [x86_64-darwin12.3.0]
[2013-06-01 16:42:10] INFO WEBrick::HTTPServer#start: pid=1183 port=3000

一切正常,即可以通过浏览器来确认环境:

rails 4.0

--完--

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0