about summary refs log tree commit diff
path: root/pkgs/development/ruby-modules
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/development/ruby-modules')
-rw-r--r--pkgs/development/ruby-modules/bundler-env/default.nix6
-rw-r--r--pkgs/development/ruby-modules/bundler/default.nix8
-rw-r--r--pkgs/development/ruby-modules/gem-config/default.nix24
-rw-r--r--pkgs/development/ruby-modules/gem/default.nix10
-rw-r--r--pkgs/development/ruby-modules/gem/gem-post-build.rb13
5 files changed, 37 insertions, 24 deletions
diff --git a/pkgs/development/ruby-modules/bundler-env/default.nix b/pkgs/development/ruby-modules/bundler-env/default.nix
index 4ebba0d5b653..56a3b371d1dc 100644
--- a/pkgs/development/ruby-modules/bundler-env/default.nix
+++ b/pkgs/development/ruby-modules/bundler-env/default.nix
@@ -16,8 +16,6 @@
 }@args:
 
 let
-
-  shellEscape = x: "'${lib.replaceChars ["'"] [("'\\'" + "'")] x}'";
   importedGemset = import gemset;
   filteredGemset = (lib.filterAttrs (name: attrs:
     if (builtins.hasAttr "groups" attrs)
@@ -58,8 +56,8 @@ let
         "${confFiles}/Gemfile" \
         "$out/${ruby.gemPath}" \
         "${bundler}/${ruby.gemPath}" \
-        ${shellEscape (toString envPaths)} \
-        ${shellEscape (toString groups)}
+        ${lib.escapeShellArg envPaths} \
+        ${lib.escapeShellArg groups}
     '' + lib.optionalString (postBuild != null) postBuild;
     passthru = rec {
       inherit ruby bundler meta gems;
diff --git a/pkgs/development/ruby-modules/bundler/default.nix b/pkgs/development/ruby-modules/bundler/default.nix
index 718da20b0068..c3c544d52689 100644
--- a/pkgs/development/ruby-modules/bundler/default.nix
+++ b/pkgs/development/ruby-modules/bundler/default.nix
@@ -4,7 +4,11 @@ buildRubyGem rec {
   inherit ruby;
   name = "${gemName}-${version}";
   gemName = "bundler";
-  version = "1.11.2";
-  sha256 = "0s37j1hyngc4shq0in8f9y1knjdqkisdg3dd1mfwgq7n1bz8zan7";
+  version = "1.12.5";
+  sha256 = "1q84xiwm9j771lpmiply0ls9l2bpvl5axn3jblxjvrldh8di2pkc";
   dontPatchShebangs = true;
+
+  postFixup = ''
+    sed -i -e "s/activate_bin_path/bin_path/g" $out/bin/bundle
+  '';
 }
diff --git a/pkgs/development/ruby-modules/gem-config/default.nix b/pkgs/development/ruby-modules/gem-config/default.nix
index 4d68584f8653..683677d05fc3 100644
--- a/pkgs/development/ruby-modules/gem-config/default.nix
+++ b/pkgs/development/ruby-modules/gem-config/default.nix
@@ -29,6 +29,21 @@ let
 in
 
 {
+  bundler = attrs:
+    let
+      templates = "${attrs.ruby.gemPath}/gems/${attrs.gemName}-${attrs.version}/lib/bundler/templates/";
+    in {
+      # patching shebangs would fail on the templates/Executable file, so we
+      # temporarily remove the executable flag.
+      preFixup  = "chmod -x $out/${templates}/Executable";
+      postFixup = ''
+        chmod +x $out/${templates}/Executable
+
+        # Allows to load another bundler version
+        sed -i -e "s/activate_bin_path/bin_path/g" $out/bin/bundle
+      '';
+    };
+
   capybara-webkit = attrs: {
     buildInputs = [ qt48 ];
   };
@@ -185,14 +200,5 @@ in
     '';
   };
 
-  # patching shebangs would fail on the templates/Executable file, so we
-  # temporarily remove the executable flag.
-  bundler = attrs:
-    let
-      templates = "${attrs.ruby.gemPath}/gems/${attrs.gemName}-${attrs.version}/lib/bundler/templates/";
-    in {
-      preFixup  = "chmod -x $out/${templates}/Executable";
-      postFixup = "chmod +x $out/${templates}/Executable";
-    };
 }
 
diff --git a/pkgs/development/ruby-modules/gem/default.nix b/pkgs/development/ruby-modules/gem/default.nix
index 6e1b0c00bd08..347c4a79c596 100644
--- a/pkgs/development/ruby-modules/gem/default.nix
+++ b/pkgs/development/ruby-modules/gem/default.nix
@@ -18,8 +18,8 @@
 # Normal gem packages can be used outside of bundler; a binstub is created in
 # $out/bin.
 
-{ lib, ruby, bundler, fetchurl, fetchgit, makeWrapper, git,
-  buildRubyGem, darwin
+{ lib, fetchurl, fetchgit, makeWrapper, git, darwin
+, ruby, bundler
 } @ defs:
 
 lib.makeOverridable (
@@ -48,12 +48,11 @@ lib.makeOverridable (
 , dontBuild ? true
 , propagatedBuildInputs ? []
 , propagatedUserEnvPkgs ? []
-, buildFlags ? null
+, buildFlags ? []
 , passthru ? {}
 , ...} @ attrs:
 
 let
-  shellEscape = x: "'${lib.replaceChars ["'"] [("'\\'" + "'")] x}'";
   src = attrs.src or (
     if type == "gem" then
       fetchurl {
@@ -165,7 +164,7 @@ stdenv.mkDerivation (attrs // {
       ${src} \
       ${attrs.rev} \
       ${version} \
-      ${shellEscape (toString buildFlags)}
+      ${lib.escapeShellArgs buildFlags}
     ''}
 
     ${lib.optionalString (type == "gem") ''
@@ -182,6 +181,7 @@ stdenv.mkDerivation (attrs // {
       --force \
       --http-proxy 'http://nodtd.invalid' \
       --ignore-dependencies \
+      --install-dir "$GEM_HOME" \
       --build-root '/' \
       --backtrace \
       ${documentFlag} \
diff --git a/pkgs/development/ruby-modules/gem/gem-post-build.rb b/pkgs/development/ruby-modules/gem/gem-post-build.rb
index 4480c525bf16..f0322b67f61f 100644
--- a/pkgs/development/ruby-modules/gem/gem-post-build.rb
+++ b/pkgs/development/ruby-modules/gem/gem-post-build.rb
@@ -7,7 +7,7 @@ ruby = File.join(ENV["ruby"], "bin", RbConfig::CONFIG['ruby_install_name'])
 out = ENV["out"]
 bin_path = File.join(ENV["out"], "bin")
 gem_home = ENV["GEM_HOME"]
-gem_path = ENV["GEM_PATH"].split(":")
+gem_path = ENV["GEM_PATH"].split(File::PATH_SEPARATOR)
 install_path = Dir.glob("#{gem_home}/gems/*").first
 gemspec_path = ARGV[0]
 
@@ -64,11 +64,16 @@ spec.executables.each do |exe|
 # this file is here to facilitate running it.
 #
 
-Gem.use_paths "#{gem_home}", #{gem_path.to_s}
-
 require 'rubygems'
 
-load Gem.bin_path(#{spec.name.inspect}, #{exe.inspect})
+Gem.paths = {
+  'GEM_PATH' => (
+    ENV['GEM_PATH'].to_s.split(File::PATH_SEPARATOR) +
+    #{([gem_home] + gem_path).to_s}
+  ).join(File::PATH_SEPARATOR)
+}
+
+load Gem.activate_bin_path(#{spec.name.inspect}, #{exe.inspect}, #{spec.version.to_s.inspect})
     EOF
   end