Skip to content

Commit

Permalink
Upgrade to Rails 6.0
Browse files Browse the repository at this point in the history
Upgrade to Rails 6, including any relevant configuration changes.
  • Loading branch information
christiannelson committed Apr 30, 2019
1 parent 89605c6 commit c0f5619
Show file tree
Hide file tree
Showing 12 changed files with 123 additions and 97 deletions.
5 changes: 2 additions & 3 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,12 @@ gem "bootsnap", require: false
gem "pg"
gem "puma"
gem "rack-canonical-host"
gem "rails", "~> 5.2.3"
gem "rails", "~> 6.0.0.rc1"

# Front-endy
gem "autoprefixer-rails"
gem "bootstrap", "~> 4.3.1"
gem "jquery-rails"
gem "sass-rails", require: false # Only needed for generator (e.g. rail g controller Users)
gem "sassc-rails"
gem "simple_form"
gem "slim-rails"
Expand All @@ -32,7 +31,7 @@ end

group :development, :test do
gem "factory_bot_rails"
gem "rspec-rails"
gem "rspec-rails", "~> 4.0.0.beta2" # For Rails 6 support.
gem "rspec_junit_formatter"
gem "rubocop", require: false
gem "rubocop-performance", require: false
Expand Down
132 changes: 68 additions & 64 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,53 +1,66 @@
GEM
remote: https://rubygems.org/
specs:
actioncable (5.2.3)
actionpack (= 5.2.3)
actioncable (6.0.0.rc1)
actionpack (= 6.0.0.rc1)
nio4r (~> 2.0)
websocket-driver (>= 0.6.1)
actionmailer (5.2.3)
actionpack (= 5.2.3)
actionview (= 5.2.3)
activejob (= 5.2.3)
actionmailbox (6.0.0.rc1)
actionpack (= 6.0.0.rc1)
activejob (= 6.0.0.rc1)
activerecord (= 6.0.0.rc1)
activestorage (= 6.0.0.rc1)
activesupport (= 6.0.0.rc1)
mail (>= 2.7.1)
actionmailer (6.0.0.rc1)
actionpack (= 6.0.0.rc1)
actionview (= 6.0.0.rc1)
activejob (= 6.0.0.rc1)
mail (~> 2.5, >= 2.5.4)
rails-dom-testing (~> 2.0)
actionpack (5.2.3)
actionview (= 5.2.3)
activesupport (= 5.2.3)
actionpack (6.0.0.rc1)
actionview (= 6.0.0.rc1)
activesupport (= 6.0.0.rc1)
rack (~> 2.0)
rack-test (>= 0.6.3)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.0, >= 1.0.2)
actionview (5.2.3)
activesupport (= 5.2.3)
actiontext (6.0.0.rc1)
actionpack (= 6.0.0.rc1)
activerecord (= 6.0.0.rc1)
activestorage (= 6.0.0.rc1)
activesupport (= 6.0.0.rc1)
nokogiri (>= 1.8.5)
actionview (6.0.0.rc1)
activesupport (= 6.0.0.rc1)
builder (~> 3.1)
erubi (~> 1.4)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.0, >= 1.0.3)
activejob (5.2.3)
activesupport (= 5.2.3)
activejob (6.0.0.rc1)
activesupport (= 6.0.0.rc1)
globalid (>= 0.3.6)
activemodel (5.2.3)
activesupport (= 5.2.3)
activerecord (5.2.3)
activemodel (= 5.2.3)
activesupport (= 5.2.3)
arel (>= 9.0)
activestorage (5.2.3)
actionpack (= 5.2.3)
activerecord (= 5.2.3)
activemodel (6.0.0.rc1)
activesupport (= 6.0.0.rc1)
activerecord (6.0.0.rc1)
activemodel (= 6.0.0.rc1)
activesupport (= 6.0.0.rc1)
activestorage (6.0.0.rc1)
actionpack (= 6.0.0.rc1)
activejob (= 6.0.0.rc1)
activerecord (= 6.0.0.rc1)
marcel (~> 0.3.1)
activesupport (5.2.3)
activesupport (6.0.0.rc1)
concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (>= 0.7, < 2)
minitest (~> 5.1)
tzinfo (~> 1.1)
zeitwerk (~> 2.1, >= 2.1.4)
addressable (2.6.0)
public_suffix (>= 2.0.2, < 4.0)
annotate (2.7.4)
activerecord (>= 3.2, < 6.0)
annotate (2.7.5)
activerecord (>= 3.2, < 7.0)
rake (>= 10.4, < 13.0)
arel (9.0.0)
ast (2.4.0)
autoprefixer-rails (9.5.1)
execjs
Expand Down Expand Up @@ -139,30 +152,32 @@ GEM
rack-test (1.1.0)
rack (>= 1.0, < 3)
rack-timeout (0.5.1)
rails (5.2.3)
actioncable (= 5.2.3)
actionmailer (= 5.2.3)
actionpack (= 5.2.3)
actionview (= 5.2.3)
activejob (= 5.2.3)
activemodel (= 5.2.3)
activerecord (= 5.2.3)
activestorage (= 5.2.3)
activesupport (= 5.2.3)
rails (6.0.0.rc1)
actioncable (= 6.0.0.rc1)
actionmailbox (= 6.0.0.rc1)
actionmailer (= 6.0.0.rc1)
actionpack (= 6.0.0.rc1)
actiontext (= 6.0.0.rc1)
actionview (= 6.0.0.rc1)
activejob (= 6.0.0.rc1)
activemodel (= 6.0.0.rc1)
activerecord (= 6.0.0.rc1)
activestorage (= 6.0.0.rc1)
activesupport (= 6.0.0.rc1)
bundler (>= 1.3.0)
railties (= 5.2.3)
railties (= 6.0.0.rc1)
sprockets-rails (>= 2.0.0)
rails-dom-testing (2.0.3)
activesupport (>= 4.2.0)
nokogiri (>= 1.6)
rails-html-sanitizer (1.0.4)
loofah (~> 2.2, >= 2.2.2)
railties (5.2.3)
actionpack (= 5.2.3)
activesupport (= 5.2.3)
railties (6.0.0.rc1)
actionpack (= 6.0.0.rc1)
activesupport (= 6.0.0.rc1)
method_source
rake (>= 0.8.7)
thor (>= 0.19.0, < 2.0)
thor (>= 0.20.3, < 2.0)
rainbow (3.0.0)
rake (12.3.2)
rb-fsevent (0.10.3)
Expand All @@ -171,20 +186,20 @@ GEM
regexp_parser (1.4.0)
rspec-core (3.8.0)
rspec-support (~> 3.8.0)
rspec-expectations (3.8.2)
rspec-expectations (3.8.3)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.8.0)
rspec-mocks (3.8.0)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.8.0)
rspec-rails (3.8.2)
actionpack (>= 3.0)
activesupport (>= 3.0)
railties (>= 3.0)
rspec-core (~> 3.8.0)
rspec-expectations (~> 3.8.0)
rspec-mocks (~> 3.8.0)
rspec-support (~> 3.8.0)
rspec-rails (4.0.0.beta2)
actionpack (>= 4.2)
activesupport (>= 4.2)
railties (>= 4.2)
rspec-core (~> 3.8)
rspec-expectations (~> 3.8)
rspec-mocks (~> 3.8)
rspec-support (~> 3.8)
rspec-support (3.8.0)
rspec_junit_formatter (0.4.1)
rspec-core (>= 2, < 4, != 2.12.0)
Expand All @@ -200,17 +215,6 @@ GEM
ruby-progressbar (1.10.0)
ruby_dep (1.5.0)
rubyzip (1.2.2)
sass (3.7.3)
sass-listen (~> 4.0.0)
sass-listen (4.0.0)
rb-fsevent (~> 0.9, >= 0.9.4)
rb-inotify (~> 0.9, >= 0.9.7)
sass-rails (5.0.7)
railties (>= 4.0.0, < 6)
sass (~> 3.1)
sprockets (>= 2.8, < 4.0)
sprockets-rails (>= 2.0, < 4.0)
tilt (>= 1.1, < 3)
sassc (2.0.1)
ffi (~> 1.9)
rake
Expand Down Expand Up @@ -270,6 +274,7 @@ GEM
websocket-extensions (0.1.3)
xpath (3.2.0)
nokogiri (~> 1.8)
zeitwerk (2.1.5)

PLATFORMS
ruby
Expand All @@ -292,12 +297,11 @@ DEPENDENCIES
puma
rack-canonical-host
rack-timeout
rails (~> 5.2.3)
rspec-rails
rails (~> 6.0.0.rc1)
rspec-rails (~> 4.0.0.beta2)
rspec_junit_formatter
rubocop
rubocop-performance
sass-rails
sassc-rails
selenium-webdriver
simple_form
Expand Down
7 changes: 3 additions & 4 deletions bin/setup
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
#!/usr/bin/env ruby
require "pathname"
require "fileutils"
include FileUtils

# path to your application root.
APP_ROOT = File.expand_path("..", __dir__)
Expand All @@ -10,8 +8,9 @@ def system!(*args)
system(*args) || abort("\n== Command #{args} failed ==")
end

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

puts "== Installing dependencies =="
Expand Down
4 changes: 1 addition & 3 deletions bin/update
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
#!/usr/bin/env ruby
require "pathname"
require "fileutils"
include FileUtils

# path to your application root.
APP_ROOT = File.expand_path("..", __dir__)
Expand All @@ -10,7 +8,7 @@ def system!(*args)
system(*args) || abort("\n== Command #{args} failed ==")
end

chdir APP_ROOT do
FileUtils.chdir APP_ROOT do
# This script is a way to update your development environment automatically.
# Add necessary update steps to this file.

Expand Down
2 changes: 1 addition & 1 deletion config/cable.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ development:
adapter: async

test:
adapter: async
adapter: test

production:
adapter: redis
Expand Down
6 changes: 5 additions & 1 deletion config/environments/development.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
# Run rails dev:cache to toggle caching.
if Rails.root.join("tmp", "caching-dev.txt").exist?
config.action_controller.perform_caching = true
config.action_controller.enable_fragment_cache_logging = true

config.cache_store = :memory_store
config.public_file_server.headers = {
Expand All @@ -27,6 +28,9 @@
config.cache_store = :null_store
end

# Store uploaded files on the local file system (see config/storage.yml for options).
config.active_storage.service = :local

# An opinionated ActionMailer config for development:
# - If mailcatcher is running when the app boots, use it.
# - If not, use Rails' built-in :test delivery-method.
Expand Down Expand Up @@ -62,7 +66,7 @@
# Suppress logger output for asset requests.
config.assets.quiet = true

# Raises error for missing translations
# Raises error for missing translations.
# config.action_view.raise_on_missing_translations = true

# Use an evented file watcher to asynchronously detect changes in source code,
Expand Down
30 changes: 24 additions & 6 deletions config/environments/production.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,26 +22,23 @@
# Apache or NGINX already handles this.
config.public_file_server.enabled = ENV["RAILS_SERVE_STATIC_FILES"].present?

# Compress JavaScripts and CSS.
config.assets.js_compressor = :uglifier
# Compress CSS using a preprocessor.
# config.assets.css_compressor = :sass

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

# `config.assets.precompile` and `config.assets.version` have moved to config/initializers/assets.rb

# Enable serving of images, stylesheets, and JavaScripts from an asset server.
config.action_controller.asset_host = ENV["ASSET_HOST"].presence

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

# Store uploaded files on the local file system (see config/storage.yml for options)
# Store uploaded files on the local file system (see config/storage.yml for options).
config.active_storage.service = :local

# Mount Action Cable outside main process or domain
# Mount Action Cable outside main process or domain.
# config.action_cable.mount_path = nil
# config.action_cable.url = 'wss://example.com/cable'
# config.action_cable.allowed_request_origins = [ 'http://example.com', /http:\/\/example.*/ ]
Expand Down Expand Up @@ -95,4 +92,25 @@

# Do not dump schema after migrations.
config.active_record.dump_schema_after_migration = false

# Inserts middleware to perform automatic connection switching.
# The `database_selector` hash is used to pass options to the DatabaseSelector
# middleware. The `delay` is used to determine how long to wait after a write
# to send a subsequent read to the primary.
#
# The `database_resolver` class is used by the middleware to determine which
# database is appropriate to use based on the time delay.
#
# The `database_resolver_context` class is used by the middleware to set
# timestamps for the last write to the primary. The resolver uses the context
# class timestamps to determine how long to wait before reading from the
# replica.
#
# By default Rails will store a last write timestamp in the session. The
# DatabaseSelector middleware is designed as such you can define your own
# strategy for connection switching and pass that into the middleware through
# these configuration options.
# config.active_record.database_selector = { delay: 2.seconds }
# config.active_record.database_resolver = ActiveRecord::Middleware::DatabaseSelector::Resolver
# config.active_record.database_resolver_context = ActiveRecord::Middleware::DatabaseSelector::Resolver::Session
end

0 comments on commit c0f5619

Please sign in to comment.