From 5365bbd9a4b5f45dfc76fcf60f172c28645f7011 Mon Sep 17 00:00:00 2001 From: Max Date: Fri, 16 Aug 2013 13:50:29 -0400 Subject: [PATCH 1/8] Update couchapp version Improves debugging. --- package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 8fb8f01..ff57124 100644 --- a/package.json +++ b/package.json @@ -30,7 +30,7 @@ "test": "grunt test" }, "dependencies": { - "couchapp": "0.9.1", + "couchapp": "0.10.1", "grunt": "~0.3.12", "nano": "3.3.0" }, @@ -40,4 +40,4 @@ "keywords": [ "gruntplugin" ] -} \ No newline at end of file +} From 3e68f281922397a31f4a461367eae5b77a56e603 Mon Sep 17 00:00:00 2001 From: Russell Branca Date: Fri, 16 Nov 2012 16:50:59 -0800 Subject: [PATCH 2/8] Add in support for basic auth and add genDB helper --- tasks/couchapp.js | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/tasks/couchapp.js b/tasks/couchapp.js index 6b7811f..93a36d2 100644 --- a/tasks/couchapp.js +++ b/tasks/couchapp.js @@ -11,6 +11,17 @@ path = require('path'); couchapp = require('couchapp'); urls = require('url'); +var genDB = function(db) { + var parts, dbname, auth; + parts = urls.parse(db); + dbname = parts.pathname.replace(/^\//, ''); + auth = parts.auth ? (parts.auth + '@') : ''; + return { + name: dbname, + url: parts.protocol + '//' + auth + parts.host + }; +}; + module.exports = function(grunt) { // ========================================================================== @@ -30,11 +41,10 @@ module.exports = function(grunt) { var done, parts, nano, dbname, _this; _this = this; done = this.async(); - parts = urls.parse(this.data.db); - dbname = parts.pathname.replace(/^\//, ''); + db = genDB(this.data.db); try { - nano = require('nano')(parts.protocol + '//' + parts.host); - nano.db.destroy(dbname, function(err) { + nano = require('nano')(db.url); + nano.db.destroy(db.name, function(err) { if (err) { if (err.status_code && err.status_code === 404) { if (_this.data.options && _this.data.options.okay_if_missing) { @@ -56,13 +66,14 @@ module.exports = function(grunt) { }); grunt.registerMultiTask("mkcouchdb", "Delete a Couch Database", function() { - var done, parts, nano, dbname, _this; + var done, parts, nano, dbname, auth, _this; _this = this; + done = this.async(); parts = urls.parse(this.data.db); - dbname = parts.pathname.replace(/^\//, ''); + db = genDB(this.data.db); try { - nano = require('nano')(parts.protocol + '//' + parts.host); + nano = require('nano')(db.url); nano.db.create(dbname, function(err) { if (_this.data.options && _this.data.options.okay_if_exists) { if (err){ From 4189d8e88810b98d8f06cdfc94eaa9338842e5e6 Mon Sep 17 00:00:00 2001 From: Max Thayer Date: Fri, 12 Jul 2013 16:15:58 -0400 Subject: [PATCH 3/8] typo --- tasks/couchapp.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tasks/couchapp.js b/tasks/couchapp.js index 93a36d2..c3c3415 100644 --- a/tasks/couchapp.js +++ b/tasks/couchapp.js @@ -74,7 +74,7 @@ module.exports = function(grunt) { db = genDB(this.data.db); try { nano = require('nano')(db.url); - nano.db.create(dbname, function(err) { + nano.db.create(db.name, function(err) { if (_this.data.options && _this.data.options.okay_if_exists) { if (err){ grunt.log.writeln("Database " + dbname + " exists, skipping"); From d4025db1e0f5e483a0d7406df52e7e9a4660c412 Mon Sep 17 00:00:00 2001 From: Max Thayer Date: Wed, 21 Aug 2013 23:49:53 -0400 Subject: [PATCH 4/8] fixed typo --- tasks/couchapp.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/tasks/couchapp.js b/tasks/couchapp.js index c3c3415..acbaa5b 100644 --- a/tasks/couchapp.js +++ b/tasks/couchapp.js @@ -5,11 +5,12 @@ * Licensed under the MIT license. */ -var path, couchapp, nanolib, urls; +var path, couchapp, nanolib, urls, auth; path = require('path'); couchapp = require('couchapp'); urls = require('url'); +auth = require('../lib/auth'); var genDB = function(db) { var parts, dbname, auth; @@ -65,8 +66,13 @@ module.exports = function(grunt) { } }); +<<<<<<< HEAD grunt.registerMultiTask("mkcouchdb", "Delete a Couch Database", function() { var done, parts, nano, dbname, auth, _this; +======= + grunt.registerMultiTask("mkcouchdb", "Make a Couch Database", function() { + var done, parts, nano, dbname, _this; +>>>>>>> fixed typo _this = this; done = this.async(); From ba25597292a581b77fdec5c9e176b48ce75f76ea Mon Sep 17 00:00:00 2001 From: Max Thayer Date: Wed, 21 Aug 2013 23:54:28 -0400 Subject: [PATCH 5/8] added auth lib --- lib/auth.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 lib/auth.js diff --git a/lib/auth.js b/lib/auth.js new file mode 100644 index 0000000..16fe02d --- /dev/null +++ b/lib/auth.js @@ -0,0 +1,12 @@ +exports.getCookie = function(opts, cb){ + var db = nano(opts.db.url); + nano.auth(opts.username, opts.password, function(err, body, headers){ + if(err){ + cb(err); + }else{ + if(headers && headers['set-cookie']){ + cb(null, headers['set-cookie']); + } + } + }); +} \ No newline at end of file From afffe75a73c9fa58db450575eefc9619b70370ca Mon Sep 17 00:00:00 2001 From: Max Thayer Date: Wed, 21 Aug 2013 23:54:41 -0400 Subject: [PATCH 6/8] well, i clearly did something --- tasks/couchapp.js | 5 ----- 1 file changed, 5 deletions(-) diff --git a/tasks/couchapp.js b/tasks/couchapp.js index acbaa5b..1d94ce7 100644 --- a/tasks/couchapp.js +++ b/tasks/couchapp.js @@ -66,13 +66,8 @@ module.exports = function(grunt) { } }); -<<<<<<< HEAD - grunt.registerMultiTask("mkcouchdb", "Delete a Couch Database", function() { - var done, parts, nano, dbname, auth, _this; -======= grunt.registerMultiTask("mkcouchdb", "Make a Couch Database", function() { var done, parts, nano, dbname, _this; ->>>>>>> fixed typo _this = this; done = this.async(); From 5bda4b82c75ed60e6171455082dbb03cc36ef479 Mon Sep 17 00:00:00 2001 From: Max Thayer Date: Wed, 21 Aug 2013 23:58:19 -0400 Subject: [PATCH 7/8] removed auth lib --- lib/auth.js | 12 ------------ tasks/couchapp.js | 1 - 2 files changed, 13 deletions(-) delete mode 100644 lib/auth.js diff --git a/lib/auth.js b/lib/auth.js deleted file mode 100644 index 16fe02d..0000000 --- a/lib/auth.js +++ /dev/null @@ -1,12 +0,0 @@ -exports.getCookie = function(opts, cb){ - var db = nano(opts.db.url); - nano.auth(opts.username, opts.password, function(err, body, headers){ - if(err){ - cb(err); - }else{ - if(headers && headers['set-cookie']){ - cb(null, headers['set-cookie']); - } - } - }); -} \ No newline at end of file diff --git a/tasks/couchapp.js b/tasks/couchapp.js index 1d94ce7..55c07dc 100644 --- a/tasks/couchapp.js +++ b/tasks/couchapp.js @@ -10,7 +10,6 @@ var path, couchapp, nanolib, urls, auth; path = require('path'); couchapp = require('couchapp'); urls = require('url'); -auth = require('../lib/auth'); var genDB = function(db) { var parts, dbname, auth; From e80eb462c9dff8ca44bb34a57faf39001b292991 Mon Sep 17 00:00:00 2001 From: Max Thayer Date: Fri, 6 Sep 2013 08:07:49 -0400 Subject: [PATCH 8/8] update couchapp version number so it can install --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index ff57124..0355b45 100644 --- a/package.json +++ b/package.json @@ -30,7 +30,7 @@ "test": "grunt test" }, "dependencies": { - "couchapp": "0.10.1", + "couchapp": "0.10.*", "grunt": "~0.3.12", "nano": "3.3.0" },