Test harnesses
This commit is contained in:
@@ -24,15 +24,13 @@
|
||||
}@args:
|
||||
|
||||
let
|
||||
inherit (import ./functions.nix (defs // args)) genStubsScript;
|
||||
|
||||
drvName =
|
||||
if name != null then name
|
||||
else if pname != null then "${toString pname}-${mainGem.version}"
|
||||
else if pname != null then "${toString pname}-${basicEnv.gems."${pname}".version}"
|
||||
else throw "bundlerEnv: either pname or name must be set";
|
||||
|
||||
mainGem =
|
||||
if pname == null then null
|
||||
else gems."${pname}" or (throw "bundlerEnv: gem ${pname} not found");
|
||||
|
||||
gemfile' =
|
||||
if gemfile == null then gemdir + "/Gemfile"
|
||||
else gemfile;
|
||||
@@ -45,12 +43,13 @@ let
|
||||
if gemset == null then gemdir + "/gemset.nix"
|
||||
else gemset;
|
||||
|
||||
envPaths = lib.attrValues gems ++ lib.optional (!hasBundler) bundler;
|
||||
|
||||
binPaths = if mainGem != null then [ mainGem ] else envPaths;
|
||||
|
||||
basicEnv = import ./basic args // { inherit drvName pname gemfile lockfile gemset; };
|
||||
basicEnv = (callPackage ./basic.nix {}) (args // { inherit pname gemdir;
|
||||
gemfile = gemfile';
|
||||
lockfile = lockfile';
|
||||
gemset = gemset';
|
||||
});
|
||||
|
||||
inherit (basicEnv) envPaths;
|
||||
# Idea here is a mkDerivation that gen-bin-stubs new stubs "as specified" -
|
||||
# either specific executables or the bin/ for certain gem(s), but
|
||||
# incorporates the basicEnv as a requirement so that its $out is in our path.
|
||||
@@ -63,8 +62,26 @@ let
|
||||
|
||||
# The basicEnv should be put into passthru so that e.g. nix-shell can use it.
|
||||
in
|
||||
(linkFarm drvName entries) // {
|
||||
passthru = {
|
||||
inherit basicEnv;
|
||||
};
|
||||
}
|
||||
if builtins.trace "pname: ${toString pname}" pname == null then
|
||||
basicEnv // { inherit name; }
|
||||
else
|
||||
(buildEnv {
|
||||
inherit ignoreCollisions;
|
||||
|
||||
name = builtins.trace "name: ${toString drvName}" drvName;
|
||||
|
||||
paths = envPaths;
|
||||
pathsToLink = [ "/lib" ];
|
||||
|
||||
postBuild = genStubsScript defs // args // {
|
||||
inherit bundler;
|
||||
confFiles = basicEnv.confFiles;
|
||||
binPaths = [ basicEnv.mainGem ];
|
||||
} + lib.optionalString (postBuild != null) postBuild;
|
||||
|
||||
meta = { platforms = ruby.meta.platforms; } // meta;
|
||||
passthru = basicEnv.passthru // {
|
||||
inherit basicEnv;
|
||||
inherit (basicEnv) env;
|
||||
};
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user