Move logstash gemspec loading into environment module

Previously the loading of the logstash gemspec was limited to the plugin manager
After more tests we need the gemspec to be loaded for any action with the plugins
Moving it to the environment module makes it available for more generic loading

Make sure plugin manager uses new function for loading gemspec
This commit is contained in:
Richard Pijnenburg 2014-09-10 13:43:57 +00:00 committed by Joao Duarte
parent d65706ded4
commit 9398cd65a1
5 changed files with 22 additions and 19 deletions

View file

@ -1,4 +1,5 @@
require "logstash/errors"
require 'logstash/version'
module LogStash
module Environment
@ -68,5 +69,22 @@ module LogStash
def locales_path(path)
return ::File.join(LOGSTASH_HOME, "locales", path)
end
def load_logstash_gemspec!
logstash_spec = Gem::Specification.new do |gem|
gem.authors = ["Jordan Sissel", "Pete Fritchman"]
gem.email = ["jls@semicomplete.com", "petef@databits.net"]
gem.description = %q{scalable log and event management (search, archive, pipeline)}
gem.summary = %q{logstash - log and event management}
gem.homepage = "http://logstash.net/"
gem.license = "Apache License (2.0)"
gem.name = "logstash"
gem.version = LOGSTASH_VERSION
end
Gem::Specification.add_spec logstash_spec
end
end
end

View file

@ -1,5 +1,6 @@
require 'clamp'
require 'logstash/namespace'
require 'logstash/environment'
require 'logstash/pluginmanager'
require 'logstash/pluginmanager/util'
require 'rubygems/dependency_installer'
@ -16,7 +17,7 @@ class LogStash::PluginManager::Install < Clamp::Command
option "--proxy", "PROXY", "Use HTTP proxy for remote operations"
def execute
LogStash::PluginManager::Util.load_logstash_gemspec
LogStash::Environment.load_logstash_gemspec!
::Gem.configuration.verbose = false
::Gem.configuration[:http_proxy] = proxy

View file

@ -17,7 +17,7 @@ class LogStash::PluginManager::Update < Clamp::Command
def execute
LogStash::PluginManager::Util.load_logstash_gemspec
LogStash::Environment.load_logstash_gemspec!
::Gem.configuration.verbose = false
::Gem.configuration[:http_proxy] = proxy

View file

@ -1,4 +1,3 @@
require 'logstash/version'
class LogStash::PluginManager::Util
@ -50,20 +49,4 @@ class LogStash::PluginManager::Util
end
end
def self.load_logstash_gemspec
logstash_spec = Gem::Specification.new do |gem|
gem.authors = ["Jordan Sissel", "Pete Fritchman"]
gem.email = ["jls@semicomplete.com", "petef@databits.net"]
gem.description = %q{scalable log and event management (search, archive, pipeline)}
gem.summary = %q{logstash - log and event management}
gem.homepage = "http://logstash.net/"
gem.license = "Apache License (2.0)"
gem.name = "logstash"
gem.version = LOGSTASH_VERSION
end
Gem::Specification.add_spec logstash_spec
end
end

View file

@ -6,6 +6,7 @@ $DEBUGLIST = (ENV["DEBUG"] || "").split(",")
require "logstash/environment"
LogStash::Environment.set_gem_paths!
LogStash::Environment.load_logstash_gemspec!
Thread.abort_on_exception = true
if ENV["PROFILE_BAD_LOG_CALLS"] || $DEBUGLIST.include?("log")