about summary refs log tree commit diff
path: root/pkgs/development/ruby-modules
diff options
context:
space:
mode:
authorAlyssa Ross <hi@alyssa.is>2019-12-26 15:49:04 +0000
committerGitHub <noreply@github.com>2019-12-26 15:49:04 +0000
commit106d0920d9d511268b435adcc06697f8c38a86e5 (patch)
tree5d552e00ad6ea5a54074583cd64abd93cafbcc5a /pkgs/development/ruby-modules
parent7c0bc044205a43b7b45d47325e26257dfd2bdbc2 (diff)
downloadnixlib-106d0920d9d511268b435adcc06697f8c38a86e5.tar
nixlib-106d0920d9d511268b435adcc06697f8c38a86e5.tar.gz
nixlib-106d0920d9d511268b435adcc06697f8c38a86e5.tar.bz2
nixlib-106d0920d9d511268b435adcc06697f8c38a86e5.tar.lz
nixlib-106d0920d9d511268b435adcc06697f8c38a86e5.tar.xz
nixlib-106d0920d9d511268b435adcc06697f8c38a86e5.tar.zst
nixlib-106d0920d9d511268b435adcc06697f8c38a86e5.zip
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.
Diffstat (limited to 'pkgs/development/ruby-modules')
-rw-r--r--pkgs/development/ruby-modules/bundled-common/functions.nix2
-rw-r--r--pkgs/development/ruby-modules/bundled-common/gen-bin-stubs.rb4
2 files changed, 3 insertions, 3 deletions
diff --git a/pkgs/development/ruby-modules/bundled-common/functions.nix b/pkgs/development/ruby-modules/bundled-common/functions.nix
index a093cc4dc95c..35307a3fbd93 100644
--- a/pkgs/development/ruby-modules/bundled-common/functions.nix
+++ b/pkgs/development/ruby-modules/bundled-common/functions.nix
@@ -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}
     '';
diff --git a/pkgs/development/ruby-modules/bundled-common/gen-bin-stubs.rb b/pkgs/development/ruby-modules/bundled-common/gen-bin-stubs.rb
index fe8c43f55ed1..add5db56d1d0 100644
--- a/pkgs/development/ruby-modules/bundled-common/gen-bin-stubs.rb
+++ b/pkgs/development/ruby-modules/bundled-common/gen-bin-stubs.rb
@@ -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(', ')})