about summary refs log tree commit diff
path: root/pkgs/development/ruby-modules/testing/stubs.nix
diff options
context:
space:
mode:
authorJudson <nyarly@gmail.com>2017-05-27 15:19:34 -0700
committerJudson <nyarly@gmail.com>2017-05-27 15:19:34 -0700
commit998d011e426c2f8c51946ebbc4931a464f531db9 (patch)
treef7c29caa5789057980f0627fd4e9435b35e34000 /pkgs/development/ruby-modules/testing/stubs.nix
parent022be78eb26de958e50e32ac40574e93ac81bee3 (diff)
downloadnixlib-998d011e426c2f8c51946ebbc4931a464f531db9.tar
nixlib-998d011e426c2f8c51946ebbc4931a464f531db9.tar.gz
nixlib-998d011e426c2f8c51946ebbc4931a464f531db9.tar.bz2
nixlib-998d011e426c2f8c51946ebbc4931a464f531db9.tar.lz
nixlib-998d011e426c2f8c51946ebbc4931a464f531db9.tar.xz
nixlib-998d011e426c2f8c51946ebbc4931a464f531db9.tar.zst
nixlib-998d011e426c2f8c51946ebbc4931a464f531db9.zip
Restructuring files
Diffstat (limited to 'pkgs/development/ruby-modules/testing/stubs.nix')
-rw-r--r--pkgs/development/ruby-modules/testing/stubs.nix33
1 files changed, 33 insertions, 0 deletions
diff --git a/pkgs/development/ruby-modules/testing/stubs.nix b/pkgs/development/ruby-modules/testing/stubs.nix
new file mode 100644
index 000000000000..3585681478c8
--- /dev/null
+++ b/pkgs/development/ruby-modules/testing/stubs.nix
@@ -0,0 +1,33 @@
+{ stdenv, lib, ruby, callPackage, ... }:
+let
+  real = {
+    inherit (stdenv) mkDerivation;
+  };
+  mkDerivation = {name, ...}@argSet:
+  derivation {
+    inherit name;
+    text = (builtins.toJSON (lib.filterAttrs ( n: v: builtins.any (x: x == n) ["name" "system"]) argSet));
+    builder = stdenv.shell;
+    args = [ "-c" "echo  $(<$textPath) > $out"];
+    system = stdenv.system;
+    passAsFile = ["text"];
+  };
+  fetchurl = {url?"", urls ? [],...}: "fetchurl:${if urls == [] then url else builtins.head urls}";
+
+  stdenv' = stdenv // {
+    inherit mkDerivation;
+    stubbed = true;
+  };
+  ruby' = ruby // {
+    stdenv = stdenv';
+    stubbed = true;
+  };
+in
+  {
+    ruby = ruby';
+    buildRubyGem = callPackage ../gem {
+      inherit fetchurl;
+      ruby = ruby';
+    };
+    stdenv = stdenv';
+  }