refactor: move pre-receive hook modification to post-app-rename-setup trigger
This commit is contained in:
1 parent
9d3538d587
commit
5801fd98a4
2 files changed
+13
-1
No files matched your search
@@ -26,7 +26,6 @@ cmd-apps-rename() {
|
|||||||
cp -a "$DOKKU_ROOT/$OLD_APP/." "$DOKKU_ROOT/$NEW_APP"
|
cp -a "$DOKKU_ROOT/$OLD_APP/." "$DOKKU_ROOT/$NEW_APP"
|
||||||
plugn trigger post-app-rename-setup "$OLD_APP" "$NEW_APP"
|
plugn trigger post-app-rename-setup "$OLD_APP" "$NEW_APP"
|
||||||
DOKKU_APPS_FORCE_DELETE=1 apps_destroy "$OLD_APP"
|
DOKKU_APPS_FORCE_DELETE=1 apps_destroy "$OLD_APP"
|
||||||
[[ -f "$DOKKU_ROOT/$NEW_APP/hooks/pre-receive" ]] && sed -i -e "s/git-hook $OLD_APP/git-hook $NEW_APP/g" "$DOKKU_ROOT/$NEW_APP/hooks/pre-receive"
|
|
||||||
plugn trigger post-app-rename "$OLD_APP" "$NEW_APP"
|
plugn trigger post-app-rename "$OLD_APP" "$NEW_APP"
|
||||||
docker_cleanup "$OLD_APP" "true"
|
docker_cleanup "$OLD_APP" "true"
|
||||||
echo "Renaming $OLD_APP to $NEW_APP... done"
|
echo "Renaming $OLD_APP to $NEW_APP... done"
|
||||||
|
|||||||
Executable
+13
@@ -0,0 +1,13 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
set -eo pipefail
|
||||||
|
[[ $DOKKU_TRACE ]] && set -x
|
||||||
|
|
||||||
|
trigger-git-post-app-rename-setup() {
|
||||||
|
declare desc="modifies git-hook"
|
||||||
|
declare trigger="post-app-rename-setup"
|
||||||
|
declare OLD_APP="$1" NEW_APP="$2"
|
||||||
|
|
||||||
|
[[ -f "$DOKKU_ROOT/$NEW_APP/hooks/pre-receive" ]] && sed -i -e "s/git-hook $OLD_APP/git-hook $NEW_APP/g" "$DOKKU_ROOT/$NEW_APP/hooks/pre-receive"
|
||||||
|
}
|
||||||
|
|
||||||
|
trigger-git-post-app-rename-setup "$@"
|
||||||
Reference in new issue
Block a user