-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup
More file actions
executable file
·42 lines (34 loc) · 1.07 KB
/
Copy pathsetup
File metadata and controls
executable file
·42 lines (34 loc) · 1.07 KB
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
#!/usr/bin/env bash
# Commands to set up the project. Run with `./setup <command>`.
# Available commands:
# sync-plugin: Sync plugin from WP install to git-tracked folder
set -euo pipefail
REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
PLUGIN_SRC="$REPO_ROOT/sitepulse-wp/wordpress/wp-content/plugins/sitepulse-monitor"
PLUGIN_DEST="$REPO_ROOT/sitepulse-wp/sitepulse-monitor"
cmd_sync_plugin() {
if [ ! -d "$PLUGIN_SRC" ]; then
echo "Error: source not found at $PLUGIN_SRC" >&2
exit 1
fi
echo "Cleaning $PLUGIN_DEST ..."
rm -rf "${PLUGIN_DEST:?}/"*
echo "Copying plugin files ..."
rsync -a \
--exclude='node_modules/' \
--exclude='vendor/' \
--exclude='resources/build/' \
--exclude='prod' \
"$PLUGIN_SRC/" "$PLUGIN_DEST/"
echo "Done."
}
case "${1:-}" in
sync-plugin) cmd_sync_plugin ;;
*)
echo "Usage: setup <command>"
echo ""
echo "Commands:"
echo " sync-plugin Sync plugin from WP install to git-tracked folder"
exit 1
;;
esac