From 1a2cc347b457c1c8de59c8177e37995391bca894 Mon Sep 17 00:00:00 2001 From: Pere Urbon-Bayes Date: Wed, 14 Jan 2015 16:13:05 +0100 Subject: [PATCH] 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 --- lib/logstash/environment.rb | 6 ++++++ lib/logstash/pluginmanager/install.rb | 4 ++++ 2 files changed, 10 insertions(+) diff --git a/lib/logstash/environment.rb b/lib/logstash/environment.rb index f59ae2bc8..0497ef60d 100644 --- a/lib/logstash/environment.rb +++ b/lib/logstash/environment.rb @@ -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 diff --git a/lib/logstash/pluginmanager/install.rb b/lib/logstash/pluginmanager/install.rb index 5d5797a8c..cb66bb4e2 100644 --- a/lib/logstash/pluginmanager/install.rb +++ b/lib/logstash/pluginmanager/install.rb @@ -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 }