Skip to content

Instantly share code, notes, and snippets.

@homoludens
Created April 25, 2011 07:48
Show Gist options
  • Save homoludens/940260 to your computer and use it in GitHub Desktop.
Save homoludens/940260 to your computer and use it in GitHub Desktop.
Small changes needed to try couchpubtato
diff --git a/README.md b/README.md
index c98438b..24daf12 100644
--- a/README.md
+++ b/README.md
@@ -18,7 +18,7 @@ To try out:
git submodule init
git submodule update
ruby create_test_data.rb http://admin:password@localhost:5894
- node couchpubtato.js http://localhost:5984/feeds
+ node couchpubtato.js http://localhost:5984/nytimes
Then look in the 'articles' database on Couch :)
@@ -44,4 +44,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.
\ No newline at end of file
+THE SOFTWARE.
diff --git a/couchpubtato.js b/couchpubtato.js
index 1562fce..3cf81c2 100644
--- a/couchpubtato.js
+++ b/couchpubtato.js
@@ -85,12 +85,12 @@ var spawnFeedProcess = function( doc ) {
}
emitter.on('change', function (change) {
- if (change.doc._id in children) {
+ if (change && change.doc && (change.doc._id in children)) {
return;
};
var doc = change.doc;
- if (doc.feed && doc.db) {
+ if (doc && (doc.feed && doc.db)) {
doc.couch = couch.protocol + "//" + couch.host;
queueFetch(doc);
}
-});
\ No newline at end of file
+});
diff --git a/create_test_data.rb b/create_test_data.rb
index bbc7992..47a9ca8 100644
--- a/create_test_data.rb
+++ b/create_test_data.rb
@@ -2,7 +2,8 @@
# pass in your couch base url. admin username and password required if you're not in admin party
# e.g. http://admin:password@localhost:5984
-YOURCOUCH = ARGV[0]
+#YOURCOUCH = ARGV[0]
+YOURCOUCH = 'http://127.0.0.1:5984'
feeds = {}
@@ -23,4 +24,4 @@ feeds.each do |feed, value|
puts %x!curl -X PUT #{YOURCOUCH}/#{feed} -H "Content-type":"application/json"!
# make a feed entry in couch for each feed
feeds[feed].each {|a_feed| puts %x!curl -X POST #{YOURCOUCH}/#{feed} -d '{"feed": "#{a_feed}", "db": "articles"}' -H "Content-type":"application/json"!}
-end
\ No newline at end of file
+end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment