2022-02-10 20:34:41 +00:00
|
|
|
{ resholvePackage
|
|
|
|
, lib
|
2022-03-05 16:20:37 +00:00
|
|
|
, stdenv
|
2022-02-10 20:34:41 +00:00
|
|
|
, fetchFromGitHub
|
|
|
|
, bash
|
|
|
|
, coreutils
|
|
|
|
, gnugrep
|
|
|
|
, ncurses
|
2022-03-05 16:20:37 +00:00
|
|
|
, lsof
|
2022-02-10 20:34:41 +00:00
|
|
|
, doInstallCheck ? true
|
|
|
|
}:
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2022-02-10 20:34:41 +00:00
|
|
|
resholvePackage rec {
|
2020-04-24 23:36:52 +00:00
|
|
|
pname = "bats";
|
2022-03-05 16:20:37 +00:00
|
|
|
version = "1.6.0";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2022-01-13 20:06:32 +00:00
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "bats-core";
|
|
|
|
repo = "bats-core";
|
|
|
|
rev = "v${version}";
|
2022-03-05 16:20:37 +00:00
|
|
|
sha256 = "sha256-s+SAqX70WeTz6s5ObXYFBVPVUEqvD1d7AX2sGHkjVQ4=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
patchPhase = ''
|
2021-02-05 17:12:51 +00:00
|
|
|
patchShebangs .
|
|
|
|
'';
|
2020-05-03 17:38:23 +00:00
|
|
|
|
2021-02-05 17:12:51 +00:00
|
|
|
installPhase = ''
|
|
|
|
./install.sh $out
|
2020-04-24 23:36:52 +00:00
|
|
|
'';
|
|
|
|
|
2022-02-10 20:34:41 +00:00
|
|
|
solutions = {
|
|
|
|
bats = {
|
|
|
|
scripts = [ "bin/bats" ];
|
|
|
|
interpreter = "${bash}/bin/bash";
|
|
|
|
inputs = [ bash coreutils gnugrep ];
|
|
|
|
fake = {
|
|
|
|
external = [ "greadlink" ];
|
|
|
|
};
|
|
|
|
fix = {
|
|
|
|
"$BATS_ROOT" = [ "${placeholder "out"}" ];
|
|
|
|
};
|
|
|
|
keep = {
|
|
|
|
"${placeholder "out"}/libexec/bats-core/bats" = true;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
inherit doInstallCheck;
|
2022-03-05 16:20:37 +00:00
|
|
|
installCheckInputs = [ ncurses ] ++ lib.optionals stdenv.isDarwin [ lsof ];
|
2022-02-10 20:34:41 +00:00
|
|
|
installCheckPhase = ''
|
2021-03-19 17:17:44 +00:00
|
|
|
# TODO: cut if https://github.com/bats-core/bats-core/issues/418 allows
|
|
|
|
sed -i '/test works even if PATH is reset/a skip' test/bats.bats
|
|
|
|
|
2021-02-05 17:12:51 +00:00
|
|
|
# test generates file with absolute shebang dynamically
|
|
|
|
substituteInPlace test/install.bats --replace \
|
|
|
|
"/usr/bin/env bash" "${bash}/bin/bash"
|
|
|
|
bin/bats test
|
|
|
|
'';
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-02-05 17:12:51 +00:00
|
|
|
meta = with lib; {
|
2020-04-24 23:36:52 +00:00
|
|
|
homepage = "https://github.com/bats-core/bats-core";
|
|
|
|
description = "Bash Automated Testing System";
|
2021-02-05 17:12:51 +00:00
|
|
|
maintainers = with maintainers; [ abathur ];
|
2020-04-24 23:36:52 +00:00
|
|
|
license = licenses.mit;
|
|
|
|
platforms = platforms.unix;
|
|
|
|
};
|
|
|
|
}
|