Upgrade from Ruby 1.8.7 to 2.1.5 – an incomplete guide

Updated . Posted . Visible to the public. Deprecated.

I recommend to go straight to 2.1.5+ without intermediate steps. Otherwhise you burden yourself with unnecessary work of encoding problems.

Issues you may encounter:

  • Set the ruby version within your .ruby-version file to 2.1.5

  • Remove gem ruby-debug and use e.g. byebug

  • Remove gem oniguruma

  • Remove gem fastercsv

  • Replace gem mysql with mysql2

  • Update gem capistrano 2.12.0 to ~>2.12 when bound for Ruby 1.8.7 and remove obsolete explicite Gemfile entries for net-scp and net-ssh if present.

  • Update gem andand

  • Update gem parallel_tests (0.8.x to 1.6.x)

  • Downdgrade database_cleaner from 1.4.x to 1.2.0

  • Use new lambda syntax: change lambda { |param| code } to ->(param) { code }

  • Unbind gem 'i18n', '~> 0.6.0' and update

  • fix yml erros:

    • %{count} errors by surrounding with ", e.g.: replace one: %{count} Objekt with one: "%{count} Objekte"

    • date: order: [ :day, :month, :year ] to

      date:
        order:
          - :year
          - :month
          - :day
      
  • fix incompatible character encodings: UTF-8 and ASCII-8BIT error by adding

    Encoding.default_external = Encoding::UTF_8
    Encoding.default_internal = Encoding::UTF_8
    

    to environment.rb before Appname::Application.initialize!

  • use ' ' for nbsp helper instead of 0xC2.chr + 0xA0.chr

  • TextHelper#truncate changed signature from (string, int) to (string, length: int)

  • You may update gem sanitize from 2.x to 4+

  • In regexes \w does not match umlauts and other special characters. If it is supposed to you can use [[:alnum:]] instead.

Last edit
Tobias Kraze
License
Source code in this card is licensed under the MIT License.
Posted to makandra dev (2015-11-27 14:42)