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 }