-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocs-post
More file actions
executable file
·26 lines (20 loc) · 838 Bytes
/
docs-post
File metadata and controls
executable file
·26 lines (20 loc) · 838 Bytes
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
#!/usr/bin/env bash
# POST a zip of generated docs or coverage reports to loadsysdev.
#@TODO: Enforce first and second args.
PROJECT_NAME=${1:-eu-mk2}
TOKEN=${2:-foobar}
DEST_URL=http://docs.loadsysdev.com/docs-manager.php
#@TODO: Add shortcut args for "docs" and "coverage" that set paths appropriately.
#@TODO: Run the appropriate command to generate docs if output path is not already populated.
SRC_DIR=tmp/coverage/html
PROJECT_NAME=${PROJECT_NAME}-coverage
# This ensures no intermediate directories are stored in the ZIP file.
cd "$SRC_DIR" >/dev/null 2>&1
# Send the POST request, using ZIP data fed from stdin
zip -rq8 - * | curl \
-F "authToken=$TOKEN" \
-F "projectName=$PROJECT_NAME" \
-F "file=@-;filename=upload.zip;type=application/zip" \
$DEST_URL
# Clean up json output from curl with an extra newline.
echo ''