Final testing

This commit is contained in:
Judson 2017-05-15 09:36:30 -07:00
parent c39508b254
commit ae84d19e65
No known key found for this signature in database
GPG key ID: 1817B08954BF0B7D
4 changed files with 24 additions and 10 deletions

View file

@ -5,7 +5,8 @@
}@defs: }@defs:
{ {
pname name
, pname ? name
, gemfile , gemfile
, lockfile , lockfile
, gemset , gemset
@ -77,7 +78,9 @@ let
basicEnv = buildEnv { basicEnv = buildEnv {
inherit ignoreCollisions; inherit ignoreCollisions;
name = pname; name = if name == null then pname else name;
#name = pname;
paths = envPaths; paths = envPaths;
pathsToLink = [ "/lib" ]; pathsToLink = [ "/lib" ];
@ -92,7 +95,8 @@ let
passthru = rec { passthru = rec {
inherit ruby bundler gems mainGem confFiles; # drvName; inherit ruby bundler gems mainGem confFiles; # drvName;
wrappedRuby = stdenv.mkDerivation { wrappedRuby =
stdenv.mkDerivation {
name = "wrapped-ruby-${pname}"; name = "wrapped-ruby-${pname}";
nativeBuildInputs = [ makeWrapper ]; nativeBuildInputs = [ makeWrapper ];
buildCommand = '' buildCommand = ''

View file

@ -27,7 +27,7 @@ let
inherit (import ./functions.nix {inherit lib ruby gemConfig groups; }) genStubsScript; inherit (import ./functions.nix {inherit lib ruby gemConfig groups; }) genStubsScript;
drvName = drvName =
if name != null then name if name != null then lib.traceVal name
else if pname != null then "${toString pname}-${basicEnv.gems."${pname}".version}" else if pname != null then "${toString pname}-${basicEnv.gems."${pname}".version}"
else throw "bundlerEnv: either pname or name must be set"; else throw "bundlerEnv: either pname or name must be set";
@ -43,7 +43,7 @@ let
if gemset == null then gemdir + "/gemset.nix" if gemset == null then gemdir + "/gemset.nix"
else gemset; else gemset;
basicEnv = (callPackage ./basic.nix {}) (args // { inherit pname gemdir; basicEnv = (callPackage ./basic.nix {}) (args // { inherit pname name gemdir;
gemfile = gemfile'; gemfile = gemfile';
lockfile = lockfile'; lockfile = lockfile';
gemset = gemset'; gemset = gemset';
@ -63,7 +63,7 @@ let
# The basicEnv should be put into passthru so that e.g. nix-shell can use it. # The basicEnv should be put into passthru so that e.g. nix-shell can use it.
in in
if pname == null then if pname == null then
basicEnv // { inherit name; } basicEnv // { inherit name basicEnv; }
else else
(buildEnv { (buildEnv {
inherit ignoreCollisions; inherit ignoreCollisions;

View file

@ -24,11 +24,11 @@ let
functions = (import ./functions.nix testConfigs); functions = (import ./functions.nix testConfigs);
justName = bundlerEnv { justName = bundlerEnv {
name = "test"; name = "test-0.1.2";
gemset = ./test/gemset.nix; gemset = ./test/gemset.nix;
}; };
pnamed = basicEnv { pnamed = bundlerEnv {
pname = "test"; pname = "test";
gemdir = ./test; gemdir = ./test;
gemset = ./test/gemset.nix; gemset = ./test/gemset.nix;
@ -51,13 +51,13 @@ let
in in
test.run "Filter excludes based on groups" gemSet (set: functions.filterGemset {inherit ruby; groups = ["a" "b"];} set == {})) test.run "Filter excludes based on groups" gemSet (set: functions.filterGemset {inherit ruby; groups = ["a" "b"];} set == {}))
(test.run "bundlerEnv { name }" justName { (test.run "bundlerEnv { name }" justName {
name = should.equal "test"; name = should.equal "test-0.1.2";
}) })
(test.run "bundlerEnv { pname }" pnamed (test.run "bundlerEnv { pname }" pnamed
[ [
(should.haveKeys [ "name" "env" "postBuild" ]) (should.haveKeys [ "name" "env" "postBuild" ])
{ {
name = should.equal "test"; name = should.equal "test-0.1.2";
env = should.beASet; env = should.beASet;
postBuild = should.havePrefix "/nix/store"; postBuild = should.havePrefix "/nix/store";
} }

View file

@ -0,0 +1,10 @@
{
test = {
source = {
remotes = ["https://rubygems.org"];
sha256 = "1j5r0anj8m4qlf2psnldip4b8ha2bsscv11lpdgnfh4nnchzjnxw";
type = "gem";
};
version = "0.1.2";
};
}