lib/autoproj/package_managers/bundler_manager.rb in autoproj-2.8.8 vs lib/autoproj/package_managers/bundler_manager.rb in autoproj-2.9.0
- old
+ new
@@ -211,11 +211,11 @@
target_env = Hash[
'GEM_HOME' => gem_home,
'GEM_PATH' => nil,
'BUNDLE_GEMFILE' => gemfile,
'RUBYOPT' => nil,
- 'RUBYLIB' => nil
+ 'RUBYLIB' => rubylib_for_bundler
]
ws.run 'autoproj', 'osdeps',
Autobuild.tool('bundle'), *commandline,
working_directory: File.dirname(gemfile), env: target_env do |line|
yield(line) if block_given?
@@ -386,20 +386,27 @@
io.readlines.map { |l| l.chomp }.find_all { |l| !l.empty? }
end
end
end
+ def self.rubylib_for_bundler
+ rx = Regexp.new("/gems/#{Regexp.quote("bundler-#{Bundler::VERSION}")}/")
+ $LOAD_PATH.grep(rx).join(File::PATH_SEPARATOR)
+ end
+
def discover_bundle_rubylib(silent_errors: false)
require 'bundler'
gemfile = File.join(ws.prefix_dir, 'gems', 'Gemfile')
silent_redirect = Hash.new
if silent_errors
silent_redirect[:err] = :close
end
env = ws.env.resolved_env
Tempfile.open 'autoproj-rubylib' do |io|
result = Bundler.clean_system(
- Hash['GEM_HOME' => env['GEM_HOME'], 'GEM_PATH' => env['GEM_PATH'], 'BUNDLE_GEMFILE' => gemfile, 'RUBYOPT' => nil, 'RUBYLIB' => nil],
+ Hash['GEM_HOME' => env['GEM_HOME'], 'GEM_PATH' => env['GEM_PATH'],
+ 'BUNDLE_GEMFILE' => gemfile, 'RUBYOPT' => nil,
+ 'RUBYLIB' => self.class.rubylib_for_bundler],
Autobuild.tool('ruby'), '-rbundler/setup', '-e', 'puts $LOAD_PATH',
out: io, **silent_redirect)
if result
io.rewind