Skip to content

Commit

Permalink
upgrade Rails 5.0.3 -> 5.0.7
Browse files Browse the repository at this point in the history
Ran rake app:update and committed what changes it made via its templates
as appropriate. Keeping these files looking as much like the Rails
templates as possible makes reviewing future app:update diffs easier.

Changes of note:

* config/environments/production.rb

Moved our logging configuration to the spots the Rails generators and
app:update templates put them.

Added a new RAILS_LOG_TO_STDOUT environment variable to the list of env
vars set in production to match the Railsy way to declare that.

* config/initializers/cookies_serializer.rb

Changed to hybrid to "transparently migrate existing Marshal-serialized
cookies to the new JSON-based format."[1]

[1] https://guides.rubyonrails.org/upgrading_ruby_on_rails.html#cookies-serializer

Signed-off-by: Robb Kidd <rkidd@chef.io>
  • Loading branch information
robbkidd committed Oct 26, 2018
1 parent 07892ef commit e0bcc5b
Show file tree
Hide file tree
Showing 10 changed files with 122 additions and 109 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -337,6 +337,7 @@
default['supermarket']['redis_jobq_url'] = nil
default['supermarket']['sentry_url'] = nil
default['supermarket']['api_item_limit'] = 100
default['supermarket']['rails_log_to_stdout'] = true

# ### Chef URL Settings
#
Expand Down
93 changes: 47 additions & 46 deletions src/supermarket/Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -22,41 +22,41 @@ PATH
GEM
remote: https://rubygems.org/
specs:
actioncable (5.0.3)
actionpack (= 5.0.3)
actioncable (5.0.7)
actionpack (= 5.0.7)
nio4r (>= 1.2, < 3.0)
websocket-driver (~> 0.6.1)
actionmailer (5.0.3)
actionpack (= 5.0.3)
actionview (= 5.0.3)
activejob (= 5.0.3)
actionmailer (5.0.7)
actionpack (= 5.0.7)
actionview (= 5.0.7)
activejob (= 5.0.7)
mail (~> 2.5, >= 2.5.4)
rails-dom-testing (~> 2.0)
actionpack (5.0.3)
actionview (= 5.0.3)
activesupport (= 5.0.3)
actionpack (5.0.7)
actionview (= 5.0.7)
activesupport (= 5.0.7)
rack (~> 2.0)
rack-test (~> 0.6.3)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.0, >= 1.0.2)
actionview (5.0.3)
activesupport (= 5.0.3)
actionview (5.0.7)
activesupport (= 5.0.7)
builder (~> 3.1)
erubis (~> 2.7.0)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.0, >= 1.0.3)
activejob (5.0.3)
activesupport (= 5.0.3)
activejob (5.0.7)
activesupport (= 5.0.7)
globalid (>= 0.3.6)
activemodel (5.0.3)
activesupport (= 5.0.3)
activerecord (5.0.3)
activemodel (= 5.0.3)
activesupport (= 5.0.3)
activemodel (5.0.7)
activesupport (= 5.0.7)
activerecord (5.0.7)
activemodel (= 5.0.7)
activesupport (= 5.0.7)
arel (~> 7.0)
activesupport (5.0.3)
activesupport (5.0.7)
concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (~> 0.7)
i18n (>= 0.7, < 2)
minitest (~> 5.1)
tzinfo (~> 1.1)
addressable (2.5.2)
Expand Down Expand Up @@ -162,7 +162,7 @@ GEM
connection_pool (2.2.1)
crack (0.4.3)
safe_yaml (~> 1.0.0)
crass (1.0.3)
crass (1.0.4)
css_parser (1.5.0)
addressable
cucumber-core (3.2.1)
Expand Down Expand Up @@ -213,7 +213,7 @@ GEM
raabro (~> 1.1)
fuzzyurl (0.9.0)
gherkin (5.1.0)
globalid (0.4.0)
globalid (0.4.1)
activesupport (>= 4.2.0)
guard (2.14.1)
formatador (>= 0.2.4)
Expand All @@ -240,7 +240,7 @@ GEM
htmlentities (4.3.4)
httparty (0.15.2)
multi_xml (>= 0.5.2)
i18n (0.9.3)
i18n (0.9.5)
concurrent-ruby (~> 1.0)
ice_nine (0.11.2)
iniparse (1.4.4)
Expand Down Expand Up @@ -282,15 +282,16 @@ GEM
crass (~> 1.0.2)
nokogiri (>= 1.5.9)
lumberjack (1.0.12)
mail (2.6.5)
mime-types (>= 1.16, < 4)
mail (2.7.1)
mini_mime (>= 0.1.1)
mail_view (2.0.4)
tilt
method_source (0.8.2)
mime-types (3.1)
mime-types (3.2.2)
mime-types-data (~> 3.2015)
mime-types-data (3.2016.0521)
mime-types-data (3.2018.0812)
mimemagic (0.3.2)
mini_mime (1.0.1)
mini_portile2 (2.3.0)
minitest (5.11.3)
mixlib-archive (0.4.18)
Expand Down Expand Up @@ -318,7 +319,7 @@ GEM
net-ssh-gateway (>= 1.2.0)
net-telnet (0.1.1)
newrelic_rpm (4.1.0.333)
nio4r (2.0.0)
nio4r (2.3.1)
nokogiri (1.8.5)
mini_portile2 (~> 2.3.0)
notiffany (0.1.1)
Expand Down Expand Up @@ -400,17 +401,17 @@ GEM
rack
rack-test (0.6.3)
rack (>= 1.0)
rails (5.0.3)
actioncable (= 5.0.3)
actionmailer (= 5.0.3)
actionpack (= 5.0.3)
actionview (= 5.0.3)
activejob (= 5.0.3)
activemodel (= 5.0.3)
activerecord (= 5.0.3)
activesupport (= 5.0.3)
bundler (>= 1.3.0, < 2.0)
railties (= 5.0.3)
rails (5.0.7)
actioncable (= 5.0.7)
actionmailer (= 5.0.7)
actionpack (= 5.0.7)
actionview (= 5.0.7)
activejob (= 5.0.7)
activemodel (= 5.0.7)
activerecord (= 5.0.7)
activesupport (= 5.0.7)
bundler (>= 1.3.0)
railties (= 5.0.7)
sprockets-rails (>= 2.0.0)
rails-controller-testing (1.0.1)
actionpack (~> 5.x)
Expand All @@ -421,9 +422,9 @@ GEM
nokogiri (>= 1.6)
rails-html-sanitizer (1.0.4)
loofah (~> 2.2, >= 2.2.2)
railties (5.0.3)
actionpack (= 5.0.3)
activesupport (= 5.0.3)
railties (5.0.7)
actionpack (= 5.0.7)
activesupport (= 5.0.7)
method_source
rake (>= 0.8.7)
thor (>= 0.18.1, < 2.0)
Expand Down Expand Up @@ -540,7 +541,7 @@ GEM
sprockets (3.7.2)
concurrent-ruby (~> 1.0)
rack (> 1, < 3)
sprockets-rails (3.2.0)
sprockets-rails (3.2.1)
actionpack (>= 4.0)
activesupport (>= 4.0)
sprockets (>= 3.0.0)
Expand All @@ -553,7 +554,7 @@ GEM
tomlrb (1.2.4)
treetop (1.6.10)
polyglot (~> 0.3)
tzinfo (1.2.4)
tzinfo (1.2.5)
thread_safe (~> 0.1)
uglifier (3.2.0)
execjs (>= 0.3.0, < 3)
Expand Down Expand Up @@ -582,7 +583,7 @@ GEM
hashdiff
websocket-driver (0.6.5)
websocket-extensions (>= 0.1.0)
websocket-extensions (0.1.2)
websocket-extensions (0.1.3)
with_env (1.1.0)
wmi-lite (1.0.0)
xml-simple (1.1.5)
Expand Down Expand Up @@ -669,4 +670,4 @@ DEPENDENCIES
yard

BUNDLED WITH
1.16.6
1.17.0
3 changes: 2 additions & 1 deletion src/supermarket/bin/setup
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#!/usr/bin/env ruby
require 'pathname'
require 'fileutils'
include FileUtils

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

FileUtils.chdir APP_ROOT do
chdir APP_ROOT do
# This script is a starting point to setup your application.
# Add necessary setup steps to this file.

Expand Down
3 changes: 2 additions & 1 deletion src/supermarket/bin/update
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#!/usr/bin/env ruby
require 'pathname'
require 'fileutils'
include FileUtils

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

FileUtils.chdir APP_ROOT do
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 src/supermarket/config/environments/development.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
config.consider_all_requests_local = true

# Enable/disable caching. By default caching is disabled.
if Rails.root.join('tmp', 'caching-dev.txt').exist?
if Rails.root.join('tmp/caching-dev.txt').exist?
config.action_controller.perform_caching = true

config.cache_store = :memory_store
Expand Down
22 changes: 15 additions & 7 deletions src/supermarket/config/environments/production.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,15 @@
# Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
# config.force_ssl = true

# default production log level has historically been WARN
# TODO: consider setting to DEBUG so that the default provides
# maximum diagnostic information after ensuring log rotation
# schedule handles the increased output
config.log_level = (ENV['LOG_LEVEL'] ? ENV['LOG_LEVEL'].downcase : 'warn').to_sym

# Prepend all log lines with the following tags.
config.log_tags = [ :request_id ]

# Use a different cache store in production.
config.cache_store = :redis_store, ENV['REDIS_URL'] || 'redis://localhost:6379/0/supermarket'

Expand Down Expand Up @@ -80,18 +89,17 @@

# Use default logging formatter so that PID and timestamp are not suppressed.
config.log_formatter = ::Logger::Formatter.new
logger = ActiveSupport::Logger.new(STDOUT)
logger.formatter = config.log_formatter
logger.level = Logger.const_get(ENV['LOG_LEVEL'] ? ENV['LOG_LEVEL'].upcase : 'WARN')
config.logger = ActiveSupport::TaggedLogging.new(logger)
config.log_level = (ENV['LOG_LEVEL'] ? ENV['LOG_LEVEL'].downcase : 'warn').to_sym
# Prepend all log lines with the following tags.
config.log_tags = [:request_id]

# Use a different logger for distributed setups.
# require 'syslog/logger'
# config.logger = ActiveSupport::TaggedLogging.new(Syslog::Logger.new 'app-name')

if ENV["RAILS_LOG_TO_STDOUT"].present?
logger = ActiveSupport::Logger.new(STDOUT)
logger.formatter = config.log_formatter
config.logger = ActiveSupport::TaggedLogging.new(logger)
end

# Do not dump schema after migrations.
config.active_record.dump_schema_after_migration = false
end
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# Be sure to restart your server when you modify this file.

# ApplicationController.renderer.defaults.merge!(
# http_host: 'example.org',
# https: false
# )
# ActiveSupport::Reloader.to_prepare do
# ApplicationController.renderer.defaults.merge!(
# http_host: 'example.org',
# https: false
# )
# end
2 changes: 1 addition & 1 deletion src/supermarket/config/initializers/cookies_serializer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@

# Specify a serializer for the signed and encrypted cookie jars.
# Valid options are :json, :marshal, and :hybrid.
Rails.application.config.action_dispatch.cookies_serializer = :marshal
Rails.application.config.action_dispatch.cookies_serializer = :hybrid
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#
# Read the Guide for Upgrading Ruby on Rails for more info on each option.

Rails.application.config.raise_on_unfiltered_parameters = true
Rails.application.config.action_controller.raise_on_unfiltered_parameters = true

# Enable per-form CSRF tokens. Previous versions had false.
Rails.application.config.action_controller.per_form_csrf_tokens = false
Expand Down
Loading

0 comments on commit e0bcc5b

Please sign in to comment.