changeset 165:a5bda54309ba

add a couchapp for easy/automated setup
author Dirk Olmes <dirk@xanthippe.ping.de>
date Mon, 29 Aug 2011 04:12:01 +0200
parents 3eeda7cec39b
children 04c3b9796b89
files backend/couchdb/CouchApp/feedworm/.couchappignore backend/couchdb/CouchApp/feedworm/.couchapprc backend/couchdb/CouchApp/feedworm/_id backend/couchdb/CouchApp/feedworm/setup.sh backend/couchdb/CouchApp/feedworm/views/feedEntries_by_feed/map.js backend/couchdb/CouchApp/feedworm/views/feedEntry_by_link/map.js backend/couchdb/CouchApp/feedworm/views/feeds/map.js backend/couchdb/CouchApp/feedworm/views/preference/map.js backend/couchdb/CouchApp/feedworm/views/unread_feedEntries_by_feed/map.js
diffstat 9 files changed, 65 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/backend/couchdb/CouchApp/feedworm/.couchappignore	Mon Aug 29 04:12:01 2011 +0200
@@ -0,0 +1,8 @@
+[
+  // filenames matching these regexps will not be pushed to the database
+  // uncomment to activate; separate entries with ","
+  // ".*~$"
+  // ".*\\.swp$"
+  // ".*\\.bak$"
+  "setup.sh"
+]
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/backend/couchdb/CouchApp/feedworm/.couchapprc	Mon Aug 29 04:12:01 2011 +0200
@@ -0,0 +1,7 @@
+{
+    "env" : {
+        "local" : {
+            "db" : "http://localhost:5984/feedworm"
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/backend/couchdb/CouchApp/feedworm/_id	Mon Aug 29 04:12:01 2011 +0200
@@ -0,0 +1,1 @@
+_design/feedworm
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/backend/couchdb/CouchApp/feedworm/setup.sh	Mon Aug 29 04:12:01 2011 +0200
@@ -0,0 +1,14 @@
+#!/bin/bash
+
+
+BASE_URL=${1:-http://localhost:5984}
+DB_URL=${BASE_URL}/feedworm
+
+# create the database if it doesn't yet exist
+curl -f "${DB_URL}" > /dev/null 2>&1
+if [ $? -gt 0 ]; then
+    echo -n "creating the database ... "
+    curl -X PUT ${DB_URL}
+fi
+
+couchapp push local
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/backend/couchdb/CouchApp/feedworm/views/feedEntries_by_feed/map.js	Mon Aug 29 04:12:01 2011 +0200
@@ -0,0 +1,7 @@
+function(doc)
+{
+    if (doc.doctype == "feedEntry")
+    {
+        emit(doc.feed, doc)
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/backend/couchdb/CouchApp/feedworm/views/feedEntry_by_link/map.js	Mon Aug 29 04:12:01 2011 +0200
@@ -0,0 +1,7 @@
+function(doc)
+{
+    if (doc.doctype == "feedEntry")
+    {
+        emit(doc.link, doc)
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/backend/couchdb/CouchApp/feedworm/views/feeds/map.js	Mon Aug 29 04:12:01 2011 +0200
@@ -0,0 +1,7 @@
+function(doc)
+{
+    if (doc.doctype == "feed")
+    {
+        emit(doc._id, doc)
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/backend/couchdb/CouchApp/feedworm/views/preference/map.js	Mon Aug 29 04:12:01 2011 +0200
@@ -0,0 +1,7 @@
+function(doc)
+{
+    if (doc.doctype == "preferences")
+    {
+        emit(doc._id, doc)
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/backend/couchdb/CouchApp/feedworm/views/unread_feedEntries_by_feed/map.js	Mon Aug 29 04:12:01 2011 +0200
@@ -0,0 +1,7 @@
+function(doc)
+{
+    if (doc.doctype == "feedEntry" && doc.read == false)
+    {
+        emit(doc.feed, doc)
+    }
+}