-
-
Notifications
You must be signed in to change notification settings - Fork 14.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #327424 from d-brasher/init-revolver
- Loading branch information
Showing
3 changed files
with
115 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4693,6 +4693,11 @@ | |
githubId = 3179832; | ||
name = "D. Bohdan"; | ||
}; | ||
d-brasher = { | ||
github = "d-brasher"; | ||
githubId = 175485311; | ||
name = "D. Brasher"; | ||
}; | ||
dbrgn = { | ||
email = "[email protected]"; | ||
github = "dbrgn"; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
Replace call to "revolver" with call to internal function. | ||
Useful when "revolver" is not defined in PATH. | ||
--- a/revolver | ||
+++ b/revolver | ||
@@ -255,9 +255,9 @@ | ||
### | ||
function _revolver_demo() { | ||
for style in "${(@k)_revolver_spinners[@]}"; do | ||
- revolver --style $style start $style | ||
+ _revolver --style $style start $style | ||
sleep 2 | ||
- revolver stop | ||
+ _revolver stop | ||
done | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
{ | ||
lib, | ||
stdenvNoCC, | ||
fetchFromGitHub, | ||
zsh, | ||
installShellFiles, | ||
ncurses, | ||
nix-update-script, | ||
testers, | ||
runCommand, | ||
}: | ||
|
||
stdenvNoCC.mkDerivation (finalAttrs: { | ||
pname = "revolver"; | ||
version = "0.2.4-unstable-2020-09-30"; | ||
|
||
src = fetchFromGitHub { | ||
owner = "molovo"; | ||
repo = "revolver"; | ||
rev = "6424e6cb14da38dc5d7760573eb6ecb2438e9661"; | ||
hash = "sha256-2onqjtPIsgiEJj00oP5xXGkPZGQpGPVwcBOhmicqKcs="; | ||
}; | ||
|
||
strictDeps = true; | ||
doInstallCheck = true; | ||
|
||
nativeBuildInputs = [ installShellFiles ]; | ||
buildInputs = [ | ||
zsh | ||
ncurses | ||
]; | ||
nativeInstallCheckInputs = [ zsh ]; | ||
|
||
patches = [ ./no-external-call.patch ]; | ||
|
||
postPatch = '' | ||
substituteInPlace revolver \ | ||
--replace-fail "tput cols" "${ncurses}/bin/tput cols" | ||
''; | ||
|
||
installPhase = '' | ||
runHook preInstall | ||
install -D revolver $out/bin/revolver | ||
runHook postInstall | ||
''; | ||
|
||
postInstall = '' | ||
installShellCompletion --cmd revolver --zsh revolver.zsh-completion | ||
''; | ||
|
||
installCheckPhase = '' | ||
runHook preInstallCheck | ||
PATH=$PATH:$out/bin revolver --help | ||
runHook postInstallCheck | ||
''; | ||
|
||
passthru = { | ||
tests = { | ||
demo = runCommand "revolver-demo" { nativeBuildInputs = [ finalAttrs.finalPackage ]; } '' | ||
export HOME="$TEMPDIR" | ||
# Drop stdout, redirect stderr to stdout and check if it's not empty | ||
exec 9>&1 | ||
echo "Running revolver demo..." | ||
if [[ $(revolver demo 2>&1 1>/dev/null | tee >(cat - >&9)) ]]; then | ||
exit 1 | ||
fi | ||
echo "Demo done!" | ||
mkdir $out | ||
''; | ||
version = testers.testVersion { | ||
package = finalAttrs.finalPackage; | ||
# Wrong '0.2.0' version in the code | ||
version = "0.2.0"; | ||
}; | ||
}; | ||
updateScript = nix-update-script { }; | ||
}; | ||
|
||
meta = { | ||
description = "Progress spinner for ZSH scripts"; | ||
homepage = "https://github.com/molovo/revolver"; | ||
downloadPage = "https://github.com/molovo/revolver/releases"; | ||
license = lib.licenses.mit; | ||
mainProgram = "revolver"; | ||
inherit (zsh.meta) platforms; | ||
maintainers = with lib.maintainers; [ d-brasher ]; | ||
}; | ||
}) |