Skip to content

Commit aa1d7d5

Browse files
Upgrade Rails 5.2 -> 6.0
1 parent 6937284 commit aa1d7d5

13 files changed

+144
-92
lines changed

Gemfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
source 'https://rubygems.org'
22

3-
gem 'rails', '~> 5.2.0'
3+
gem 'rails', '~> 6.0.0'
44
gem 'bootsnap'
55
gem 'coffee-script'
66
gem 'jbuilder'

Gemfile.lock

+64-48
Original file line numberDiff line numberDiff line change
@@ -1,51 +1,64 @@
11
GEM
22
remote: https://rubygems.org/
33
specs:
4-
actioncable (5.2.4.5)
5-
actionpack (= 5.2.4.5)
4+
actioncable (6.0.3.5)
5+
actionpack (= 6.0.3.5)
66
nio4r (~> 2.0)
77
websocket-driver (>= 0.6.1)
8-
actionmailer (5.2.4.5)
9-
actionpack (= 5.2.4.5)
10-
actionview (= 5.2.4.5)
11-
activejob (= 5.2.4.5)
8+
actionmailbox (6.0.3.5)
9+
actionpack (= 6.0.3.5)
10+
activejob (= 6.0.3.5)
11+
activerecord (= 6.0.3.5)
12+
activestorage (= 6.0.3.5)
13+
activesupport (= 6.0.3.5)
14+
mail (>= 2.7.1)
15+
actionmailer (6.0.3.5)
16+
actionpack (= 6.0.3.5)
17+
actionview (= 6.0.3.5)
18+
activejob (= 6.0.3.5)
1219
mail (~> 2.5, >= 2.5.4)
1320
rails-dom-testing (~> 2.0)
14-
actionpack (5.2.4.5)
15-
actionview (= 5.2.4.5)
16-
activesupport (= 5.2.4.5)
21+
actionpack (6.0.3.5)
22+
actionview (= 6.0.3.5)
23+
activesupport (= 6.0.3.5)
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.5)
22-
activesupport (= 5.2.4.5)
27+
rails-html-sanitizer (~> 1.0, >= 1.2.0)
28+
actiontext (6.0.3.5)
29+
actionpack (= 6.0.3.5)
30+
activerecord (= 6.0.3.5)
31+
activestorage (= 6.0.3.5)
32+
activesupport (= 6.0.3.5)
33+
nokogiri (>= 1.8.5)
34+
actionview (6.0.3.5)
35+
activesupport (= 6.0.3.5)
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.5)
28-
activesupport (= 5.2.4.5)
39+
rails-html-sanitizer (~> 1.1, >= 1.2.0)
40+
activejob (6.0.3.5)
41+
activesupport (= 6.0.3.5)
2942
globalid (>= 0.3.6)
30-
activemodel (5.2.4.5)
31-
activesupport (= 5.2.4.5)
32-
activerecord (5.2.4.5)
33-
activemodel (= 5.2.4.5)
34-
activesupport (= 5.2.4.5)
35-
arel (>= 9.0)
36-
activerecord-sqlserver-adapter (5.2.1)
37-
activerecord (~> 5.2.0)
43+
activemodel (6.0.3.5)
44+
activesupport (= 6.0.3.5)
45+
activerecord (6.0.3.5)
46+
activemodel (= 6.0.3.5)
47+
activesupport (= 6.0.3.5)
48+
activerecord-sqlserver-adapter (6.0.1)
49+
activerecord (~> 6.0.0)
3850
tiny_tds
39-
activestorage (5.2.4.5)
40-
actionpack (= 5.2.4.5)
41-
activerecord (= 5.2.4.5)
51+
activestorage (6.0.3.5)
52+
actionpack (= 6.0.3.5)
53+
activejob (= 6.0.3.5)
54+
activerecord (= 6.0.3.5)
4255
marcel (~> 0.3.1)
43-
activesupport (5.2.4.5)
56+
activesupport (6.0.3.5)
4457
concurrent-ruby (~> 1.0, >= 1.0.2)
4558
i18n (>= 0.7, < 2)
4659
minitest (~> 5.1)
4760
tzinfo (~> 1.1)
48-
arel (9.0.0)
61+
zeitwerk (~> 2.2, >= 2.2.2)
4962
better_errors (2.9.1)
5063
coderay (>= 1.0.0)
5164
erubi (>= 1.0.0)
@@ -99,30 +112,32 @@ GEM
99112
rack (2.2.3)
100113
rack-test (1.1.0)
101114
rack (>= 1.0, < 3)
102-
rails (5.2.4.5)
103-
actioncable (= 5.2.4.5)
104-
actionmailer (= 5.2.4.5)
105-
actionpack (= 5.2.4.5)
106-
actionview (= 5.2.4.5)
107-
activejob (= 5.2.4.5)
108-
activemodel (= 5.2.4.5)
109-
activerecord (= 5.2.4.5)
110-
activestorage (= 5.2.4.5)
111-
activesupport (= 5.2.4.5)
115+
rails (6.0.3.5)
116+
actioncable (= 6.0.3.5)
117+
actionmailbox (= 6.0.3.5)
118+
actionmailer (= 6.0.3.5)
119+
actionpack (= 6.0.3.5)
120+
actiontext (= 6.0.3.5)
121+
actionview (= 6.0.3.5)
122+
activejob (= 6.0.3.5)
123+
activemodel (= 6.0.3.5)
124+
activerecord (= 6.0.3.5)
125+
activestorage (= 6.0.3.5)
126+
activesupport (= 6.0.3.5)
112127
bundler (>= 1.3.0)
113-
railties (= 5.2.4.5)
128+
railties (= 6.0.3.5)
114129
sprockets-rails (>= 2.0.0)
115130
rails-dom-testing (2.0.3)
116131
activesupport (>= 4.2.0)
117132
nokogiri (>= 1.6)
118133
rails-html-sanitizer (1.3.0)
119134
loofah (~> 2.3)
120-
railties (5.2.4.5)
121-
actionpack (= 5.2.4.5)
122-
activesupport (= 5.2.4.5)
135+
railties (6.0.3.5)
136+
actionpack (= 6.0.3.5)
137+
activesupport (= 6.0.3.5)
123138
method_source
124139
rake (>= 0.8.7)
125-
thor (>= 0.19.0, < 2.0)
140+
thor (>= 0.20.3, < 2.0)
126141
rake (13.0.3)
127142
rb-fsevent (0.10.4)
128143
rb-inotify (0.10.1)
@@ -156,14 +171,15 @@ GEM
156171
thread_safe (~> 0.1)
157172
uglifier (4.2.0)
158173
execjs (>= 0.3.0, < 3)
159-
web-console (3.7.0)
160-
actionview (>= 5.0)
161-
activemodel (>= 5.0)
174+
web-console (4.1.0)
175+
actionview (>= 6.0.0)
176+
activemodel (>= 6.0.0)
162177
bindex (>= 0.4.0)
163-
railties (>= 5.0)
178+
railties (>= 6.0.0)
164179
websocket-driver (0.7.3)
165180
websocket-extensions (>= 0.1.0)
166181
websocket-extensions (0.1.5)
182+
zeitwerk (2.4.2)
167183

168184
PLATFORMS
169185
ruby
@@ -177,7 +193,7 @@ DEPENDENCIES
177193
jbuilder
178194
jquery-rails
179195
listen
180-
rails (~> 5.2.0)
196+
rails (~> 6.0.0)
181197
sass-rails
182198
spring
183199
spring-watcher-listen

bin/setup

+6-6
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 =='
1717
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

2323
# puts "\n== Copying sample files =="
2424
# unless File.exist?('config/database.yml')
25-
# cp 'config/database.yml.sample', 'config/database.yml'
25+
# FileUtils.cp 'config/database.yml.sample', 'config/database.yml'
2626
# 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

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
module SsApp
1010
class Application < Rails::Application
1111
# Initialize configuration defaults for originally generated Rails version.
12-
config.load_defaults 5.2
12+
config.load_defaults 6.0
1313

1414
# Settings in config/environments/* take precedence over those specified here.
1515
# Application configuration can go into files in config/initializers

config/cable.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ development:
22
adapter: async
33

44
test:
5-
adapter: async
5+
adapter: test
66

77
production:
88
adapter: redis

config/environments/development.rb

+3-2
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
# Run rails dev:cache to toggle caching.
1717
if Rails.root.join('tmp', 'caching-dev.txt').exist?
1818
config.action_controller.perform_caching = true
19+
config.action_controller.enable_fragment_cache_logging = true
1920

2021
config.cache_store = :memory_store
2122
config.public_file_server.headers = {
@@ -27,7 +28,7 @@
2728
config.cache_store = :null_store
2829
end
2930

30-
# Store uploaded files on the local file system (see config/storage.yml for options)
31+
# Store uploaded files on the local file system (see config/storage.yml for options).
3132
config.active_storage.service = :local
3233

3334
# Don't care if the mailer can't send.
@@ -52,7 +53,7 @@
5253
# Suppress logger output for asset requests.
5354
config.assets.quiet = true
5455

55-
# Raises error for missing translations
56+
# Raises error for missing translations.
5657
# config.action_view.raise_on_missing_translations = true
5758

5859
# Use an evented file watcher to asynchronously detect changes in source code,

config/environments/production.rb

+26-8
Original file line numberDiff line numberDiff line change
@@ -22,26 +22,23 @@
2222
# Apache or NGINX already handles this.
2323
config.public_file_server.enabled = ENV['RAILS_SERVE_STATIC_FILES'].present?
2424

25-
# Compress JavaScripts and CSS.
26-
config.assets.js_compressor = :uglifier
25+
# Compress CSS using a preprocessor.
2726
# config.assets.css_compressor = :sass
2827

2928
# Do not fallback to assets pipeline if a precompiled asset is missed.
3029
config.assets.compile = false
3130

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

3734
# Specifies the header that your server uses for sending files.
3835
# config.action_dispatch.x_sendfile_header = 'X-Sendfile' # for Apache
3936
# config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for NGINX
4037

41-
# Store uploaded files on the local file system (see config/storage.yml for options)
38+
# Store uploaded files on the local file system (see config/storage.yml for options).
4239
config.active_storage.service = :local
4340

44-
# Mount Action Cable outside main process or domain
41+
# Mount Action Cable outside main process or domain.
4542
# config.action_cable.mount_path = nil
4643
# config.action_cable.url = 'wss://example.com/cable'
4744
# config.action_cable.allowed_request_origins = [ 'http://example.com', /http:\/\/example.*/ ]
@@ -59,9 +56,9 @@
5956
# Use a different cache store in production.
6057
# config.cache_store = :mem_cache_store
6158

62-
# Use a real queuing backend for Active Job (and separate queues per environment)
59+
# Use a real queuing backend for Active Job (and separate queues per environment).
6360
# config.active_job.queue_adapter = :resque
64-
# config.active_job.queue_name_prefix = "ss_app_#{Rails.env}"
61+
# config.active_job.queue_name_prefix = "ss_app_production"
6562

6663
config.action_mailer.perform_caching = false
6764

@@ -91,4 +88,25 @@
9188

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

config/environments/test.rb

+10-7
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
1+
# The test environment is used exclusively to run your application's
2+
# test suite. You never need to work with it otherwise. Remember that
3+
# your test database is "scratch space" for the test suite and is wiped
4+
# and recreated between test runs. Don't rely on the data there!
5+
16
Rails.application.configure do
27
# Settings specified here will take precedence over those in config/application.rb.
38

4-
# The test environment is used exclusively to run your application's
5-
# test suite. You never need to work with it otherwise. Remember that
6-
# your test database is "scratch space" for the test suite and is wiped
7-
# and recreated between test runs. Don't rely on the data there!
8-
config.cache_classes = true
9+
config.cache_classes = false
10+
config.action_view.cache_template_loading = true
911

1012
# Do not eager load code on boot. This avoids loading your whole application
1113
# just for the purpose of running a single test. If you are using a tool that
@@ -21,14 +23,15 @@
2123
# Show full error reports and disable caching.
2224
config.consider_all_requests_local = true
2325
config.action_controller.perform_caching = false
26+
config.cache_store = :null_store
2427

2528
# Raise exceptions instead of rendering exception templates.
2629
config.action_dispatch.show_exceptions = false
2730

2831
# Disable request forgery protection in test environment.
2932
config.action_controller.allow_forgery_protection = false
3033

31-
# Store uploaded files on the local file system in a temporary directory
34+
# Store uploaded files on the local file system in a temporary directory.
3235
config.active_storage.service = :test
3336

3437
config.action_mailer.perform_caching = false
@@ -41,6 +44,6 @@
4144
# Print deprecation notices to the stderr.
4245
config.active_support.deprecation = :stderr
4346

44-
# Raises error for missing translations
47+
# Raises error for missing translations.
4548
# config.action_view.raise_on_missing_translations = true
4649
end

config/initializers/content_security_policy.rb

+5
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
# policy.object_src :none
1212
# policy.script_src :self, :https
1313
# policy.style_src :self, :https
14+
# # If you are using webpack-dev-server then specify webpack-dev-server host
15+
# policy.connect_src :self, :https, "http://localhost:3035", "ws://localhost:3035" if Rails.env.development?
1416

1517
# # Specify URI for violation reports
1618
# # policy.report_uri "/csp-violation-report-endpoint"
@@ -19,6 +21,9 @@
1921
# If you are using UJS then enable automatic nonce generation
2022
# Rails.application.config.content_security_policy_nonce_generator = -> request { SecureRandom.base64(16) }
2123

24+
# Set the nonce only to specific directives
25+
# Rails.application.config.content_security_policy_nonce_directives = %w(script-src)
26+
2227
# Report CSP violations to a specified URI
2328
# For further information see the following documentation:
2429
# https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy-Report-Only

config/locales/en.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
# 'true': 'foo'
2828
#
2929
# To learn more, please read the Rails Internationalization guide
30-
# available at http://guides.rubyonrails.org/i18n.html.
30+
# available at https://guides.rubyonrails.org/i18n.html.
3131

3232
en:
3333
hello: "Hello world"

0 commit comments

Comments
 (0)