-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
look-for-changes
executable file
·48 lines (40 loc) · 1.88 KB
/
look-for-changes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#!/bin/bash
# ([[ `git status --porcelain` ]] && echo "local changes" && exit 1 || exit 0) && (test $(git rev-parse --abbrev-ref HEAD) != "main" && echo "on branch" && exit 1 || exit 0) && ~/octodns/octodns-template/script/look-for-changes 2>&1 | tee /tmp/changes.patch
#
# ~/octodns/octodns-template/script/look-for-changes 2>&1 | tee /tmp/changes.patch
#
# ./script/format && git checkout -b general-updates && git add -p && git commit -m "Updates to latest template" && ./script/update-requirements && git add -p && git commit -m "Update requirements files" && git pob
#
# hub pull-request --file /tmp/body.txt -b main -h general-updates -a ross
set -e
set -o pipefail
MDIR=$(pwd)
cd "$(dirname "$0")/.."
ROOT=$(pwd)
echo "## paths #######################################################################"
echo "root: $ROOT"
echo "moduledir: $MDIR"
TDIR=$(mktemp -d)
echo "tempdir: $TDIR"
echo "## template vars ###############################################################"
MODULE=$(basename "$MDIR" | sed 's/-/_/')
echo "module: $MODULE"
PROVIDER=$(grep --no-filename -r '^class .*\(Provider\|Source\)(' "$MDIR/$MODULE/" | sed -e 's/class //' -e 's/(.*//')
echo "provider: $PROVIDER"
NAME=$(head -n 1 $MDIR/README.md | sed -e 's/## //' -e 's/ provider.*//')
echo "name: $NAME"
LINK=$(grep 'provider that targets' $MDIR/README.md | sed -e 's/.*targets .*](//' -e 's/)\.$//' || echo "NoT-FoUnD")
echo "link: $LINK"
AUTHOR=$(grep 'author=' "$MDIR/setup.py" | sed -e "s/.*author='//" -e "s/',//")
echo "author: $AUTHOR"
AUTHOR_EMAIL=$(grep 'author_email=' "$MDIR/setup.py" | sed -e "s/.*author_email='//" -e "s/',//")
echo "author_email: $AUTHOR_EMAIL"
cd $TDIR
$ROOT/script/template \
--module "$MODULE" \
--provider "$PROVIDER" \
--name "$NAME" \
--link "$LINK" \
--author "$AUTHOR" \
--author-email "$AUTHOR_EMAIL"
diff -ru --ignore-matching-lines='TODO' --exclude=$MODULE --exclude=tests* . $MDIR