2019-04-07 01:45:00 +02:00
|
|
|
#!/usr/bin/env nix-shell
|
|
|
|
#!nix-shell -i bash -p curl common-updater-scripts jq
|
|
|
|
|
|
|
|
set -eu -o pipefail
|
|
|
|
|
2019-11-24 18:22:28 +01:00
|
|
|
oldVersion="$(nix-instantiate --eval -E "with import ./. {}; lib.getVersion oh-my-zsh" | tr -d '"')"
|
2019-12-12 13:38:40 +01:00
|
|
|
latestSha="$(curl -L -s https://api.github.com/repos/ohmyzsh/ohmyzsh/commits\?sha\=master\&since\=${oldVersion} | jq -r '.[0].sha')"
|
2019-04-07 01:45:00 +02:00
|
|
|
url="$(nix-instantiate --eval -E "with import ./. {}; oh-my-zsh.src.url" | tr -d '"')"
|
|
|
|
|
|
|
|
if [ ! "null" = "${latestSha}" ]; then
|
2019-12-12 13:38:40 +01:00
|
|
|
latestDate="$(curl -L -s https://api.github.com/repos/ohmyzsh/ohmyzsh/commits/${latestSha} | jq '.commit.author.date' | sed 's|"\(.*\)T.*|\1|g')"
|
2019-04-07 01:45:00 +02:00
|
|
|
update-source-version oh-my-zsh "${latestSha}" --version-key=rev
|
|
|
|
update-source-version oh-my-zsh "${latestDate}" --ignore-same-hash
|
|
|
|
nixpkgs="$(git rev-parse --show-toplevel)"
|
|
|
|
default_nix="$nixpkgs/pkgs/shells/zsh/oh-my-zsh/default.nix"
|
|
|
|
git add "${default_nix}"
|
|
|
|
git commit -m "oh-my-zsh: ${oldVersion} -> ${latestDate}"
|
|
|
|
else
|
|
|
|
echo "oh-my-zsh is already up-to-date"
|
|
|
|
fi
|