Skip to content

Commit 8122087

Browse files
committed
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.
1 parent ad5c4b4 commit 8122087

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

lib/yaml.rb

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,17 @@
33
begin
44
require 'psych'
55
rescue LoadError
6-
warn "It seems your ruby installation is missing psych (for YAML output).\n" \
7-
"To eliminate this warning, please install libyaml and reinstall your ruby.\n",
8-
uplevel: 1
6+
case RUBY_ENGINE
7+
when 'jruby'
8+
warn "The Psych YAML extension failed to load.\n" \
9+
"Check your env for conflicting versions of SnakeYAML\n" \
10+
"See https://github.com/jruby/jruby/wiki/FAQs#why-does-the-psych-yaml-extension-fail-to-load-in-my-environment",
11+
uplevel: 1
12+
else
13+
warn "It seems your ruby installation is missing psych (for YAML output).\n" \
14+
"To eliminate this warning, please install libyaml and reinstall your ruby.\n",
15+
uplevel: 1
16+
end
917
raise
1018
end
1119

0 commit comments

Comments
 (0)