1
0
Fork 1
mirror of https://github.com/NixOS/nixpkgs.git synced 2024-11-21 13:10:33 +00:00

bundlerEnv: fix for Ruby 2.7

Setting a Bundler version with GEM_PATH doesn't seem to work in Ruby
2.7, so we need to use the LOAD_PATH instead.  Without this,
bundlerEnv environments will always use the version of Bundler that
comes with Ruby, which won't necessarily work because it isn't the
version that was used to generate the bundle.

For example, building ronn with Ruby 2.7 without this change results
in a broken executable, but it works (when built with all packaged
Ruby versions) after this change.
This commit is contained in:
Alyssa Ross 2019-12-26 15:49:04 +00:00 committed by GitHub
parent 7c0bc04420
commit 106d0920d9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 3 deletions

View file

@ -64,7 +64,7 @@ in rec {
"${ruby}/bin/ruby" \
"${confFiles}/Gemfile" \
"$out/${ruby.gemPath}" \
"${bundler}/${ruby.gemPath}" \
"${bundler}/${ruby.gemPath}/gems/bundler-${bundler.version}" \
${lib.escapeShellArg binPaths} \
${lib.escapeShellArg groups}
'';

View file

@ -8,7 +8,7 @@ out = ENV["out"]
ruby = ARGV[0]
gemfile = ARGV[1]
bundle_path = ARGV[2]
bundler_gem_path = ARGV[3]
bundler_path = ARGV[3]
paths = ARGV[4].split
groups = ARGV[5].split
@ -35,7 +35,7 @@ ENV["BUNDLE_GEMFILE"] = #{gemfile.dump}
ENV["BUNDLE_PATH"] = #{bundle_path.dump}
ENV['BUNDLE_FROZEN'] = '1'
Gem.use_paths(#{bundler_gem_path.dump}, ENV["GEM_PATH"])
$LOAD_PATH.unshift #{bundler_path.dump} + "/lib"
require 'bundler'
Bundler.setup(#{groups.map(&:dump).join(', ')})