This repository has been archived by the owner on Dec 21, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add shell script to check if dependencies are up-to-date
- Loading branch information
Showing
1 changed file
with
29 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 |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#!/usr/bin/env fish | ||
|
||
function get_remote_master | ||
git ls-remote "$argv[1]" | \ | ||
grep 'refs/heads/master' | \ | ||
awk '{print $1}' | ||
end | ||
|
||
function list_deps | ||
grep '"git"' -B2 kontemplate.frm | \ | ||
grep -P -o '(?<=silo: ")https://.+(?=")' | ||
end | ||
|
||
function diff_dep | ||
set -l current (grep -B1 "$argv[1]" kontemplate.frm | grep -P -o '(?<=hash: ").+(?=")') | ||
set -l remote (get_remote_master "$argv[1]") | ||
|
||
if [ $current != $remote ] | ||
echo "$argv[1]" | ||
echo -e "current:\t$current" | ||
echo -e "remote:\t\t$remote\n" | ||
else | ||
echo -e "$argv[1] up to date\n" | ||
end | ||
end | ||
|
||
for dep in (list_deps) | ||
diff_dep $dep | ||
end |