Skip to content

Commit 79c069f

Browse files
authored
SWIFT-1431: Add spec sync script
1 parent bbea910 commit 79c069f

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

etc/update-spec-test.sh

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
#!/usr/bin/env bash
2+
3+
# This script is used to fetch the latest version of a JSON test from the specification repository
4+
# You can pass it the relative path to a spec file and it will fetch the latest version of the test
5+
# Example usage from driver root directory:
6+
# $ ./etc/update-spec-test.sh crud/tests/unified/deleteMany-let.json
7+
8+
set -o errexit
9+
set -o nounset
10+
11+
if [ ! -d ".git" ]; then
12+
echo "$0: This script must be run from the root of the repository" >&2
13+
exit 1
14+
fi
15+
16+
if [ $# -ne 1 ]; then
17+
echo "$0: This script must be passed exactly one argument for which test to sync" >&2
18+
exit 1
19+
fi
20+
21+
spec_root="Tests/Specs"
22+
23+
tmpdir=`perl -MFile::Temp=tempdir -wle 'print tempdir(TMPDIR => 1, CLEANUP => 0)'`
24+
curl -sL https://github.com/mongodb/specifications/archive/master.zip -o "$tmpdir/specs.zip"
25+
unzip -d "$tmpdir" "$tmpdir/specs.zip" > /dev/null
26+
27+
touch "$spec_root/$1"
28+
rsync -ah "$tmpdir/specifications-master/source/$1" "$spec_root/$1" --delete
29+
30+
rm -rf "$tmpdir"

0 commit comments

Comments
 (0)