Skip to content

Commit 137db9a

Browse files
committed
Merge pull request #56 from loadsys/f/docs-post
F/docs post
2 parents a7e60d8 + 9db9703 commit 137db9a

3 files changed

Lines changed: 28 additions & 0 deletions

File tree

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ The following dependencies are assumed to be available on the target system and
2121

2222
* `bash`
2323
* `composer`
24+
* `curl`
2425
* `git`
2526
* `mail`
2627
* `mysql`

composer.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
"db-sample-data",
3131
"deploy",
3232
"docs-generate",
33+
"docs-post",
3334
"email",
3435
"folder-delete-items-older-than-days",
3536
"git-currentbranch",

docs-post

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#!/usr/bin/env bash
2+
# POST a zip of generated docs or coverage reports to loadsysdev.
3+
4+
#@TODO: Enforce first and second args.
5+
PROJECT_NAME=${1:-eu-mk2}
6+
TOKEN=${2:-foobar}
7+
DEST_URL=http://docs.loadsysdev.com/docs-manager.php
8+
9+
#@TODO: Add shortcut args for "docs" and "coverage" that set paths appropriately.
10+
#@TODO: Run the appropriate command to generate docs if output path is not already populated.
11+
12+
SRC_DIR=tmp/coverage/html
13+
PROJECT_NAME=${PROJECT_NAME}-coverage
14+
15+
# This ensures no intermediate directories are stored in the ZIP file.
16+
cd "$SRC_DIR" >/dev/null 2>&1
17+
18+
# Send the POST request, using ZIP data fed from stdin
19+
zip -rq8 - * | curl \
20+
-F "authToken=$TOKEN" \
21+
-F "projectName=$PROJECT_NAME" \
22+
-F "file=@-;filename=upload.zip;type=application/zip" \
23+
$DEST_URL
24+
25+
# Clean up json output from curl with an extra newline.
26+
echo ''

0 commit comments

Comments
 (0)