Created
August 31, 2011 17:07
-
-
Save bobagold/1184075 to your computer and use it in GitHub Desktop.
bash couchdb client
This file contains hidden or 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/bash | |
| url=http://localhost:5984 | |
| rev() { | |
| php -R '$a = json_decode($argn, true); echo $a[$argv[1]];' rev | |
| } | |
| curly() { | |
| echo curl "$@" | |
| curl -sS "$@" | |
| } | |
| curly $url | |
| curly $url/_all_dbs | |
| dburl=$url/ttt | |
| curly -X DELETE $dburl | |
| curly -X PUT $dburl | |
| curly $dburl/_all_docs | |
| curly -d '{"ok": "okay1"}' -X PUT $dburl | |
| curly -d '{"ok": "okay2"}' -X PUT $dburl/ | |
| curly -d '{"ok": "okay3"}' -X POST $dburl/ | |
| curly -d '{"ok": "okay4"}' -X POST -H "Content-Type: application/json" $dburl/ | |
| curly -d '{"ok": "okay5"}' -X PUT $dburl/aaa | tee | rev > revision | |
| revision=`cat revision` | |
| echo ------------ rev=$revision --------- | |
| curly -d '{"ok": "okay6"}' -X PUT $dburl/aaa | |
| curly -d "{\"ok\": \"okay7\", \"_rev\": \"$revision\"}" -X PUT $dburl/aaa | tee | rev > revision | |
| revision=`cat revision` | |
| curly --data-binary @$0 -X PUT -H "Content-Type: application/x-shellscript" $dburl/aaa/code?rev=$revision | |
| curly $dburl/aaa/code | |
| curly $dburl/aaa | |
| echo ============= all =============== | |
| curly $dburl/_all_docs?include_docs=true | |
| #curly -X DELETE $dburl |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment