mirror of
https://github.com/elastic/logstash.git
synced 2025-04-24 06:37:19 -04:00
- refactor agent so it compiles under jruby 1.6.1
This commit is contained in:
parent
39a3f00a6a
commit
e90f1b1107
1 changed files with 32 additions and 23 deletions
|
@ -1,28 +1,37 @@
|
|||
require "rubygems"
|
||||
require "logstash/namespace"
|
||||
|
||||
$: << File.join(File.dirname(__FILE__), "../")
|
||||
command = ARGV.shift
|
||||
class LogStash::Runner
|
||||
def self.main(args)
|
||||
$: << File.join(File.dirname(__FILE__), "../")
|
||||
command = args.shift
|
||||
|
||||
commands = {
|
||||
"agent" => proc do
|
||||
require "logstash/agent"
|
||||
agent = LogStash::Agent.new
|
||||
agent.argv = ARGV
|
||||
agent.run
|
||||
end,
|
||||
"web" => proc do
|
||||
require "logstash/web/server"
|
||||
end,
|
||||
"test" => proc do
|
||||
require "logstash_test_runner"
|
||||
end
|
||||
}
|
||||
commands = {
|
||||
"agent" => proc do
|
||||
require "logstash/agent"
|
||||
agent = LogStash::Agent.new
|
||||
agent.argv = args
|
||||
agent.run
|
||||
end,
|
||||
"web" => proc do
|
||||
require "logstash/web/server"
|
||||
end,
|
||||
"test" => proc do
|
||||
require "logstash_test_runner"
|
||||
end
|
||||
}
|
||||
|
||||
if commands.include?(command)
|
||||
commands[command].call
|
||||
else
|
||||
$stderr.puts "No such command #{command.inspect}"
|
||||
$stderr.puts "Available commands:"
|
||||
$stderr.puts commands.keys.map { |s| " #{s}" }.join("\n")
|
||||
exit 1
|
||||
if commands.include?(command)
|
||||
commands[command].call
|
||||
else
|
||||
$stderr.puts "No such command #{command.inspect}"
|
||||
$stderr.puts "Available commands:"
|
||||
$stderr.puts commands.keys.map { |s| " #{s}" }.join("\n")
|
||||
exit 1
|
||||
end
|
||||
end # def self.main
|
||||
end # class LogStash::Runner
|
||||
|
||||
if $0 == __FILE__
|
||||
LogStash::Runner.main(ARGV)
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue