-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvendor.sh
More file actions
executable file
·64 lines (57 loc) · 1.54 KB
/
Copy pathvendor.sh
File metadata and controls
executable file
·64 lines (57 loc) · 1.54 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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#!/bin/sh
set -eu
SCRIPT_DIR=$( cd "$( dirname "$0" )" && pwd )
TARGET_DIR="$PWD"
usage() {
echo "Rsync templates to your repo"
echo "Usage: vendor.sh [--help]"
echo "Examples:"
echo " # Vendor all templates to the current working directory (dry-run)"
echo " /path/to/Generate-DockerImageVariantsTemplates/vendor.sh -n"
echo
echo " # Vendor all templates to the current working directory"
echo " /path/to/Generate-DockerImageVariantsTemplates/vendor.sh"
echo
echo " # Vendor CI templates to the current working directory"
echo " /path/to/Generate-DockerImageVariantsTemplates/vendor.sh ci"
}
# Exit if we got no options
# if [ $# -eq 0 ]; then usage; exit 1; fi
# Get some options
while test $# -gt 0; do
case "$1" in
-h|--help)
usage
exit 0
;;
-n|--dry-run)
DRY_RUN=1
shift
;;
ci)
SUBCOMMAND_CI=1
shift
;;
*)
echo "Invalid option '$1'" 1>&2
usage
exit 1
;;
esac
done
SUBCOMMAND_CI=${SUBCOMMAND_CI:-}
DRY_RUN=${DRY_RUN:-}
if [ -n "$DRY_RUN" ]; then
set -- '-n'
fi
if [ "$SUBCOMMAND_CI" ]; then
(
cd "$SCRIPT_DIR"
rsync -av .github .vscode generate LICENSE Update-Versions.ps1 "$TARGET_DIR" --exclude=generate/definitions --exclude='generate/templates/*.ps1' "$@"
)
else
(
cd "$SCRIPT_DIR"
rsync -av .github .vscode generate LICENSE Update-Versions.ps1 "$TARGET_DIR" "$@"
)
fi