publish.sh 647 B

1234567891011121314151617181920212223242526272829
  1. #!/usr/bin/env bash
  2. set -eu
  3. ARDUINOJSON_H="$1"
  4. read_string() {
  5. jq --slurp --raw-input '.' "$1"
  6. }
  7. compile() {
  8. FILE_PATH="$(dirname $0)/$1.cpp"
  9. cat >parameters.json <<END
  10. {
  11. "code":$(read_string "$FILE_PATH"),
  12. "codes": [{"file":"ArduinoJson.h","code":$(read_string "$ARDUINOJSON_H")}],
  13. "options": "warning",
  14. "compiler": "gcc-4.9.4",
  15. "save": true
  16. }
  17. END
  18. URL=$(curl -sS -H "Content-type: application/json" -d @parameters.json https://wandbox.org/api/compile.json | jq --raw-output .url)
  19. rm parameters.json
  20. [ -n "$URL" ] && echo "$1: $URL"
  21. }
  22. compile "JsonGeneratorExample"
  23. compile "JsonParserExample"
  24. compile "MsgPackParserExample"