Slide 1

Slide 1 text

@etagwerker | #RailsUpgrades | https://fastruby.io/upgrade Upgrade Rails 101 The Roadmap to Smooth Upgrades Southeast Ruby 2019

Slide 2

Slide 2 text

@etagwerker | #RailsUpgrades | https://fastruby.io/upgrade Ernesto Tagwerker (he/him)

Slide 3

Slide 3 text

@etagwerker | #RailsUpgrades | https://fastruby.io/upgrade Founder & Software Engineer at Ombu Labs

Slide 4

Slide 4 text

@etagwerker | #RailsUpgrades | https://fastruby.io/upgrade Founder & Software Engineer at FastRuby.io

Slide 5

Slide 5 text

@etagwerker | #RailsUpgrades | https://fastruby.io/upgrade Who is this workshop for? 5

Slide 6

Slide 6 text

@etagwerker | #RailsUpgrades | https://fastruby.io/upgrade bundle update rails ?

Slide 7

Slide 7 text

@etagwerker | #RailsUpgrades | https://fastruby.io/upgrade Workshop Outline 7

Slide 8

Slide 8 text

@etagwerker | #RailsUpgrades | https://fastruby.io/upgrade Goal #1: The Rails Upgrade Roadmap 8

Slide 9

Slide 9 text

@etagwerker | #RailsUpgrades | https://fastruby.io/upgrade Goal #2: The Rails Upgrade Process 9

Slide 10

Slide 10 text

@etagwerker | #RailsUpgrades | https://fastruby.io/upgrade fastruby.io/ upgrade 10

Slide 11

Slide 11 text

@etagwerker | #RailsUpgrades | https://fastruby.io/upgrade #RailsUpgrades 11

Slide 12

Slide 12 text

@etagwerker | #RailsUpgrades | https://fastruby.io/upgrade Questions are welcome

Slide 13

Slide 13 text

@etagwerker | #RailsUpgrades | https://fastruby.io/upgrade Pre-Requisites

Slide 14

Slide 14 text

@etagwerker | #RailsUpgrades | https://fastruby.io/upgrade ✓ docker ✓ docker-compose ✓ git

Slide 15

Slide 15 text

@etagwerker | #RailsUpgrades | https://fastruby.io/upgrade 15 $ git clone \ [email protected]:fastruby/e-petitions.git $ cd e-petitions $ git fetch origin docker:docker $ git checkout docker

Slide 16

Slide 16 text

@etagwerker | #RailsUpgrades | https://fastruby.io/upgrade 16 $ docker-compose up -d $ docker-compose exec app \ ./bin/docker-setup

Slide 17

Slide 17 text

@etagwerker | #RailsUpgrades | https://fastruby.io/upgrade 17 $ docker-compose exec app \ rspec spec/models/admin_user_spec.rb ... Finished in 22.24 seconds (files took 7.65 seconds to load) 81 examples, 0 failures

Slide 18

Slide 18 text

@etagwerker | #RailsUpgrades | https://fastruby.io/upgrade Questions?

Slide 19

Slide 19 text

@etagwerker | #RailsUpgrades | https://fastruby.io/upgrade Exercise #1: Check Pre-Requisites Time: 15 minutes https://fastruby.io/upgrade#1 https://fastruby.io/upgrade#2 https://fastruby.io/upgrade#3

Slide 20

Slide 20 text

@etagwerker | #RailsUpgrades | https://fastruby.io/upgrade Is our app ready for an upgrade?

Slide 21

Slide 21 text

@etagwerker | #RailsUpgrades | https://fastruby.io/upgrade “Upgrading Rails is easy.” — No one. 21

Slide 22

Slide 22 text

@etagwerker | #RailsUpgrades | https://fastruby.io/upgrade - “Upgrading Rails is easy, right?” - “Right, right, easy…”

Slide 23

Slide 23 text

@etagwerker | #RailsUpgrades | https://fastruby.io/upgrade Does our test suite succeed? 23

Slide 24

Slide 24 text

@etagwerker | #RailsUpgrades | https://fastruby.io/upgrade Does our app have decent test coverage? 24

Slide 25

Slide 25 text

@etagwerker | #RailsUpgrades | https://fastruby.io/upgrade Exercise #2: Calculate Test Coverage

Slide 26

Slide 26 text

@etagwerker | #RailsUpgrades | https://fastruby.io/upgrade SimpleCov 26

Slide 27

Slide 27 text

@etagwerker | #RailsUpgrades | https://fastruby.io/upgrade 27 # Gemfile group :test do gem 'simplecov', require: false end

Slide 28

Slide 28 text

@etagwerker | #RailsUpgrades | https://fastruby.io/upgrade 28 # spec/spec_helper.rb if ENV['COVERAGE'] == 'true' require 'simplecov' SimpleCov.start 'rails' end

Slide 29

Slide 29 text

@etagwerker | #RailsUpgrades | https://fastruby.io/upgrade 29 $ docker-compose run -e COVERAGE=true app rspec spec/models/

Slide 30

Slide 30 text

@etagwerker | #RailsUpgrades | https://fastruby.io/upgrade Questions?

Slide 31

Slide 31 text

@etagwerker | #RailsUpgrades | https://fastruby.io/upgrade 31 Exercise #2: Check Test Coverage Time: 15 minutes https://fastruby.io/upgrade#4

Slide 32

Slide 32 text

@etagwerker | #RailsUpgrades | https://fastruby.io/upgrade Is upgrading a good idea?

Slide 33

Slide 33 text

@etagwerker | #RailsUpgrades | https://fastruby.io/upgrade

Slide 34

Slide 34 text

@etagwerker | #RailsUpgrades | https://fastruby.io/upgrade Upgrading is always a good idea 34

Slide 35

Slide 35 text

@etagwerker | #RailsUpgrades | https://fastruby.io/upgrade Dependencies Checkup

Slide 36

Slide 36 text

@etagwerker | #RailsUpgrades | https://fastruby.io/upgrade SemVer 36

Slide 37

Slide 37 text

@etagwerker | #RailsUpgrades | https://fastruby.io/upgrade .. 37

Slide 38

Slide 38 text

@etagwerker | #RailsUpgrades | https://fastruby.io/upgrade

Slide 39

Slide 39 text

@etagwerker | #RailsUpgrades | https://fastruby.io/upgrade Rails 5.0.7 MAJOR: 5 MINOR: 0 PATCH: 7 39

Slide 40

Slide 40 text

@etagwerker | #RailsUpgrades | https://fastruby.io/upgrade Fixed vs. Pessimistic 40

Slide 41

Slide 41 text

@etagwerker | #RailsUpgrades | https://fastruby.io/upgrade 41 # Gemfile (fixed version) source 'https://rubygems.org' gem 'rails', '4.2.7'

Slide 42

Slide 42 text

@etagwerker | #RailsUpgrades | https://fastruby.io/upgrade 42 $ bundle update $ cat Gemfile.lock | grep rails rails (4.2.7)

Slide 43

Slide 43 text

@etagwerker | #RailsUpgrades | https://fastruby.io/upgrade 43 # Gemfile (pessimistic versions) source 'https://rubygems.org' gem 'rails', '~> 4.2.7'

Slide 44

Slide 44 text

@etagwerker | #RailsUpgrades | https://fastruby.io/upgrade 44 $ bundle update $ cat Gemfile.lock | grep rails rails (4.2.11.1)

Slide 45

Slide 45 text

@etagwerker | #RailsUpgrades | https://fastruby.io/upgrade Dependencies should be pessimistic* 45

Slide 46

Slide 46 text

@etagwerker | #RailsUpgrades | https://fastruby.io/upgrade Exercise #3: Relax our Gemfile

Slide 47

Slide 47 text

@etagwerker | #RailsUpgrades | https://fastruby.io/upgrade Let’s analyze our Gemfile 47

Slide 48

Slide 48 text

@etagwerker | #RailsUpgrades | https://fastruby.io/upgrade 48 $ docker-compose exec app bundle outdated Fetching gem metadata from https://rubygems.org/. Resolving dependencies..... Outdated gems included in the bundle: * actionmailer (newest 5.2.3, installed 4.2.11.1) * actionpack (newest 5.2.3, installed 4.2.11.1) * actionview (newest 5.2.3, installed 4.2.11.1) * activejob (newest 5.2.3, installed 4.2.11.1) * activemodel (newest 5.2.3, installed 4.2.11.1) * activerecord (newest 5.2.3, installed 4.2.11.1) * activesupport (newest 5.2.3, installed 4.2.11.1) ...

Slide 49

Slide 49 text

@etagwerker | #RailsUpgrades | https://fastruby.io/upgrade 49 # Gemfile group :development do gem 'next_rails' end

Slide 50

Slide 50 text

@etagwerker | #RailsUpgrades | https://fastruby.io/upgrade $ docker-compose down $ docker-compose up --build -d

Slide 51

Slide 51 text

@etagwerker | #RailsUpgrades | https://fastruby.io/upgrade $ docker-compose exec app \ bundle_report outdated ... aws-sdk 2.11.314: released 19 days ago (latest version, 3.0.1, released almost 2 years ago) 0 gems are sourced from git 44 of the 139 gems are out-of-date (32%)

Slide 52

Slide 52 text

@etagwerker | #RailsUpgrades | https://fastruby.io/upgrade For every fixed dependency declaration: - Turn it into a pessimistic declaration 52

Slide 53

Slide 53 text

@etagwerker | #RailsUpgrades | https://fastruby.io/upgrade For every fixed dependency declaration we change: 53 $ docker-compose down --volumes $ docker-compose up --build -d

Slide 54

Slide 54 text

@etagwerker | #RailsUpgrades | https://fastruby.io/upgrade For every fixed dependency declaration we change: 54 $ docker-compose exec app \ rspec spec/lib/atomic_dalli_store_spec.rb

Slide 55

Slide 55 text

@etagwerker | #RailsUpgrades | https://fastruby.io/upgrade Does your build pass? - Submit a PR - Create a story 55

Slide 56

Slide 56 text

@etagwerker | #RailsUpgrades | https://fastruby.io/upgrade Questions?

Slide 57

Slide 57 text

@etagwerker | #RailsUpgrades | https://fastruby.io/upgrade 57 Exercise #3: Pessimistic Dependencies Time: 10 minutes https://fastruby.io/upgrade#5 https://fastruby.io/upgrade#6

Slide 58

Slide 58 text

@etagwerker | #RailsUpgrades | https://fastruby.io/upgrade What happened? 58

Slide 59

Slide 59 text

@etagwerker | #RailsUpgrades | https://fastruby.io/upgrade Dual Boot: Setup

Slide 60

Slide 60 text

@etagwerker | #RailsUpgrades | https://fastruby.io/upgrade Let’s bump that Rails version 60

Slide 61

Slide 61 text

@etagwerker | #RailsUpgrades | https://fastruby.io/upgrade ONE DOES NOT SIMPLY BUNDLE UPDATE RAILS

Slide 62

Slide 62 text

@etagwerker | #RailsUpgrades | https://fastruby.io/upgrade Dual Boot: There are many gems for that 62

Slide 63

Slide 63 text

@etagwerker | #RailsUpgrades | https://fastruby.io/upgrade 63 # Gemfile group :development do gem 'next_rails' end

Slide 64

Slide 64 text

@etagwerker | #RailsUpgrades | https://fastruby.io/upgrade 64 $ docker-compose exec app next --init Created Gemfile.next (a symlink to your Gemfile). Your Gemfile has been modified to support dual-booting! There's just one more step: modify your Gemfile to use a newer version of Rails using the `next?` helper method. For example, here's how to go from 5.2.3 to 6.0: if next? gem "rails", "6.0.0" else gem "rails", "5.2.3" end

Slide 65

Slide 65 text

@etagwerker | #RailsUpgrades | https://fastruby.io/upgrade 65 # Gemfile def next? File.basename(__FILE__) == "Gemfile.next" end source ‘https://rubygems.org' gem 'rails', '4.2.11.1'

Slide 66

Slide 66 text

@etagwerker | #RailsUpgrades | https://fastruby.io/upgrade 66 # Gemfile if next? gem 'rails', '~> 5.0.7' else gem 'rails', '4.2.11.1' end

Slide 67

Slide 67 text

@etagwerker | #RailsUpgrades | https://fastruby.io/upgrade 67 $ docker-compose exec \ next bundle install $ cat Gemfile.next.lock

Slide 68

Slide 68 text

@etagwerker | #RailsUpgrades | https://fastruby.io/upgrade 68 # Dockerfile COPY Gemfile Gemfile.lock ./ COPY Gemfile.next Gemfile.next.lock ./ RUN gem install bundler -v=1.17.3 RUN bundle install RUN next bundle install COPY . .

Slide 69

Slide 69 text

@etagwerker | #RailsUpgrades | https://fastruby.io/upgrade 69 $ docker-compose down $ docker-compose up --build -d $ docker-compose exec app \ ./bin/docker-setup

Slide 70

Slide 70 text

@etagwerker | #RailsUpgrades | https://fastruby.io/upgrade Incompatibilities 70

Slide 71

Slide 71 text

@etagwerker | #RailsUpgrades | https://fastruby.io/upgrade 71 $ docker-compose exec app \ bundle_report compatibility --rails-version=5.0.7 => Incompatible with Rails 5.0.7 (with new versions that are compatible): These gems will need to be upgraded before upgrading to Rails 5.0.7. rails-dom-testing 1.0.9 - upgrade to 2.0.3 test_after_commit 1.2.2 - new version, 1.2.2, is not compatible with Rails 5.0.7 2 gems incompatible with Rails 5.0.7

Slide 72

Slide 72 text

@etagwerker | #RailsUpgrades | https://fastruby.io/upgrade 72 Exercise #4: next bundle install Time: 15 minutes https://fastruby.io/upgrade#7

Slide 73

Slide 73 text

@etagwerker | #RailsUpgrades | https://fastruby.io/upgrade #CoffeeBreak

Slide 74

Slide 74 text

@etagwerker | #RailsUpgrades | https://fastruby.io/upgrade Dual Boot: Test Models

Slide 75

Slide 75 text

@etagwerker | #RailsUpgrades | https://fastruby.io/upgrade Now that you can next bundle install successfully... 75

Slide 76

Slide 76 text

@etagwerker | #RailsUpgrades | https://fastruby.io/upgrade 76 $ docker-compose exec app \ next rspec spec/models

Slide 77

Slide 77 text

@etagwerker | #RailsUpgrades | https://fastruby.io/upgrade Failures 77

Slide 78

Slide 78 text

@etagwerker | #RailsUpgrades | https://fastruby.io/upgrade 78 $ docker-compose exec app \ next rspec spec/models rake aborted! Bundler::GemRequireError: There was an error while trying to load the gem 'test_after_commit'. Gem Load Error is: after_commit testing is baked into rails 5, you no longer need test_after_commit gem Backtrace for gem load error is: /Users/etagwerker/.rvm/gems/ruby-2.4.5@petitions/gems/ test_after_commit-1.1.0/lib/test_after_commit.rb:4:in `' /Users/etagwerker/.rvm/rubies/ruby-2.4.5/lib/ruby/site_ruby/2.4.0/ bundler/runtime.rb:81:in `require' /Users/etagwerker/.rvm/rubies/ruby-2.4.5/lib/ruby/site_ruby/2.4.0/ bundler/runtime.rb:81:in `block (2 levels) in require' /Users/etagwerker/.rvm/rubies/ruby-2.4.5/lib/ruby/site_ruby/2.4.0/ bundler/runtime.rb:76:in `each'

Slide 79

Slide 79 text

@etagwerker | #RailsUpgrades | https://fastruby.io/upgrade 79 # Gemfile group :test do # ... gem 'test_after_commit' unless next? end

Slide 80

Slide 80 text

@etagwerker | #RailsUpgrades | https://fastruby.io/upgrade # spec/support/after_commits.rb if defined?(TestAfterCommit) TestAfterCommit.enabled = false RSpec.configure do |config| config.around(:each) do |example| # ... end end end

Slide 81

Slide 81 text

@etagwerker | #RailsUpgrades | https://fastruby.io/upgrade 81 $ docker-compose exec app \ next rspec spec/models NoMethodError: undefined method `hide_action' for Delayed::Web::ApplicationController:Class # ./config/initializers/delayed_web.rb:10:in `block in ' # ./config/initializers/delayed_web.rb:7:in `class_eval' # ./config/initializers/delayed_web.rb:7:in `' # /Users/etagwerker/.rvm/gems/ruby-2.4.5@petitions/gems/ activesupport-5.0.7.2/lib/active_support/dependencies.rb:287:in `load' # /Users/etagwerker/.rvm/gems/ruby-2.4.5@petitions/gems/ activesupport-5.0.7.2/lib/active_support/dependencies.rb:287:in `block in load' # /Users/etagwerker/.rvm/gems/ruby-2.4.5@petitions/gems/ activesupport-5.0.7.2/lib/active_support/dependencies.rb:259:in `load_dependency'

Slide 82

Slide 82 text

@etagwerker | #RailsUpgrades | https://fastruby.io/upgrade 82 # config/initializers/delayed_web.rb Delayed::Web::ApplicationController.class_eval do include Authentication, FlashI18n hide_action :admin_request? def admin_request? true end protected def admin_login_url main_app.admin_login_url end end

Slide 83

Slide 83 text

@etagwerker | #RailsUpgrades | https://fastruby.io/upgrade 83 # config/initializers/delayed_web.rb Delayed::Web::ApplicationController.class_eval do include Authentication, FlashI18n protected def admin_request? true end def admin_login_url main_app.admin_login_url end end

Slide 84

Slide 84 text

@etagwerker | #RailsUpgrades | https://fastruby.io/upgrade Fix Failures 84

Slide 85

Slide 85 text

@etagwerker | #RailsUpgrades | https://fastruby.io/upgrade Deprecation Warnings 85

Slide 86

Slide 86 text

@etagwerker | #RailsUpgrades | https://fastruby.io/upgrade 86 $ docker-compose exec app \ next rspec spec/models DEPRECATION WARNING: ActiveRecord::Base.raise_in_transactional_callbacks= is deprecated, has no effect and will be removed without replacement. (called from at /usr/src/app/ config/environment.rb:5) DEPRECATION WARNING: #table_exists? currently checks both tables and views. This behavior is deprecated and will be changed with Rails 5.1 to only check tables. Use #data_source_exists? instead. (called from table_exists? at / usr/src/app/app/models/site.rb:23) DEPRECATION WARNING: Passing an argument to force an association to reload is now deprecated and will be removed in Rails 5.1. Please call `reload_rejection` instead. (called from rejection at /usr/src/app/app/models/petition.rb:639) ...

Slide 87

Slide 87 text

@etagwerker | #RailsUpgrades | https://fastruby.io/upgrade One Item per Deprecation Warning 87

Slide 88

Slide 88 text

@etagwerker | #RailsUpgrades | https://fastruby.io/upgrade 88 Exercise #5: next rspec spec/models Time: 20 minutes https://fastruby.io/upgrade#8

Slide 89

Slide 89 text

@etagwerker | #RailsUpgrades | https://fastruby.io/upgrade What happened? 89

Slide 90

Slide 90 text

@etagwerker | #RailsUpgrades | https://fastruby.io/upgrade Dual Boot: Test Libraries

Slide 91

Slide 91 text

@etagwerker | #RailsUpgrades | https://fastruby.io/upgrade 91 $ docker-compose exec app \ next rspec spec/lib DEPRECATION WARNING: `config.serve_static_files` is deprecated and will be removed in Rails 5.1. Please use `config.public_file_server.enabled = true` instead. (called from block in at /usr/src/app/config/environments/ test.rb:16) DEPRECATION WARNING: `config.static_cache_control` is deprecated and will be removed in Rails 5.1. Please use `config.public_file_server.headers = { 'Cache-Control' => 'public, max- age=3600' }` instead. (called from block in at /usr/src/app/config/environments/ test.rb:17)

Slide 92

Slide 92 text

@etagwerker | #RailsUpgrades | https://fastruby.io/upgrade 92 Exercise #6: next rspec spec/lib Time: 10 minutes https://fastruby.io/upgrade#9

Slide 93

Slide 93 text

@etagwerker | #RailsUpgrades | https://fastruby.io/upgrade What happened? 93

Slide 94

Slide 94 text

@etagwerker | #RailsUpgrades | https://fastruby.io/upgrade Dual Boot: Test Controllers

Slide 95

Slide 95 text

@etagwerker | #RailsUpgrades | https://fastruby.io/upgrade 95 $ docker-compose exec app \ next rspec spec/controllers DEPRECATION WARNING: Using positional arguments in functional tests has been deprecated, in favor of keyword arguments, and will be removed in Rails 5.1. Deprecated style: get :show, { id: 1 }, nil, { notice: "This is a flash message" } New keyword style: get :show, params: { id: 1 }, flash: { notice: "This is a flash message" }, session: nil # Can safely be omitted. (called from block (4 levels) in at /usr/src/app/spec/ controllers/admin/petition_tags_controller_spec.rb:46) DEPRECATION WARNING: Using positional arguments in functional tests has been deprecated, in favor of keyword arguments, and will be removed in Rails 5.1.

Slide 96

Slide 96 text

@etagwerker | #RailsUpgrades | https://fastruby.io/upgrade # Gemfile group :development, :test do gem 'next_rails', '~> 1.0.1' # … gem 'rubocop' gem 'rubocop-rails' end

Slide 97

Slide 97 text

@etagwerker | #RailsUpgrades | https://fastruby.io/upgrade 97 $ docker-compose down $ docker-compose up --build -d $ docker-compose exec app \ ./bin/docker-setup

Slide 98

Slide 98 text

@etagwerker | #RailsUpgrades | https://fastruby.io/upgrade 98 $ docker-compose exec app \ rubocop \ --only Rails/HttpPositionalArguments \ --require rubocop-rails --auto-correct spec/controllers

Slide 99

Slide 99 text

@etagwerker | #RailsUpgrades | https://fastruby.io/upgrade 99 $ docker-compose exec app \ next rspec spec/controllers

Slide 100

Slide 100 text

@etagwerker | #RailsUpgrades | https://fastruby.io/upgrade 100 Exercise #7: next rspec spec/controllers Time: 15 minutes https://fastruby.io/upgrade#10

Slide 101

Slide 101 text

@etagwerker | #RailsUpgrades | https://fastruby.io/upgrade Find References To Deprecated API

Slide 102

Slide 102 text

@etagwerker | #RailsUpgrades | https://fastruby.io/upgrade https://edgeguides.rubyonrails.org/ upgrading_ruby_on_rails.html Official Guides

Slide 103

Slide 103 text

@etagwerker | #RailsUpgrades | https://fastruby.io/upgrade Unofficial Guides 103 1.https://fastruby.io/blog/rails/upgrades/upgrade-to-rails-3.html 2.https://fastruby.io/blog/rails/upgrades/upgrade-to-rails-3-1.html 3.https://fastruby.io/blog/rails/upgrades/upgrade-to-rails-3-2.html 4.https://fastruby.io/blog/rails/upgrades/upgrade-rails-from-3-2-to-4-0.html 5.https://fastruby.io/blog/rails/upgrades/upgrade-rails-from-4-0-to-4-1.html 6.https://fastruby.io/blog/rails/upgrades/upgrade-rails-from-4-1-to-4-2.html 7.https://fastruby.io/blog/rails/upgrades/active-record-5-1-api-changes.html 8.https://fastruby.io/blog/rails/upgrades/upgrade-rails-from-4-2-to-5-0.html 9.https://fastruby.io/blog/rails/upgrades/upgrade-rails-from-5-0-to-5-1.html 10.https://fastruby.io/blog/rails/upgrades/upgrade-rails-from-5-1-to-5-2.html 11.https://fastruby.io/blog/rails/upgrades/upgrade-rails-from-5-2-to-6-0.html

Slide 104

Slide 104 text

@etagwerker | #RailsUpgrades | https://fastruby.io/upgrade http://railsdiff.org/ RailsDiff

Slide 105

Slide 105 text

@etagwerker | #RailsUpgrades | https://fastruby.io/upgrade Find In Project 105

Slide 106

Slide 106 text

@etagwerker | #RailsUpgrades | https://fastruby.io/upgrade Trust The Process

Slide 107

Slide 107 text

@etagwerker | #RailsUpgrades | https://fastruby.io/upgrade Gradual version jumps 107

Slide 108

Slide 108 text

@etagwerker | #RailsUpgrades | https://fastruby.io/upgrade ... ✅ 2.3 3.0 ✅ 3.0 3.1 ✅ 3.1 3.2 ✅ 3.2 4.0 ✅ 4.0 4.1 ✅ 4.1 4.2 ✅ 4.2 5.0 ✅ 5.0 5.1 ✅ 5.1 5.2 ✅ 5.2 6.0 108 Gemfile Gemfile.next { }

Slide 109

Slide 109 text

@etagwerker | #RailsUpgrades | https://fastruby.io/upgrade For every version jump: bundle install bundle exec rake Smoke test 109

Slide 110

Slide 110 text

@etagwerker | #RailsUpgrades | https://fastruby.io/upgrade Ship backwards-compatible changes first 110

Slide 111

Slide 111 text

@etagwerker | #RailsUpgrades | https://fastruby.io/upgrade Every deprecation warning is a story 111

Slide 112

Slide 112 text

@etagwerker | #RailsUpgrades | https://fastruby.io/upgrade Every failing scenario is a story 112

Slide 113

Slide 113 text

@etagwerker | #RailsUpgrades | https://fastruby.io/upgrade Tiny Pull Requests over One Huge PR 113

Slide 114

Slide 114 text

@etagwerker | #RailsUpgrades | https://fastruby.io/upgrade Tiny Changesets over Huge Changesets 114

Slide 115

Slide 115 text

@etagwerker | #RailsUpgrades | https://fastruby.io/upgrade 1. Tweak 2. Test 3. Merge And Iterate

Slide 116

Slide 116 text

@etagwerker | #RailsUpgrades | https://fastruby.io/upgrade The Version Jump Pull Request is Last 116

Slide 117

Slide 117 text

@etagwerker | #RailsUpgrades | https://fastruby.io/upgrade How To Stay Current

Slide 118

Slide 118 text

@etagwerker | #RailsUpgrades | https://fastruby.io/upgrade Treat new deprecation warnings as exceptions 118

Slide 119

Slide 119 text

@etagwerker | #RailsUpgrades | https://fastruby.io/upgrade # config/environments/test.rb Rails.application.configure do # ... # Raise on deprecation notices config.active_support.deprecation = :raise # ... end 119

Slide 120

Slide 120 text

@etagwerker | #RailsUpgrades | https://fastruby.io/upgrade Add bundler-audit to your default rake task 120

Slide 121

Slide 121 text

@etagwerker | #RailsUpgrades | https://fastruby.io/upgrade # Rakefile # ... task default: %i[ bundle:audit brakeman:check spec spec:javascripts cucumber ] 121

Slide 122

Slide 122 text

@etagwerker | #RailsUpgrades | https://fastruby.io/upgrade namespace :bundle do desc "Audit bundle for any known vulnerabilities" task :audit do unless system "bundle-audit check --update" exit 1 end end end 122

Slide 123

Slide 123 text

@etagwerker | #RailsUpgrades | https://fastruby.io/upgrade Keep up with upcoming releases 123

Slide 124

Slide 124 text

@etagwerker | #RailsUpgrades | https://fastruby.io/upgrade 124 # Gemfile source 'https://rubygems.org' git_source(:github) do |repo_name| repo_name = "#{repo_name}/#{repo_name}" unless repo_name.include?("/") "https://github.com/#{repo_name}.git" end if next? gem 'rails', github: 'rails/rails' else gem 'rails', '~> 6.0.0.rc2' end

Slide 125

Slide 125 text

@etagwerker | #RailsUpgrades | https://fastruby.io/upgrade @etagwerker #RailsUpgrades fastruby.io Feedback is welcome

Slide 126

Slide 126 text

@etagwerker | #RailsUpgrades | https://fastruby.io/upgrade 126 Thank You!

Slide 127

Slide 127 text

@etagwerker | #RailsUpgrades | https://fastruby.io/upgrade Resources 127 1.https://github.com/clio/ten_years_rails 2.https://github.com/alphagov/e-petitions 3.https://github.com/rubyperu/ready4rails 4.https://edgeguides.rubyonrails.org/upgrading_ruby_on_rails.html#the-upgrade-process 5.https://fastruby.io/blog/tags/upgrades 6.https://semver.org 7.https://github.com/Shopify/bootboot 8.https://github.com/fastruby/rails_upgrader 9.http://railsdiff.org 10.https://github.com/hintmedia/moderate_parameters 11.https://edgeguides.rubyonrails.org/upgrading_ruby_on_rails.html#the-update-task