From 26c0199c018cb934d1eca1650337db5177aa2b32 Mon Sep 17 00:00:00 2001 From: Sam Saffron Date: Fri, 8 Nov 2019 16:56:30 +1100 Subject: [PATCH] DEV: update Rails to version 6.0.1 This version of Rails eliminates a monkey patch that is no longer needed! Additionally it preps us for Ruby 2.7 support. --- Gemfile | 14 +++---- Gemfile.lock | 70 +++++++++++++++++------------------ lib/freedom_patches/rails6.rb | 57 ---------------------------- 3 files changed, 42 insertions(+), 99 deletions(-) delete mode 100644 lib/freedom_patches/rails6.rb diff --git a/Gemfile b/Gemfile index 2e1ce26cc9d..6d4182e56cc 100644 --- a/Gemfile +++ b/Gemfile @@ -16,13 +16,13 @@ if rails_master? else # until rubygems gives us optional dependencies we are stuck with this # bundle update actionmailer actionpack actionview activemodel activerecord activesupport railties - gem 'actionmailer', '6.0.0' - gem 'actionpack', '6.0.0' - gem 'actionview', '6.0.0' - gem 'activemodel', '6.0.0' - gem 'activerecord', '6.0.0' - gem 'activesupport', '6.0.0' - gem 'railties', '6.0.0' + gem 'actionmailer', '6.0.1' + gem 'actionpack', '6.0.1' + gem 'actionview', '6.0.1' + gem 'activemodel', '6.0.1' + gem 'activerecord', '6.0.1' + gem 'activesupport', '6.0.1' + gem 'railties', '6.0.1' gem 'sprockets-rails' end diff --git a/Gemfile.lock b/Gemfile.lock index 704a6e0e5b5..1201ee97154 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,21 +1,21 @@ GEM remote: https://rubygems.org/ specs: - actionmailer (6.0.0) - actionpack (= 6.0.0) - actionview (= 6.0.0) - activejob (= 6.0.0) + actionmailer (6.0.1) + actionpack (= 6.0.1) + actionview (= 6.0.1) + activejob (= 6.0.1) mail (~> 2.5, >= 2.5.4) rails-dom-testing (~> 2.0) - actionpack (6.0.0) - actionview (= 6.0.0) - activesupport (= 6.0.0) + actionpack (6.0.1) + actionview (= 6.0.1) + activesupport (= 6.0.1) rack (~> 2.0) rack-test (>= 0.6.3) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.0, >= 1.2.0) - actionview (6.0.0) - activesupport (= 6.0.0) + actionview (6.0.1) + activesupport (= 6.0.1) builder (~> 3.1) erubi (~> 1.4) rails-dom-testing (~> 2.0) @@ -24,20 +24,20 @@ GEM actionview (>= 6.0.a) active_model_serializers (0.8.4) activemodel (>= 3.0) - activejob (6.0.0) - activesupport (= 6.0.0) + activejob (6.0.1) + activesupport (= 6.0.1) globalid (>= 0.3.6) - activemodel (6.0.0) - activesupport (= 6.0.0) - activerecord (6.0.0) - activemodel (= 6.0.0) - activesupport (= 6.0.0) - activesupport (6.0.0) + activemodel (6.0.1) + activesupport (= 6.0.1) + activerecord (6.0.1) + activemodel (= 6.0.1) + activesupport (= 6.0.1) + activesupport (6.0.1) concurrent-ruby (~> 1.0, >= 1.0.2) i18n (>= 0.7, < 2) minitest (~> 5.1) tzinfo (~> 1.1) - zeitwerk (~> 2.1, >= 2.1.8) + zeitwerk (~> 2.2) addressable (2.5.2) public_suffix (>= 2.0.2, < 4.0) annotate (2.7.5) @@ -119,7 +119,7 @@ GEM jquery-rails (>= 1.0.17) railties (>= 3.1) ember-source (2.18.2) - erubi (1.8.0) + erubi (1.9.0) excon (0.64.0) execjs (2.7.0) exifr (1.3.6) @@ -146,7 +146,7 @@ GEM hkdf (0.3.0) htmlentities (4.3.4) http_accept_language (2.0.5) - i18n (1.6.0) + i18n (1.7.0) concurrent-ruby (~> 1.0) image_size (1.5.0) in_threads (1.5.1) @@ -195,7 +195,7 @@ GEM mini_sql (0.2.2) mini_suffix (0.3.0) ffi (~> 1.9) - minitest (5.11.3) + minitest (5.13.0) mocha (1.8.0) metaclass (~> 0.0.1) mock_redis (0.19.0) @@ -204,7 +204,7 @@ GEM multi_xml (0.6.0) multipart-post (2.1.1) mustache (1.1.0) - nokogiri (1.10.4) + nokogiri (1.10.5) mini_portile2 (~> 2.4.0) nokogumbo (2.0.1) nokogiri (~> 1.8, >= 1.8.4) @@ -283,14 +283,14 @@ GEM rails-dom-testing (2.0.3) activesupport (>= 4.2.0) nokogiri (>= 1.6) - rails-html-sanitizer (1.2.0) - loofah (~> 2.2, >= 2.2.2) + rails-html-sanitizer (1.3.0) + loofah (~> 2.3) rails_multisite (2.0.7) activerecord (> 4.2, < 7) railties (> 4.2, < 7) - railties (6.0.0) - actionpack (= 6.0.0) - activesupport (= 6.0.0) + railties (6.0.1) + actionpack (= 6.0.1) + activesupport (= 6.0.1) method_source rake (>= 0.8.7) thor (>= 0.20.3, < 2.0) @@ -418,20 +418,20 @@ GEM hkdf (~> 0.2) jwt (~> 2.0) yaml-lint (0.0.10) - zeitwerk (2.1.10) + zeitwerk (2.2.1) PLATFORMS ruby DEPENDENCIES - actionmailer (= 6.0.0) - actionpack (= 6.0.0) - actionview (= 6.0.0) + actionmailer (= 6.0.1) + actionpack (= 6.0.1) + actionview (= 6.0.1) actionview_precompiler active_model_serializers (~> 0.8.3) - activemodel (= 6.0.0) - activerecord (= 6.0.0) - activesupport (= 6.0.0) + activemodel (= 6.0.1) + activerecord (= 6.0.1) + activesupport (= 6.0.1) annotate aws-sdk-s3 aws-sdk-sns @@ -508,7 +508,7 @@ DEPENDENCIES rack-mini-profiler rack-protection rails_multisite - railties (= 6.0.0) + railties (= 6.0.1) rake rb-fsevent rb-inotify (~> 0.9) diff --git a/lib/freedom_patches/rails6.rb b/lib/freedom_patches/rails6.rb deleted file mode 100644 index cf2f96de053..00000000000 --- a/lib/freedom_patches/rails6.rb +++ /dev/null @@ -1,57 +0,0 @@ -# frozen_string_literal: true - -# see: https://github.com/rails/rails/pull/36949#issuecomment-530698779 -# -# Without this patch each time we close a DB connection we spin a thread - -module ::ActiveRecord - module ConnectionAdapters - class AbstractAdapter - class StaticThreadLocalVar - attr_reader :value - - def initialize(value) - @value = value - end - - def bind(value) - raise "attempting to change immutable local var" if value != @value - if block_given? - yield - end - end - end - - # we have no choice but to perform an aggressive patch here - # if we simply hook the method we will still call a finalizer - # on Concurrent::ThreadLocalVar - - def initialize(connection, logger = nil, config = {}) # :nodoc: - super() - - @connection = connection - @owner = nil - @instrumenter = ActiveSupport::Notifications.instrumenter - @logger = logger - @config = config - @pool = ActiveRecord::ConnectionAdapters::NullPool.new - @idle_since = Concurrent.monotonic_time - @visitor = arel_visitor - @statements = build_statement_pool - @lock = ActiveSupport::Concurrency::LoadInterlockAwareMonitor.new - - if self.class.type_cast_config_to_boolean(config.fetch(:prepared_statements) { true }) - @prepared_statement_status = Concurrent::ThreadLocalVar.new(true) - @visitor.extend(DetermineIfPreparableVisitor) - else - #@prepared_statement_status = Concurrent::ThreadLocalVar.new(false) - @prepared_statement_status = StaticThreadLocalVar.new(false) - end - - @advisory_locks_enabled = self.class.type_cast_config_to_boolean( - config.fetch(:advisory_locks, true) - ) - end - end - end -end