From 42711448407b58398850a9922b93e1617be933ee Mon Sep 17 00:00:00 2001 From: Sean Lang Date: Fri, 9 Oct 2015 19:18:17 -0400 Subject: [PATCH 1/2] fix whitespace issues & add .editorconfig file --- .editorconfig | 7 +++++++ examples/bulk_transform.js | 8 ++++---- examples/lazy_creation_of_views.js | 14 +++++++------- examples/lazy_db_creation_and_replication.js | 6 +++--- examples/pipe.js | 2 +- examples/readme.md | 4 ++-- 6 files changed, 24 insertions(+), 17 deletions(-) create mode 100644 .editorconfig diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 00000000..c57c399f --- /dev/null +++ b/.editorconfig @@ -0,0 +1,7 @@ +[*] +end_of_line = lf +indent_style = space +indent_size = 2 +insert_final_newline = true +max_line_length = 80 +trim_trailing_whitespace = true diff --git a/examples/bulk_transform.js b/examples/bulk_transform.js index ba61348e..ee968094 100644 --- a/examples/bulk_transform.js +++ b/examples/bulk_transform.js @@ -26,16 +26,16 @@ function update_row(row,cb) { function list(offset) { var ended = false; offset = offset || 0; - db.list({include_docs: true, limit: 10, skip: offset}, + db.list({include_docs: true, limit: 10, skip: offset}, function(err, data) { var total, offset, rows; if(err) { console.log('fuuuu: ' + err.message); rows = []; return; } total = data.total_rows; offset = data.offset; rows = data.rows; - if(offset === total) { + if(offset === total) { ended = true; - return; + return; } async.forEach(rows, update_row, function (err) { if(err) { console.log('something failed, check logs'); } @@ -45,4 +45,4 @@ function list(offset) { }); } -list(); \ No newline at end of file +list(); diff --git a/examples/lazy_creation_of_views.js b/examples/lazy_creation_of_views.js index 75df3634..47eb3b9c 100644 --- a/examples/lazy_creation_of_views.js +++ b/examples/lazy_creation_of_views.js @@ -13,7 +13,7 @@ module.exports = function() { var nano = require('nano')('http://localhost:5984') , users = nano.use('users') - , VIEWS = { by_twitter_id: + , VIEWS = { by_twitter_id: { "map": "function(doc) { emit(doc.twitter.screen_name, doc); }" } } ; @@ -56,7 +56,7 @@ function user_create(email_address,secret,name,retries) { /***************************************************************************** * user.find() ****************************************************************************/ - // + // // some more logic needed // what if design document exists but view doesnt, we cant just overwrite it // @@ -69,11 +69,11 @@ function user_find(view, id, opts, tried, callback) { tried = {tried:0, max_retries:2}; } users.view('users', view, opts, function (e,b,h) { - if(e) { + if(e) { var current_view = VIEWS[view]; - if(!current_view) { + if(!current_view) { e.message = 'View is not available'; - return callback(e,b,h); + return callback(e,b,h); } if(tried.tried < tried.max_retries) { if(e.message === 'missing' || e.message === 'deleted') { // create design document @@ -96,7 +96,7 @@ function user_find(view, id, opts, tried, callback) { return; } } - else { return callback(e,b,h); } + else { return callback(e,b,h); } } return callback(null,b,h); }); @@ -111,4 +111,4 @@ return { new: user_new , create: user_create , first: user_first }; -}; \ No newline at end of file +}; diff --git a/examples/lazy_db_creation_and_replication.js b/examples/lazy_db_creation_and_replication.js index b54eb08d..83c6f4cd 100644 --- a/examples/lazy_db_creation_and_replication.js +++ b/examples/lazy_db_creation_and_replication.js @@ -11,7 +11,7 @@ // the License. var nano = require('nano') - , couch = + , couch = { "master" : "http://localhost:5984/landing_m" , "replica" : "http://localhost:5984/landing_r" } @@ -24,7 +24,7 @@ function insert_with_retry(db, email, retries, callback) { } callback = callback || function(){}; db.insert(email, function(err, resp, head) { - if(err) { + if(err) { if(err.message === 'no_db_file' && retries < 1) { var db_name = db.config.db , server = nano(db.config.url) @@ -62,4 +62,4 @@ function replicate_with_retry(master_uri, replica_uri, retries, callback) { }); } -module.exports = {insert: insert_with_retry, replicate: replicate_with_retry}; \ No newline at end of file +module.exports = {insert: insert_with_retry, replicate: replicate_with_retry}; diff --git a/examples/pipe.js b/examples/pipe.js index 04d23ec6..11606a76 100644 --- a/examples/pipe.js +++ b/examples/pipe.js @@ -20,4 +20,4 @@ app.get("/", function(request,response) { db.attachment.get("new", "logo.png").pipe(response); }); -app.listen(3333); \ No newline at end of file +app.listen(3333); diff --git a/examples/readme.md b/examples/readme.md index 093b7cd5..06e02bb1 100644 --- a/examples/readme.md +++ b/examples/readme.md @@ -2,6 +2,6 @@ if you have a sample please feel free to send a pull request. -also the tests are very concise and helpful. +also the tests are very concise and helpful. -i would recommend taking a peek. \ No newline at end of file +i would recommend taking a peek. From 952f32babcb61849af6a9866f6daaf46166e7f62 Mon Sep 17 00:00:00 2001 From: Sean Lang Date: Sun, 11 Oct 2015 17:59:08 -0400 Subject: [PATCH 2/2] upgrade to container-based infrastructure --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index 7de7b97a..929e5438 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,5 +1,6 @@ language: "node_js" env: DEBUG=* +sudo: false branches: only: - master