我正在使用4.2.7.1,我想升级到Rails 5.0.0.1。所以我调整了我的Gemfile
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '~> 5.0.0.1’
# Use Puma as the app server
gem 'puma', '~> 3.0'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 5.0'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
# Use CoffeeScript for .coffee assets and views
gem 'coffee-rails', '~> 4.2'
# See https://github.com/rails/execjs#readme for more supported runtimes
# gem 'therubyracer', platforms: :ruby
# Use jquery as the JavaScript library
gem 'jquery-rails'
# Turbolinks makes navigating your web application faster. Read more: https://github.com/turbolinks/turbolinks
gem 'turbolinks', '~> 5'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 2.5'
# Use Redis adapter to run Action Cable in production
# gem 'redis', '~> 3.0'
gem 'uuids'
gem 'addressable'
gem 'postgresql'
gem 'pundit'
gem 'omniauth-oauth2', '~> 1.3.1'
gem 'omniauth-google-oauth2'
gem 'omniauth-facebook'
gem 'omniauth-twitter'
gem 'omniauth-linkedin-oauth2'
gem 'jquery-ui-rails'
gem 'will_paginate'
gem 'bootstrap-sass'
gem 'autoprefixer-rails'
gem 'compass-rails'
gem 'pdf-reader'
gem 'jquery-turbolinks'
gem 'tor', :git => 'https://github.com/dryruby/tor.rb.git'
gem 'tor_requests'
gem 'tor-privoxy'
gem 'net-telnet'
gem 'mechanize'
gem 'activerecord-import'
但是当我尝试运行“bundle install”(删除Gemfile.lock之后)时,我收到了这些错误......
localhost:myproject davea$ bundle install
Fetching https://github.com/dryruby/tor.rb.git
Fetching gem metadata from https://rubygems.org/.........
Fetching version metadata from https://rubygems.org/...
Fetching dependency metadata from https://rubygems.org/..
Resolving dependencies.................................................
Bundler could not find compatible versions for gem "activerecord":
In Gemfile:
activerecord-import was resolved to 0.16.1, which depends on
activerecord (>= 3.2)
rails (~> 5.0.0.1) was resolved to 5.0.0.1, which depends on
activerecord (= 5.0.0.1)
uuids was resolved to 1.4.0, which depends on
activerecord (~> 4.1)
Bundler could not find compatible versions for gem "hexx-active_record":
In Gemfile:
uuids was resolved to 4.0.0, which depends on
hexx-active_record (~> 1.3)
Could not find gem 'hexx-active_record (~> 1.3)', which is required by gem 'uuids', in any of the sources.Bundler could not find compatible versions for gem "rails":
In Gemfile:
rails (~> 5.0.0.1)
uuids was resolved to 0.0.1, which depends on
rails (~> 4.1)
升级Rails版本需要做什么?
编辑:输出以回应给出的答案
localhost:myproject davea$ rails app:update
Error: Command 'app:update' not recognized
Usage: rails COMMAND [ARGS]
The most common rails commands are:
generate Generate new code (short-cut alias: "g")
console Start the Rails console (short-cut alias: "c")
server Start the Rails server (short-cut alias: "s")
dbconsole Start a console for the database specified in config/database.yml
(short-cut alias: "db")
new Create a new Rails application. "rails new my_app" creates a
new application called MyApp in "./my_app"
In addition to those, there are:
destroy Undo code generated with "generate" (short-cut alias: "d")
plugin new Generates skeleton for developing a Rails plugin
runner Run a piece of code in the application environment (short-cut alias: "r")
All commands can be run with -h (or --help) for more information.
答案 0 :(得分:2)
从Ruby on Rails文档中,它看起来像rails app:update将帮助您从第4轨到第5轨更新。
http://edgeguides.rubyonrails.org/upgrading_ruby_on_rails.html
答案 1 :(得分:1)
有一篇关于如何升级rails和rails_app的文章Updating to Rails 5.0 您应首先升级本地ruby和rails版本,然后升级您的应用程序。
但是在将您的应用更新到rails 5后,您应该进行一些更改。还有另一篇关于如何执行此操作的文章Rails Upgrade Checklist
答案 2 :(得分:1)
你找不到uuids gem的替代品,因为即使是最新版本的uuids也需要hexx-active_record,这需要activerecord< 5,虽然rails5需要activerecord 5.而且rubygems上没有hexx-active_record gem。请参阅此链接https://www.versioneye.com/ruby/hexx-active_record/6.1.0。
因此,目前唯一的解决方案是找到uuids的替代品
答案 3 :(得分:0)
我想这是最好的http://railsapps.github.io/updating-rails.html,但你应该在升级前检查你的测试。