Created
November 21, 2019 20:43
-
-
Save evertonfraga/824c72db5e27c46e320ad426c72e6965 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# | |
# It wraps the provided JSON file and adds some metadata to it (source, commit, date). | |
# Based on these instructions: https://github.com/ethereumjs/ethereumjs-block/issues/55 | |
# | |
# Usage: | |
# ./wrap-ethereum-test.sh "https://raw.githubusercontent.com/ethereum/tests/eea4bfbeec5524b2e2c0ff84c8a350fcb3edec23/BasicTests/difficultyEIP2384.json" | |
# The url must contain the commit hash and should point to a raw JSON file | |
# | |
URL=$1 | |
DATE=`date +%Y-%m-%d` | |
COMMIT=$(echo "$URL" | sed -E 's/.+\/([a-f0-9]+)\/.+/\1/') | |
FILENAME=$(echo $URL | sed -E 's/.+\/([^\/]+)$/\1/') | |
echo "URL: $URL\nFILENAME: $FILENAME\nDATE: $DATE" | |
curl $URL | jq -r --arg SOURCE "$URL" --arg COMMIT "$COMMIT" --arg DATE "$DATE" '{ source: $SOURCE, commit: $COMMIT, date: $DATE, tests: .}' > $FILENAME |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment