add a way to handle env checks using method names

cleanup the method missing magic for enviroment test

ammend space

add a comment to the variable place

Fixes #2356
This commit is contained in:
Pere Urbon-Bayes 2015-01-15 09:59:50 +01:00 committed by Jordan Sissel
parent 1a2cc347b4
commit 6ca6189c74
2 changed files with 15 additions and 1 deletions

View file

@ -39,6 +39,18 @@ module LogStash
LOGSTASH_ENV LOGSTASH_ENV
end 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 # set GEM_PATH for logstash runtime
# GEM_PATH should include the logstash gems, the plugin gems and the bootstrap gems. # 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 # the bootstrap gems are required specificly for bundler which is a runtime dependency

View file

@ -56,7 +56,9 @@ class LogStash::PluginManager::Install < Clamp::Command
FileDependencies::Gem.hook FileDependencies::Gem.hook
options = {} options = {}
options[:document] = [] 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[:dev_shallow] = true
options[:development] = true options[:development] = true
end end