8

I’m using 4.2.7.1 and I want to upgrade to Rails 5.0.0.1. So I adjusted my Gemfile like so

# 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'

but when I try and run “bundle install” (after deleting Gemfile.lock), I get these errors …

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)

What do I need to do to get my Rails version upgraded?

Edit: Output in response to answer given

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.
Dave
  • 15,639
  • 133
  • 442
  • 830
  • you will need to `bundle update`, not install (update gets new gems, install matches your gemfile.lock) ., as you will need new versions of gems (specifically activerecord-import 0.11.0 or greater) to resolve that dependency. Then follow the upgrade guides as suggested below – Doon Oct 14 '16 at 14:18
  • As I mentioned in my question, I deleted the "Gemfile.lock" question before running "bundle install". Notwithstanding, keeping it there and running "bundle update" results in the same error. – Dave Oct 14 '16 at 14:55
  • yeah missed the deleting of the .lock file. have you verified that all your gems are rails 5 compatible – Doon Oct 14 '16 at 15:46
  • No, is there a programmatic way to do that or would I just go to each site and try and decipher their documentation? – Dave Oct 17 '16 at 19:10
  • it looks like it is the uuids gem. `uuids was resolved to 0.0.1, which depends on rails (~> 4.1)`. the `~>` means `> 4.1 and < 5.0`. So it is blocking currently. I cannot seem to find homepage for it (and latest version is from1/15). – Doon Oct 17 '16 at 19:41
  • actually it could be hexx-active_record as well, which appears to be have been yanked and not available either.. – Doon Oct 17 '16 at 19:43
  • rake rails:update on 4.2 and earlier – Bandi Oct 23 '16 at 21:41

4 Answers4

2

From the Ruby on Rails Docs, it looks like rails app:update will help update you from rails 4 to 5.

http://edgeguides.rubyonrails.org/upgrading_ruby_on_rails.html

jhack
  • 71
  • 4
  • Thanks but when I run the command I get the error, "Error: Command 'app:update' not recognized". Complete output is in an edit to my question. – Dave Oct 14 '16 at 14:53
  • Are you just guessing now? I ran that command, was asksd to overwrite a bunch of files, and then I ran "rails -v" to which I got "Rails 4.2.7.1" so nothing has changed. – Dave Oct 14 '16 at 15:44
  • No, i'm not guessing. It's in the docs in parenthesis. (rake rails:update on 4.2 and earlier). Section 1.4 in the upgrading ruby on rails docs. – jhack Oct 14 '16 at 15:44
1

There is an article on how to upgrade rails and rails_app Updating to Rails 5.0 You should upgrade your local ruby and rails versions first, then upgrade your app.

But after update your app to rails 5 you should probably make some changes. There is another article on how to do this Rails Upgrade Checklist

Kirill Zhuravlov
  • 444
  • 9
  • 21
1

You cannot until you find substitute for uuids gem, because even the latest version of uuids requires hexx-active_record which requires activerecord < 5, while rails5 requires activerecord 5. moreover the hexx-active_record gem is not available on rubygems. see this link https://www.versioneye.com/ruby/hexx-active_record/6.1.0.

so the only solution as of now is to find substitute for uuids

user2301346
  • 438
  • 3
  • 11
0

I guess this is the best http://railsapps.github.io/updating-rails.html but you should check your tests before upgrading.

eayurt
  • 1,169
  • 1
  • 19
  • 42