mirror of
https://github.com/elastic/logstash.git
synced 2025-04-25 07:07:54 -04:00
parent
b376d913bd
commit
4edbf5d32b
2 changed files with 8 additions and 31 deletions
|
@ -18,16 +18,6 @@ module Bundler
|
||||||
@definition = nil
|
@definition = nil
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def reset_settings
|
|
||||||
# reset!
|
|
||||||
# clear_gemspec_cache
|
|
||||||
|
|
||||||
# remove_instance_variable(:@setup) if defined?(@setup)
|
|
||||||
# remove_instance_variable(:@locked_gems) if defined?(@locked_gems)
|
|
||||||
# remove_instance_variable(:@load) if defined?(@load)
|
|
||||||
remove_instance_variable(:@settings) if defined?(@settings)
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -62,9 +52,10 @@ module LogStash
|
||||||
options[:update] = Array(options[:update]) if options[:update]
|
options[:update] = Array(options[:update]) if options[:update]
|
||||||
|
|
||||||
ENV["GEM_PATH"] = LogStash::Environment.logstash_gem_home
|
ENV["GEM_PATH"] = LogStash::Environment.logstash_gem_home
|
||||||
ENV["BUNDLE_PATH"] = LogStash::Environment::BUNDLE_DIR
|
|
||||||
ENV["BUNDLE_GEMFILE"] = LogStash::Environment::GEMFILE_PATH
|
::Bundler.settings[:path] = LogStash::Environment::BUNDLE_DIR
|
||||||
ENV["BUNDLE_WITHOUT"] = options[:without].join(":")
|
::Bundler.settings[:gemfile] = LogStash::Environment::GEMFILE_PATH
|
||||||
|
::Bundler.settings[:without] = options[:without].join(":")
|
||||||
|
|
||||||
try = 0
|
try = 0
|
||||||
|
|
||||||
|
@ -105,13 +96,7 @@ module LogStash
|
||||||
|
|
||||||
if options[:install]
|
if options[:install]
|
||||||
arguments << "install"
|
arguments << "install"
|
||||||
arguments << "--gemfile=#{LogStash::Environment::GEMFILE_PATH}"
|
elsif options[:update]
|
||||||
arguments << ["--path", LogStash::Environment::BUNDLE_DIR]
|
|
||||||
# note that generating "--without=" when options[:without] is empty is intended
|
|
||||||
arguments << "--without=#{options[:without].join(' ')}"
|
|
||||||
end
|
|
||||||
|
|
||||||
if options[:update]
|
|
||||||
arguments << "update"
|
arguments << "update"
|
||||||
arguments << options[:update]
|
arguments << options[:update]
|
||||||
end
|
end
|
||||||
|
|
|
@ -91,23 +91,15 @@ module LogStash
|
||||||
end
|
end
|
||||||
|
|
||||||
def bundler_setup!
|
def bundler_setup!
|
||||||
# if there's no .bundle/config setup the runtime environment.
|
|
||||||
unless ::File.exists?(BUNDLE_CONFIG_PATH)
|
|
||||||
ENV["BUNDLE_PATH"] = LogStash::Environment::BUNDLE_DIR
|
|
||||||
ENV["BUNDLE_WITHOUT"] = "development"
|
|
||||||
end
|
|
||||||
# force BUNDLE_GEMFILE since Bundler does not store it in its ./bundle/config. this is required otherwise Bundler will look for the Gemfile in the CWD
|
|
||||||
# and will crash when invoking logstash outside its home dir.
|
|
||||||
ENV["BUNDLE_GEMFILE"] = LogStash::Environment::GEMFILE_PATH
|
|
||||||
|
|
||||||
# make sure we use our own nicely installed bundler and not a rogue, bad, mean, ugly, stupid other bundler. bad bundler, bad bad bundler go away.
|
# make sure we use our own nicely installed bundler and not a rogue, bad, mean, ugly, stupid other bundler. bad bundler, bad bad bundler go away.
|
||||||
Gem.clear_paths
|
Gem.clear_paths
|
||||||
Gem.paths = ENV['GEM_HOME'] = ENV['GEM_PATH'] = logstash_gem_home
|
Gem.paths = ENV['GEM_HOME'] = ENV['GEM_PATH'] = logstash_gem_home
|
||||||
require "bundler"
|
require "bundler"
|
||||||
|
|
||||||
require "logstash/bundler"
|
require "logstash/bundler"
|
||||||
|
|
||||||
::Bundler.reset_settings # our monkey patched method
|
::Bundler.settings[:path] = LogStash::Environment::BUNDLE_DIR
|
||||||
|
::Bundler.settings[:gemfile] = LogStash::Environment::GEMFILE_PATH
|
||||||
|
::Bundler.settings[:without] = "development"
|
||||||
::Bundler.reset!
|
::Bundler.reset!
|
||||||
::Bundler.setup
|
::Bundler.setup
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue