summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHans de Graaff <graaff@gentoo.org>2022-03-14 17:00:45 +0100
committerHans de Graaff <graaff@gentoo.org>2022-03-14 17:01:01 +0100
commit668439082818b43deafd721e4cd250540ccc25f1 (patch)
tree175cea07a2590cd7848e0aae2e9c849bb11fd9f5 /dev-ruby/settingslogic
parentdev-ruby/deep_merge: add ruby31 (diff)
downloadgentoo-668439082818b43deafd721e4cd250540ccc25f1.tar.gz
gentoo-668439082818b43deafd721e4cd250540ccc25f1.tar.bz2
gentoo-668439082818b43deafd721e4cd250540ccc25f1.zip
dev-ruby/settingslogic: add psych 4 compatibility
Package-Manager: Portage-3.0.30, Repoman-3.0.3 Signed-off-by: Hans de Graaff <graaff@gentoo.org>
Diffstat (limited to 'dev-ruby/settingslogic')
-rw-r--r--dev-ruby/settingslogic/files/settingslogic-2.0.9-psych-4.patch31
-rw-r--r--dev-ruby/settingslogic/settingslogic-2.0.9-r2.ebuild26
2 files changed, 57 insertions, 0 deletions
diff --git a/dev-ruby/settingslogic/files/settingslogic-2.0.9-psych-4.patch b/dev-ruby/settingslogic/files/settingslogic-2.0.9-psych-4.patch
new file mode 100644
index 000000000000..aecb968e9766
--- /dev/null
+++ b/dev-ruby/settingslogic/files/settingslogic-2.0.9-psych-4.patch
@@ -0,0 +1,31 @@
+From bd477f59560f3dea86f0cf43dabd814ac459d2ee Mon Sep 17 00:00:00 2001
+From: Tomohiko Mimura <mito.5525@gmail.com>
+Date: Mon, 2 Aug 2021 13:26:22 +0900
+Subject: [PATCH] Support Psych v4.0.0
+
+Ruby master ships with Psych 4.0.0 which makes `YAML.load`
+defaults to safe mode (https://github.com/ruby/psych/pull/487).
+
+Keep compatibility by using `unsafe_load`.
+---
+ lib/settingslogic.rb | 7 ++++++-
+ 1 file changed, 6 insertions(+), 1 deletion(-)
+
+diff --git a/lib/settingslogic.rb b/lib/settingslogic.rb
+index a99acaf..e7ea37e 100644
+--- a/lib/settingslogic.rb
++++ b/lib/settingslogic.rb
+@@ -100,7 +100,12 @@ def initialize(hash_or_file = self.class.source, section = nil)
+ self.replace hash_or_file
+ else
+ file_contents = open(hash_or_file).read
+- hash = file_contents.empty? ? {} : YAML.load(ERB.new(file_contents).result).to_hash
++ hash = if file_contents.empty?
++ {}
++ else
++ payload = ERB.new(file_contents).result
++ (YAML.respond_to?(:unsafe_load) ? YAML.unsafe_load(payload) : YAML.load(payload)).to_hash
++ end
+ if self.class.namespace
+ hash = hash[self.class.namespace] or return missing_key("Missing setting '#{self.class.namespace}' in #{hash_or_file}")
+ end
diff --git a/dev-ruby/settingslogic/settingslogic-2.0.9-r2.ebuild b/dev-ruby/settingslogic/settingslogic-2.0.9-r2.ebuild
new file mode 100644
index 000000000000..5d2b70ee8217
--- /dev/null
+++ b/dev-ruby/settingslogic/settingslogic-2.0.9-r2.ebuild
@@ -0,0 +1,26 @@
+# Copyright 1999-2022 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+USE_RUBY="ruby26 ruby27"
+
+RUBY_FAKEGEM_TASK_DOC=""
+RUBY_FAKEGEM_EXTRADOC="README.rdoc"
+
+RUBY_FAKEGEM_RECIPE_TEST="rspec"
+
+inherit ruby-fakegem
+
+DESCRIPTION="A simple configuration / settings solution that uses an ERB enabled YAML file"
+HOMEPAGE="https://github.com/binarylogic/settingslogic"
+LICENSE="MIT"
+
+KEYWORDS="~amd64 ~x86"
+SLOT="0"
+IUSE=""
+
+PATCHES=( "${FILESDIR}/${P}-psych-4.patch" )
+
+all_ruby_prepare() {
+ sed -i -e '/check_dependencies/d' Rakefile || die
+}