Created
September 25, 2015 10:28
-
-
Save tlvince/0a7caf8593c6c95a246a to your computer and use it in GitHub Desktop.
Clone all design docs of a given CouchDB DB. Requires node and couchapp on PATH
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
#!/usr/bin/env bash | |
set -euo pipefail | |
url=${1:-}; [[ $url ]] || { echo "$0 http://couchdb.example.com/db" && exit 1; } | |
curl $url'/_all_docs?startkey="_design/"&endkey="_design/\uffff"' | \ | |
node -pe "JSON.parse(require('fs').readFileSync('/dev/stdin')).rows.map(function(row){return row.id}).join('\n')" | \ | |
while read ddoc; do couchapp clone "$url/$ddoc"; done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment