2021-12-06 16:07:01 +00:00
|
|
|
{ stdenv, lib, fetchzip, bash, makeWrapper, coreutils, gnugrep, ncurses, doCheck ? true }:
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
pname = "bats";
|
2021-12-06 16:07:01 +00:00
|
|
|
version = "1.5.0";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchzip {
|
|
|
|
url = "https://github.com/bats-core/bats-core/archive/v${version}.tar.gz";
|
2021-12-06 16:07:01 +00:00
|
|
|
hash = "sha256-MEkMi2w8G9FZhE3JvzzbqObcErQ9WFXy5mtKwQOoxbk=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2021-02-05 17:12:51 +00:00
|
|
|
nativeBuildInputs = [ makeWrapper ];
|
|
|
|
|
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
|
|
|
|
wrapProgram $out/bin/bats --suffix PATH : "${lib.makeBinPath [ bash coreutils gnugrep ]}"
|
2020-04-24 23:36:52 +00:00
|
|
|
'';
|
|
|
|
|
2021-02-05 17:12:51 +00:00
|
|
|
inherit doCheck;
|
2021-12-06 16:07:01 +00:00
|
|
|
checkInputs = [ ncurses ];
|
2021-02-05 17:12:51 +00:00
|
|
|
checkPhase = ''
|
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;
|
|
|
|
};
|
|
|
|
}
|