Skip to content
This repository was archived by the owner on Nov 6, 2021. It is now read-only.

Commit 4c055ce

Browse files
authored
Upgrade rails to 6.0 (#288)
* Attempt upgrade to rails 6 * Update rspec-rails * Fix migration with duplicate columns * Add missing host
1 parent cb75fbd commit 4c055ce

17 files changed

Lines changed: 193 additions & 110 deletions

Gemfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ gem "pg"
1818
gem "prawn-rails"
1919
gem "puma", "~> 3.12"
2020
gem "pundit", "~> 2.0.0"
21-
gem "rails", "~> 5.2.1"
21+
gem "rails", "~> 6.0.0"
2222
gem "sass-rails", "~> 5.0"
2323
gem "uglifier", ">= 1.3.0"
2424
gem "wicked_pdf", "~> 1.1"
@@ -36,7 +36,7 @@ group :development, :test do
3636
gem "pry"
3737
gem "pry-rails"
3838
gem "pry-remote"
39-
gem "rspec-rails", "~> 3.5"
39+
gem "rspec-rails", "~> 4.0"
4040
gem "rubocop"
4141
gem "rubocop-rails"
4242
gem "rubocop-rspec"

Gemfile.lock

Lines changed: 70 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,61 @@
11
GEM
22
remote: https://rubygems.org/
33
specs:
4-
actioncable (5.2.4.1)
5-
actionpack (= 5.2.4.1)
4+
actioncable (6.0.2.2)
5+
actionpack (= 6.0.2.2)
66
nio4r (~> 2.0)
77
websocket-driver (>= 0.6.1)
8-
actionmailer (5.2.4.1)
9-
actionpack (= 5.2.4.1)
10-
actionview (= 5.2.4.1)
11-
activejob (= 5.2.4.1)
8+
actionmailbox (6.0.2.2)
9+
actionpack (= 6.0.2.2)
10+
activejob (= 6.0.2.2)
11+
activerecord (= 6.0.2.2)
12+
activestorage (= 6.0.2.2)
13+
activesupport (= 6.0.2.2)
14+
mail (>= 2.7.1)
15+
actionmailer (6.0.2.2)
16+
actionpack (= 6.0.2.2)
17+
actionview (= 6.0.2.2)
18+
activejob (= 6.0.2.2)
1219
mail (~> 2.5, >= 2.5.4)
1320
rails-dom-testing (~> 2.0)
14-
actionpack (5.2.4.1)
15-
actionview (= 5.2.4.1)
16-
activesupport (= 5.2.4.1)
21+
actionpack (6.0.2.2)
22+
actionview (= 6.0.2.2)
23+
activesupport (= 6.0.2.2)
1724
rack (~> 2.0, >= 2.0.8)
1825
rack-test (>= 0.6.3)
1926
rails-dom-testing (~> 2.0)
20-
rails-html-sanitizer (~> 1.0, >= 1.0.2)
21-
actionview (5.2.4.1)
22-
activesupport (= 5.2.4.1)
27+
rails-html-sanitizer (~> 1.0, >= 1.2.0)
28+
actiontext (6.0.2.2)
29+
actionpack (= 6.0.2.2)
30+
activerecord (= 6.0.2.2)
31+
activestorage (= 6.0.2.2)
32+
activesupport (= 6.0.2.2)
33+
nokogiri (>= 1.8.5)
34+
actionview (6.0.2.2)
35+
activesupport (= 6.0.2.2)
2336
builder (~> 3.1)
2437
erubi (~> 1.4)
2538
rails-dom-testing (~> 2.0)
26-
rails-html-sanitizer (~> 1.0, >= 1.0.3)
27-
activejob (5.2.4.1)
28-
activesupport (= 5.2.4.1)
39+
rails-html-sanitizer (~> 1.1, >= 1.2.0)
40+
activejob (6.0.2.2)
41+
activesupport (= 6.0.2.2)
2942
globalid (>= 0.3.6)
30-
activemodel (5.2.4.1)
31-
activesupport (= 5.2.4.1)
32-
activerecord (5.2.4.1)
33-
activemodel (= 5.2.4.1)
34-
activesupport (= 5.2.4.1)
35-
arel (>= 9.0)
36-
activestorage (5.2.4.1)
37-
actionpack (= 5.2.4.1)
38-
activerecord (= 5.2.4.1)
43+
activemodel (6.0.2.2)
44+
activesupport (= 6.0.2.2)
45+
activerecord (6.0.2.2)
46+
activemodel (= 6.0.2.2)
47+
activesupport (= 6.0.2.2)
48+
activestorage (6.0.2.2)
49+
actionpack (= 6.0.2.2)
50+
activejob (= 6.0.2.2)
51+
activerecord (= 6.0.2.2)
3952
marcel (~> 0.3.1)
40-
activesupport (5.2.4.1)
53+
activesupport (6.0.2.2)
4154
concurrent-ruby (~> 1.0, >= 1.0.2)
4255
i18n (>= 0.7, < 2)
4356
minitest (~> 5.1)
4457
tzinfo (~> 1.1)
58+
zeitwerk (~> 2.2)
4559
addressable (2.7.0)
4660
public_suffix (>= 2.0.2, < 5.0)
4761
airbrussh (1.4.0)
@@ -51,7 +65,6 @@ GEM
5165
rake (>= 10.4, < 14.0)
5266
archive-zip (0.12.0)
5367
io-like (~> 0.3.0)
54-
arel (9.0.0)
5568
ast (2.4.0)
5669
autoprefixer-rails (9.7.4)
5770
execjs
@@ -191,7 +204,7 @@ GEM
191204
rb-fsevent (~> 0.9, >= 0.9.4)
192205
rb-inotify (~> 0.9, >= 0.9.7)
193206
ruby_dep (~> 1.2)
194-
loofah (2.4.0)
207+
loofah (2.5.0)
195208
crass (~> 1.0.2)
196209
nokogiri (>= 1.5.9)
197210
lumberjack (1.2.4)
@@ -248,30 +261,32 @@ GEM
248261
rack
249262
rack-test (1.1.0)
250263
rack (>= 1.0, < 3)
251-
rails (5.2.4.1)
252-
actioncable (= 5.2.4.1)
253-
actionmailer (= 5.2.4.1)
254-
actionpack (= 5.2.4.1)
255-
actionview (= 5.2.4.1)
256-
activejob (= 5.2.4.1)
257-
activemodel (= 5.2.4.1)
258-
activerecord (= 5.2.4.1)
259-
activestorage (= 5.2.4.1)
260-
activesupport (= 5.2.4.1)
264+
rails (6.0.2.2)
265+
actioncable (= 6.0.2.2)
266+
actionmailbox (= 6.0.2.2)
267+
actionmailer (= 6.0.2.2)
268+
actionpack (= 6.0.2.2)
269+
actiontext (= 6.0.2.2)
270+
actionview (= 6.0.2.2)
271+
activejob (= 6.0.2.2)
272+
activemodel (= 6.0.2.2)
273+
activerecord (= 6.0.2.2)
274+
activestorage (= 6.0.2.2)
275+
activesupport (= 6.0.2.2)
261276
bundler (>= 1.3.0)
262-
railties (= 5.2.4.1)
277+
railties (= 6.0.2.2)
263278
sprockets-rails (>= 2.0.0)
264279
rails-dom-testing (2.0.3)
265280
activesupport (>= 4.2.0)
266281
nokogiri (>= 1.6)
267282
rails-html-sanitizer (1.3.0)
268283
loofah (~> 2.3)
269-
railties (5.2.4.1)
270-
actionpack (= 5.2.4.1)
271-
activesupport (= 5.2.4.1)
284+
railties (6.0.2.2)
285+
actionpack (= 6.0.2.2)
286+
activesupport (= 6.0.2.2)
272287
method_source
273288
rake (>= 0.8.7)
274-
thor (>= 0.19.0, < 2.0)
289+
thor (>= 0.20.3, < 2.0)
275290
rainbow (3.0.0)
276291
rake (13.0.1)
277292
rb-fsevent (0.10.3)
@@ -288,20 +303,20 @@ GEM
288303
rspec-mocks (~> 3.9.0)
289304
rspec-core (3.9.1)
290305
rspec-support (~> 3.9.1)
291-
rspec-expectations (3.9.0)
306+
rspec-expectations (3.9.1)
292307
diff-lcs (>= 1.2.0, < 2.0)
293308
rspec-support (~> 3.9.0)
294309
rspec-mocks (3.9.1)
295310
diff-lcs (>= 1.2.0, < 2.0)
296311
rspec-support (~> 3.9.0)
297-
rspec-rails (3.9.0)
298-
actionpack (>= 3.0)
299-
activesupport (>= 3.0)
300-
railties (>= 3.0)
301-
rspec-core (~> 3.9.0)
302-
rspec-expectations (~> 3.9.0)
303-
rspec-mocks (~> 3.9.0)
304-
rspec-support (~> 3.9.0)
312+
rspec-rails (4.0.0)
313+
actionpack (>= 4.2)
314+
activesupport (>= 4.2)
315+
railties (>= 4.2)
316+
rspec-core (~> 3.9)
317+
rspec-expectations (~> 3.9)
318+
rspec-mocks (~> 3.9)
319+
rspec-support (~> 3.9)
305320
rspec-support (3.9.2)
306321
rubocop (0.80.1)
307322
jaro_winkler (~> 1.5.1)
@@ -370,7 +385,7 @@ GEM
370385
thread_safe (0.3.6)
371386
tilt (2.0.10)
372387
ttfunk (1.6.2.1)
373-
tzinfo (1.2.6)
388+
tzinfo (1.2.7)
374389
thread_safe (~> 0.1)
375390
uglifier (4.2.0)
376391
execjs (>= 0.3.0, < 3)
@@ -394,6 +409,7 @@ GEM
394409
wkhtmltopdf-binary (0.12.5.4)
395410
xpath (3.2.0)
396411
nokogiri (~> 1.8)
412+
zeitwerk (2.3.0)
397413

398414
PLATFORMS
399415
ruby
@@ -436,8 +452,8 @@ DEPENDENCIES
436452
pry-remote
437453
puma (~> 3.12)
438454
pundit (~> 2.0.0)
439-
rails (~> 5.2.1)
440-
rspec-rails (~> 3.5)
455+
rails (~> 6.0.0)
456+
rspec-rails (~> 4.0)
441457
rubocop
442458
rubocop-rails
443459
rubocop-rspec

bin/rails

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,4 @@
11
#!/usr/bin/env ruby
2-
begin
3-
load File.expand_path('../spring', __FILE__)
4-
rescue LoadError => e
5-
raise unless e.message.include?('spring')
6-
end
72
APP_PATH = File.expand_path('../config/application', __dir__)
83
require_relative '../config/boot'
94
require 'rails/commands'

bin/rake

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,4 @@
11
#!/usr/bin/env ruby
2-
begin
3-
load File.expand_path('../spring', __FILE__)
4-
rescue LoadError => e
5-
raise unless e.message.include?('spring')
6-
end
72
require_relative '../config/boot'
83
require 'rake'
94
Rake.application.run

bin/setup

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
#!/usr/bin/env ruby
22
require 'fileutils'
3-
include FileUtils
43

54
# path to your application root.
65
APP_ROOT = File.expand_path('..', __dir__)
@@ -9,24 +8,25 @@ def system!(*args)
98
system(*args) || abort("\n== Command #{args} failed ==")
109
end
1110

12-
chdir APP_ROOT do
13-
# This script is a starting point to setup your application.
11+
FileUtils.chdir APP_ROOT do
12+
# This script is a way to setup or update your development environment automatically.
13+
# This script is idempotent, so that you can run it at anytime and get an expectable outcome.
1414
# Add necessary setup steps to this file.
1515

1616
puts '== Installing dependencies =='
17-
system! 'gem install -v 1.17.2 bundler --conservative'
17+
system! 'gem install bundler --conservative'
1818
system('bundle check') || system!('bundle install')
1919

20-
# Install JavaScript dependencies if using Yarn
20+
# Install JavaScript dependencies
2121
# system('bin/yarn')
2222

23-
puts "\n== Copying sample files =="
24-
unless File.exist?('.env.sample')
25-
cp '.env.sample', '.env'
26-
end
23+
# puts "\n== Copying sample files =="
24+
# unless File.exist?('config/database.yml')
25+
# FileUtils.cp 'config/database.yml.sample', 'config/database.yml'
26+
# end
2727

2828
puts "\n== Preparing database =="
29-
system! 'bin/rails db:setup'
29+
system! 'bin/rails db:prepare'
3030

3131
puts "\n== Removing old logs and tempfiles =="
3232
system! 'bin/rails log:clear tmp:clear'

config/application.rb

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
require_relative "boot"
1+
require_relative 'boot'
22

3-
require "rails/all"
4-
require "net/http"
3+
require 'rails/all'
54

65
# Require the gems listed in Gemfile, including any gems
76
# you've limited to :test, :development, or :production.

config/boot.rb

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__)
1+
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__)
22

3-
require "bundler/setup" # Set up gems listed in the Gemfile.
4-
# require "bootsnap/setup" # Speed up boot time by caching expensive operations.
3+
require 'bundler/setup' # Set up gems listed in the Gemfile.

config/environments/development.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
Rails.application.configure do
22
# Settings specified here will take precedence over those in config/application.rb.
3+
config.hosts << "partner.test"
34

45
# In the development environment your application's code is reloaded on
56
# every request. This slows down response time but is perfect for development
@@ -16,6 +17,7 @@
1617
# Run rails dev:cache to toggle caching.
1718
if Rails.root.join("tmp", "caching-dev.txt").exist?
1819
config.action_controller.perform_caching = true
20+
config.action_controller.enable_fragment_cache_logging = true
1921

2022
config.cache_store = :memory_store
2123
config.public_file_server.headers = {

config/environments/production.rb

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,6 @@
2929
# Do not fallback to assets pipeline if a precompiled asset is missed.
3030
config.assets.compile = false
3131

32-
# `config.assets.precompile` and `config.assets.version` have moved to config/initializers/assets.rb
33-
3432
# Enable serving of images, stylesheets, and JavaScripts from an asset server.
3533
# config.action_controller.asset_host = 'http://assets.example.com'
3634

@@ -93,7 +91,24 @@
9391
# Do not dump schema after migrations.
9492
config.active_record.dump_schema_after_migration = false
9593

96-
config.action_mailer.raise_delivery_errors = true
97-
host = "partner.diaper.app"
98-
config.action_mailer.default_url_options = { host: host }
94+
# Inserts middleware to perform automatic connection switching.
95+
# The `database_selector` hash is used to pass options to the DatabaseSelector
96+
# middleware. The `delay` is used to determine how long to wait after a write
97+
# to send a subsequent read to the primary.
98+
#
99+
# The `database_resolver` class is used by the middleware to determine which
100+
# database is appropriate to use based on the time delay.
101+
#
102+
# The `database_resolver_context` class is used by the middleware to set
103+
# timestamps for the last write to the primary. The resolver uses the context
104+
# class timestamps to determine how long to wait before reading from the
105+
# replica.
106+
#
107+
# By default Rails will store a last write timestamp in the session. The
108+
# DatabaseSelector middleware is designed as such you can define your own
109+
# strategy for connection switching and pass that into the middleware through
110+
# these configuration options.
111+
# config.active_record.database_selector = { delay: 2.seconds }
112+
# config.active_record.database_resolver = ActiveRecord::Middleware::DatabaseSelector::Resolver
113+
# config.active_record.database_resolver_context = ActiveRecord::Middleware::DatabaseSelector::Resolver::Session
99114
end

config/environments/test.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
# Show full error reports and disable caching.
2222
config.consider_all_requests_local = true
2323
config.action_controller.perform_caching = false
24+
config.cache_store = :null_store
2425

2526
# Raise exceptions instead of rendering exception templates.
2627
config.action_dispatch.show_exceptions = false

0 commit comments

Comments
 (0)