reinstate standalone flag and remove .bundle in vendor task

Fixes #2184
This commit is contained in:
Joao Duarte 2014-12-05 12:24:59 +00:00 committed by Jordan Sissel
parent c0e91ce044
commit d6beaccc0c
2 changed files with 20 additions and 8 deletions

View file

@ -21,7 +21,7 @@ namespace "plugin" do
::File.join(LogStash::Environment::LOGSTASH_HOME, 'vendor/bundle/jruby/1.9'),
::File.join(LogStash::Environment::LOGSTASH_HOME, 'vendor/jruby/lib/ruby/gems/shared')
].join(":"),
"GEM_HOME" => "vendor/plugins/jruby/1.9",
"GEM_HOME" => ::File.join(LogStash::Environment::LOGSTASH_HOME, "vendor/plugins/jruby/1.9"),
"BUNDLE_GEMFILE" => "tools/Gemfile.plugins"
}
if ENV['USE_RUBY'] != '1'

View file

@ -242,13 +242,25 @@ namespace "vendor" do
end
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)
env = {
'GEM_HOME' => ::File.join(LogStash::Environment::LOGSTASH_HOME, LogStash::Environment.gem_home),
'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",
"--standalone",
"--clean",
"--without", "development",
"--jobs", "4",
"--path", LogStash::Environment::BUNDLE_DIR
]
system(env, *cmd)
# because --path creates a .bundle/config file and changes bundler path
# we need to remove this file so it doesn't influence following bundler calls
FileUtils.rm_rf(::File.join(LogStash::Environment::LOGSTASH_HOME, "tools/.bundle"))
ENV['GEM_HOME'] = backup_gem_home
ENV['GEM_PATH'] = backup_gem_path
raise RuntimeError, $!.to_s unless $?.success?