set correct env in bootstrap to avoid dup gems

Fixes #2171
This commit is contained in:
Joao Duarte 2014-12-04 11:28:16 +00:00 committed by Jordan Sissel
parent 04d6a51261
commit 14d8ba1693

View file

@ -238,9 +238,19 @@ namespace "vendor" do
else else
# Use the vendored jruby binary # Use the vendored jruby binary
jruby = File.join("vendor", "jruby", "bin", "jruby") jruby = File.join("vendor", "jruby", "bin", "jruby")
bundler = File.join("build", "bootstrap", "bin", "bundle")
end end
cmd = [jruby, bundler, "install", "--gemfile=tools/Gemfile", "--path", LogStash::Environment::BUNDLE_DIR, "--standalone", "--clean", "--without", "development", "--jobs", "4"] backup_gem_home = ENV['GEM_HOME']
backup_gem_path = ENV['GEM_PATH']
ENV['GEM_HOME'] = LogStash::Environment.gem_home
ENV['GEM_PATH'] = [
::File.join(LogStash::Environment::LOGSTASH_HOME, 'build/bootstrap'),
::File.join(LogStash::Environment::LOGSTASH_HOME, 'vendor/jruby/lib/ruby/gems/shared')
].join(":")
cmd = [jruby, "-S", bundler, "install", "--gemfile=tools/Gemfile"]
system(*cmd) system(*cmd)
ENV['GEM_HOME'] = backup_gem_home
ENV['GEM_PATH'] = backup_gem_path
raise RuntimeError, $!.to_s unless $?.success? raise RuntimeError, $!.to_s unless $?.success?
break break
rescue Gem::RemoteFetcher::FetchError => e rescue Gem::RemoteFetcher::FetchError => e