logstash-core 1.5.0.rc2.snapshot-java → 1.5.0.rc3-java
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of logstash-core might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/lib/logstash/agent.rb +0 -8
- data/lib/logstash/bundler.rb +72 -26
- data/lib/logstash/config/config_ast.rb +62 -29
- data/lib/logstash/config/mixin.rb +1 -1
- data/lib/logstash/environment.rb +33 -75
- data/lib/logstash/event.rb +31 -20
- data/lib/logstash/filters/base.rb +1 -0
- data/lib/logstash/gemfile.rb +19 -1
- data/lib/logstash/java_integration.rb +72 -18
- data/lib/logstash/namespace.rb +0 -2
- data/lib/logstash/outputs/base.rb +1 -1
- data/lib/logstash/patches/bundler.rb +20 -0
- data/lib/logstash/patches/rubygems.rb +37 -0
- data/lib/logstash/pipeline.rb +59 -39
- data/lib/logstash/pluginmanager/command.rb +38 -0
- data/lib/logstash/pluginmanager/install.rb +103 -74
- data/lib/logstash/pluginmanager/list.rb +20 -17
- data/lib/logstash/pluginmanager/main.rb +0 -1
- data/lib/logstash/pluginmanager/uninstall.rb +13 -21
- data/lib/logstash/pluginmanager/update.rb +58 -39
- data/lib/logstash/pluginmanager/util.rb +3 -2
- data/lib/logstash/runner.rb +5 -3
- data/lib/logstash/util.rb +0 -1
- data/lib/logstash/util/accessors.rb +6 -0
- data/lib/logstash/version.rb +1 -1
- data/locales/en.yml +5 -0
- metadata +6 -60
- data/lib/logstash/pluginmanager/maven_tools_patch.rb +0 -12
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 33f2eca5fac0bd51fb51dcaa864f11e5dad12614
|
4
|
+
data.tar.gz: e16ce45358620cd81a1044b42f31744ac4106274
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6fed2572b9d8d055330b405efe6524c9a9cbc228b946bca904ec9967206d6c7753e8f6a08ac8a3b3cfce6ef1cb36c62a9d6d876ab551ba5b711b018343e5a96c
|
7
|
+
data.tar.gz: 88c502df536ec73769152280fac1172737db4c7b49bc1c081b2ed821b3f2b185472adf8185095d876e95e26f6108c13e6a8ad5df0f42bd3d8f3b3a970c34d729
|
data/lib/logstash/agent.rb
CHANGED
@@ -172,7 +172,6 @@ class LogStash::Agent < Clamp::Command
|
|
172
172
|
|
173
173
|
if RUBY_PLATFORM == "java"
|
174
174
|
show_version_java
|
175
|
-
show_version_elasticsearch
|
176
175
|
end
|
177
176
|
|
178
177
|
if [:debug].include?(verbosity?) || debug?
|
@@ -190,13 +189,6 @@ class LogStash::Agent < Clamp::Command
|
|
190
189
|
puts RUBY_DESCRIPTION
|
191
190
|
end # def show_version_ruby
|
192
191
|
|
193
|
-
def show_version_elasticsearch
|
194
|
-
LogStash::Environment.load_elasticsearch_jars!
|
195
|
-
|
196
|
-
$stdout.write("Elasticsearch: ");
|
197
|
-
org.elasticsearch.Version::main([])
|
198
|
-
end # def show_version_elasticsearch
|
199
|
-
|
200
192
|
def show_version_java
|
201
193
|
properties = java.lang.System.getProperties
|
202
194
|
puts "java #{properties["java.version"]} (#{properties["java.vendor"]})"
|
data/lib/logstash/bundler.rb
CHANGED
@@ -1,28 +1,55 @@
|
|
1
|
-
require "
|
2
|
-
require "bundler/cli"
|
3
|
-
|
4
|
-
module Bundler
|
5
|
-
# Patch bundler to write a .lock file specific to the version of ruby.
|
6
|
-
# This keeps MRI/JRuby/RBX from conflicting over the Gemfile.lock updates
|
7
|
-
module SharedHelpers
|
8
|
-
def default_lockfile
|
9
|
-
ruby = "#{LogStash::Environment.ruby_engine}-#{LogStash::Environment.ruby_abi_version}"
|
10
|
-
Pathname.new("#{default_gemfile}.#{ruby}.lock")
|
11
|
-
end
|
12
|
-
end
|
13
|
-
|
14
|
-
# Add the Bundler.reset! method which has been added in master but is not in 1.7.9.
|
15
|
-
class << self
|
16
|
-
unless self.method_defined?("reset!")
|
17
|
-
def reset!
|
18
|
-
@definition = nil
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|
22
|
-
end
|
1
|
+
require "logstash/environment"
|
23
2
|
|
24
3
|
module LogStash
|
25
4
|
module Bundler
|
5
|
+
# Take a gem package and extract it to a specific target
|
6
|
+
# @param [String] Gem file, this must be a path
|
7
|
+
# @param [String, String] Return a Gem::Package and the installed path
|
8
|
+
def self.unpack(file, path)
|
9
|
+
require "rubygems/package"
|
10
|
+
require "securerandom"
|
11
|
+
|
12
|
+
# We are creating a random directory per extract,
|
13
|
+
# if we dont do this bundler will not trigger download of the dependencies.
|
14
|
+
# Use case is:
|
15
|
+
# - User build his own gem with a fix
|
16
|
+
# - User doesnt increment the version
|
17
|
+
# - User install the same version but different code or dependencies multiple times..
|
18
|
+
basename = ::File.basename(file, '.gem')
|
19
|
+
unique = SecureRandom.hex(4)
|
20
|
+
target_path = ::File.expand_path(::File.join(path, unique, basename))
|
21
|
+
|
22
|
+
package = ::Gem::Package.new(file)
|
23
|
+
package.extract_files(target_path)
|
24
|
+
|
25
|
+
return [package, target_path]
|
26
|
+
end
|
27
|
+
|
28
|
+
def self.setup!(options = {})
|
29
|
+
options = {:without => [:development]}.merge(options)
|
30
|
+
options[:without] = Array(options[:without])
|
31
|
+
|
32
|
+
# make sure we use our own installed bundler
|
33
|
+
require "logstash/patches/rubygems" # patch rubygems before clear_paths
|
34
|
+
::Gem.clear_paths
|
35
|
+
::Gem.paths = ENV['GEM_HOME'] = ENV['GEM_PATH'] = LogStash::Environment.logstash_gem_home
|
36
|
+
|
37
|
+
# set BUNDLE_GEMFILE ENV before requiring bundler to avoid bundler recurse and load unrelated Gemfile(s)
|
38
|
+
ENV["BUNDLE_GEMFILE"] = LogStash::Environment::GEMFILE_PATH
|
39
|
+
|
40
|
+
require "bundler"
|
41
|
+
require "logstash/bundler"
|
42
|
+
require "logstash/patches/bundler"
|
43
|
+
|
44
|
+
::Bundler.settings[:path] = LogStash::Environment::BUNDLE_DIR
|
45
|
+
::Bundler.settings[:without] = options[:without].join(":")
|
46
|
+
# in the context of Bundler.setup it looks like this is useless here because Gemfile path can only be specified using
|
47
|
+
# the ENV, see https://github.com/bundler/bundler/blob/v1.8.3/lib/bundler/shared_helpers.rb#L103
|
48
|
+
::Bundler.settings[:gemfile] = LogStash::Environment::GEMFILE_PATH
|
49
|
+
|
50
|
+
::Bundler.reset!
|
51
|
+
::Bundler.setup
|
52
|
+
end
|
26
53
|
|
27
54
|
# capture any $stdout from the passed block. also trap any exception in that block, in which case the trapped exception will be returned
|
28
55
|
# @param [Proc] the code block to execute
|
@@ -51,7 +78,22 @@ module LogStash
|
|
51
78
|
options[:without] = Array(options[:without])
|
52
79
|
options[:update] = Array(options[:update]) if options[:update]
|
53
80
|
|
54
|
-
|
81
|
+
# make sure we use our own installed bundler
|
82
|
+
require "logstash/patches/rubygems" # patch rubygems before clear_paths
|
83
|
+
::Gem.clear_paths
|
84
|
+
::Gem.paths = ENV['GEM_HOME'] = ENV['GEM_PATH'] = LogStash::Environment.logstash_gem_home
|
85
|
+
|
86
|
+
# set BUNDLE_GEMFILE ENV before requiring bundler to avoid bundler recurse and load unrelated Gemfile(s).
|
87
|
+
# in the context of calling Bundler::CLI this is not really required since Bundler::CLI will look at
|
88
|
+
# Bundler.settings[:gemfile] unlike Bundler.setup. For the sake of consistency and defensive/future proofing, let's keep it here.
|
89
|
+
ENV["BUNDLE_GEMFILE"] = LogStash::Environment::GEMFILE_PATH
|
90
|
+
|
91
|
+
require "bundler"
|
92
|
+
require "bundler/cli"
|
93
|
+
require "logstash/patches/bundler"
|
94
|
+
|
95
|
+
# force Rubygems sources to our Gemfile sources
|
96
|
+
::Gem.sources = options[:rubygems_source] if options[:rubygems_source]
|
55
97
|
|
56
98
|
::Bundler.settings[:path] = LogStash::Environment::BUNDLE_DIR
|
57
99
|
::Bundler.settings[:gemfile] = LogStash::Environment::GEMFILE_PATH
|
@@ -60,7 +102,7 @@ module LogStash
|
|
60
102
|
try = 0
|
61
103
|
|
62
104
|
# capture_stdout also traps any raised exception and pass them back as the function return [output, exception]
|
63
|
-
capture_stdout do
|
105
|
+
output, exception = capture_stdout do
|
64
106
|
loop do
|
65
107
|
begin
|
66
108
|
::Bundler.reset!
|
@@ -81,11 +123,15 @@ module LogStash
|
|
81
123
|
|
82
124
|
try += 1
|
83
125
|
$stderr.puts("Error #{e.class}, retrying #{try}/#{options[:max_tries]}")
|
84
|
-
$stderr.puts(e.message)
|
126
|
+
$stderr.puts(e.message)
|
85
127
|
sleep(0.5)
|
86
128
|
end
|
87
129
|
end
|
88
130
|
end
|
131
|
+
|
132
|
+
raise exception if exception
|
133
|
+
|
134
|
+
return output
|
89
135
|
end
|
90
136
|
|
91
137
|
# build Bundler::CLI.start arguments array from the given options hash
|
@@ -107,4 +153,4 @@ module LogStash
|
|
107
153
|
arguments.flatten
|
108
154
|
end
|
109
155
|
end
|
110
|
-
end
|
156
|
+
end
|
@@ -1,7 +1,9 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
require 'logstash/errors'
|
3
3
|
require "treetop"
|
4
|
+
|
4
5
|
class Treetop::Runtime::SyntaxNode
|
6
|
+
|
5
7
|
def compile
|
6
8
|
return "" if elements.nil?
|
7
9
|
return elements.collect(&:compile).reject(&:empty?).join("")
|
@@ -55,11 +57,31 @@ class Treetop::Runtime::SyntaxNode
|
|
55
57
|
end
|
56
58
|
end
|
57
59
|
|
60
|
+
|
58
61
|
module LogStash; module Config; module AST
|
62
|
+
|
63
|
+
def self.defered_conditionals=(val)
|
64
|
+
@defered_conditionals = val
|
65
|
+
end
|
66
|
+
|
67
|
+
def self.defered_conditionals
|
68
|
+
@defered_conditionals
|
69
|
+
end
|
70
|
+
|
71
|
+
def self.defered_conditionals_index
|
72
|
+
@defered_conditionals_index
|
73
|
+
end
|
74
|
+
|
75
|
+
def self.defered_conditionals_index=(val)
|
76
|
+
@defered_conditionals_index = val
|
77
|
+
end
|
78
|
+
|
59
79
|
class Node < Treetop::Runtime::SyntaxNode; end
|
60
80
|
|
61
81
|
class Config < Node
|
62
82
|
def compile
|
83
|
+
LogStash::Config::AST.defered_conditionals = []
|
84
|
+
LogStash::Config::AST.defered_conditionals_index = 0
|
63
85
|
code = []
|
64
86
|
|
65
87
|
code << <<-CODE
|
@@ -81,20 +103,22 @@ module LogStash; module Config; module AST
|
|
81
103
|
["filter", "output"].each do |type|
|
82
104
|
# defines @filter_func and @output_func
|
83
105
|
|
84
|
-
definitions << "
|
85
|
-
definitions << " events = [event]"
|
106
|
+
definitions << "def #{type}_func(event)"
|
107
|
+
definitions << " events = [event]" if type == "filter"
|
86
108
|
definitions << " @logger.debug? && @logger.debug(\"#{type} received\", :event => event.to_hash)"
|
109
|
+
|
87
110
|
sections.select { |s| s.plugin_type.text_value == type }.each do |s|
|
88
111
|
definitions << s.compile.split("\n", -1).map { |e| " #{e}" }
|
89
112
|
end
|
90
113
|
|
91
|
-
if type == "filter"
|
92
|
-
definitions << " events.flatten.each{|e| block.call(e) }"
|
93
|
-
end
|
114
|
+
definitions << " events" if type == "filter"
|
94
115
|
definitions << "end"
|
95
116
|
end
|
96
117
|
|
97
118
|
code += definitions.join("\n").split("\n", -1).collect { |l| " #{l}" }
|
119
|
+
|
120
|
+
code += LogStash::Config::AST.defered_conditionals
|
121
|
+
|
98
122
|
return code.join("\n")
|
99
123
|
end
|
100
124
|
end
|
@@ -125,20 +149,15 @@ module LogStash; module Config; module AST
|
|
125
149
|
#{name}_flush = lambda do |options, &block|
|
126
150
|
@logger.debug? && @logger.debug(\"Flushing\", :plugin => #{name})
|
127
151
|
|
128
|
-
|
152
|
+
events = #{name}.flush(options)
|
129
153
|
|
130
|
-
return if
|
154
|
+
return if events.nil? || events.empty?
|
131
155
|
|
132
|
-
|
133
|
-
@logger.debug? && @logger.debug(\"Flushing\", :plugin => #{name}, :event => event)
|
156
|
+
@logger.debug? && @logger.debug(\"Flushing\", :plugin => #{name}, :events => events)
|
134
157
|
|
135
|
-
|
136
|
-
#{plugin.compile_starting_here.gsub(/^/, " ")}
|
137
|
-
|
138
|
-
block.call(event)
|
139
|
-
events.flatten.each{|e| block.call(e) if e != event}
|
140
|
-
end
|
158
|
+
#{plugin.compile_starting_here.gsub(/^/, " ")}
|
141
159
|
|
160
|
+
events.each{|e| block.call(e)}
|
142
161
|
end
|
143
162
|
|
144
163
|
if #{name}.respond_to?(:flush)
|
@@ -211,13 +230,7 @@ module LogStash; module Config; module AST
|
|
211
230
|
return "start_input(#{variable_name})"
|
212
231
|
when "filter"
|
213
232
|
return <<-CODE
|
214
|
-
|
215
|
-
next [] if event.cancelled?
|
216
|
-
|
217
|
-
new_events = []
|
218
|
-
#{variable_name}.filter(event){|new_event| new_events << new_event}
|
219
|
-
event.cancelled? ? new_events : new_events.unshift(event)
|
220
|
-
end
|
233
|
+
#{variable_name}.filter(event) {|new_event| events << new_event }
|
221
234
|
CODE
|
222
235
|
when "output"
|
223
236
|
return "#{variable_name}.handle(event)\n"
|
@@ -287,7 +300,7 @@ module LogStash; module Config; module AST
|
|
287
300
|
|
288
301
|
module Unicode
|
289
302
|
def self.wrap(text)
|
290
|
-
return "(" + text.
|
303
|
+
return "(" + text.force_encoding(Encoding::UTF_8).inspect + ")"
|
291
304
|
end
|
292
305
|
end
|
293
306
|
|
@@ -364,18 +377,38 @@ module LogStash; module Config; module AST
|
|
364
377
|
# at the end, events is returned to handle the case where no branch match and no branch code is executed
|
365
378
|
# so we must make sure to return the current event.
|
366
379
|
|
367
|
-
|
368
|
-
|
369
|
-
|
380
|
+
type = recursive_select_parent(PluginSection).first.plugin_type.text_value
|
381
|
+
|
382
|
+
if type == "filter"
|
383
|
+
i = LogStash::Config::AST.defered_conditionals_index += 1
|
384
|
+
source = <<-CODE
|
385
|
+
def cond_func_#{i}(input_events)
|
386
|
+
result = []
|
387
|
+
input_events.each do |event|
|
388
|
+
events = [event]
|
389
|
+
#{super}
|
390
|
+
end
|
391
|
+
result += events
|
392
|
+
end
|
393
|
+
result
|
394
|
+
end
|
395
|
+
CODE
|
396
|
+
LogStash::Config::AST.defered_conditionals << source
|
397
|
+
|
398
|
+
<<-CODE
|
399
|
+
events = cond_func_#{i}(events)
|
400
|
+
CODE
|
401
|
+
else
|
402
|
+
<<-CODE
|
370
403
|
#{super}
|
371
404
|
end
|
372
|
-
|
373
|
-
|
374
|
-
CODE
|
405
|
+
CODE
|
406
|
+
end
|
375
407
|
end
|
376
408
|
end
|
377
409
|
|
378
410
|
class BranchEntry < Node; end
|
411
|
+
|
379
412
|
class If < BranchEntry
|
380
413
|
def compile
|
381
414
|
children = recursive_inject { |e| e.is_a?(Branch) || e.is_a?(Plugin) }
|
@@ -472,7 +472,7 @@ module LogStash::Config::Mixin
|
|
472
472
|
bytes = Integer(value.first) rescue nil
|
473
473
|
result = bytes || Filesize.from(value.first).to_i
|
474
474
|
rescue ArgumentError
|
475
|
-
return false, "Unparseable filesize: #{value.first}. possible units (KiB, MiB, ...) e.g. '10 KiB'. doc reference: http://www.
|
475
|
+
return false, "Unparseable filesize: #{value.first}. possible units (KiB, MiB, ...) e.g. '10 KiB'. doc reference: http://www.elastic.co/guide/en/logstash/current/configuration.html#bytes"
|
476
476
|
end
|
477
477
|
else
|
478
478
|
return false, "Unknown validator symbol #{validator}"
|
data/lib/logstash/environment.rb
CHANGED
@@ -1,75 +1,19 @@
|
|
1
1
|
require "logstash/errors"
|
2
|
-
require
|
3
|
-
|
4
|
-
# monkey patch RubyGems to silence ffi warnings:
|
5
|
-
#
|
6
|
-
# WARN: Unresolved specs during Gem::Specification.reset:
|
7
|
-
# ffi (>= 0)
|
8
|
-
# WARN: Clearing out unresolved specs.
|
9
|
-
# Please report a bug if this causes problems.
|
10
|
-
#
|
11
|
-
# see https://github.com/elasticsearch/logstash/issues/2556 and https://github.com/rubygems/rubygems/issues/1070
|
12
|
-
#
|
13
|
-
# 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.
|
14
|
-
|
15
|
-
# this method implementation works for Rubygems version 2.1.0 and up, verified up to 2.4.6
|
16
|
-
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new("2.1.0") && Gem::Version.new(Gem::VERSION) < Gem::Version.new("2.5.0")
|
17
|
-
class Gem::Specification
|
18
|
-
def self.reset
|
19
|
-
@@dirs = nil
|
20
|
-
Gem.pre_reset_hooks.each { |hook| hook.call }
|
21
|
-
@@all = nil
|
22
|
-
@@stubs = nil
|
23
|
-
_clear_load_cache
|
24
|
-
unresolved = unresolved_deps
|
25
|
-
unless unresolved.empty?
|
26
|
-
unless (unresolved.size == 1 && unresolved["ffi"])
|
27
|
-
w = "W" + "ARN"
|
28
|
-
warn "#{w}: Unresolved specs during Gem::Specification.reset:"
|
29
|
-
unresolved.values.each do |dep|
|
30
|
-
warn " #{dep}"
|
31
|
-
end
|
32
|
-
warn "#{w}: Clearing out unresolved specs."
|
33
|
-
warn "Please report a bug if this causes problems."
|
34
|
-
end
|
35
|
-
unresolved.clear
|
36
|
-
end
|
37
|
-
Gem.post_reset_hooks.each { |hook| hook.call }
|
38
|
-
end
|
39
|
-
end
|
40
|
-
end
|
2
|
+
require "logstash/version"
|
41
3
|
|
42
4
|
module LogStash
|
43
5
|
module Environment
|
44
6
|
extend self
|
45
7
|
|
46
8
|
LOGSTASH_HOME = ::File.expand_path(::File.join(::File.dirname(__FILE__), "..", ".."))
|
47
|
-
JAR_DIR = ::File.join(LOGSTASH_HOME, "vendor", "jar")
|
48
|
-
ELASTICSEARCH_DIR = ::File.join(LOGSTASH_HOME, "vendor", "elasticsearch")
|
49
9
|
BUNDLE_DIR = ::File.join(LOGSTASH_HOME, "vendor", "bundle")
|
50
10
|
GEMFILE_PATH = ::File.join(LOGSTASH_HOME, "Gemfile")
|
51
11
|
BUNDLE_CONFIG_PATH = ::File.join(LOGSTASH_HOME, ".bundle", "config")
|
52
12
|
BOOTSTRAP_GEM_PATH = ::File.join(LOGSTASH_HOME, 'build', 'bootstrap')
|
13
|
+
LOCAL_GEM_PATH = ::File.join(LOGSTASH_HOME, 'vendor', 'local_gems')
|
53
14
|
|
54
15
|
LOGSTASH_ENV = (ENV["LS_ENV"] || 'production').to_s.freeze
|
55
16
|
|
56
|
-
# loads currently embedded elasticsearch jars
|
57
|
-
# @raise LogStash::EnvironmentError if not running under JRuby or if no jar files are found
|
58
|
-
def load_elasticsearch_jars!
|
59
|
-
raise(LogStash::EnvironmentError, "JRuby is required") unless jruby?
|
60
|
-
|
61
|
-
require "java"
|
62
|
-
jars_path = ::File.join(ELASTICSEARCH_DIR, "**", "*.jar")
|
63
|
-
jar_files = Dir.glob(jars_path)
|
64
|
-
|
65
|
-
raise(LogStash::EnvironmentError, "Could not find Elasticsearch jar files under #{ELASTICSEARCH_DIR}") if jar_files.empty?
|
66
|
-
|
67
|
-
jar_files.each do |jar|
|
68
|
-
loaded = require jar
|
69
|
-
puts("Loaded #{jar}") if $DEBUG && loaded
|
70
|
-
end
|
71
|
-
end
|
72
|
-
|
73
17
|
def logstash_gem_home
|
74
18
|
::File.join(BUNDLE_DIR, ruby_engine, gem_ruby_version)
|
75
19
|
end
|
@@ -90,27 +34,41 @@ module LogStash
|
|
90
34
|
env.downcase == "test"
|
91
35
|
end
|
92
36
|
|
93
|
-
def
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
::
|
37
|
+
def runtime_jars_root(dir_name, package)
|
38
|
+
::File.join(dir_name, package, "runtime-jars")
|
39
|
+
end
|
40
|
+
|
41
|
+
def test_jars_root(dir_name, package)
|
42
|
+
::File.join(dir_name, package, "test-jars")
|
43
|
+
end
|
44
|
+
|
45
|
+
def load_runtime_jars!(dir_name="vendor", package="jar-dependencies")
|
46
|
+
load_jars!(::File.join(runtime_jars_root(dir_name, package), "*.jar"))
|
47
|
+
end
|
99
48
|
|
100
|
-
|
101
|
-
|
49
|
+
def load_test_jars!(dir_name="vendor", package="jar-dependencies")
|
50
|
+
load_jars!(::File.join(test_jars_root(dir_name, package), "*.jar"))
|
51
|
+
end
|
102
52
|
|
103
|
-
|
104
|
-
|
53
|
+
def load_jars!(pattern)
|
54
|
+
raise(LogStash::EnvironmentError, I18n.t("logstash.environment.jruby-required")) unless LogStash::Environment.jruby?
|
105
55
|
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
# the ENV, see https://github.com/bundler/bundler/blob/v1.8.3/lib/bundler/shared_helpers.rb#L103
|
110
|
-
::Bundler.settings[:gemfile] = LogStash::Environment::GEMFILE_PATH
|
56
|
+
jar_files = find_jars(pattern)
|
57
|
+
require_jars! jar_files
|
58
|
+
end
|
111
59
|
|
112
|
-
|
113
|
-
|
60
|
+
def find_jars(pattern)
|
61
|
+
require 'java'
|
62
|
+
jar_files = Dir.glob(pattern)
|
63
|
+
raise(LogStash::EnvironmentError, I18n.t("logstash.environment.missing-jars", :pattern => pattern)) if jar_files.empty?
|
64
|
+
jar_files
|
65
|
+
end
|
66
|
+
|
67
|
+
def require_jars!(files)
|
68
|
+
files.each do |jar_file|
|
69
|
+
loaded = require jar_file
|
70
|
+
puts("Loaded #{jar_file}") if $DEBUG && loaded
|
71
|
+
end
|
114
72
|
end
|
115
73
|
|
116
74
|
def ruby_bin
|