Skip to content

Instantly share code, notes, and snippets.

@jiggneshhgohel
Last active November 19, 2015 10:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jiggneshhgohel/4a2c15b0c3bdb3838874 to your computer and use it in GitHub Desktop.
Save jiggneshhgohel/4a2c15b0c3bdb3838874 to your computer and use it in GitHub Desktop.
Steps to upgrade an existing Rails 4.2.x app to unreleased Rails 5 edge version

Note: At the time of writing this the commands shown below were executed on Ubuntu 14.04

  • Updated .ruby-version by replacing 2.2.1 WITH 2.2.3. In case this file is not present, its better to create it.

  • Updated .ruby-gemset by replacing <MY_APP_NAME> WITH <MY_APP_NAME>-on-rails-5, where <MY_APP_NAME> represents your app's name. In case this file is not present, its better to create it.

  • Upgraded rvm by running command $ rvm get stable.

  • Installed latest stable Ruby version listed here using command: $ rvm install 2.2.3

  • Removed Gemfile.lock

  • Updated Gemfile by replacing gem 'rails', '4.2.0' WITH gem 'rails', git: 'https://github.com/rails/rails.git'

  • Installed bundler using command: $ gem install bundler

  • Ran bundle and encountered error:

    ```
      Bundler could not find compatible versions for gem "rack":
      In Gemfile:
        rails (>= 0) ruby depends on
          actionpack (= 5.0.0.alpha) ruby depends on
            rack (~> 2.x) ruby
      Could not find gem 'rack (~> 2.x) ruby', which is required by gem 'actionpack (= 5.0.0.alpha) ruby', in any of the sources.
    ```
    
    Found following references on this error: https://github.com/rails/rails/issues/21422
    
  • Based on the reference found to get rid of the error shown above, added following to the Gemfile.

      ```
      # ================================
      # Once Rails 5 is officially released I don't think the following shall be needed. But for
      # now those are required to get rid of error reported in https://github.com/rails/rails/issues/21422
      gem 'rack', :git => 'https://github.com/rack/rack.git'
      gem 'arel', :git => 'https://github.com/rails/arel.git'
      # ================================
      ```
    

    Reference: http://www.christopherbloom.com/2015/04/26/setting-up-a-rails-5-app-from-edge/

  • Ran bundle and encountered following error:

      ```
        Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
    
            /home/jignesh/.rvm/rubies/ruby-2.2.3/bin/ruby -r ./siteconf20151119-12203-hjmfyi.rb extconf.rb
        creating Makefile
    
        make "DESTDIR=" clean
    
        make "DESTDIR="
        compiling generator.c
        linking shared-object json/ext/generator.so
        /usr/bin/ld: cannot find -lgmp
        collect2: error: ld returned 1 exit status
        make: *** [generator.so] Error 1
    
        make failed, exit code 2
    
        Gem files will remain installed in /home/jignesh/.rvm/gems/ruby-2.2.3@<GEMSET_NAME>/gems/json-1.8.3 for inspection.
        Results logged to /home/jignesh/.rvm/gems/ruby-2.2.3@<GEMSET_NAME>/extensions/x86_64-linux/2.2.0/json-1.8.3/gem_make.out
        An error occurred while installing json (1.8.3), and Bundler cannot continue.
        Make sure that `gem install json -v '1.8.3'` succeeds before bundling.
      ```
    
      Found following reference on this error: http://stackoverflow.com/questions/32130649/can-not-install-json-gem-with-ruby-2-2-3-on-ubuntu
    
  • Based on the reference found to get rid of the error shown above, ran following: $ sudo apt-get install libgmp3-dev Reference: http://stackoverflow.com/a/32191707/936494

  • Ran bundle again and it ran successfully!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment