[前][次][番号順一覧][スレッド一覧]

ruby-changes:71032

From: Charles <ko1@a...>
Date: Thu, 27 Jan 2022 17:16:22 +0900 (JST)
Subject: [ruby-changes:71032] f511ff3b3a (master): [ruby/yaml] Add JRuby-specific warning when psych fails

https://git.ruby-lang.org/ruby.git/commit/?id=f511ff3b3a

From f511ff3b3af4e70877538b911fde27c57792fc1d Mon Sep 17 00:00:00 2001
From: Charles Oliver Nutter <headius@h...>
Date: Wed, 26 Jan 2022 23:29:17 -0600
Subject: [ruby/yaml] Add JRuby-specific warning when psych fails

The error here is confusing for users because JRuby does not use
libyaml and installing it will not help. Instead, JRuby directs
them to a wiki page that describes an issue when multiple
conflicting versions of SnakeYAML are installed.

This change allows us to use the yaml gem and delete our local
sources.

https://github.com/ruby/yaml/commit/8122087ffb
---
 lib/yaml.rb | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/lib/yaml.rb b/lib/yaml.rb
index 17b27e802f9..6d5d5ebd4cf 100644
--- a/lib/yaml.rb
+++ b/lib/yaml.rb
@@ -3,9 +3,17 @@ https://github.com/ruby/ruby/blob/trunk/lib/yaml.rb#L3
 begin
   require 'psych'
 rescue LoadError
-  warn "It seems your ruby installation is missing psych (for YAML output).\n" \
-    "To eliminate this warning, please install libyaml and reinstall your ruby.\n",
-    uplevel: 1
+  case RUBY_ENGINE
+  when 'jruby'
+    warn "The Psych YAML extension failed to load.\n" \
+      "Check your env for conflicting versions of SnakeYAML\n" \
+      "See https://github.com/jruby/jruby/wiki/FAQs#why-does-the-psych-yaml-extension-fail-to-load-in-my-environment",
+         uplevel: 1
+  else
+    warn "It seems your ruby installation is missing psych (for YAML output).\n" \
+      "To eliminate this warning, please install libyaml and reinstall your ruby.\n",
+         uplevel: 1
+  end
   raise
 end
 
-- 
cgit v1.2.1


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]