updated the plugin manager install process to request to install the plugin development dependencies whenever an env variable is properly set to test, like this we can run test from logstash if necessary

renamed the LOGSTASH_ENV var to follow the LS_ENV standard

Fixes #2356
This commit is contained in:
Pere Urbon-Bayes 2015-01-14 16:13:05 +01:00 committed by Jordan Sissel
parent c8d78f5fb3
commit 1a2cc347b4
2 changed files with 10 additions and 0 deletions

View file

@ -12,6 +12,8 @@ module LogStash
GEMFILE_PATH = ::File.join(LOGSTASH_HOME, "tools", "Gemfile")
BOOTSTRAP_GEM_PATH = ::File.join(LOGSTASH_HOME, 'build', 'bootstrap')
LOGSTASH_ENV = (ENV["LS_ENV"] || 'production').to_s.freeze
# loads currently embedded elasticsearch jars
# @raise LogStash::EnvironmentError if not running under JRuby or if no jar files are found
def load_elasticsearch_jars!
@ -33,6 +35,10 @@ module LogStash
::File.join(BUNDLE_DIR, ruby_engine, gem_ruby_version)
end
def env
LOGSTASH_ENV
end
# set GEM_PATH for logstash runtime
# GEM_PATH should include the logstash gems, the plugin gems and the bootstrap gems.
# the bootstrap gems are required specificly for bundler which is a runtime dependency

View file

@ -56,6 +56,10 @@ class LogStash::PluginManager::Install < Clamp::Command
FileDependencies::Gem.hook
options = {}
options[:document] = []
if LogStash::Environment.env == 'test'
options[:dev_shallow] = true
options[:development] = true
end
inst = Gem::DependencyInstaller.new(options)
inst.install plugin, version
specs = inst.installed_gems.detect { |gemspec| gemspec.name == gem_meta.name }