diff --git a/lib/logstash/environment.rb b/lib/logstash/environment.rb index 0497ef60d..859eb71bc 100644 --- a/lib/logstash/environment.rb +++ b/lib/logstash/environment.rb @@ -39,6 +39,18 @@ module LogStash LOGSTASH_ENV end + def production? + env.downcase == "production" + end + + def development? + env.downcase == "development" + end + + def test? + env.downcase == "test" + 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 cb66bb4e2..f287324c0 100644 --- a/lib/logstash/pluginmanager/install.rb +++ b/lib/logstash/pluginmanager/install.rb @@ -56,7 +56,9 @@ class LogStash::PluginManager::Install < Clamp::Command FileDependencies::Gem.hook options = {} options[:document] = [] - if LogStash::Environment.env == 'test' + if LogStash::Environment.test? + # More info on what do this options means + # https://github.com/rubygems/rubygems/blob/master/lib/rubygems/dependency_installer.rb#L56 options[:dev_shallow] = true options[:development] = true end