Don't make rexml an dependency of activesupport

rexml is only used in the xml_mini backend and it should be the users
choice if they want to use that feature or not. If they do we will warn
them that installing rexml is needed like we do with all backends.
This commit is contained in:
Rafael Mendonça França 2020-09-24 22:41:04 +00:00
parent 357013d366
commit f624ed09ab
No known key found for this signature in database
GPG Key ID: FC23B6D0F1EEE948
4 changed files with 11 additions and 3 deletions

@ -48,6 +48,7 @@ gem "dalli"
gem "listen", "~> 3.2", require: false, github: "guard/listen"
gem "libxml-ruby", platforms: :ruby
gem "connection_pool", require: false
gem "rexml", require: false
# for railties app_generator_test
gem "bootsnap", ">= 1.4.4", require: false

@ -95,7 +95,6 @@ PATH
concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (>= 1.6, < 2)
minitest (>= 5.1)
rexml
tzinfo (~> 2.0)
zeitwerk (~> 2.3)
rails (6.1.0.alpha)
@ -607,6 +606,7 @@ DEPENDENCIES
redis-namespace!
resque
resque-scheduler
rexml
rouge
rubocop (>= 0.90)
rubocop-packaging

@ -38,5 +38,4 @@
s.add_dependency "concurrent-ruby", "~> 1.0", ">= 1.0.2"
s.add_dependency "zeitwerk", "~> 2.3"
s.add_dependency "minitest", ">= 5.1"
s.add_dependency "rexml"
end

@ -25,7 +25,7 @@ def parse(data)
if data.eof?
{}
else
silence_warnings { require "rexml/document" } unless defined?(REXML::Document)
require_rexml unless defined?(REXML::Document)
doc = REXML::Document.new(data)
if doc.root
@ -38,6 +38,14 @@ def parse(data)
end
private
def require_rexml
silence_warnings { require "rexml/document" }
rescue LoadError => e
$stderr.puts "You don't have rexml installed in your application. Please add it to your Gemfile and run bundle install"
raise e
end
# Convert an XML element and merge into the hash
#
# hash::