ruby 已经升级到了 2.0
$ ruby -v
ruby 2.0.0p0 (2013-02-24 revision 39474) [x86_64-linux]
$ gem update rails --include-dependencies
ERROR: While executing gem ... (OptionParser::InvalidOption)
invalid option: --include-dependencies
$ gem update rails
Updating installed gems
Nothing to update
$ gem update rails bundler
Updating installed gems
Nothing to update
$ gem -v
2.0.0.rc.2
$ rails -v
程序“rails”尚未安装。 您可以使用以下命令安装:
sudo apt-get install rails
昨天刚刚安装的 rails 环境,还没来得及学习,就出了新版。现在想直接升级到 ruby2.0 rails4 上去入门。
但是环境没弄好。
昨天安装的时候,参考的 http://ruby-china.org/wiki/install_ruby_guide
今天升级的时候 还执行了。一个这个
PATH=$PATH:$HOME/.rvm/bin # Add RVM to PATH for scripting
[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm" # This loads RVM
升级一下 rvm,rubygems 现在是 2.0 了
自己的升级过程:
rvm get stable
rvm install ruby-2.0.0-p0
rvm use ruby-2.0.0-p0 --default
gem install rails
cd project & bundle install
升级一下 rvm,rubygems现在是 2.0 了
自己的升级过程:
1. rvm get stable
2. rvm install ruby-2.0.0-p0
3. rvm use ruby-2.0.0-p0 --default
4. gem install rails
5. cd project & bundle install
多谢你的指点啊。但是 我这样子操作之后 Rails 还是 3.2.12 没有升级到 4 啊“
$ ruby -v
ruby 2.0.0p0 (2013-02-24 revision 39474) [x86_64-linux]
$ rails -v
Rails 3.2.12
$ gem -v
2.0.0.rc.2
我用 3.0.12 的新建立了一个项目(按那个http://guides.ruby-china.org/getting_started.html 来做的)
~/Ruby-project$ gem install bundle
Fetching: bundle-0.0.1.gem (100%)
Successfully installed bundle-0.0.1
Installing ri documentation for bundle-0.0.1
Done installing documentation for bundle (0 sec).
1 gem installed
~/Ruby-project$ rails new blog
create
create README.rdoc
create Rakefile
create config.ru
create .gitignore
create Gemfile
create app
create app/assets/images/rails.png
create app/assets/javascripts/application.js
create app/assets/stylesheets/application.css
create app/controllers/application_controller.rb
create app/helpers/application_helper.rb
create app/views/layouts/application.html.erb
create app/mailers/.gitkeep
create app/models/.gitkeep
create config
create config/routes.rb
create config/application.rb
create config/environment.rb
create config/environments
create config/environments/development.rb
create config/environments/production.rb
create config/environments/test.rb
create config/initializers
create config/initializers/backtrace_silencers.rb
create config/initializers/inflections.rb
create config/initializers/mime_types.rb
create config/initializers/secret_token.rb
create config/initializers/session_store.rb
create config/initializers/wrap_parameters.rb
create config/locales
create config/locales/en.yml
create config/boot.rb
create config/database.yml
create db
create db/seeds.rb
create doc
create doc/README_FOR_APP
create lib
create lib/tasks
create lib/tasks/.gitkeep
create lib/assets
create lib/assets/.gitkeep
create log
create log/.gitkeep
create public
create public/404.html
create public/422.html
create public/500.html
create public/favicon.ico
create public/index.html
create public/robots.txt
create script
create script/rails
create test/fixtures
create test/fixtures/.gitkeep
create test/functional
create test/functional/.gitkeep
create test/integration
create test/integration/.gitkeep
create test/unit
create test/unit/.gitkeep
create test/performance/browsing_test.rb
create test/test_helper.rb
create tmp/cache
create tmp/cache/assets
create vendor/assets/javascripts
create vendor/assets/javascripts/.gitkeep
create vendor/assets/stylesheets
create vendor/assets/stylesheets/.gitkeep
create vendor/plugins
create vendor/plugins/.gitkeep
run bundle install
Fetching gem metadata from https://rubygems.org/...........
Fetching gem metadata from https://rubygems.org/..
Resolving dependencies...
Using rake (10.0.3)
Using i18n (0.6.1)
Using multi_json (1.6.1)
Using activesupport (3.2.12)
Using builder (3.0.4)
Using activemodel (3.2.12)
Using erubis (2.7.0)
Using journey (1.0.4)
Using rack (1.4.5)
Using rack-cache (1.2)
Using rack-test (0.6.2)
Using hike (1.2.1)
Using tilt (1.3.3)
Using sprockets (2.2.2)
Using actionpack (3.2.12)
Using mime-types (1.21)
Using polyglot (0.3.3)
Using treetop (1.4.12)
Using mail (2.4.4)
Using actionmailer (3.2.12)
Using arel (3.0.2)
Using tzinfo (0.3.35)
Using activerecord (3.2.12)
Using activeresource (3.2.12)
Using bundler (1.3.0.pre.8)
Installing coffee-script-source (1.4.0)
Installing execjs (1.4.0)
Installing coffee-script (2.2.0)
Using rack-ssl (1.3.3)
Using json (1.7.7)
Installing rdoc (3.12.2)
Using thor (0.17.0)
Using railties (3.2.12)
Installing coffee-rails (3.2.2)
Installing jquery-rails (2.2.1)
Using rails (3.2.12)
Installing sass (3.2.6)
Installing sass-rails (3.2.6)
Installing sqlite3 (1.3.7)
Installing uglifier (1.3.0)
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!
~/Ruby-project$
在运行 run bundle install
的过程中,我开了另外一个终端。
执行了
sed -i -e 's/ftp\.ruby-lang\.org\/pub\/ruby/ruby\.taobao\.org\/mirrors\/ruby/g' ~/.rvm/config/db
那现在
$cd blog/
rails s #这一步瞎报错,百度了半天, 然后安装下面的这写包
gem install execjs
gem install ref libv8 therubyracer
sudo apt-get install nodejs
$ rails s
=> Booting WEBrick
=> Rails 3.2.12 application starting in development on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
[2013-02-25 21:49:15] INFO WEBrick 1.3.1
[2013-02-25 21:49:15] INFO ruby 2.0.0 (2013-02-24) [x86_64-linux]
[2013-02-25 21:49:15] INFO WEBrick::HTTPServer#start: pid=22522 port=3000
Started GET "/assets/rails.png" for 127.0.0.1 at 2013-02-25 21:49:46 +0800
Connecting to database specified by database.yml
Served asset /rails.png - 200 OK (88ms)
Started GET "/rails/info/properties" for 127.0.0.1 at 2013-02-25 21:50:03 +0800
Processing by Rails::InfoController#properties as */*
Rendered inline template (3.9ms)
Completed 200 OK in 70ms (Views: 68.8ms | ActiveRecord: 0.0ms)
终于启动了, @saiga 多谢你啊,没有你的指点,我启动不了。
这升级的也太快了吧。Rails 升了吗?还想跟着 RubyChina 的源代码学学 Rails3.2 呢。感觉有点不可思议!不过,顶!最好再整个升级教程。哈哈