From 6b40fc63500c24bd2da8311f6f1b81637002f789 Mon Sep 17 00:00:00 2001 From: ulferts Date: Fri, 19 Nov 2021 16:01:01 +0100 Subject: [PATCH] bump disposable & representable --- Gemfile | 4 +- Gemfile.lock | 13 ++--- lib/open_project/patches/disposable.rb | 61 +++++++++++++++++++++++ lib/open_project/patches/representable.rb | 2 +- 4 files changed, 70 insertions(+), 10 deletions(-) create mode 100644 lib/open_project/patches/disposable.rb diff --git a/Gemfile b/Gemfile index da5807c3eb4..072a26200d8 100644 --- a/Gemfile +++ b/Gemfile @@ -295,7 +295,9 @@ gem 'roar', '~> 1.1.0' gem 'rack-cors', '~> 1.1.1' # Required for contracts -gem 'disposable', '~> 0.4.7' +# Not requiring since it needs to be patched before initialization: +# See lib/open_project/patches/disposable.rb +gem 'disposable', '~> 0.6.1', require: false platforms :mri, :mingw, :x64_mingw do group :postgres do diff --git a/Gemfile.lock b/Gemfile.lock index 30ca270e0d3..c2d55493f1a 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -406,12 +406,9 @@ GEM activerecord (>= 3.0, < 6.2) delayed_job (>= 3.0, < 5) diff-lcs (1.4.4) - disposable (0.4.7) + disposable (0.6.1) declarative (>= 0.0.9, < 1.0.0) - declarative-builder (< 0.2.0) - declarative-option (< 0.2.0) - representable (>= 2.4.0, <= 3.1.0) - uber (< 0.2.0) + representable (>= 3.1.1, < 3.2.0) domain_name (0.5.20190701) unf (>= 0.0.5, < 1.0.0) doorkeeper (5.5.4) @@ -782,9 +779,9 @@ GEM json redcarpet (3.5.1) regexp_parser (2.1.1) - representable (3.1.0) + representable (3.1.1) declarative (< 0.1.0) - trailblazer-option (~> 0.1.0) + trailblazer-option (>= 0.1.1, < 0.2.0) uber (< 0.2.0) request_store (1.5.0) rack (>= 1.4) @@ -1011,7 +1008,7 @@ DEPENDENCIES deckar01-task_list (~> 2.3.1) delayed_cron_job (~> 0.9.0) delayed_job_active_record (~> 4.1.5) - disposable (~> 0.4.7) + disposable (~> 0.6.1) doorkeeper (~> 5.5.0) email_validator (~> 2.2.3) equivalent-xml (~> 0.6) diff --git a/lib/open_project/patches/disposable.rb b/lib/open_project/patches/disposable.rb new file mode 100644 index 00000000000..5fd71bede98 --- /dev/null +++ b/lib/open_project/patches/disposable.rb @@ -0,0 +1,61 @@ +#-- copyright +# OpenProject is an open source project management software. +# Copyright (C) 2012-2021 the OpenProject GmbH +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License version 3. +# +# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows: +# Copyright (C) 2006-2013 Jean-Philippe Lang +# Copyright (C) 2010-2013 the ChiliProject Team +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +# +# See COPYRIGHT and LICENSE files for more details. +#++ + +# Disposable from 0.6.0 on includes Forwardable into every +# class inheriting from Disposable::Twin. OpenProject +# uses Disposable::Twin for the contracts. +# Including Forwardable overwrites the rails core_ext delegate +# on which e.g. ActiveModel::Naming relies. +OpenProject::Patches.patch_gem_version 'disposable', '6.0.1' do + # The patch thus loads the module including Forwardable, then removes the + # code and defines its own empty module. + module Disposable + class Twin + module Property + + end + end + end + + require "disposable/twin/property/unnest" + Disposable::Twin::Property.send(:remove_const, :Unnest) + + module Disposable + class Twin + module Property + module Unnest + def unnest(_name, _options) + raise 'Relying on patched away method' + end + end + end + end + end + + require 'disposable' +end diff --git a/lib/open_project/patches/representable.rb b/lib/open_project/patches/representable.rb index c0b508da60a..468181306ae 100644 --- a/lib/open_project/patches/representable.rb +++ b/lib/open_project/patches/representable.rb @@ -70,7 +70,7 @@ module OpenProject::Patches::Representable end end -OpenProject::Patches.patch_gem_version 'representable', '3.1.0' do +OpenProject::Patches.patch_gem_version 'representable', '3.1.1' do unless Representable::Decorator.included_modules.include?(OpenProject::Patches::Representable::DecoratorPatch) Representable::Decorator.include OpenProject::Patches::Representable::DecoratorPatch end