verify Rubygems versions before monkeypatching

Fixes #2684
This commit is contained in:
Colin Surprenant 2015-02-24 18:45:21 -05:00 committed by Jordan Sissel
parent 5e9644b7a5
commit d805cc76aa

View file

@ -11,6 +11,9 @@ require 'logstash/version'
# see https://github.com/elasticsearch/logstash/issues/2556 and https://github.com/rubygems/rubygems/issues/1070
#
# this code is from Rubygems v2.1.9 in JRuby 1.7.17. Per tickets this issue should be solved at JRuby >= 1.7.20.
# this method implementation works for Rubygems version 2.1.0 and up, verified up to 2.4.6
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new("2.1.0") && Gem::Version.new(Gem::VERSION) < Gem::Version.new("2.5.0")
class Gem::Specification
def self.reset
@@dirs = nil
@ -34,6 +37,7 @@ class Gem::Specification
Gem.post_reset_hooks.each { |hook| hook.call }
end
end
end
module LogStash
module Environment