It would be great, maybe not now, but for the next review, to have a single flag which enables debug. Like a
``` GEM_DEBUG=1 ```. With it at 1 the curl log is saved, the script is launched with ```set -e``` and ```set -x``` and all the other (very useful) debug features you provided.