summary refs log tree commit diff
diff options
context:
space:
mode:
authorJudson <nyarly@gmail.com>2017-06-09 09:04:33 -0700
committerJudson <nyarly@gmail.com>2017-06-09 09:04:33 -0700
commit964d9b7a067fc48d9774c5bff37d7fff41158f5a (patch)
tree5d5ace6a96680f7fdfa88efe93a62847ce8097dd
parent0bde4071fcd056172405005e7c99a56287e3477c (diff)
downloadnixpkgs-964d9b7a067fc48d9774c5bff37d7fff41158f5a.tar
nixpkgs-964d9b7a067fc48d9774c5bff37d7fff41158f5a.tar.gz
nixpkgs-964d9b7a067fc48d9774c5bff37d7fff41158f5a.tar.bz2
nixpkgs-964d9b7a067fc48d9774c5bff37d7fff41158f5a.tar.lz
nixpkgs-964d9b7a067fc48d9774c5bff37d7fff41158f5a.tar.xz
nixpkgs-964d9b7a067fc48d9774c5bff37d7fff41158f5a.tar.zst
nixpkgs-964d9b7a067fc48d9774c5bff37d7fff41158f5a.zip
Made gemdir handling into a common function
-rw-r--r--pkgs/development/ruby-modules/bundled-common/default.nix21
-rw-r--r--pkgs/development/ruby-modules/bundler-env/default.nix18
-rw-r--r--pkgs/development/ruby-modules/testing/tap-support.nix1
-rw-r--r--pkgs/development/ruby-modules/tool/default.nix14
4 files changed, 21 insertions, 33 deletions
diff --git a/pkgs/development/ruby-modules/bundled-common/default.nix b/pkgs/development/ruby-modules/bundled-common/default.nix
index 30c82100d5e..2aea35844fe 100644
--- a/pkgs/development/ruby-modules/bundled-common/default.nix
+++ b/pkgs/development/ruby-modules/bundled-common/default.nix
@@ -7,10 +7,10 @@
 {
   name
 , pname ? name
-, gemdir
-, gemfile
-, lockfile
-, gemset
+, gemdir ? null
+, gemfile ? null
+, lockfile ? null
+, gemset ? null
 , ruby ? defs.ruby
 , gemConfig ? defaultGemConfig
 , postBuild ? null
@@ -24,8 +24,9 @@
 with  import ./functions.nix { inherit lib gemConfig; };
 
 let
+  gemFiles = bundlerFiles args;
 
-  importedGemset = import gemset;
+  importedGemset = import gemFiles.gemset;
 
   filteredGemset = filterGemset { inherit ruby groups; } importedGemset;
 
@@ -42,9 +43,9 @@ let
   gems = lib.flip lib.mapAttrs configuredGemset (name: attrs: buildGem name attrs);
 
   copyIfBundledByPath = { bundledByPath ? false, ...}@main:
-  (if bundledByPath then ''
-  cp -a ${gemdir}/* $out/
-  '' else ""
+  (if bundledByPath then
+      assert gemFiles.gemdir != nil; "cp -a ${gemFiles.gemdir}/* $out/"
+    else ""
   );
 
   maybeCopyAll = pname: if pname == null then "" else
@@ -59,8 +60,8 @@ let
   confFiles = runCommand "gemfile-and-lockfile" {} ''
     mkdir -p $out
     ${maybeCopyAll pname}
-    cp ${gemfile} $out/Gemfile || ls -l $out/Gemfile
-    cp ${lockfile} $out/Gemfile.lock || ls -l $out/Gemfile.lock
+    cp ${gemFiles.gemfile} $out/Gemfile || ls -l $out/Gemfile
+    cp ${gemFiles.lockfile} $out/Gemfile.lock || ls -l $out/Gemfile.lock
   '';
 
   buildGem = name: attrs: (
diff --git a/pkgs/development/ruby-modules/bundler-env/default.nix b/pkgs/development/ruby-modules/bundler-env/default.nix
index 89fafb5f230..a72647fb00a 100644
--- a/pkgs/development/ruby-modules/bundler-env/default.nix
+++ b/pkgs/development/ruby-modules/bundler-env/default.nix
@@ -27,23 +27,7 @@ let
     else if pname != null then "${toString pname}-${basicEnv.gems."${pname}".version}"
     else throw "bundlerEnv: either pname or name must be set";
 
-  gemfile' =
-    if gemfile == null then gemdir + "/Gemfile"
-    else gemfile;
-
-  lockfile' =
-    if lockfile == null then gemdir + "/Gemfile.lock"
-    else lockfile;
-
-  gemset' =
-    if gemset == null then gemdir + "/gemset.nix"
-    else gemset;
-
-  basicEnv = (callPackage ../bundled-common {}) (args // { inherit pname name gemdir;
-    gemfile = gemfile';
-    lockfile  = lockfile';
-    gemset = gemset';
-  });
+  basicEnv = (callPackage ../bundled-common {}) (args // { inherit pname name; });
 
   inherit (basicEnv) envPaths;
   # Idea here is a mkDerivation that gen-bin-stubs new stubs "as specified" -
diff --git a/pkgs/development/ruby-modules/testing/tap-support.nix b/pkgs/development/ruby-modules/testing/tap-support.nix
index 3147ed066c1..555ce89d833 100644
--- a/pkgs/development/ruby-modules/testing/tap-support.nix
+++ b/pkgs/development/ruby-modules/testing/tap-support.nix
@@ -4,6 +4,7 @@ let
 
   testLine = report: "${okStr report} ${toString (report.index + 1)} ${report.description}" + testDirective report + testYaml report;
 
+  # These are part of the TAP spec, not yet implemented.
   testDirective = report: "";
 
   testYaml = report: "";
diff --git a/pkgs/development/ruby-modules/tool/default.nix b/pkgs/development/ruby-modules/tool/default.nix
index 02bf3b96a26..04c385d75ae 100644
--- a/pkgs/development/ruby-modules/tool/default.nix
+++ b/pkgs/development/ruby-modules/tool/default.nix
@@ -2,24 +2,26 @@
 
 {
   name
+  # gemdir is the location of the Gemfile{,.lock} and gemset.nix; usually ./.
 , gemdir
+  # Exes is the list of executables provided by the gems in the Gemfile
 , exes ? []
+  # Scripts are programs included directly in nixpkgs that depend on gems
 , scripts ? []
+, gemfile ? null
+, lockfile ? null
+, gemset ? null
 , postBuild
 }@args:
 
 let
-  basicEnv = (callPackage ../bundled-common {}) (args // { inherit name gemdir;
-    gemfile = gemfile';
-    lockfile  = lockfile';
-    gemset = gemset';
-  });
+  basicEnv = (callPackage ../bundled-common {}) args;
 
   args = removeAttrs args_ [ "name" "postBuild" ]
   // { inherit preferLocalBuild allowSubstitutes; }; # pass the defaults
 in
    runCommand name args ''
-    mkdir -p $out; cd $out;
+    mkdir -p ${out}/bin; cd $out;
       ${(lib.concatMapStrings (x: "ln -s '${basicEnv}/bin/${x}' '${x}';\n") exes)}
       ${(lib.concatMapStrings (s: "makeWrapper ${out}/bin/$(basename ${s}) $srcdir/${s} " +
               "--set BUNDLE_GEMFILE ${basicEnv.confFiles}/Gemfile "+