[40/50] [abbrv] git commit: Initial view editor functionality

2013-02-11 Thread jan
Initial view editor functionality


Project: http://git-wip-us.apache.org/repos/asf/couchdb/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb/commit/43dab9b6
Tree: http://git-wip-us.apache.org/repos/asf/couchdb/tree/43dab9b6
Diff: http://git-wip-us.apache.org/repos/asf/couchdb/diff/43dab9b6

Branch: refs/heads/fauxton
Commit: 43dab9b6e808bbead39175d1d9031cce323dfc15
Parents: 6ab9c65
Author: Russell Branca chewbra...@gmail.com
Authored: Tue Feb 5 17:09:48 2013 -0800
Committer: Russell Branca chewbra...@gmail.com
Committed: Tue Feb 5 17:11:18 2013 -0800

--
 src/fauxton/app/api.js |   10 +
 src/fauxton/app/modules/documents/routes.js|   42 +++
 src/fauxton/app/modules/documents/views.js |  197 +--
 src/fauxton/app/templates/documents/sidebar.html   |4 +-
 .../app/templates/documents/view_editor.html   |   65 +
 src/fauxton/assets/css/cloudant-additions.css  |8 -
 src/fauxton/assets/less/cloudant.less  |   22 ++
 7 files changed, 322 insertions(+), 26 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/couchdb/blob/43dab9b6/src/fauxton/app/api.js
--
diff --git a/src/fauxton/app/api.js b/src/fauxton/app/api.js
index 7aebd37..9ec2894 100644
--- a/src/fauxton/app/api.js
+++ b/src/fauxton/app/api.js
@@ -17,6 +17,16 @@ function(app, Fauxton) {
 initialize: function() {}
   };
 
+  // List of JSHINT errors to ignore
+  // Gets around problem of anonymous functions not being a valid statement
+  FauxtonAPI.excludedViewErrors = [
+Missing name in function declaration.
+  ];
+
+  FauxtonAPI.isIgnorableError = function(msg) {
+return _.contains(FauxtonAPI.excludedViewErrors, msg);
+  };
+
   FauxtonAPI.View = Backbone.View.extend({
 // This should return an array of promises, an empty array, or null
 establish: function() {

http://git-wip-us.apache.org/repos/asf/couchdb/blob/43dab9b6/src/fauxton/app/modules/documents/routes.js
--
diff --git a/src/fauxton/app/modules/documents/routes.js 
b/src/fauxton/app/modules/documents/routes.js
index efaa374..19897e9 100644
--- a/src/fauxton/app/modules/documents/routes.js
+++ b/src/fauxton/app/modules/documents/routes.js
@@ -59,6 +59,47 @@ function(app, FauxtonAPI, Documents, Databases) {
 };
   };
 
+  var newViewEditorCallback = function(databaseName) {
+var data = {
+  database: new Databases.Model({id:databaseName})
+};
+data.designDocs = new Documents.AllDocs(null, {
+  database: data.database,
+  params: {startkey: '_design',
+   endkey: '_design1',
+   include_docs: true}
+});
+
+return {
+  layout: with_tabs_sidebar,
+
+  data: data,
+
+  crumbs: [
+{name: Databases, link: /_all_dbs},
+{name: data.database.id, link: 
Databases.databaseUrl(data.database)}
+  ],
+
+  views: {
+#sidebar-content: new Documents.Views.Sidebar({
+  collection: data.designDocs
+}),
+
+#tabs: new Documents.Views.Tabs({
+  collection: data.designDocs,
+  database: data.database.id
+}),
+
+#dashboard-content: new Documents.Views.ViewEditor({
+  model: data.database,
+  ddocs: data.designDocs
+})
+  },
+
+  apiUrl: data.database.url()
+};
+  };
+
   // HACK: this kind of works
   // Basically need a way to share state between different routes, for
   // instance making a new doc won't work for switching back and forth
@@ -260,6 +301,7 @@ function(app, FauxtonAPI, Documents, Databases) {
 },
 
 database/:database/new: newDocCodeEditorCallback,
+database/:database/new_view: newViewEditorCallback,
 
 // TODO: fix optional search params
 // Can't get :view(?*search) to work

http://git-wip-us.apache.org/repos/asf/couchdb/blob/43dab9b6/src/fauxton/app/modules/documents/views.js
--
diff --git a/src/fauxton/app/modules/documents/views.js 
b/src/fauxton/app/modules/documents/views.js
index 30a799a..41d0d43 100644
--- a/src/fauxton/app/modules/documents/views.js
+++ b/src/fauxton/app/modules/documents/views.js
@@ -472,16 +472,14 @@ function(app, FauxtonAPI, Codemirror, JSHint) {
 json = JSON.parse(this.editor.getValue());
 this.model.set(json);
 notification = FauxtonAPI.addNotification({msg: Saving document.});
-this.model.save().error(
-  function(xhr) {
-var responseText = JSON.parse(xhr.responseText).reason;
-notification = FauxtonAPI.addNotification({
-  msg: Save failed:  + responseText,
-  type: error,
-  clear: true
-});
-   

[39/50] [abbrv] git commit: add changes feed to database

2013-02-11 Thread jan
add changes feed to database


Project: http://git-wip-us.apache.org/repos/asf/couchdb/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb/commit/6001be11
Tree: http://git-wip-us.apache.org/repos/asf/couchdb/tree/6001be11
Diff: http://git-wip-us.apache.org/repos/asf/couchdb/diff/6001be11

Branch: refs/heads/fauxton
Commit: 6001be116437a65e0c39c3bae0dd302816ddabf5
Parents: 2c48183
Author: Garren Smith garren.sm...@gmail.com
Authored: Tue Feb 5 14:56:58 2013 +0200
Committer: Garren Smith garren.sm...@gmail.com
Committed: Tue Feb 5 14:56:58 2013 +0200

--
 src/fauxton/TODO.md|2 +-
 src/fauxton/app/modules/databases/resources.js |   31 +++
 src/fauxton/app/modules/documents/routes.js|   69 +++
 src/fauxton/app/modules/documents/views.js |   34 +++
 src/fauxton/app/templates/documents/changes.html   |   16 
 src/fauxton/app/templates/documents/tabs.html  |3 +-
 src/fauxton/app/templates/layouts/with_tabs.html   |   13 +++
 .../app/templates/layouts/with_tabs_sidebar.html   |2 +-
 8 files changed, 150 insertions(+), 20 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/couchdb/blob/6001be11/src/fauxton/TODO.md
--
diff --git a/src/fauxton/TODO.md b/src/fauxton/TODO.md
index 31127e0..b929e05 100644
--- a/src/fauxton/TODO.md
+++ b/src/fauxton/TODO.md
@@ -11,7 +11,7 @@ In no particular order
 - [ ] show design docs only
 - [ ] fix delete doc button UI bug
 - [ ] delete multiple docs via _bulk_docs
-- [ ] show change events in database view
+- [x] show change events in database view
 - [ ] pouchdb addon
 - [ ] bespoke bootstrap style
 - [ ] responsive interface

http://git-wip-us.apache.org/repos/asf/couchdb/blob/6001be11/src/fauxton/app/modules/databases/resources.js
--
diff --git a/src/fauxton/app/modules/databases/resources.js 
b/src/fauxton/app/modules/databases/resources.js
index 76f8c6e..73af4f7 100644
--- a/src/fauxton/app/modules/databases/resources.js
+++ b/src/fauxton/app/modules/databases/resources.js
@@ -39,6 +39,37 @@ function(app, FauxtonAPI, Documents) {
   } else {
 return app.host + / + this.id;
   }
+},
+
+buildChanges: function (params) {
+  this.changes = new Databases.Changes({
+database: this,
+params: params
+  });
+
+  return this.changes;
+}
+  });
+
+  Databases.Changes = Backbone.Collection.extend({
+
+initialize: function(options) {
+  this.database = options.database;
+  this.params = options.params;
+},
+
+url: function () {
+  var query = ;
+  if (this.params) {
+query = ? + $.param(this.params);
+  }
+
+  return app.host + '/' + this.database.id + '/_changes' + query;
+},
+
+parse: function (resp) {
+  this.last_seq = resp.last_seq;
+  return resp.results;
 }
   });
 

http://git-wip-us.apache.org/repos/asf/couchdb/blob/6001be11/src/fauxton/app/modules/documents/routes.js
--
diff --git a/src/fauxton/app/modules/documents/routes.js 
b/src/fauxton/app/modules/documents/routes.js
index d851caf..dfa208f 100644
--- a/src/fauxton/app/modules/documents/routes.js
+++ b/src/fauxton/app/modules/documents/routes.js
@@ -1,11 +1,11 @@
 define([
-  app,
+   app,
 
-  api,
+   api,
 
-  // Modules
-  modules/documents/resources,
-  modules/databases/base
+   // Modules
+   modules/documents/resources,
+   modules/databases/base
 ],
 
 function(app, FauxtonAPI, Documents, Databases) {
@@ -25,8 +25,8 @@ function(app, FauxtonAPI, Documents, Databases) {
 data.designDocs = new Documents.AllDocs(null, {
   database: data.database,
   params: {startkey: '_design',
-   endkey: '_design1',
-   include_docs: true}
+endkey: '_design1',
+include_docs: true}
 });
 
 var options = app.getParams();
@@ -73,8 +73,8 @@ function(app, FauxtonAPI, Documents, Databases) {
 data.designDocs = new Documents.AllDocs(null, {
   database: data.database,
   params: {startkey: '_design',
-   endkey: '_design1',
-   include_docs: true}
+endkey: '_design1',
+include_docs: true}
 });
 
 var options = app.getParams();
@@ -120,8 +120,8 @@ function(app, FauxtonAPI, Documents, Databases) {
   data.designDocs = new Documents.AllDocs(null, {
 database: data.database,
 params: {startkey: '_design',
- endkey: '_design1',
- include_docs: true}
+  endkey: '_design1',
+  include_docs: true}
   });
 
   var options = app.getParams();
@@ -182,8 +182,8 @@ function(app, 

[41/50] [abbrv] git commit: Merge pull request #14 from garrensmith/small-fixes

2013-02-11 Thread jan
Merge pull request #14 from garrensmith/small-fixes

Changes + log date formating + delete database

Project: http://git-wip-us.apache.org/repos/asf/couchdb/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb/commit/9dfa09a0
Tree: http://git-wip-us.apache.org/repos/asf/couchdb/tree/9dfa09a0
Diff: http://git-wip-us.apache.org/repos/asf/couchdb/diff/9dfa09a0

Branch: refs/heads/fauxton
Commit: 9dfa09a0968c4719982f97f1a959bd976d25c2a8
Parents: 43dab9b 6001be1
Author: Russell Branca chewbra...@gmail.com
Authored: Tue Feb 5 17:35:55 2013 -0800
Committer: Russell Branca chewbra...@gmail.com
Committed: Tue Feb 5 17:35:55 2013 -0800

--
 src/fauxton/TODO.md|6 +-
 src/fauxton/app/addons/logs/resources.js   |   27 +-
 .../app/addons/logs/templates/dashboard.html   |   12 ++--
 src/fauxton/app/modules/databases/resources.js |   31 +++
 src/fauxton/app/modules/documents/routes.js|   71 +++
 src/fauxton/app/modules/documents/views.js |   55 +++-
 src/fauxton/app/templates/documents/changes.html   |   16 
 src/fauxton/app/templates/documents/tabs.html  |7 +-
 src/fauxton/app/templates/layouts/with_tabs.html   |   13 +++
 .../app/templates/layouts/with_tabs_sidebar.html   |2 +-
 10 files changed, 206 insertions(+), 34 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/couchdb/blob/9dfa09a0/src/fauxton/app/modules/documents/routes.js
--
diff --cc src/fauxton/app/modules/documents/routes.js
index 19897e9,dfa208f..ab66670
--- a/src/fauxton/app/modules/documents/routes.js
+++ b/src/fauxton/app/modules/documents/routes.js
@@@ -300,8 -259,42 +300,43 @@@ function(app, FauxtonAPI, Documents, Da
};
  },
  
+ database/:database/_changes(:params): function(databaseName, params) {
+   var data = {
+ database: new Databases.Model({id:databaseName})
+   };
+ 
+   var options = app.getParams();
+   data.database.buildChanges(options);
+ 
+   return {
+ layout: with_tabs,
+ 
+ data: data,
+ 
+ crumbs: [
+   {name: Databases, link: /_all_dbs},
+   {name: data.database.id, link: 
Databases.databaseUrl(data.database)},
+   {name: _changes, link: /_changes}
+ ],
+ 
+ views: {
+   #dashboard-content: new Documents.Views.Changes({
+ collection: data.database.changes
+   }),
+ 
+   #tabs: new Documents.Views.Tabs({
+ collection: data.designDocs,
+ database: data.database,
+ active_id: 'changes'
+   })
+ },
+ 
+ apiUrl: data.database.changes.url()
+   };
+ },
+ 
  database/:database/new: newDocCodeEditorCallback,
 +database/:database/new_view: newViewEditorCallback,
  
  // TODO: fix optional search params
  // Can't get :view(?*search) to work

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9dfa09a0/src/fauxton/app/modules/documents/views.js
--



[33/50] [abbrv] git commit: fix COUCHDB-1653

2013-02-11 Thread jan
fix COUCHDB-1653

AM_... is obsolote. use AC_CONFIG_HEADERS instead.


Project: http://git-wip-us.apache.org/repos/asf/couchdb/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb/commit/e62fa496
Tree: http://git-wip-us.apache.org/repos/asf/couchdb/tree/e62fa496
Diff: http://git-wip-us.apache.org/repos/asf/couchdb/diff/e62fa496

Branch: refs/heads/fauxton
Commit: e62fa49621e7f4725afafa2e1ba4d3ae68cd1dbb
Parents: f506050
Author: benoitc bchesn...@gmail.com
Authored: Sat Jan 26 21:51:10 2013 +0100
Committer: Russell Branca chewbra...@gmail.com
Committed: Thu Jan 31 11:02:06 2013 -0800

--
 configure.ac |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/couchdb/blob/e62fa496/configure.ac
--
diff --git a/configure.ac b/configure.ac
index 7ce4842..aa7a176 100644
--- a/configure.ac
+++ b/configure.ac
@@ -19,7 +19,7 @@ AC_CONFIG_SRCDIR([CHANGES])
 AC_CONFIG_AUX_DIR([build-aux])
 AC_CONFIG_MACRO_DIR([m4])
 
-AM_CONFIG_HEADER([config.h])
+AC_CONFIG_HEADER([config.h])
 AC_CONFIG_HEADERS([src/snappy/google-snappy/config.h])
 
 AM_INIT_AUTOMAKE([1.6.3 foreign])



[49/50] [abbrv] git commit: Remove remaining Cloudant references

2013-02-11 Thread jan
Remove remaining Cloudant references


Project: http://git-wip-us.apache.org/repos/asf/couchdb/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb/commit/d3751ee1
Tree: http://git-wip-us.apache.org/repos/asf/couchdb/tree/d3751ee1
Diff: http://git-wip-us.apache.org/repos/asf/couchdb/diff/d3751ee1

Branch: refs/heads/fauxton
Commit: d3751ee13028cc5a6bd7b37f68c354c6f68c296b
Parents: ba682f4
Author: Russell Branca chewbra...@gmail.com
Authored: Wed Feb 6 12:53:16 2013 -0800
Committer: Russell Branca chewbra...@gmail.com
Committed: Wed Feb 6 12:53:16 2013 -0800

--
 src/fauxton/assets/less/cloudant.less |   95 
 src/fauxton/assets/less/fauxton.less  |   95 
 src/fauxton/grunt.js  |2 +-
 3 files changed, 96 insertions(+), 96 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/couchdb/blob/d3751ee1/src/fauxton/assets/less/cloudant.less
--
diff --git a/src/fauxton/assets/less/cloudant.less 
b/src/fauxton/assets/less/cloudant.less
deleted file mode 100644
index 1af92ee..000
--- a/src/fauxton/assets/less/cloudant.less
+++ /dev/null
@@ -1,95 +0,0 @@
-/*  Licensed under the Apache License, Version 2.0 (the License); you may not
- *  use this file except in compliance with the License. You may obtain a copy 
of
- *  the License at
- *
- *http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an AS IS BASIS, WITHOUT
- *  WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- *  License for the specific language governing permissions and limitations 
under
- *  the License.
- */
-
-/*!
- *
- * Cloudant less style files
- *
- */
-@import bootstrap/bootstrap.less;
-@import config.less;
-@import logs.less;
-@import prettyprint.less;
-@import database.less;
-
-/*!
- *
- * OVERRIDES
- *
- * Override styles from included less files here. Record where the style is
- * originally defined.
- *
- */
-
-//
-// Breadcrumbs
-
-.breadcrumb {
-  background-color: transparent;
-  padding-left: 0px;
-  li {
-color: @grayLight;
-background-color: transparent;
-a {
-  color: @grayLight;
-}
-  }
-  .divider {
-padding: 0 5px;
-color: @grayLight; //ccc
-  }
-  .active {
-color: @black;
-font-weight: bold;
-  }
-}
-
-
-// Navs
-// --
-
-.nav-tabs  li  a {
-  background-color: @grayLighter;
-}
-
-.dropdown-menu li  a {
-  font-size: 12px;
-}
-
-.nav-list .divider {
-  color: @grayLight;
-  // This function is defined in mixins
-  .nav-divider(transparent, @white);
-}
-
-
-// Misc
-// --
-
-pre.view-code-error {
-color: red !important; // yuck
-}
-
-.CodeMirror-scroll {
-height: auto;
-overflow-y: visible;
-}
-
-#define-view form textarea.js-editor {
-  width: 95%;
-}
-
-#define-view .CodeMirror-scroll {
-  height: auto;
-  min-height: 50px;
-}

http://git-wip-us.apache.org/repos/asf/couchdb/blob/d3751ee1/src/fauxton/assets/less/fauxton.less
--
diff --git a/src/fauxton/assets/less/fauxton.less 
b/src/fauxton/assets/less/fauxton.less
new file mode 100644
index 000..0bbde28
--- /dev/null
+++ b/src/fauxton/assets/less/fauxton.less
@@ -0,0 +1,95 @@
+/*  Licensed under the Apache License, Version 2.0 (the License); you may not
+ *  use this file except in compliance with the License. You may obtain a copy 
of
+ *  the License at
+ *
+ *http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an AS IS BASIS, WITHOUT
+ *  WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ *  License for the specific language governing permissions and limitations 
under
+ *  the License.
+ */
+
+/*!
+ *
+ * Fauxton less style files
+ *
+ */
+@import bootstrap/bootstrap.less;
+@import config.less;
+@import logs.less;
+@import prettyprint.less;
+@import database.less;
+
+/*!
+ *
+ * OVERRIDES
+ *
+ * Override styles from included less files here. Record where the style is
+ * originally defined.
+ *
+ */
+
+//
+// Breadcrumbs
+
+.breadcrumb {
+  background-color: transparent;
+  padding-left: 0px;
+  li {
+color: @grayLight;
+background-color: transparent;
+a {
+  color: @grayLight;
+}
+  }
+  .divider {
+padding: 0 5px;
+color: @grayLight; //ccc
+  }
+  .active {
+color: @black;
+font-weight: bold;
+  }
+}
+
+
+// Navs
+// --
+
+.nav-tabs  li  a {
+  background-color: @grayLighter;
+}
+
+.dropdown-menu li  a {
+  font-size: 12px;
+}
+
+.nav-list .divider {
+  color: @grayLight;
+  // This function is defined in mixins
+  

[50/50] [abbrv] git commit: Adding fauxton libs to NOTICE

2013-02-11 Thread jan
Updated Branches:
  refs/heads/fauxton [created] c31fa4bfb


Adding fauxton libs to NOTICE


Project: http://git-wip-us.apache.org/repos/asf/couchdb/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb/commit/c31fa4bf
Tree: http://git-wip-us.apache.org/repos/asf/couchdb/tree/c31fa4bf
Diff: http://git-wip-us.apache.org/repos/asf/couchdb/diff/c31fa4bf

Branch: refs/heads/fauxton
Commit: c31fa4bfb3448b04c9e5f27a656858e81d476e80
Parents: d3751ee
Author: Russell Branca chewbra...@gmail.com
Authored: Wed Feb 6 13:27:12 2013 -0800
Committer: Russell Branca chewbra...@gmail.com
Committed: Wed Feb 6 13:27:12 2013 -0800

--
 NOTICE |   36 
 1 files changed, 36 insertions(+), 0 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/couchdb/blob/c31fa4bf/NOTICE
--
diff --git a/NOTICE b/NOTICE
index ef3ff9e..9530748 100644
--- a/NOTICE
+++ b/NOTICE
@@ -73,3 +73,39 @@ This product also includes the following third-party 
components:
  * CoffeeScript (http://coffeescript.org/)
 
   Copyright 2011, Jeremy Ashkenas
+
+ * almond.js (http://github.com/jrburke/almond)
+
+  Copyright 2011, The Dojo Foundation
+
+ * backbone.js (http://backbonejs.org/)
+
+  Copyright 2012, Jeremy Ashkenas, DocumentCloud Inc.
+
+ * Bootstrap (http://twitter.github.com/bootstrap/)
+
+  Copyright 2012, Twitter, Inc.
+
+ * d3.js (http://d3js.org)
+
+  Copyright 2012, Michael Bostock
+
+ * JSHint (http://jshint.com/)
+
+  Copyright 2002, Douglas Crockford, modifications by JSHint Community
+
+ * Lodash (http://lodash.com/)
+
+  Copyright 2012, John-David Dalton http://allyoucanleet.com/
+
+ * nvd3.js (http://nvd3.org/)
+
+  Copyright 2012, Novus Partners, Inc.
+
+ * backbone.layoutmanager.js 
(https://github.com/tbranyen/backbone.layoutmanager)
+
+  Copyright 2012, Tim Branyen (@tbranyen)
+
+ * prettify.js (http://code.google.com/p/google-code-prettify/)
+
+  Copyright 2011, Mike Samuel et al



[45/50] [abbrv] git commit: Add Apache license to html templates

2013-02-11 Thread jan
Add Apache license to html templates


Project: http://git-wip-us.apache.org/repos/asf/couchdb/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb/commit/c52bcfd7
Tree: http://git-wip-us.apache.org/repos/asf/couchdb/tree/c52bcfd7
Diff: http://git-wip-us.apache.org/repos/asf/couchdb/diff/c52bcfd7

Branch: refs/heads/fauxton
Commit: c52bcfd7476065e07a99d10d3b2c072b3615
Parents: fc1e640
Author: Russell Branca chewbra...@gmail.com
Authored: Tue Feb 5 23:15:59 2013 -0800
Committer: Russell Branca chewbra...@gmail.com
Committed: Tue Feb 5 23:15:59 2013 -0800

--
 .../app/addons/config/templates/dashboard.html |   14 ++
 src/fauxton/app/addons/config/templates/item.html  |   14 ++
 .../app/addons/logs/templates/dashboard.html   |   14 ++
 .../app/addons/logs/templates/filterItem.html  |   14 ++
 src/fauxton/app/addons/logs/templates/sidebar.html |   14 ++
 .../app/addons/stats/templates/by_method.html  |   14 ++
 .../app/addons/stats/templates/pie_table.html  |   14 ++
 src/fauxton/app/addons/stats/templates/stats.html  |   14 ++
 .../app/addons/stats/templates/statselect.html |   14 ++
 src/fauxton/app/templates/databases/item.html  |   14 ++
 src/fauxton/app/templates/databases/list.html  |   14 ++
 src/fauxton/app/templates/databases/sidebar.html   |   14 ++
 .../app/templates/documents/all_docs_item.html |   14 ++
 .../app/templates/documents/all_docs_list.html |   14 ++
 src/fauxton/app/templates/documents/changes.html   |   14 ++
 src/fauxton/app/templates/documents/doc.html   |   14 ++
 .../app/templates/documents/doc_field_editor.html  |   14 ++
 .../templates/documents/doc_field_editor_tabs.html |   14 ++
 .../app/templates/documents/index_menu_item.html   |   14 ++
 .../app/templates/documents/index_row_docular.html |   14 ++
 .../app/templates/documents/index_row_tabular.html |   14 ++
 src/fauxton/app/templates/documents/search.html|   14 ++
 src/fauxton/app/templates/documents/sidebar.html   |   14 ++
 src/fauxton/app/templates/documents/tabs.html  |   14 ++
 .../app/templates/documents/view_editor.html   |   14 ++
 src/fauxton/app/templates/fauxton/api_bar.html |   14 ++
 src/fauxton/app/templates/fauxton/breadcrumbs.html |   14 ++
 src/fauxton/app/templates/fauxton/nav_bar.html |   14 ++
 .../app/templates/fauxton/notification.html|   14 ++
 src/fauxton/app/templates/layouts/one_pane.html|   14 ++
 src/fauxton/app/templates/layouts/two_pane.html|   14 ++
 .../app/templates/layouts/with_right_sidebar.html  |   14 ++
 .../app/templates/layouts/with_sidebar.html|   14 ++
 src/fauxton/app/templates/layouts/with_tabs.html   |   14 ++
 .../app/templates/layouts/with_tabs_sidebar.html   |   14 ++
 35 files changed, 490 insertions(+), 0 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/couchdb/blob/c52bcfd7/src/fauxton/app/addons/config/templates/dashboard.html
--
diff --git a/src/fauxton/app/addons/config/templates/dashboard.html 
b/src/fauxton/app/addons/config/templates/dashboard.html
index 889397f..7cff90a 100644
--- a/src/fauxton/app/addons/config/templates/dashboard.html
+++ b/src/fauxton/app/addons/config/templates/dashboard.html
@@ -1,3 +1,17 @@
+!--
+Licensed under the Apache License, Version 2.0 (the License); you may not
+use this file except in compliance with the License. You may obtain a copy of
+the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an AS IS BASIS, WITHOUT
+WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+License for the specific language governing permissions and limitations under
+the License.
+--
+
 div class=row
   div class=span2 offset10
 button id=add-section href=# class=btn btn-primary button-margin

http://git-wip-us.apache.org/repos/asf/couchdb/blob/c52bcfd7/src/fauxton/app/addons/config/templates/item.html
--
diff --git a/src/fauxton/app/addons/config/templates/item.html 
b/src/fauxton/app/addons/config/templates/item.html
index 7acdc2d..3e6e4ee 100644
--- a/src/fauxton/app/addons/config/templates/item.html
+++ b/src/fauxton/app/addons/config/templates/item.html
@@ -1,3 +1,17 @@
+!--
+Licensed under the Apache License, 

[46/50] [abbrv] git commit: Add Apache license to less stylings

2013-02-11 Thread jan
Add Apache license to less stylings


Project: http://git-wip-us.apache.org/repos/asf/couchdb/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb/commit/8096445d
Tree: http://git-wip-us.apache.org/repos/asf/couchdb/tree/8096445d
Diff: http://git-wip-us.apache.org/repos/asf/couchdb/diff/8096445d

Branch: refs/heads/fauxton
Commit: 8096445dca52730ccc8c30071e64f3caa4608e1b
Parents: c52bcfd
Author: Russell Branca chewbra...@gmail.com
Authored: Tue Feb 5 23:22:59 2013 -0800
Committer: Russell Branca chewbra...@gmail.com
Committed: Tue Feb 5 23:22:59 2013 -0800

--
 src/fauxton/assets/less/cloudant.less|   13 +
 src/fauxton/assets/less/config.less  |   13 +
 src/fauxton/assets/less/couchdb.less |   13 +
 src/fauxton/assets/less/database.less|   13 +
 src/fauxton/assets/less/logs.less|   13 +
 src/fauxton/assets/less/prettyprint.less |   13 +
 6 files changed, 78 insertions(+), 0 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/couchdb/blob/8096445d/src/fauxton/assets/less/cloudant.less
--
diff --git a/src/fauxton/assets/less/cloudant.less 
b/src/fauxton/assets/less/cloudant.less
index deae5e0..1af92ee 100644
--- a/src/fauxton/assets/less/cloudant.less
+++ b/src/fauxton/assets/less/cloudant.less
@@ -1,3 +1,16 @@
+/*  Licensed under the Apache License, Version 2.0 (the License); you may not
+ *  use this file except in compliance with the License. You may obtain a copy 
of
+ *  the License at
+ *
+ *http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an AS IS BASIS, WITHOUT
+ *  WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ *  License for the specific language governing permissions and limitations 
under
+ *  the License.
+ */
+
 /*!
  *
  * Cloudant less style files

http://git-wip-us.apache.org/repos/asf/couchdb/blob/8096445d/src/fauxton/assets/less/config.less
--
diff --git a/src/fauxton/assets/less/config.less 
b/src/fauxton/assets/less/config.less
index a622a55..fe03796 100644
--- a/src/fauxton/assets/less/config.less
+++ b/src/fauxton/assets/less/config.less
@@ -1,3 +1,16 @@
+/*  Licensed under the Apache License, Version 2.0 (the License); you may not
+ *  use this file except in compliance with the License. You may obtain a copy 
of
+ *  the License at
+ *
+ *http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an AS IS BASIS, WITHOUT
+ *  WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ *  License for the specific language governing permissions and limitations 
under
+ *  the License.
+ */
+
 .config-item {
   height: 41px;
 

http://git-wip-us.apache.org/repos/asf/couchdb/blob/8096445d/src/fauxton/assets/less/couchdb.less
--
diff --git a/src/fauxton/assets/less/couchdb.less 
b/src/fauxton/assets/less/couchdb.less
index 8b7e1d9..20da486 100644
--- a/src/fauxton/assets/less/couchdb.less
+++ b/src/fauxton/assets/less/couchdb.less
@@ -1,3 +1,16 @@
+/*  Licensed under the Apache License, Version 2.0 (the License); you may not
+ *  use this file except in compliance with the License. You may obtain a copy 
of
+ *  the License at
+ *
+ *http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an AS IS BASIS, WITHOUT
+ *  WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ *  License for the specific language governing permissions and limitations 
under
+ *  the License.
+ */
+
 /*!
  *
  * CouchDB less style files

http://git-wip-us.apache.org/repos/asf/couchdb/blob/8096445d/src/fauxton/assets/less/database.less
--
diff --git a/src/fauxton/assets/less/database.less 
b/src/fauxton/assets/less/database.less
index 19cca2e..74a990f 100644
--- a/src/fauxton/assets/less/database.less
+++ b/src/fauxton/assets/less/database.less
@@ -1,3 +1,16 @@
+/*  Licensed under the Apache License, Version 2.0 (the License); you may not
+ *  use this file except in compliance with the License. You may obtain a copy 
of
+ *  the License at
+ *
+ *http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an AS IS BASIS, WITHOUT
+ *  WARRANTIES OR CONDITIONS OF ANY 

[42/50] [abbrv] git commit: Update changes for links to docs and a few other things

2013-02-11 Thread jan
Update changes for links to docs and a few other things


Project: http://git-wip-us.apache.org/repos/asf/couchdb/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb/commit/cc9f021b
Tree: http://git-wip-us.apache.org/repos/asf/couchdb/tree/cc9f021b
Diff: http://git-wip-us.apache.org/repos/asf/couchdb/diff/cc9f021b

Branch: refs/heads/fauxton
Commit: cc9f021b2f610919a61ccad8b9172ca6e87696c5
Parents: 9dfa09a
Author: Russell Branca chewbra...@gmail.com
Authored: Tue Feb 5 17:58:09 2013 -0800
Committer: Russell Branca chewbra...@gmail.com
Committed: Tue Feb 5 17:58:09 2013 -0800

--
 src/fauxton/app/modules/databases/resources.js   |2 +
 src/fauxton/app/modules/documents/routes.js  |   14 ++--
 src/fauxton/app/modules/documents/views.js   |   13 +--
 src/fauxton/app/templates/documents/changes.html |   18 +++-
 4 files changed, 27 insertions(+), 20 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/couchdb/blob/cc9f021b/src/fauxton/app/modules/databases/resources.js
--
diff --git a/src/fauxton/app/modules/databases/resources.js 
b/src/fauxton/app/modules/databases/resources.js
index 73af4f7..0d2f311 100644
--- a/src/fauxton/app/modules/databases/resources.js
+++ b/src/fauxton/app/modules/databases/resources.js
@@ -34,6 +34,8 @@ function(app, FauxtonAPI, Documents) {
 url: function(context) {
   if (context === index) {
 return /database/ + this.id + /_all_docs;
+   } else if (context === changes) {
+return /database/ + this.id + /_changes?descending=truelimit=100;
   } else if (context === app) {
 return /database/ + this.id;
   } else {

http://git-wip-us.apache.org/repos/asf/couchdb/blob/cc9f021b/src/fauxton/app/modules/documents/routes.js
--
diff --git a/src/fauxton/app/modules/documents/routes.js 
b/src/fauxton/app/modules/documents/routes.js
index ab66670..6eddb03 100644
--- a/src/fauxton/app/modules/documents/routes.js
+++ b/src/fauxton/app/modules/documents/routes.js
@@ -1,11 +1,11 @@
 define([
-   app,
+  app,
 
-   api,
+  api,
 
-   // Modules
-   modules/documents/resources,
-   modules/databases/base
+  // Modules
+  modules/documents/resources,
+  modules/databases/base
 ],
 
 function(app, FauxtonAPI, Documents, Databases) {
@@ -77,7 +77,7 @@ function(app, FauxtonAPI, Documents, Databases) {
 
   crumbs: [
 {name: Databases, link: /_all_dbs},
-{name: data.database.id, link: 
Databases.databaseUrl(data.database)}
+{name: data.database.id, link: data.database.url('app')}
   ],
 
   views: {
@@ -321,7 +321,7 @@ function(app, FauxtonAPI, Documents, Databases) {
 
 views: {
   #dashboard-content: new Documents.Views.Changes({
-collection: data.database.changes
+model: data.database
   }),
 
   #tabs: new Documents.Views.Tabs({

http://git-wip-us.apache.org/repos/asf/couchdb/blob/cc9f021b/src/fauxton/app/modules/documents/views.js
--
diff --git a/src/fauxton/app/modules/documents/views.js 
b/src/fauxton/app/modules/documents/views.js
index d41d53e..d11b96c 100644
--- a/src/fauxton/app/modules/documents/views.js
+++ b/src/fauxton/app/modules/documents/views.js
@@ -30,8 +30,8 @@ function(app, FauxtonAPI, Codemirror, JSHint) {
 serialize: function () {
   return {
 // TODO make this not hard coded here
-changes_url: '#database/'+ this.database.id + 
'/_changes?descending=truelimit=100',
-db_url: '#database/'+ this.database.id + '/_all_docs?limit=100'
+changes_url: '#' + this.database.url('changes'),
+db_url: '#' + this.database.url('index') + '?limit=100'
   };
 },
 
@@ -56,12 +56,10 @@ function(app, FauxtonAPI, Codemirror, JSHint) {
 
   if (!result) { return; }
 
-  var promise = this.database.destroy();
-  promise.done(function () {
+  return this.database.destroy().done(function () {
 app.router.navigate('/', {trigger: true});
   });
 }
-
   });
 
   Views.SearchBox = FauxtonAPI.View.extend({
@@ -848,13 +846,14 @@ function(app, FauxtonAPI, Codemirror, JSHint) {
 
 establish: function() {
   return [
-this.collection.fetch()
+this.model.changes.fetch()
   ];
 },
 
 serialize: function () {
   return {
-changes: this.collection.toJSON()
+changes: this.model.changes.toJSON(),
+database: this.model
   };
 }
 

http://git-wip-us.apache.org/repos/asf/couchdb/blob/cc9f021b/src/fauxton/app/templates/documents/changes.html
--
diff 

[48/50] [abbrv] git commit: Quick fix for tabs and the change in expected data structure

2013-02-11 Thread jan
Quick fix for tabs and the change in expected data structure


Project: http://git-wip-us.apache.org/repos/asf/couchdb/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb/commit/ba682f48
Tree: http://git-wip-us.apache.org/repos/asf/couchdb/tree/ba682f48
Diff: http://git-wip-us.apache.org/repos/asf/couchdb/diff/ba682f48

Branch: refs/heads/fauxton
Commit: ba682f48aa65961877b5a5de0ebfc8a2c87e3db7
Parents: fc3a498
Author: Russell Branca chewbra...@gmail.com
Authored: Wed Feb 6 11:17:15 2013 -0800
Committer: Russell Branca chewbra...@gmail.com
Committed: Wed Feb 6 11:17:15 2013 -0800

--
 src/fauxton/app/modules/documents/routes.js |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/couchdb/blob/ba682f48/src/fauxton/app/modules/documents/routes.js
--
diff --git a/src/fauxton/app/modules/documents/routes.js 
b/src/fauxton/app/modules/documents/routes.js
index 5e5838d..801fa60 100644
--- a/src/fauxton/app/modules/documents/routes.js
+++ b/src/fauxton/app/modules/documents/routes.js
@@ -99,7 +99,7 @@ function(app, FauxtonAPI, Documents, Databases) {
 
 #tabs: new Documents.Views.Tabs({
   collection: data.designDocs,
-  database: data.database.id
+  database: data.database
 }),
 
 #dashboard-content: new Documents.Views.ViewEditor({
@@ -401,7 +401,7 @@ function(app, FauxtonAPI, Documents, Databases) {
 
   #tabs: new Documents.Views.Tabs({
 collection: data.designDocs,
-database: data.database.id
+database: data.database
   })
 },
 



[43/50] [abbrv] git commit: Adding Apache license to js files in app/

2013-02-11 Thread jan
Adding Apache license to js files in app/


Project: http://git-wip-us.apache.org/repos/asf/couchdb/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb/commit/d7cf9f51
Tree: http://git-wip-us.apache.org/repos/asf/couchdb/tree/d7cf9f51
Diff: http://git-wip-us.apache.org/repos/asf/couchdb/diff/d7cf9f51

Branch: refs/heads/fauxton
Commit: d7cf9f510f55c3be9ef8959bcfed4c1b1d27bea0
Parents: cc9f021
Author: Russell Branca chewbra...@gmail.com
Authored: Tue Feb 5 22:46:44 2013 -0800
Committer: Russell Branca chewbra...@gmail.com
Committed: Tue Feb 5 22:46:44 2013 -0800

--
 src/fauxton/app/addons/config/base.js  |   12 
 src/fauxton/app/addons/config/resources.js |   12 
 src/fauxton/app/addons/config/routes.js|   12 
 src/fauxton/app/addons/logs/base.js|   12 
 src/fauxton/app/addons/logs/resources.js   |   12 
 src/fauxton/app/addons/logs/routes.js  |   12 
 src/fauxton/app/addons/stats/base.js   |   12 
 src/fauxton/app/addons/stats/resources.js  |   12 
 src/fauxton/app/addons/stats/routes.js |   12 
 src/fauxton/app/addons/stats/views.js  |   12 
 src/fauxton/app/api.js |   12 
 src/fauxton/app/initialize.js  |   12 
 src/fauxton/app/modules/databases/base.js  |   12 
 src/fauxton/app/modules/databases/resources.js |   12 
 src/fauxton/app/modules/databases/routes.js|   12 
 src/fauxton/app/modules/databases/views.js |   12 
 src/fauxton/app/modules/documents/base.js  |   12 
 src/fauxton/app/modules/documents/resources.js |   12 
 src/fauxton/app/modules/documents/routes.js|   12 
 src/fauxton/app/modules/documents/views.js |   12 
 src/fauxton/app/modules/fauxton/base.js|   12 
 src/fauxton/app/modules/fauxton/layout.js  |   12 
 src/fauxton/app/router.js  |   12 
 23 files changed, 276 insertions(+), 0 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/couchdb/blob/d7cf9f51/src/fauxton/app/addons/config/base.js
--
diff --git a/src/fauxton/app/addons/config/base.js 
b/src/fauxton/app/addons/config/base.js
index f71569e..f589b16 100644
--- a/src/fauxton/app/addons/config/base.js
+++ b/src/fauxton/app/addons/config/base.js
@@ -1,3 +1,15 @@
+// Licensed under the Apache License, Version 2.0 (the License); you may not
+// use this file except in compliance with the License. You may obtain a copy 
of
+// the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an AS IS BASIS, WITHOUT
+// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+// License for the specific language governing permissions and limitations 
under
+// the License.
+
 define([
   app,
 

http://git-wip-us.apache.org/repos/asf/couchdb/blob/d7cf9f51/src/fauxton/app/addons/config/resources.js
--
diff --git a/src/fauxton/app/addons/config/resources.js 
b/src/fauxton/app/addons/config/resources.js
index 59bf6a4..db26bb7 100644
--- a/src/fauxton/app/addons/config/resources.js
+++ b/src/fauxton/app/addons/config/resources.js
@@ -1,3 +1,15 @@
+// Licensed under the Apache License, Version 2.0 (the License); you may not
+// use this file except in compliance with the License. You may obtain a copy 
of
+// the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an AS IS BASIS, WITHOUT
+// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+// License for the specific language governing permissions and limitations 
under
+// the License.
+
 define([
   app,
   api

http://git-wip-us.apache.org/repos/asf/couchdb/blob/d7cf9f51/src/fauxton/app/addons/config/routes.js
--
diff --git a/src/fauxton/app/addons/config/routes.js 
b/src/fauxton/app/addons/config/routes.js
index 0030c42..7ed6498 100644
--- a/src/fauxton/app/addons/config/routes.js
+++ b/src/fauxton/app/addons/config/routes.js
@@ -1,3 +1,15 @@
+// Licensed under the Apache License, Version 2.0 (the License); you may not
+// use this file except in compliance with the License. You may obtain a copy 
of
+// the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by 

[34/50] [abbrv] git commit: Initial steps towards working bbb server

2013-02-11 Thread jan
Initial steps towards working bbb server

Added proxy info to grunt.js. We'll want to bring this out into a config
file at some point.

Had to add back /index.html for the moment. Need to generate this as
part of the bbb server process, or change the file location.


Project: http://git-wip-us.apache.org/repos/asf/couchdb/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb/commit/f1016d91
Tree: http://git-wip-us.apache.org/repos/asf/couchdb/tree/f1016d91
Diff: http://git-wip-us.apache.org/repos/asf/couchdb/diff/f1016d91

Branch: refs/heads/fauxton
Commit: f1016d91fd62fac96b9a1762e66dd7e0f69f9133
Parents: e62fa49
Author: Russell Branca chewbra...@gmail.com
Authored: Fri Feb 1 11:32:55 2013 -0800
Committer: Russell Branca chewbra...@gmail.com
Committed: Fri Feb 1 11:32:55 2013 -0800

--
 src/fauxton/grunt.js   |8 
 src/fauxton/index.html |   38 ++
 2 files changed, 46 insertions(+), 0 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/couchdb/blob/f1016d91/src/fauxton/grunt.js
--
diff --git a/src/fauxton/grunt.js b/src/fauxton/grunt.js
index 09cf12d..693e08b 100644
--- a/src/fauxton/grunt.js
+++ b/src/fauxton/grunt.js
@@ -199,6 +199,14 @@ module.exports = function(grunt) {
 }
   },
 
+  proxies: {
+'': {
+  host: 'localhost',
+  port: 5984,
+  https: false
+}
+  },
+
   release: {
 // This makes it easier for deploying, by defaulting to any IP.
 host: 0.0.0.0,

http://git-wip-us.apache.org/repos/asf/couchdb/blob/f1016d91/src/fauxton/index.html
--
diff --git a/src/fauxton/index.html b/src/fauxton/index.html
new file mode 100644
index 000..4a924e8
--- /dev/null
+++ b/src/fauxton/index.html
@@ -0,0 +1,38 @@
+!doctype html
+html lang=en
+head
+  meta charset=utf-8
+  meta http-equiv=X-UA-Compatible content=IE=edge,chrome=1
+  meta name=viewport content=width=device-width,initial-scale=1
+
+  titleProject Fauxton/title
+
+  !-- Application styles. --
+  link rel=stylesheet href=/css/index.css
+  style type=text/css
+body {
+padding-top: 60px;
+padding-bottom: 40px;
+}
+  /style
+  base href=//base
+/head
+
+body id=home
+  !-- Main container. --
+  div role=main id=main
+div id=global-notifications class=container errors-container/div
+div id=app-container/div
+hr
+
+footer
+  div id=footer-content class=container
+pcopy; Project Fauxton 2012/p
+  /div
+/footer
+  /div
+
+  !-- Application source. --
+  script data-main=/app/config src=/assets/js/libs/require.js/script
+/body
+/html



[47/50] [abbrv] git commit: Add Apache license to misc files

2013-02-11 Thread jan
Add Apache license to misc files


Project: http://git-wip-us.apache.org/repos/asf/couchdb/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb/commit/fc3a498f
Tree: http://git-wip-us.apache.org/repos/asf/couchdb/tree/fc3a498f
Diff: http://git-wip-us.apache.org/repos/asf/couchdb/diff/fc3a498f

Branch: refs/heads/fauxton
Commit: fc3a498f5b76c8adfd7b2ce97df4ff169932
Parents: 8096445
Author: Russell Branca chewbra...@gmail.com
Authored: Tue Feb 5 23:24:30 2013 -0800
Committer: Russell Branca chewbra...@gmail.com
Committed: Tue Feb 5 23:24:30 2013 -0800

--
 src/fauxton/assets/index.underscore |   15 +++
 src/fauxton/bin/bbb |   12 
 src/fauxton/bin/grunt   |   12 
 src/fauxton/tasks/fauxton.js|   12 
 4 files changed, 51 insertions(+), 0 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/couchdb/blob/fc3a498f/src/fauxton/assets/index.underscore
--
diff --git a/src/fauxton/assets/index.underscore 
b/src/fauxton/assets/index.underscore
index 3788925..1179ffb 100644
--- a/src/fauxton/assets/index.underscore
+++ b/src/fauxton/assets/index.underscore
@@ -1,4 +1,19 @@
 !doctype html
+
+!--
+// Licensed under the Apache License, Version 2.0 (the License); you may not
+// use this file except in compliance with the License. You may obtain a copy 
of
+// the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an AS IS BASIS, WITHOUT
+// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+// License for the specific language governing permissions and limitations 
under
+// the License.
+--
+
 html lang=en
 head
   meta charset=utf-8

http://git-wip-us.apache.org/repos/asf/couchdb/blob/fc3a498f/src/fauxton/bin/bbb
--
diff --git a/src/fauxton/bin/bbb b/src/fauxton/bin/bbb
index bce5a07..91842a3 100755
--- a/src/fauxton/bin/bbb
+++ b/src/fauxton/bin/bbb
@@ -1,5 +1,17 @@
 #!/bin/sh
 
+# Licensed under the Apache License, Version 2.0 (the License); you may not
+# use this file except in compliance with the License. You may obtain a copy of
+# the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an AS IS BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations under
+# the License.
+
 REL_PATH=`dirname \$0\`
 BBB_PATH=$REL_PATH/../node_modules/.bin/bbb
 

http://git-wip-us.apache.org/repos/asf/couchdb/blob/fc3a498f/src/fauxton/bin/grunt
--
diff --git a/src/fauxton/bin/grunt b/src/fauxton/bin/grunt
index 4bed8e8..2c52393 100755
--- a/src/fauxton/bin/grunt
+++ b/src/fauxton/bin/grunt
@@ -1,5 +1,17 @@
 #!/bin/sh
 
+# Licensed under the Apache License, Version 2.0 (the License); you may not
+# use this file except in compliance with the License. You may obtain a copy of
+# the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an AS IS BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations under
+# the License.
+
 REL_PATH=`dirname \$0\`
 GRUNT_PATH=$REL_PATH/../node_modules/.bin/grunt
 

http://git-wip-us.apache.org/repos/asf/couchdb/blob/fc3a498f/src/fauxton/tasks/fauxton.js
--
diff --git a/src/fauxton/tasks/fauxton.js b/src/fauxton/tasks/fauxton.js
index c15c906..a08a561 100644
--- a/src/fauxton/tasks/fauxton.js
+++ b/src/fauxton/tasks/fauxton.js
@@ -1,3 +1,15 @@
+// Licensed under the Apache License, Version 2.0 (the License); you may not
+// use this file except in compliance with the License. You may obtain a copy 
of
+// the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an AS IS BASIS, WITHOUT
+// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+// License for the specific language governing permissions and limitations 
under
+// the License.
+
 // var prompt = require('prompt');
 
 module.exports = function(grunt) {



[19/50] [abbrv] git commit: Add some todos

2013-02-11 Thread jan
Add some todos

Project: http://git-wip-us.apache.org/repos/asf/couchdb/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb/commit/217dce09
Tree: http://git-wip-us.apache.org/repos/asf/couchdb/tree/217dce09
Diff: http://git-wip-us.apache.org/repos/asf/couchdb/diff/217dce09

Branch: refs/heads/fauxton
Commit: 217dce09dd4349acf81b417589633d25ec6bd541
Parents: b8fde1d
Author: Simon Metson simon+git...@cloudant.com
Authored: Fri Jan 25 23:27:42 2013 +0100
Committer: Simon Metson simon+git...@cloudant.com
Committed: Sat Jan 26 16:36:17 2013 +0100

--
 src/fauxton/TODO.md|   26 +++
 .../app/addons/logs/templates/dashboard.html   |2 +
 src/fauxton/app/addons/logs/templates/sidebar.html |2 +
 3 files changed, 30 insertions(+), 0 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/couchdb/blob/217dce09/src/fauxton/TODO.md
--
diff --git a/src/fauxton/TODO.md b/src/fauxton/TODO.md
new file mode 100644
index 000..3c1b85b
--- /dev/null
+++ b/src/fauxton/TODO.md
@@ -0,0 +1,26 @@
+# Fauxton todo
+In no particular order
+
+- [ ] docco docs
+- [ ] user management
+- [ ] view options
+- [ ] view editor
+- [ ] visual view builder
+- [ ] new db as modal
+- [ ] new view button
+- [ ] show design docs only
+- [ ] fix delete doc button UI bug
+- [ ] delete multiple docs via _bulk_docs
+- [ ] show change events in database view
+- [ ] pouchdb addon
+- [ ] bespoke bootstrap style
+- [ ] responsive interface
+- [ ] sticky subnav for some UI components on _all_docs
+- [ ] show me button in API bar doesn't
+- [ ] edit index button doesn't
+- [ ] replicate UI
+- [ ] delete database
+- [ ] format dates better (e.g. in logs plugin)
+- [ ] format log entry better
+- [ ] filter logs by method
+- [ ] restore unfiltered data in logs UI

http://git-wip-us.apache.org/repos/asf/couchdb/blob/217dce09/src/fauxton/app/addons/logs/templates/dashboard.html
--
diff --git a/src/fauxton/app/addons/logs/templates/dashboard.html 
b/src/fauxton/app/addons/logs/templates/dashboard.html
index dddad9a..951e1ba 100644
--- a/src/fauxton/app/addons/logs/templates/dashboard.html
+++ b/src/fauxton/app/addons/logs/templates/dashboard.html
@@ -13,6 +13,7 @@
 % _.each(logs, function (log) { %
 tr class=%= log.log_level %
   td
+!-- TODO: better format the date --
 %= log.date.replace(/ /g,'') %
   /td
   td
@@ -22,6 +23,7 @@
 %= _.escape(log.pid) %
   /td
   td
+!-- TODO: split the line, maybe put method in it's own column --
 %= _.escape(log.args) %
   /td
 /tr

http://git-wip-us.apache.org/repos/asf/couchdb/blob/217dce09/src/fauxton/app/addons/logs/templates/sidebar.html
--
diff --git a/src/fauxton/app/addons/logs/templates/sidebar.html 
b/src/fauxton/app/addons/logs/templates/sidebar.html
index bae2020..d54f796 100644
--- a/src/fauxton/app/addons/logs/templates/sidebar.html
+++ b/src/fauxton/app/addons/logs/templates/sidebar.html
@@ -3,6 +3,8 @@
 fieldset
   legendLog Filter/legend
   input type=text name=filter placeholder=Type a filter to sort the 
logs by
+  !-- TODO: filter by method --
+  !-- TODO: correct removed filter behaviour --
   button type=submit class=btnFilter/button
   span class=help-block h6 Eg. debug or 1.4.1 or any regex /h6 
/span
 /fieldset



[12/50] [abbrv] git commit: Fix inappropriate display of Document saved successfully

2013-02-11 Thread jan
Fix inappropriate display of Document saved successfully

Background: If a doc is already loaded, the Document
saved successfully message appears when it is redisplayed
in the doc editor.

This patch modifies updateValues to check for changedAttributes
in the model and the notification is only displayed if there
are changed attributes.

Note that this correctly handles the case where a document is
saved that has no actual changes, as the _rev will be
different and so changedAttributes will still be truthy.


Project: http://git-wip-us.apache.org/repos/asf/couchdb/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb/commit/825e01d5
Tree: http://git-wip-us.apache.org/repos/asf/couchdb/tree/825e01d5
Diff: http://git-wip-us.apache.org/repos/asf/couchdb/diff/825e01d5

Branch: refs/heads/fauxton
Commit: 825e01d55c2c26454df318c79efeb26f49100e18
Parents: c216334
Author: Mike Wallace mikewallace1...@googlemail.com
Authored: Sun Jan 20 16:41:39 2013 +
Committer: Mike Wallace mikewallace1...@googlemail.com
Committed: Mon Jan 21 13:25:09 2013 +

--
 src/fauxton/app/modules/documents/views.js |   15 +--
 1 files changed, 9 insertions(+), 6 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/couchdb/blob/825e01d5/src/fauxton/app/modules/documents/views.js
--
diff --git a/src/fauxton/app/modules/documents/views.js 
b/src/fauxton/app/modules/documents/views.js
index 31db461..b530c82 100644
--- a/src/fauxton/app/modules/documents/views.js
+++ b/src/fauxton/app/modules/documents/views.js
@@ -363,12 +363,15 @@ function(app, FauxtonAPI, Codemirror, JSHint) {
 },
 
 updateValues: function() {
-  notification = FauxtonAPI.addNotification({
-msg: Document saved successfully.,
-type: success,
-clear: true
-  });
-  this.editor.setValue(this.model.prettyJSON());
+  var notification;
+  if (this.model.changedAttributes()) {
+notification = FauxtonAPI.addNotification({
+  msg: Document saved successfully.,
+  type: success,
+  clear: true
+});
+this.editor.setValue(this.model.prettyJSON());
+  }
 },
 
 establish: function() {



[22/50] [abbrv] git commit: add guide for writing addons

2013-02-11 Thread jan
add guide for writing addons

Project: http://git-wip-us.apache.org/repos/asf/couchdb/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb/commit/1592665d
Tree: http://git-wip-us.apache.org/repos/asf/couchdb/tree/1592665d
Diff: http://git-wip-us.apache.org/repos/asf/couchdb/diff/1592665d

Branch: refs/heads/fauxton
Commit: 1592665d19335d420b6b77d3de62971b628a9a0b
Parents: fd219f5
Author: Simon Metson simon+git...@cloudant.com
Authored: Sun Jan 27 13:00:07 2013 +0100
Committer: Simon Metson simon+git...@cloudant.com
Committed: Sun Jan 27 13:07:42 2013 +0100

--
 src/fauxton/writing_addons.md |   55 
 1 files changed, 55 insertions(+), 0 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/couchdb/blob/1592665d/src/fauxton/writing_addons.md
--
diff --git a/src/fauxton/writing_addons.md b/src/fauxton/writing_addons.md
new file mode 100644
index 000..b435566
--- /dev/null
+++ b/src/fauxton/writing_addons.md
@@ -0,0 +1,55 @@
+# Addons
+Addons allow you to extend Fauxton for a specific use case. Addons will usually
+have the following structure:
+
+ * templates/
+   * my_addon.html - _underscore template fragments_
+ * base.js - _entry point to the addon_
+ * resources.js - _models and collections of the addon_
+ * routes.js - _URL routing for the addon_
+ * views.js - _views that the model provides_
+
+## Generating an addon
+We have a grunt task that lets you create a skeleton addon, including all the
+boiler plate code. Run `bbb addon` and answer the questions it asks to create
+an addon:
+
+± bbb addon
+path.existsSync is now called `fs.existsSync`.
+Running addon task
+
+Please answer the following:
+[?] Add on Name (WickedCool) SuperAddon
+[?] Location of add ons (app/addons)
+[?] Do you need to make any changes to the above before continuing? (y/N)
+
+Created addon SuperAddon in app/addons
+
+Done, without errors.
+
+## Routes and hooks
+An addon can insert itself into fauxton in two ways; via a route or via a hook.
+
+### Routes
+An addon will override an existing route should one exist, but in all other
+ways is just a normal backbone route/view. This is how you would add a whole
+new feature.
+
+### Hooks
+Hooks let you modify/extend an existing feature. They modify a DOM element by
+selector for a named set of routes, for example:
+
+var Search = new FauxtonAPI.addon();
+Search.hooks = {
+  // Render additional content into the sidebar
+  #sidebar-content: {
+routes:[
+  database/:database/_design/:ddoc/_search/:search,
+  database/:database/_design/:ddoc/_view/:view,
+  database/:database/_:handler],
+callback: searchSidebar
+  }
+};
+return Search;
+
+adds the `searchSidebar` callback to `#sidebar-content` for three routes.
\ No newline at end of file



[18/50] [abbrv] git commit: remove whitespace from log entries

2013-02-11 Thread jan
remove whitespace from log entries

Project: http://git-wip-us.apache.org/repos/asf/couchdb/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb/commit/1edcd9ee
Tree: http://git-wip-us.apache.org/repos/asf/couchdb/tree/1edcd9ee
Diff: http://git-wip-us.apache.org/repos/asf/couchdb/diff/1edcd9ee

Branch: refs/heads/fauxton
Commit: 1edcd9ee3b75c1530bf1c5498d1dafb566f5cb5c
Parents: 11f321f
Author: Simon Metson simon+git...@cloudant.com
Authored: Fri Jan 25 14:14:30 2013 +0100
Committer: Simon Metson simon+git...@cloudant.com
Committed: Sat Jan 26 13:27:30 2013 +0100

--
 .../app/addons/logs/templates/dashboard.html   |8 
 1 files changed, 4 insertions(+), 4 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/couchdb/blob/1edcd9ee/src/fauxton/app/addons/logs/templates/dashboard.html
--
diff --git a/src/fauxton/app/addons/logs/templates/dashboard.html 
b/src/fauxton/app/addons/logs/templates/dashboard.html
index 955c75c..dddad9a 100644
--- a/src/fauxton/app/addons/logs/templates/dashboard.html
+++ b/src/fauxton/app/addons/logs/templates/dashboard.html
@@ -13,16 +13,16 @@
 % _.each(logs, function (log) { %
 tr class=%= log.log_level %
   td
-%= log.date % 
+%= log.date.replace(/ /g,'') %
   /td
   td
-%= log.log_level %
+%= log.log_level.replace(/ /g,'') %
   /td
   td
-%= log.pid %
+%= _.escape(log.pid) %
   /td
   td
-%= log.args %
+%= _.escape(log.args) %
   /td
 /tr
 % }); %



[31/50] [abbrv] git commit: More view form validation and error handling

2013-02-11 Thread jan
More view form validation and error handling


Project: http://git-wip-us.apache.org/repos/asf/couchdb/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb/commit/48ad0618
Tree: http://git-wip-us.apache.org/repos/asf/couchdb/tree/48ad0618
Diff: http://git-wip-us.apache.org/repos/asf/couchdb/diff/48ad0618

Branch: refs/heads/fauxton
Commit: 48ad0618c2aeec779055b9844d688c3723fd3d10
Parents: f25958b
Author: Russell Branca chewbra...@gmail.com
Authored: Wed Jan 30 17:36:07 2013 -0800
Committer: Russell Branca chewbra...@gmail.com
Committed: Wed Jan 30 17:36:07 2013 -0800

--
 src/fauxton/app/modules/documents/views.js |   57 ++-
 .../app/templates/documents/all_docs_list.html |1 +
 2 files changed, 56 insertions(+), 2 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/couchdb/blob/48ad0618/src/fauxton/app/modules/documents/views.js
--
diff --git a/src/fauxton/app/modules/documents/views.js 
b/src/fauxton/app/modules/documents/views.js
index c4107c4..30a799a 100644
--- a/src/fauxton/app/modules/documents/views.js
+++ b/src/fauxton/app/modules/documents/views.js
@@ -233,7 +233,13 @@ function(app, FauxtonAPI, Codemirror, JSHint) {
 },
 
 establish: function() {
-  var deferreds = [this.collection.fetch()];
+  var deferreds = [
+this.collection.fetch().error(function() {
+  // TODO: handle error requests that slip through
+  // This should just throw a notification, not break the page
+  console.log(ERROR: , arguments);
+})
+  ];
   if (this.designDocs) {
 deferreds.push(this.designDocs.fetch());
   }
@@ -281,10 +287,50 @@ function(app, FauxtonAPI, Codemirror, JSHint) {
 updateView: function(event) {
   event.preventDefault();
   var $form = $(event.currentTarget);
+
   // Ignore params without a value
   var params = _.filter($form.serializeArray(), function(param) {
 return param.value;
   });
+
+  // Validate *key* params to ensure they're valid JSON
+  var keyParams = [key,keys,startkey,endkey];
+  var errorParams = _.filter(params, function(param) {
+if (_.contains(keyParams, param.name)) {
+  try {
+JSON.parse(param.value);
+return false;
+  } catch(e) {
+return true;
+  }
+} else {
+  return false;
+}
+  });
+
+  if (_.any(errorParams)) {
+_.map(errorParams, function(param) {
+
+  // TODO: Where to add this error?
+  // bootstrap wants the error on a control-group div, but we're not 
using that
+  //$('form.view-query-update input[name='+param+'], 
form.view-query-update select[name='+param+']').addClass('error');
+
+  return FauxtonAPI.addNotification({
+msg: JSON Parse Error on field: +param.name,
+type: error,
+selector: .view.show .errors-container
+  });
+});
+
+FauxtonAPI.addNotification({
+  msg: Make sure that strings are properly quoted and any other 
values are valid JSON structures,
+  type: warning,
+  selector: .view.show .errors-container
+});
+
+return false;
+  }
+
   var fragment = window.location.hash.replace(/\?.*$/, '');
   fragment = fragment + '?' + $.param(params);
   FauxtonAPI.navigate(fragment);
@@ -305,7 +351,14 @@ function(app, FauxtonAPI, Codemirror, JSHint) {
 //   - can't include group_level for reduce=false
 case reduce:
   if ($ele.prop('checked') === true) {
-$form.find(input[name=include_docs]).prop(checked, false);
+if ($form.find(input[name=include_docs]).prop(checked) === 
true) {
+  $form.find(input[name=include_docs]).prop(checked, false);
+  var notification = FauxtonAPI.addNotification({
+msg: include_docs has been disabled as you cannot include 
docs on a reduced view,
+type: warn,
+selector: .view.show .errors-container
+  });
+}
 $form.find(input[name=include_docs]).prop(disabled, true);
 $form.find(select[name=group_level]).prop(disabled, false);
   } else {

http://git-wip-us.apache.org/repos/asf/couchdb/blob/48ad0618/src/fauxton/app/templates/documents/all_docs_list.html
--
diff --git a/src/fauxton/app/templates/documents/all_docs_list.html 
b/src/fauxton/app/templates/documents/all_docs_list.html
index a3536e0..73df4cb 100644
--- a/src/fauxton/app/templates/documents/all_docs_list.html
+++ b/src/fauxton/app/templates/documents/all_docs_list.html
@@ -11,6 +11,7 @@
   /div
 
   div class=row
+div 

[1/50] [abbrv] git commit: Initial advanced view options functionality

2013-02-11 Thread jan
Initial advanced view options functionality

Not super happy with this, number of things that could be done better or
differently, but I figured I would get this out as it works decently
well and provides a good baseline for figuring out where to go next.


Project: http://git-wip-us.apache.org/repos/asf/couchdb/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb/commit/776620d7
Tree: http://git-wip-us.apache.org/repos/asf/couchdb/tree/776620d7
Diff: http://git-wip-us.apache.org/repos/asf/couchdb/diff/776620d7

Branch: refs/heads/fauxton
Commit: 776620d710e7bb33619341ab4c6540e1233b9216
Parents: 180d822
Author: Russell Branca chewbra...@gmail.com
Authored: Tue Jan 8 19:03:11 2013 -0800
Committer: Russell Branca chewbra...@gmail.com
Committed: Tue Jan 8 19:03:11 2013 -0800

--
 src/fauxton/app/modules/documents/resources.js |   41 +++-
 src/fauxton/app/modules/documents/routes.js|   22 +++-
 src/fauxton/app/modules/documents/views.js |   87 ++-
 .../app/templates/documents/all_docs_list.html |   71 -
 src/fauxton/app/templates/documents/index_row.html |   11 --
 .../app/templates/documents/index_row_docular.html |   10 ++
 .../app/templates/documents/index_row_tabular.html |   11 ++
 7 files changed, 230 insertions(+), 23 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/couchdb/blob/776620d7/src/fauxton/app/modules/documents/resources.js
--
diff --git a/src/fauxton/app/modules/documents/resources.js 
b/src/fauxton/app/modules/documents/resources.js
index a042fe3..2a15cf8 100644
--- a/src/fauxton/app/modules/documents/resources.js
+++ b/src/fauxton/app/modules/documents/resources.js
@@ -39,6 +39,29 @@ function(app, FauxtonAPI, Views) {
   return this.id.match(/^_design/) ? design doc : doc;
 },
 
+isDdoc: function() {
+  return this.docType() === design doc;
+},
+
+hasViews: function() {
+  if (!this.isDdoc()) return false;
+  var doc = this.get('doc');
+  return doc  doc.views  doc.views.length  0;
+},
+
+getDdocView: function(view) {
+  if (!this.isDdoc() || !this.hasViews()) return false;
+
+  var doc = this.get('doc');
+  return doc.views[view];
+},
+
+viewHasReduce: function(viewName) {
+  var view = this.getDdocView(viewName);
+
+  return view  view.reduce;
+},
+
 // Need this to work around backbone router thinking _design/foo
 // is a separate route. Alternatively, maybe these should be
 // treated separately. For instance, we could default into the
@@ -81,6 +104,19 @@ function(app, FauxtonAPI, Views) {
 }
   });
 
+  Documents.ViewRow = Backbone.Model.extend({
+docType: function() {
+  if (!this.id) return reduction;
+
+  return this.id.match(/^_design/) ? design doc : doc;
+},
+
+prettyJSON: function() {
+  //var data = this.get(doc) ? this.get(doc) : this;
+  return JSON.stringify(this, null,   );
+}
+  });
+
   Documents.NewDoc = Documents.Doc.extend({
 fetch: function() {
   var uuid = new FauxtonAPI.UUID();
@@ -126,7 +162,7 @@ function(app, FauxtonAPI, Views) {
   });
 
   Documents.IndexCollection = Backbone.Collection.extend({
-model: Backbone.Model,
+model: Documents.ViewRow,
 
 initialize: function(_models, options) {
   this.database = options.database;
@@ -151,7 +187,8 @@ function(app, FauxtonAPI, Views) {
 return {
   value: row.value,
   key: row.key,
-  doc: row.doc || undefined
+  doc: row.doc,
+  id: row.id
 };
   });
 },

http://git-wip-us.apache.org/repos/asf/couchdb/blob/776620d7/src/fauxton/app/modules/documents/routes.js
--
diff --git a/src/fauxton/app/modules/documents/routes.js 
b/src/fauxton/app/modules/documents/routes.js
index fb35867..233308d 100644
--- a/src/fauxton/app/modules/documents/routes.js
+++ b/src/fauxton/app/modules/documents/routes.js
@@ -258,8 +258,14 @@ function(app, FauxtonAPI, Documents, Databases) {
 
 database/:database/new: newDocCodeEditorCallback,
 
-database/:database/_design/:ddoc/_view/:view: function(databaseName, 
ddoc, view) {
-  // alert(This will filter your data by the  + ddoc + / + view + 
view.);
+// TODO: fix optional search params
+// Can't get :view(?*search) to work
+// However :view?*search does work
+//database/:database/_design/:ddoc/_view/:view(\?*options): 
function(databaseName, ddoc, view, options) {
+database/:database/_design/:ddoc/_view/:view: function(databaseName, 
ddoc, view, options) {
+  // hack around backbone router limitations
+  view = view.replace(/\?.*$/,'');
+  var params = app.getParams();
   var data = {
 database: 

[30/50] [abbrv] git commit: Initial view filter constraints

2013-02-11 Thread jan
Initial view filter constraints


Project: http://git-wip-us.apache.org/repos/asf/couchdb/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb/commit/f25958be
Tree: http://git-wip-us.apache.org/repos/asf/couchdb/tree/f25958be
Diff: http://git-wip-us.apache.org/repos/asf/couchdb/diff/f25958be

Branch: refs/heads/fauxton
Commit: f25958be0589248a6656810ebee188314ff6ede2
Parents: 73e69b3
Author: Russell Branca chewbra...@gmail.com
Authored: Tue Jan 29 12:19:56 2013 -0800
Committer: Russell Branca chewbra...@gmail.com
Committed: Tue Jan 29 12:19:56 2013 -0800

--
 src/fauxton/app/modules/documents/views.js |   39 ++-
 .../app/templates/documents/all_docs_list.html |6 +-
 2 files changed, 40 insertions(+), 5 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/couchdb/blob/f25958be/src/fauxton/app/modules/documents/views.js
--
diff --git a/src/fauxton/app/modules/documents/views.js 
b/src/fauxton/app/modules/documents/views.js
index f6ce4e9..c4107c4 100644
--- a/src/fauxton/app/modules/documents/views.js
+++ b/src/fauxton/app/modules/documents/views.js
@@ -216,6 +216,8 @@ function(app, FauxtonAPI, Codemirror, JSHint) {
 events: {
   click button.all: selectAll,
   click button.bulk-delete: bulkDelete,
+  change form.view-query-update input: updateFilters,
+  change form.view-query-update select: updateFilters,
   submit form.view-query-update: updateView
 },
 
@@ -288,6 +290,34 @@ function(app, FauxtonAPI, Codemirror, JSHint) {
   FauxtonAPI.navigate(fragment);
 },
 
+updateFilters: function(event) {
+  event.preventDefault();
+  var $ele = $(event.currentTarget);
+  var name = $ele.attr('name');
+  this.updateFiltersFor(name, $ele);
+},
+
+updateFiltersFor: function(name, $ele) {
+  var $form = $ele.parents(form.view-query-update:first);
+  switch (name) {
+// Reduce constraints
+//   - Can't include_docs for reduce=true
+//   - can't include group_level for reduce=false
+case reduce:
+  if ($ele.prop('checked') === true) {
+$form.find(input[name=include_docs]).prop(checked, false);
+$form.find(input[name=include_docs]).prop(disabled, true);
+$form.find(select[name=group_level]).prop(disabled, false);
+  } else {
+$form.find(select[name=group_level]).prop(disabled, true);
+$form.find(input[name=include_docs]).prop(disabled, false);
+  }
+  break;
+case include_docs:
+  break;
+  }
+},
+
 /*
  * TODO: this should be reconsidered
  * This currently performs delete operations on the model level,
@@ -335,22 +365,27 @@ function(app, FauxtonAPI, Codemirror, JSHint) {
   if (this.params) {
 var $form = this.$el.find(form.view-query-update);
 _.each(this.params, function(val, key) {
+  var $ele;
   switch (key) {
 case limit:
 case group_level:
   $form.find(select[name='+key+']).val(val);
   break;
 case include_docs:
+  $form.find(input[name='+key+']).prop('checked', true);
+  break;
 case reduce:
+  $ele = $form.find(input[name='+key+']);
   if (val == true) {
-$form.find(input[name='+key+']).prop('checked', true);
+$ele.prop('checked', true);
   }
+  this.updateFiltersFor(key, $ele);
   break;
 default:
   $form.find(input[name='+key+']).val(val);
   break;
   }
-});
+}, this);
   }
 }
   });

http://git-wip-us.apache.org/repos/asf/couchdb/blob/f25958be/src/fauxton/app/templates/documents/all_docs_list.html
--
diff --git a/src/fauxton/app/templates/documents/all_docs_list.html 
b/src/fauxton/app/templates/documents/all_docs_list.html
index e987dff..a3536e0 100644
--- a/src/fauxton/app/templates/documents/all_docs_list.html
+++ b/src/fauxton/app/templates/documents/all_docs_list.html
@@ -33,15 +33,15 @@
   /select
 /label
 label class=span3 checkbox inline
-  input name=include_docs type=checkbox 
id=inlineCheckbox1 value=true Include Docs
+  input name=include_docs type=checkbox value=true 
Include Docs
 /label
 % if (hasReduce) { %
   label class=span2 checkbox inline
-input name=reduce type=checkbox id=inlineCheckbox1 
value=true Reduce
+input name=reduce type=checkbox value=true Reduce
   /label
 

[17/50] [abbrv] git commit: basic table of stats and pie chart, working with nv.d3 charts - actually from Garren

2013-02-11 Thread jan
basic table of stats and pie chart, working with nv.d3 charts - actually from 
Garren


Project: http://git-wip-us.apache.org/repos/asf/couchdb/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb/commit/11f321f5
Tree: http://git-wip-us.apache.org/repos/asf/couchdb/tree/11f321f5
Diff: http://git-wip-us.apache.org/repos/asf/couchdb/diff/11f321f5

Branch: refs/heads/fauxton
Commit: 11f321f537a7080cae65741393b9a975d789fbfd
Parents: 24ec3e9
Author: Simon Metson simon+git...@cloudant.com
Authored: Sat Jan 26 12:17:59 2013 +0100
Committer: Simon Metson simon+git...@cloudant.com
Committed: Sat Jan 26 12:17:59 2013 +0100

--
 src/fauxton/app/addons/stats/resources.js  |   10 +-
 src/fauxton/app/addons/stats/routes.js |   15 +-
 .../app/addons/stats/templates/by_code.html|3 -
 .../app/addons/stats/templates/pie_table.html  |   45 +
 src/fauxton/app/addons/stats/templates/stats.html  |2 +
 .../app/addons/stats/templates/statselect.html |8 +
 src/fauxton/app/addons/stats/views.js  |  166 +-
 src/fauxton/app/config.js  |2 +-
 src/fauxton/app/templates/databases/sidebar.html   |3 +-
 src/fauxton/app/templates/fauxton/nav_bar.html |5 +-
 src/fauxton/assets/css/nv.d3.css   |  656 +
 src/fauxton/assets/js/libs/nv.d3.js|11286 +++
 src/fauxton/grunt.js   |2 +
 13 files changed, 12153 insertions(+), 50 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/couchdb/blob/11f321f5/src/fauxton/app/addons/stats/resources.js
--
diff --git a/src/fauxton/app/addons/stats/resources.js 
b/src/fauxton/app/addons/stats/resources.js
index 7347ef8..ed2fd7f 100644
--- a/src/fauxton/app/addons/stats/resources.js
+++ b/src/fauxton/app/addons/stats/resources.js
@@ -1,9 +1,9 @@
 define([
-  app,
-  api,
-  backbone,
-  lodash,
-  modules/fauxton/base
+   app,
+   api,
+   backbone,
+   lodash,
+   modules/fauxton/base
 ],
 
 function (app, FauxtonAPI, backbone, _, Fauxton) {

http://git-wip-us.apache.org/repos/asf/couchdb/blob/11f321f5/src/fauxton/app/addons/stats/routes.js
--
diff --git a/src/fauxton/app/addons/stats/routes.js 
b/src/fauxton/app/addons/stats/routes.js
index ec7b019..36c06e6 100644
--- a/src/fauxton/app/addons/stats/routes.js
+++ b/src/fauxton/app/addons/stats/routes.js
@@ -14,22 +14,19 @@ function(app, FauxtonAPI, Stats, Views) {
 
   var routeCallback = function() {
 return {
-  layout: two_pane,
+  layout: with_sidebar,
 
   data: data,
 
   crumbs: [],
 
   views: {
-#left-content: new Views.Pie({
-  collection: data.stats,
-  template: by_method,
-  datatype: httpd_request_methods
+#sidebar-content: new Views.StatSelect({
+  collection: data.stats
 }),
-#right-content: new Views.Pie({
-  collection: data.stats,
-  template: by_code,
-  datatype: httpd_status_codes
+
+#dashboard-content: new Views.Statistics({
+  collection: data.stats
 })
   },
 

http://git-wip-us.apache.org/repos/asf/couchdb/blob/11f321f5/src/fauxton/app/addons/stats/templates/by_code.html
--
diff --git a/src/fauxton/app/addons/stats/templates/by_code.html 
b/src/fauxton/app/addons/stats/templates/by_code.html
deleted file mode 100644
index 4414b07..000
--- a/src/fauxton/app/addons/stats/templates/by_code.html
+++ /dev/null
@@ -1,3 +0,0 @@
-h2By Code small200, 201, 404, 409/small/h2
-div id=httpd_status_codes/div
-bTotal requests:/b %= statistics.reduce(function(memo, d){return memo + 
d.get(sum); }, 0) %
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/couchdb/blob/11f321f5/src/fauxton/app/addons/stats/templates/pie_table.html
--
diff --git a/src/fauxton/app/addons/stats/templates/pie_table.html 
b/src/fauxton/app/addons/stats/templates/pie_table.html
new file mode 100644
index 000..a9be6f5
--- /dev/null
+++ b/src/fauxton/app/addons/stats/templates/pie_table.html
@@ -0,0 +1,45 @@
+div class=row
+  div class=span8
+h2  %= datatype % /h2
+  /div
+/div
+
+% if (datatype != couchdb){%
+div class=row
+  div class=span8 style=height:430px;
+center
+  svg id=%= datatype %_graph/svg
+/center
+  /div
+/div
+% } %
+div class=row
+  div class=span8
+table class=table table-condensed table-striped
+  thead
+tr
+  th Description /th
+  th current /th
+  th  sum /th
+  th  mean /th
+  th  stddev /th
+  th  min /th
+   

[29/50] [abbrv] git commit: add docs about settings.json in the addon walkthrough

2013-02-11 Thread jan
add docs about settings.json in the addon walkthrough

Project: http://git-wip-us.apache.org/repos/asf/couchdb/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb/commit/73e69b32
Tree: http://git-wip-us.apache.org/repos/asf/couchdb/tree/73e69b32
Diff: http://git-wip-us.apache.org/repos/asf/couchdb/diff/73e69b32

Branch: refs/heads/fauxton
Commit: 73e69b320332449f05ba8c70acf5bcf4472e99a3
Parents: 37e184f
Author: Simon Metson simon+git...@cloudant.com
Authored: Sun Jan 27 20:15:05 2013 +0100
Committer: Simon Metson simon+git...@cloudant.com
Committed: Sun Jan 27 20:15:49 2013 +0100

--
 src/fauxton/writing_addons.md |9 +
 1 files changed, 9 insertions(+), 0 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/couchdb/blob/73e69b32/src/fauxton/writing_addons.md
--
diff --git a/src/fauxton/writing_addons.md b/src/fauxton/writing_addons.md
index 6e83966..a41af53 100644
--- a/src/fauxton/writing_addons.md
+++ b/src/fauxton/writing_addons.md
@@ -144,3 +144,12 @@ Then wire it all together in base.js:
   console.log(Hello);
   return Hello;
 });
+
+Once the code is in place include the add on in your `settings.json` so that it
+gets included by the `require` task. Your addon is included in one of three
+ways; a local path, a git URL or a name. Named plugins assume the plugin is in
+the fauxton base directory, addons with a git URL will be cloned into the
+application, local paths will be copied. Addons included from a local path will
+be cleaned out by the clean task, others are left alone.
+
+**TODO:** addons via npm module



[15/50] [abbrv] basic table of stats and pie chart, working with nv.d3 charts - actually from Garren

2013-02-11 Thread jan
http://git-wip-us.apache.org/repos/asf/couchdb/blob/11f321f5/src/fauxton/grunt.js
--
diff --git a/src/fauxton/grunt.js b/src/fauxton/grunt.js
index 14b57bd..18ba7e1 100644
--- a/src/fauxton/grunt.js
+++ b/src/fauxton/grunt.js
@@ -315,4 +315,6 @@ module.exports = function(grunt) {
   grunt.registerTask(release, test dependencies build minify 
template:release copy:dist);
   // install fauxton as couchapp
   grunt.registerTask('couchapp_install', 'rmcouchdb:fauxton mkcouchdb:fauxton 
couchapp:fauxton');
+  grunt.registerTask('couchapp_deploy', 'couchapp_setup couchapp_install');
+
 };



[5/50] [abbrv] update rickshaw remove cloudant.css and concat all css files in assets/css

2013-02-11 Thread jan
http://git-wip-us.apache.org/repos/asf/couchdb/blob/67d81a4b/src/fauxton/assets/css/rickshaw.css
--
diff --git a/src/fauxton/assets/css/rickshaw.css 
b/src/fauxton/assets/css/rickshaw.css
new file mode 100644
index 000..520b069
--- /dev/null
+++ b/src/fauxton/assets/css/rickshaw.css
@@ -0,0 +1,315 @@
+.rickshaw_graph .detail {
+   pointer-events: none;
+   position: absolute;
+   top: 0;
+   z-index: 2;
+   background: rgba(0, 0, 0, 0.1);
+   bottom: 0;
+   width: 1px;
+   transition: opacity 0.25s linear;
+   -moz-transition: opacity 0.25s linear;
+   -o-transition: opacity 0.25s linear;
+   -webkit-transition: opacity 0.25s linear;
+}
+.rickshaw_graph .detail.inactive {
+   opacity: 0;
+}
+.rickshaw_graph .detail .item.active {
+   opacity: 1;
+}
+.rickshaw_graph .detail .x_label {
+   font-family: Arial, sans-serif;
+   border-radius: 3px;
+   padding: 6px;
+   opacity: 0.5;
+   border: 1px solid #e0e0e0;
+   font-size: 12px;
+   position: absolute;
+   background: white;
+   white-space: nowrap;
+}
+.rickshaw_graph .detail .item {
+   position: absolute;
+   z-index: 2;
+   border-radius: 3px;
+   padding: 0.25em;
+   font-size: 12px;
+   font-family: Arial, sans-serif;
+   opacity: 0;
+   background: rgba(0, 0, 0, 0.4);
+   color: white;
+   border: 1px solid rgba(0, 0, 0, 0.4);
+   margin-left: 1em;
+   margin-top: -1em;
+   white-space: nowrap;
+}
+.rickshaw_graph .detail .item.active {
+   opacity: 1;
+   background: rgba(0, 0, 0, 0.8);
+}
+.rickshaw_graph .detail .item:before {
+   content: \25c2;
+   position: absolute;
+   left: -0.5em;
+   color: rgba(0, 0, 0, 0.7);
+   width: 0;
+}
+.rickshaw_graph .detail .dot {
+   width: 4px;
+   height: 4px;
+   margin-left: -4px;
+   margin-top: -3px;
+   border-radius: 5px;
+   position: absolute;
+   box-shadow: 0 0 2px rgba(0, 0, 0, 0.6);
+   background: white;
+   border-width: 2px;
+   border-style: solid;
+   display: none;
+   background-clip: padding-box;
+}
+.rickshaw_graph .detail .dot.active {
+   display: block;
+}
+/* graph */
+
+.rickshaw_graph {
+   position: relative;
+}
+.rickshaw_graph svg {
+   display: block; 
+   overflow: hidden;
+}
+
+/* ticks */
+
+.rickshaw_graph .x_tick {
+   position: absolute;
+   top: 0;
+   bottom: 0;
+   width: 0px;
+   border-left: 1px dotted rgba(0, 0, 0, 0.2);
+   pointer-events: none;
+}
+.rickshaw_graph .x_tick .title {
+   position: absolute;
+   font-size: 12px;
+   font-family: Arial, sans-serif;
+   opacity: 0.5;
+   white-space: nowrap;
+   margin-left: 3px;
+   bottom: 1px;
+}
+
+/* annotations */
+
+.rickshaw_annotation_timeline {
+   height: 1px;
+   border-top: 1px solid #e0e0e0;
+   margin-top: 10px;
+   position: relative;
+}
+.rickshaw_annotation_timeline .annotation {
+   position: absolute;
+   height: 6px;
+   width: 6px;
+   margin-left: -2px;
+   top: -3px;
+   border-radius: 5px;
+   background-color: rgba(0, 0, 0, 0.25);
+}
+.rickshaw_graph .annotation_line {
+   position: absolute;
+   top: 0;
+   bottom: -6px;
+   width: 0px;
+   border-left: 2px solid rgba(0, 0, 0, 0.3);
+   display: none;
+}
+.rickshaw_graph .annotation_line.active {
+   display: block;
+}
+
+.rickshaw_graph .annotation_range {
+background: rgba(0, 0, 0, 0.1);
+display: none;
+position: absolute;
+top: 0;
+bottom: -6px;
+z-index: -10;
+}
+.rickshaw_graph .annotation_range.active {
+display: block;
+}
+.rickshaw_graph .annotation_range.active.offscreen {
+display: none;
+}
+
+.rickshaw_annotation_timeline .annotation .content {
+   background: white;
+   color: black;
+   opacity: 0.9;
+   padding: 5px 5px;
+   box-shadow: 0 0 2px rgba(0, 0, 0, 0.8);
+   border-radius: 3px;
+   position: relative;
+   z-index: 20;
+   font-size: 12px;
+   padding: 6px 8px 8px;
+   top: 18px;
+   left: -11px;
+   width: 160px;
+   display: none;
+   cursor: pointer;
+}
+.rickshaw_annotation_timeline .annotation .content:before {
+   content: \25b2;
+   position: absolute;
+   top: -11px;
+   color: white;
+   text-shadow: 0 -1px 1px rgba(0, 0, 0, 0.8);
+}
+.rickshaw_annotation_timeline .annotation.active,
+.rickshaw_annotation_timeline .annotation:hover {
+   background-color: rgba(0, 0, 0, 0.8);
+   cursor: none;
+}
+.rickshaw_annotation_timeline .annotation .content:hover {
+   z-index: 50;
+}
+.rickshaw_annotation_timeline .annotation.active .content {
+   display: block;
+}
+.rickshaw_annotation_timeline .annotation:hover .content {
+   display: 

[28/50] [abbrv] git commit: make clean less aggressive - if an addon is configured by name only (e.g. is in the fauxton directory) don't clean it up.

2013-02-11 Thread jan
make clean less aggressive - if an addon is configured by name only (e.g. is in
the fauxton directory) don't clean it up.


Project: http://git-wip-us.apache.org/repos/asf/couchdb/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb/commit/37e184f5
Tree: http://git-wip-us.apache.org/repos/asf/couchdb/tree/37e184f5
Diff: http://git-wip-us.apache.org/repos/asf/couchdb/diff/37e184f5

Branch: refs/heads/fauxton
Commit: 37e184f5e21b1f88a36812f6a9526dd38bc8c62d
Parents: fbca1d9
Author: Simon Metson simon+git...@cloudant.com
Authored: Sun Jan 27 20:00:58 2013 +0100
Committer: Simon Metson simon+git...@cloudant.com
Committed: Sun Jan 27 20:00:58 2013 +0100

--
 src/fauxton/grunt.js |8 
 1 files changed, 4 insertions(+), 4 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/couchdb/blob/37e184f5/src/fauxton/grunt.js
--
diff --git a/src/fauxton/grunt.js b/src/fauxton/grunt.js
index 19a6d96..09cf12d 100644
--- a/src/fauxton/grunt.js
+++ b/src/fauxton/grunt.js
@@ -14,16 +14,16 @@ module.exports = function(grunt) {
   };
 
   var cleanable = function(){
+// Whitelist files and directories to be cleaned
 var path = require('path');
 // You'll always want to clean these two directories
 var theListToClean = [dist/, app/load_addons.js];
-
-// Now find the addons you have and add them for cleaning up
+// Now find the external addons you have and add them for cleaning up
 if (path.existsSync(settings.json)){
   var settings = grunt.file.readJSON(settings.json) || {deps: []};
   settings.deps.forEach(function(addon){
-// Don't clean up the default addons
-if (['config', 'logs', 'stats'].indexOf(addon.name) == -1){
+// Only clean addons that are included from a local dir
+if (addon.path){
   theListToClean.push(app/addons/ + addon.name);
 }
   });



[4/50] [abbrv] git commit: Fix views page and minor lint changes

2013-02-11 Thread jan
Fix views page and minor lint changes


Project: http://git-wip-us.apache.org/repos/asf/couchdb/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb/commit/f55ae987
Tree: http://git-wip-us.apache.org/repos/asf/couchdb/tree/f55ae987
Diff: http://git-wip-us.apache.org/repos/asf/couchdb/diff/f55ae987

Branch: refs/heads/fauxton
Commit: f55ae987e37204a9e2c3b78f9dfbd5a36e915b73
Parents: 47f3d33
Author: Russell Branca chewbra...@gmail.com
Authored: Mon Jan 14 12:18:48 2013 -0500
Committer: Russell Branca chewbra...@gmail.com
Committed: Mon Jan 14 12:18:48 2013 -0500

--
 src/fauxton/app/modules/documents/views.js |5 +
 src/fauxton/grunt.js   |6 +++---
 2 files changed, 4 insertions(+), 7 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/couchdb/blob/f55ae987/src/fauxton/app/modules/documents/views.js
--
diff --git a/src/fauxton/app/modules/documents/views.js 
b/src/fauxton/app/modules/documents/views.js
index 06da9ee..d942887 100644
--- a/src/fauxton/app/modules/documents/views.js
+++ b/src/fauxton/app/modules/documents/views.js
@@ -302,10 +302,6 @@ function(app, FauxtonAPI, Codemirror, JSHint) {
   click button.save-doc: saveDoc
 },
 
-initialize: function() {
-  this.model.on(sync, this.updateValues, this);
-},
-
 updateValues: function() {
   notification = FauxtonAPI.addNotification({
 msg: Document saved successfully.,
@@ -370,6 +366,7 @@ function(app, FauxtonAPI, Codemirror, JSHint) {
 },
 
 afterRender: function() {
+  this.model.on(sync, this.updateValues, this);
   var that = this;
   this.editor = 
Codemirror.fromTextArea(this.$el.find(textarea.doc-code).get()[0], {
 mode: application/json,

http://git-wip-us.apache.org/repos/asf/couchdb/blob/f55ae987/src/fauxton/grunt.js
--
diff --git a/src/fauxton/grunt.js b/src/fauxton/grunt.js
index 8f95058..80f8f4b 100644
--- a/src/fauxton/grunt.js
+++ b/src/fauxton/grunt.js
@@ -11,7 +11,7 @@ module.exports = function(grunt) {
 okay_if_missing: true
   }
 }
-  }
+  };
 
   grunt.initConfig({
 
@@ -267,13 +267,13 @@ module.exports = function(grunt) {
 },
 
 get_deps: {
-  default: {
+  default: {
 src: settings.json
   }
 },
 
 gen_load_addons: {
-  default: {
+  default: {
 src: settings.json
   }
 },



[11/50] [abbrv] git commit: Declare all variables in newDatabase at top of function

2013-02-11 Thread jan
Declare all variables in newDatabase at top of function


Project: http://git-wip-us.apache.org/repos/asf/couchdb/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb/commit/c2163349
Tree: http://git-wip-us.apache.org/repos/asf/couchdb/tree/c2163349
Diff: http://git-wip-us.apache.org/repos/asf/couchdb/diff/c2163349

Branch: refs/heads/fauxton
Commit: c2163349bdcd0454f8d0d1b2dccf4509eaff2bf0
Parents: c585708
Author: Mike Wallace mikewallace1...@googlemail.com
Authored: Mon Jan 21 13:15:30 2013 +
Committer: Mike Wallace mikewallace1...@googlemail.com
Committed: Mon Jan 21 13:15:30 2013 +

--
 src/fauxton/app/modules/databases/views.js |3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/couchdb/blob/c2163349/src/fauxton/app/modules/databases/views.js
--
diff --git a/src/fauxton/app/modules/databases/views.js 
b/src/fauxton/app/modules/databases/views.js
index b069b85..fb4f608 100644
--- a/src/fauxton/app/modules/databases/views.js
+++ b/src/fauxton/app/modules/databases/views.js
@@ -99,6 +99,7 @@ function(app, FauxtonAPI) {
 
 newDatabase: function() {
   var notification;
+  var db;
   // TODO: use a modal here instead of the prompt
   var name = prompt('Name of database', 'newdatabase');
   if (name === null) {
@@ -111,7 +112,7 @@ function(app, FauxtonAPI) {
 });
 return;
   }
-  var db = new this.collection.model({
+  db = new this.collection.model({
 id: encodeURIComponent(name),
 name: name
   });



[21/50] [abbrv] git commit: Handle cleaning up addons better

2013-02-11 Thread jan
Handle cleaning up addons better

Project: http://git-wip-us.apache.org/repos/asf/couchdb/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb/commit/fd219f5f
Tree: http://git-wip-us.apache.org/repos/asf/couchdb/tree/fd219f5f
Diff: http://git-wip-us.apache.org/repos/asf/couchdb/diff/fd219f5f

Branch: refs/heads/fauxton
Commit: fd219f5f247e33ee1f5f8d3a41b8bd3b4d59f516
Parents: 217dce0
Author: Simon Metson simon+git...@cloudant.com
Authored: Sun Jan 27 11:02:11 2013 +0100
Committer: Simon Metson simon+git...@cloudant.com
Committed: Sun Jan 27 13:07:26 2013 +0100

--
 src/fauxton/grunt.js |   20 +++-
 1 files changed, 19 insertions(+), 1 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/couchdb/blob/fd219f5f/src/fauxton/grunt.js
--
diff --git a/src/fauxton/grunt.js b/src/fauxton/grunt.js
index 18ba7e1..19a6d96 100644
--- a/src/fauxton/grunt.js
+++ b/src/fauxton/grunt.js
@@ -13,11 +13,29 @@ module.exports = function(grunt) {
 }
   };
 
+  var cleanable = function(){
+var path = require('path');
+// You'll always want to clean these two directories
+var theListToClean = [dist/, app/load_addons.js];
+
+// Now find the addons you have and add them for cleaning up
+if (path.existsSync(settings.json)){
+  var settings = grunt.file.readJSON(settings.json) || {deps: []};
+  settings.deps.forEach(function(addon){
+// Don't clean up the default addons
+if (['config', 'logs', 'stats'].indexOf(addon.name) == -1){
+  theListToClean.push(app/addons/ + addon.name);
+}
+  });
+}
+return theListToClean;
+  }();
+
   grunt.initConfig({
 
 // The clean task ensures all files are removed from the dist/ directory so
 // that no files linger from previous builds.
-clean: [dist/, app/load_addons.js, app/addons/search, 
app/addons/dashboard],
+clean:  cleanable,
 
 // The lint task will run the build configuration and the application
 // JavaScript through JSHint and report any errors.  You can change the



[14/50] [abbrv] git commit: Merge pull request #11 from cloudant-labs/fauxton-notifications-savedoc-createdb

2013-02-11 Thread jan
Merge pull request #11 from cloudant-labs/fauxton-notifications-savedoc-createdb

Fauxton notifications savedoc createdb

Project: http://git-wip-us.apache.org/repos/asf/couchdb/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb/commit/24ec3e98
Tree: http://git-wip-us.apache.org/repos/asf/couchdb/tree/24ec3e98
Diff: http://git-wip-us.apache.org/repos/asf/couchdb/diff/24ec3e98

Branch: refs/heads/fauxton
Commit: 24ec3e98913eccda2415517f9790ba6f69720e44
Parents: 48752ff 9a0c72f
Author: Simon Metson simonmetson+git...@googlemail.com
Authored: Sat Jan 26 02:38:44 2013 -0800
Committer: Simon Metson simonmetson+git...@googlemail.com
Committed: Sat Jan 26 02:38:44 2013 -0800

--
 src/fauxton/app/modules/databases/views.js |   28 ++-
 src/fauxton/app/modules/documents/views.js |   26 +++-
 2 files changed, 46 insertions(+), 8 deletions(-)
--




[37/50] [abbrv] git commit: delete database

2013-02-11 Thread jan
delete database


Project: http://git-wip-us.apache.org/repos/asf/couchdb/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb/commit/827a1b58
Tree: http://git-wip-us.apache.org/repos/asf/couchdb/tree/827a1b58
Diff: http://git-wip-us.apache.org/repos/asf/couchdb/diff/827a1b58

Branch: refs/heads/fauxton
Commit: 827a1b58989528fd9c6c30c828df0911d0723cc5
Parents: 6ab9c65
Author: Garren Smith garren.sm...@gmail.com
Authored: Tue Feb 5 10:01:24 2013 +0200
Committer: Garren Smith garren.sm...@gmail.com
Committed: Tue Feb 5 10:01:24 2013 +0200

--
 src/fauxton/TODO.md   |2 +-
 src/fauxton/app/modules/documents/routes.js   |2 +-
 src/fauxton/app/modules/documents/views.js|   21 +++-
 src/fauxton/app/templates/documents/tabs.html |4 +-
 4 files changed, 24 insertions(+), 5 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/couchdb/blob/827a1b58/src/fauxton/TODO.md
--
diff --git a/src/fauxton/TODO.md b/src/fauxton/TODO.md
index 3c1b85b..bb37113 100644
--- a/src/fauxton/TODO.md
+++ b/src/fauxton/TODO.md
@@ -19,7 +19,7 @@ In no particular order
 - [ ] show me button in API bar doesn't
 - [ ] edit index button doesn't
 - [ ] replicate UI
-- [ ] delete database
+- [x] delete database
 - [ ] format dates better (e.g. in logs plugin)
 - [ ] format log entry better
 - [ ] filter logs by method

http://git-wip-us.apache.org/repos/asf/couchdb/blob/827a1b58/src/fauxton/app/modules/documents/routes.js
--
diff --git a/src/fauxton/app/modules/documents/routes.js 
b/src/fauxton/app/modules/documents/routes.js
index efaa374..d851caf 100644
--- a/src/fauxton/app/modules/documents/routes.js
+++ b/src/fauxton/app/modules/documents/routes.js
@@ -251,7 +251,7 @@ function(app, FauxtonAPI, Documents, Databases) {
 
   #tabs: new Documents.Views.Tabs({
 collection: data.designDocs,
-database: data.database.id
+database: data.database
   })
 },
 

http://git-wip-us.apache.org/repos/asf/couchdb/blob/827a1b58/src/fauxton/app/modules/documents/views.js
--
diff --git a/src/fauxton/app/modules/documents/views.js 
b/src/fauxton/app/modules/documents/views.js
index 30a799a..556a5cf 100644
--- a/src/fauxton/app/modules/documents/views.js
+++ b/src/fauxton/app/modules/documents/views.js
@@ -21,12 +21,31 @@ function(app, FauxtonAPI, Codemirror, JSHint) {
   this.collection = options.collection;
   this.database = options.database;
 },
+
+events: {
+  click #delete-database: delete_database
+},
+
 beforeRender: function(manage) {
   this.insertView(#search, new Views.SearchBox({
 collection: this.collection,
-database: this.database
+database: this.database.id
   }));
+},
+
+delete_database: function (event) {
+  event.preventDefault();
+
+  var result = confirm(Are you sure you want to delete this database?);
+
+  if (!result) { return; }
+
+  var promise = this.database.destroy();
+  promise.done(function () {
+app.router.navigate('/', {trigger: true});
+  });
 }
+
   });
 
   Views.SearchBox = FauxtonAPI.View.extend({

http://git-wip-us.apache.org/repos/asf/couchdb/blob/827a1b58/src/fauxton/app/templates/documents/tabs.html
--
diff --git a/src/fauxton/app/templates/documents/tabs.html 
b/src/fauxton/app/templates/documents/tabs.html
index 8cca6c3..d0231e0 100644
--- a/src/fauxton/app/templates/documents/tabs.html
+++ b/src/fauxton/app/templates/documents/tabs.html
@@ -12,9 +12,9 @@
 /a
 ul class=dropdown-menu
   lia class=i class=icon-repeat/i Replicate 
database/a/li
-  lia class=i class=icon-trash/i Delete database/a/li
+  lia id=delete-database class=i class=icon-trash/i 
Delete database/a/li
 /ul
   /div
 /li
   /ul
-/ul
\ No newline at end of file
+/ul



[13/50] [abbrv] git commit: Display a notification if save doc fails

2013-02-11 Thread jan
Display a notification if save doc fails


Project: http://git-wip-us.apache.org/repos/asf/couchdb/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb/commit/9a0c72f9
Tree: http://git-wip-us.apache.org/repos/asf/couchdb/tree/9a0c72f9
Diff: http://git-wip-us.apache.org/repos/asf/couchdb/diff/9a0c72f9

Branch: refs/heads/fauxton
Commit: 9a0c72f915eda03412e0896d53ff4af81d281ca1
Parents: 825e01d
Author: Mike Wallace mikewallace1...@googlemail.com
Authored: Sun Jan 20 21:55:02 2013 +
Committer: Mike Wallace mikewallace1...@googlemail.com
Committed: Mon Jan 21 13:29:34 2013 +

--
 src/fauxton/app/modules/documents/views.js |   11 ++-
 1 files changed, 10 insertions(+), 1 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/couchdb/blob/9a0c72f9/src/fauxton/app/modules/documents/views.js
--
diff --git a/src/fauxton/app/modules/documents/views.js 
b/src/fauxton/app/modules/documents/views.js
index b530c82..f6ce4e9 100644
--- a/src/fauxton/app/modules/documents/views.js
+++ b/src/fauxton/app/modules/documents/views.js
@@ -384,7 +384,16 @@ function(app, FauxtonAPI, Codemirror, JSHint) {
 json = JSON.parse(this.editor.getValue());
 this.model.set(json);
 notification = FauxtonAPI.addNotification({msg: Saving document.});
-this.model.save();
+this.model.save().error(
+  function(xhr) {
+var responseText = JSON.parse(xhr.responseText).reason;
+notification = FauxtonAPI.addNotification({
+  msg: Save failed:  + responseText,
+  type: error,
+  clear: true
+});
+  }
+);
   } else {
 notification = FauxtonAPI.addNotification({
   msg: Please fix the JSON errors and try again.,



[25/50] [abbrv] git commit: fix addons task

2013-02-11 Thread jan
fix addons task


Project: http://git-wip-us.apache.org/repos/asf/couchdb/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb/commit/139d4a15
Tree: http://git-wip-us.apache.org/repos/asf/couchdb/tree/139d4a15
Diff: http://git-wip-us.apache.org/repos/asf/couchdb/diff/139d4a15

Branch: refs/heads/fauxton
Commit: 139d4a15c65cbafec5d016f556d9887b9973f825
Parents: a3b2141
Author: Simon Metson simon+git...@cloudant.com
Authored: Sun Jan 27 16:52:02 2013 +0100
Committer: Simon Metson simon+git...@cloudant.com
Committed: Sun Jan 27 16:52:02 2013 +0100

--
 src/fauxton/tasks/fauxton.js |3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/couchdb/blob/139d4a15/src/fauxton/tasks/fauxton.js
--
diff --git a/src/fauxton/tasks/fauxton.js b/src/fauxton/tasks/fauxton.js
index 0ea1045..eb464a6 100644
--- a/src/fauxton/tasks/fauxton.js
+++ b/src/fauxton/tasks/fauxton.js
@@ -20,7 +20,7 @@ module.exports = function(grunt) {
 {
   name: 'base',
   filename: 'base.js',
-  template: 'define([\n  app,\n  api,\n  addons/%= 
module.toLowerCase() %/routes\n],\n\nfunction(app, FauxtonAPI, %= module %) 
{\n\tvar %= module % = new FauxtonAPI.addon();\n\treturn %= module 
%;\n});\n'
+  template: 'define([\n  app,\n  api,\n  addons/%= 
module.toLowerCase() %/routes\n],\n\nfunction(app, FauxtonAPI, %= module 
%Routes) {\n\tvar %= module % = new FauxtonAPI.addon();\n\treturn %= module 
%;\n});\n'
 },
 {
   name: 'resources',
@@ -42,6 +42,7 @@ module.exports = function(grunt) {
   var module = result.name
   filepath = result.path + '/' + module.toLowerCase() + '/templates';
   grunt.file.mkdir(filepath);
+  filepath = result.path + '/' + module.toLowerCase();
   _.each(addonTemplates, function(file){
 file.module = module.charAt(0).toUpperCase() + module.substr(1);
 var content = grunt.template.process(file.template, file);



[20/50] [abbrv] git commit: add in couchdb logo

2013-02-11 Thread jan
add in couchdb logo

Project: http://git-wip-us.apache.org/repos/asf/couchdb/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb/commit/b8fde1df
Tree: http://git-wip-us.apache.org/repos/asf/couchdb/tree/b8fde1df
Diff: http://git-wip-us.apache.org/repos/asf/couchdb/diff/b8fde1df

Branch: refs/heads/fauxton
Commit: b8fde1df1865f3109b56c4e1e7bddec6de63cdb8
Parents: 1edcd9e
Author: Simon Metson simon+git...@cloudant.com
Authored: Sat Jan 26 13:24:51 2013 +0100
Committer: Simon Metson simon+git...@cloudant.com
Committed: Sat Jan 26 16:36:17 2013 +0100

--
 src/fauxton/assets/img/couchdblogo.png |  Bin 0 - 2738 bytes
 1 files changed, 0 insertions(+), 0 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/couchdb/blob/b8fde1df/src/fauxton/assets/img/couchdblogo.png
--
diff --git a/src/fauxton/assets/img/couchdblogo.png 
b/src/fauxton/assets/img/couchdblogo.png
new file mode 100644
index 000..cbe991c
Binary files /dev/null and b/src/fauxton/assets/img/couchdblogo.png differ



[10/50] [abbrv] git commit: Handle a null or empty database name

2013-02-11 Thread jan
Handle a null or empty database name

If name is null then user cancelled the prompt so we
do nothing.

If name is zero length then display an error via
notifications.


Project: http://git-wip-us.apache.org/repos/asf/couchdb/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb/commit/c585708f
Tree: http://git-wip-us.apache.org/repos/asf/couchdb/tree/c585708f
Diff: http://git-wip-us.apache.org/repos/asf/couchdb/diff/c585708f

Branch: refs/heads/fauxton
Commit: c585708f71ca4344abd0d51e86edecbc6ff16812
Parents: 08de3e7
Author: Mike Wallace mikewallace1...@googlemail.com
Authored: Sun Jan 20 22:26:48 2013 +
Committer: Mike Wallace mikewallace1...@googlemail.com
Committed: Mon Jan 21 13:12:10 2013 +

--
 src/fauxton/app/modules/databases/views.js |   13 -
 1 files changed, 12 insertions(+), 1 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/couchdb/blob/c585708f/src/fauxton/app/modules/databases/views.js
--
diff --git a/src/fauxton/app/modules/databases/views.js 
b/src/fauxton/app/modules/databases/views.js
index fafddc5..b069b85 100644
--- a/src/fauxton/app/modules/databases/views.js
+++ b/src/fauxton/app/modules/databases/views.js
@@ -98,13 +98,24 @@ function(app, FauxtonAPI) {
 },
 
 newDatabase: function() {
+  var notification;
   // TODO: use a modal here instead of the prompt
   var name = prompt('Name of database', 'newdatabase');
+  if (name === null) {
+return;
+  } else if (name.length === 0) {
+notification = FauxtonAPI.addNotification({
+  msg: Please enter a valid database name,
+  type: error,
+  clear: true
+});
+return;
+  }
   var db = new this.collection.model({
 id: encodeURIComponent(name),
 name: name
   });
-  var notification = FauxtonAPI.addNotification({msg: Creating 
database.});
+  notification = FauxtonAPI.addNotification({msg: Creating database.});
   db.save().done(function() {
 notification = FauxtonAPI.addNotification({
   msg: Database created successfully,



[7/50] [abbrv] git commit: update rickshaw remove cloudant.css and concat all css files in assets/css

2013-02-11 Thread jan
update rickshaw
remove cloudant.css and concat all css files in assets/css


Project: http://git-wip-us.apache.org/repos/asf/couchdb/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb/commit/67d81a4b
Tree: http://git-wip-us.apache.org/repos/asf/couchdb/tree/67d81a4b
Diff: http://git-wip-us.apache.org/repos/asf/couchdb/diff/67d81a4b

Branch: refs/heads/fauxton
Commit: 67d81a4bdbaf8b9aa88571fd46ca773379da335e
Parents: f55ae98
Author: Simon Metson simon+git...@cloudant.com
Authored: Tue Jan 8 17:02:09 2013 +
Committer: Simon Metson simon+git...@cloudant.com
Committed: Fri Jan 18 16:55:16 2013 -0500

--
 src/fauxton/assets/css/cloudant.css| 4167 ---
 src/fauxton/assets/css/rickshaw.css|  315 ++
 src/fauxton/assets/js/libs/rickshaw.js |7 +-
 src/fauxton/grunt.js   |4 +-
 4 files changed, 322 insertions(+), 4171 deletions(-)
--




[Couchdb Wiki] Update of Merge_Procedure by JanLehnardt

2013-02-11 Thread Apache Wiki
Dear Wiki user,

You have subscribed to a wiki page or wiki category on Couchdb Wiki for 
change notification.

The Merge_Procedure page has been changed by JanLehnardt:
http://wiki.apache.org/couchdb/Merge_Procedure?action=diffrev1=11rev2=12

Comment:
clarify branch naming

  
  Please use the ticket number, the type of the branch, along with a very short 
descriptive phrase, for your branch name.
  
- If the ticket was COUCHDB-1234, and the ticket title was My Cool Feature, 
your branch should be called `1234-feature-cool`. If the issue is a bug and the 
branch includes the bug fix, it should be called `1234-fix-cool`.
+ If the ticket was COUCHDB-1234, and the ticket title was My Cool Feature, 
your branch should be called `1234-feature-cool`. If the issue is a bug and the 
branch includes the bug fix, it should be called `1234-fix-cool`. If `cool` are 
multiple words, separate them with a dash: `1234-feature-cool-stuff`.
  
  == Git Best Practice ==
  


[16/19] git commit: Get the pids/ports from pid_procs, not lang_procs

2013-02-11 Thread jhs
Get the pids/ports from pid_procs, not lang_procs


Project: http://git-wip-us.apache.org/repos/asf/couchdb/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb/commit/801b7310
Tree: http://git-wip-us.apache.org/repos/asf/couchdb/tree/801b7310
Diff: http://git-wip-us.apache.org/repos/asf/couchdb/diff/801b7310

Branch: refs/heads/nodejs_couchdb
Commit: 801b7310e1ce1cb4d958b57dc6d192903df6b416
Parents: c27cef1
Author: Jason Smith (work) j...@iriscouch.com
Authored: Fri Feb 8 11:28:02 2013 +
Committer: Jason Smith (work) j...@iriscouch.com
Committed: Fri Feb 8 11:28:02 2013 +

--
 src/couchdb/couch_query_servers.erl |   20 
 1 files changed, 8 insertions(+), 12 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/couchdb/blob/801b7310/src/couchdb/couch_query_servers.erl
--
diff --git a/src/couchdb/couch_query_servers.erl 
b/src/couchdb/couch_query_servers.erl
index 26382d7..099fc12 100644
--- a/src/couchdb/couch_query_servers.erl
+++ b/src/couchdb/couch_query_servers.erl
@@ -353,18 +353,9 @@ handle_call({get_proc, Lang}, From, Server) -
 {reply, Error, Server}
 end;
 handle_call({get_debugging, Lang}, _From, Server) -
-#qserver{lang_procs=LangProcs} = Server,
-case ets:lookup(LangProcs, Lang) of
-[{Lang, Procs}] -
-Ports = lists:map(fun(#proc{pid=Pid, debug_port=Port}) -
-[PidStr] = io_lib:format(~w, [Pid]),
-Pids = string:substr(PidStr, 2, length(PidStr) - 2),
-{?l2b(Pids), Port}
-end, Procs),
-{reply, Ports, Server};
-_ -
-{reply, [], Server}
-end;
+#qserver{pid_procs=PidProcs} = Server,
+Reply = lists:map(fun pid_and_port/1, ets:tab2list(PidProcs)),
+{reply, Reply, Server};
 handle_call({unlink_proc, Pid}, _From, Server) -
 unlink(Pid),
 {reply, ok, Server};
@@ -471,6 +462,11 @@ service_waiting({{Lang}, From}, Server) -
 ok
 end.
 
+pid_and_port({Pid, #proc{debug_port=Port}}) -
+[PidStr] = io_lib:format(~w, [Pid]),
+PidRepr = string:substr(PidStr, 2, length(PidStr) - 2),
+{?l2b(PidRepr), Port}.
+
 lang_proc(Lang, #qserver{
 langs=Langs,
 pid_procs=PidProcs,



[13/19] git commit: Barely-working proxy to node-inspector

2013-02-11 Thread jhs
Barely-working proxy to node-inspector


Project: http://git-wip-us.apache.org/repos/asf/couchdb/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb/commit/df3cf5e2
Tree: http://git-wip-us.apache.org/repos/asf/couchdb/tree/df3cf5e2
Diff: http://git-wip-us.apache.org/repos/asf/couchdb/diff/df3cf5e2

Branch: refs/heads/nodejs_couchdb
Commit: df3cf5e2638cf01c2cd0fc9eeb04dc3e53dd1830
Parents: e2e7d90
Author: Jason Smith (work) j...@iriscouch.com
Authored: Thu Feb 7 12:51:44 2013 +
Committer: Jason Smith (work) j...@iriscouch.com
Committed: Thu Feb 7 12:51:44 2013 +

--
 share/www/verify_install.html   |2 +
 src/couchdb/couch_httpd_debug.erl   |   94 +++--
 src/couchdb/couch_httpd_proxy.erl   |   56 ++
 src/ibrowse/ibrowse_http_client.erl |7 ++
 4 files changed, 101 insertions(+), 58 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/couchdb/blob/df3cf5e2/share/www/verify_install.html
--
diff --git a/share/www/verify_install.html b/share/www/verify_install.html
index 7e3a7a7..ce85c03 100644
--- a/share/www/verify_install.html
+++ b/share/www/verify_install.html
@@ -75,6 +75,8 @@ specific language governing permissions and limitations under 
the License.
 
   //  temporary view
   var resp = db.query(function(doc) {
+if(doc.a)
+  debugger
 if(doc.a) {
   emit(doc.a, doc.a);
 }

http://git-wip-us.apache.org/repos/asf/couchdb/blob/df3cf5e2/src/couchdb/couch_httpd_debug.erl
--
diff --git a/src/couchdb/couch_httpd_debug.erl 
b/src/couchdb/couch_httpd_debug.erl
index f574eff..6faf966 100644
--- a/src/couchdb/couch_httpd_debug.erl
+++ b/src/couchdb/couch_httpd_debug.erl
@@ -27,15 +27,18 @@ handle_debug_req(#httpd{method='GET', 
path_parts=[_Debug]}=Req) - ok
 
 handle_debug_req(#httpd{method='GET', path_parts=[_Debug, Pid | 
_Rest]=Path}=Req) - ok
 , ok = couch_httpd:verify_is_server_admin(Req)
-, io:format(Must look up: ~p for: ~p\n, [Pid, Path])
+%, io:format(Must look up: ~p for: ~p\n, [Pid, Path])
 , Procs = couch_query_servers:debug_ports(javascript)
 , case lists:keyfind(Pid, 1, Procs)
 of {Pid, Port} - ok
 , InspectorPort = Port + 1
 %, proxy_to_inspector(Req, InspectorPort)
-, R = couch_httpd:send_json(Req, 200, {[ {ok,true}, {todo,To 
do} ]})
-, io:format(send_json returns: ~p\n, [R])
-, R
+%, R = couch_httpd:send_json(Req, 200, {[ {ok,true}, {todo,To 
do} ]})
+%, io:format(send_json returns: ~p\n, [R])
+%, R
+, Url = io_lib:format(http://127.0.0.1:~w/_debug/;, 
[InspectorPort])
+%, io:format(Proxy: ~p\n, [Url])
+, couch_httpd_proxy:handle_proxy_req(Req, ?l2b(Url))
 ; false - ok
 , io:format(No such pid: ~p\n, [Pid])
 , couch_httpd:send_json(Req, 404, {[ {error,pid_not_found}, 
{pid,Pid} ]})
@@ -46,61 +49,36 @@ handle_debug_req(Req) - ok
 , send_method_not_allowed(Req, GET)
 .
 
-relay(#httpd{mochi_req=MochiReq}=Req, InspectorSocket) - ok
-, ReqBytes = request_to_iolist(Req)
-, Client = MochiReq:get(socket)
-, gen_tcp:send(InspectorSocket, ReqBytes)
-, relay(Client, InspectorSocket, 0, 0)
-.
-
-relay(Client, Remote, BytesIn, BytesOut) - ok
-%, io:format(Relay in=~w out=~w\n, [BytesIn, BytesOut])
-, inet:setopts(Client, [{packet,0}, {active,once}])
-, inet:setopts(Remote, [{packet,0}, {active,once}])
-, receive
-{_Type, Client, Data} - ok
-%, io:format(  ~w bytes from client\n, [size(Data)])
-, gen_tcp:send(Remote, Data)
-, relay(Client, Remote, BytesIn + size(Data), BytesOut)
-; {_Type, Remote, Data} - ok
-%, io:format(  ~w bytes from inspector\n, [size(Data)])
-, gen_tcp:send(Client, Data)
-, relay(Client, Remote, BytesIn, BytesOut + size(Data))
-; {tcp_closed, _} - ok
-, io:format(Relay finished in=~w out=~w\n, [BytesIn, BytesOut])
-, gen_tcp:close(Client)
-, gen_tcp:close(Remote)
-, {ok, BytesIn, BytesOut}
-, ok
-; Else - ok
-, ?LOG_ERROR(Relay error: ~p, [Else])
-end
-%, couch_httpd:send_json(Req, 200, {[ {ok,true}, {todo,To do} ]})
-.
-
-proxy_to_inspector(Req, Port) - ok
-, io:format(Connect to port ~w\n, [Port])
-, case gen_tcp:connect(127.0.0.1, Port, [binary, {packet,0}, 
{delay_send,true}])
-of {ok, InspectorSocket} - ok
-, io:format(Connected to inspector on :~w\n, [Port])
-, relay(Req, InspectorSocket)
-; {error, Error} - ok
-, 

[11/19] git commit: The idea of the inspector UI

2013-02-11 Thread jhs
The idea of the inspector UI


Project: http://git-wip-us.apache.org/repos/asf/couchdb/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb/commit/fb598b4a
Tree: http://git-wip-us.apache.org/repos/asf/couchdb/tree/fb598b4a
Diff: http://git-wip-us.apache.org/repos/asf/couchdb/diff/fb598b4a

Branch: refs/heads/nodejs_couchdb
Commit: fb598b4a23805400201f92843af33da3823509d5
Parents: 595c1eb
Author: Jason Smith (work) j...@iriscouch.com
Authored: Thu Feb 7 10:51:59 2013 +
Committer: Jason Smith (work) j...@iriscouch.com
Committed: Thu Feb 7 10:51:59 2013 +

--
 share/www/debug.html |   61 +++--
 1 files changed, 53 insertions(+), 8 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/couchdb/blob/fb598b4a/share/www/debug.html
--
diff --git a/share/www/debug.html b/share/www/debug.html
index 6c90417..5738cb4 100644
--- a/share/www/debug.html
+++ b/share/www/debug.html
@@ -28,6 +28,12 @@ specific language governing permissions and limitations 
under the License.
   .is_not_admin, .is_admin {
 display: none;
   }
+
+  #node_inspector_frame {
+width: 100%;
+height: 50em;
+border: none;
+  }
 /style
   /head
   body
@@ -40,18 +46,25 @@ specific language governing permissions and limitations 
under the License.
 p class=is_not_admin
   Sorry, only the site admin may use the debugger.
 /p
-p class=is_admin
+div class=is_admin
+  p
   These JavaScript processes are debuggable:
-/p
-ul id=query_servers
-  !--
-  libutton class=run id=runVerify Your 
Installation./buttonspan id=result/span/li
-  --
-/ul
+  /p
+
+  ul id=query_servers
+li.../li
+  /ul
+
+  div id=node_inspector
+hr
+h2 class=title/h2
+iframe id=node_inspector_frame src=/iframe
+  /div
+/div !-- is_admin --
   /div
 /div
 script
-jQuery(function($) {
+jQuery(function($) {
 
 request.couch('/_session', function(er, res) {
   if(er)
@@ -63,9 +76,41 @@ request.couch('/_session', function(er, res) {
 
   console.log('Confirmed admin')
   $('.is_admin').show()
+  get_debuggers()
 })
 
+function get_debuggers() {
+  request.couch('/_debug', function(er, res) {
+if(er)
+  throw er
+if(!res.body.ok)
+  throw new Error('Unknown response: ' + JSON.stringify(res.body))
+
+var servers = $('#query_servers')
+servers.html('')
+if(res.body.pids.length == 0)
+  return
+
+res.body.pids.forEach(function(pid) {
+  var link = $('lia href=#' + pid + '/a/li')
+  servers.append(link)
+
+  link.find('a').click(function() {
+inspect_pid(pid)
+return false
+  })
 })
+  })
+}
+
+function inspect_pid(pid) {
+  var src = '/_debug/' + pid + '/'
+  $('#node_inspector .title').html('Debugging: ' + pid + '')
+  $('#node_inspector_frame').attr('src', src)
+  $('#node_inspector_frame').css('border', '1px solid black')
+}
+
+}) // jQuery
 /script
   /body
 /html



[6/19] git commit: A /_debug http handler

2013-02-11 Thread jhs
A /_debug http handler


Project: http://git-wip-us.apache.org/repos/asf/couchdb/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb/commit/ea88ce70
Tree: http://git-wip-us.apache.org/repos/asf/couchdb/tree/ea88ce70
Diff: http://git-wip-us.apache.org/repos/asf/couchdb/diff/ea88ce70

Branch: refs/heads/nodejs_couchdb
Commit: ea88ce707be26f0e199424c6f4cbff194b898fb8
Parents: 374e536
Author: Jason Smith (work) j...@iriscouch.com
Authored: Thu Feb 7 07:44:15 2013 +
Committer: Jason Smith (work) j...@iriscouch.com
Committed: Thu Feb 7 07:44:15 2013 +

--
 etc/couchdb/default.ini.tpl.in  |1 +
 share/doc/src/api/configuration.rst |1 +
 share/doc/src/config_reference.rst  |2 ++
 3 files changed, 4 insertions(+), 0 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/couchdb/blob/ea88ce70/etc/couchdb/default.ini.tpl.in
--
diff --git a/etc/couchdb/default.ini.tpl.in b/etc/couchdb/default.ini.tpl.in
index deed659..a2cdf49 100644
--- a/etc/couchdb/default.ini.tpl.in
+++ b/etc/couchdb/default.ini.tpl.in
@@ -157,6 +157,7 @@ _stats = {couch_httpd_stats_handlers, handle_stats_req}
 _log = {couch_httpd_misc_handlers, handle_log_req}
 _session = {couch_httpd_auth, handle_session_req}
 _oauth = {couch_httpd_oauth, handle_oauth_req}
+_debug = {couch_httpd_debug, handle_debug_req}
 
 [httpd_db_handlers]
 _all_docs = {couch_mrview_http, handle_all_docs_req}

http://git-wip-us.apache.org/repos/asf/couchdb/blob/ea88ce70/share/doc/src/api/configuration.rst
--
diff --git a/share/doc/src/api/configuration.rst 
b/share/doc/src/api/configuration.rst
index 6c2c588..a7c938f 100644
--- a/share/doc/src/api/configuration.rst
+++ b/share/doc/src/api/configuration.rst
@@ -162,6 +162,7 @@ The response is the JSON structure:
   _oauth : {couch_httpd_oauth, handle_oauth_req},
   _restart : {couch_httpd_misc_handlers, handle_restart_req},
   _uuids : {couch_httpd_misc_handlers, handle_uuids_req},
+  _debug : {couch_httpd_debug, handle_debug_req},
   _stats : {couch_httpd_stats_handlers, handle_stats_req}
}
 }

http://git-wip-us.apache.org/repos/asf/couchdb/blob/ea88ce70/share/doc/src/config_reference.rst
--
diff --git a/share/doc/src/config_reference.rst 
b/share/doc/src/config_reference.rst
index 7ae761a..9f150c3 100644
--- a/share/doc/src/config_reference.rst
+++ b/share/doc/src/config_reference.rst
@@ -224,6 +224,8 @@ httpd_global_handlers Configuration Options
 
+--+---+
 | _utils   | _utils
|
 
+--+---+
+| _debug   | _debug
|
++--+---+
 | _uuids   | _uuids
|
 
+--+---+
 | favicon.ico  | favicon.ico   
|



[14/19] git commit: Connect directly to node-inspector for now

2013-02-11 Thread jhs
Connect directly to node-inspector for now


Project: http://git-wip-us.apache.org/repos/asf/couchdb/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb/commit/45654f11
Tree: http://git-wip-us.apache.org/repos/asf/couchdb/tree/45654f11
Diff: http://git-wip-us.apache.org/repos/asf/couchdb/diff/45654f11

Branch: refs/heads/nodejs_couchdb
Commit: 45654f115ef1a1f7c1accaabf73222818032d6d6
Parents: df3cf5e
Author: Jason Smith (work) j...@iriscouch.com
Authored: Fri Feb 8 10:01:55 2013 +
Committer: Jason Smith (work) j...@iriscouch.com
Committed: Fri Feb 8 10:01:55 2013 +

--
 share/www/debug.html  |   13 -
 src/couchdb/couch_httpd_debug.erl |2 +-
 2 files changed, 9 insertions(+), 6 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/couchdb/blob/45654f11/share/www/debug.html
--
diff --git a/share/www/debug.html b/share/www/debug.html
index 5738cb4..7aee22a 100644
--- a/share/www/debug.html
+++ b/share/www/debug.html
@@ -92,21 +92,24 @@ function get_debuggers() {
   return
 
 res.body.pids.forEach(function(pid) {
-  var link = $('lia href=#' + pid + '/a/li')
+  var port = res.body.procs[pid] + 1
+  var url = 'http://' + window.location.hostname + ':' + port + '/_debug/' 
+ pid + '/'
+  var link = $('lia href='+url+'' + pid + '/a/li')
+  console.log(res.body)
   servers.append(link)
 
   link.find('a').click(function() {
-inspect_pid(pid)
+var url = $(this).attr('href')
+inspect_pid(pid, url)
 return false
   })
 })
   })
 }
 
-function inspect_pid(pid) {
-  var src = '/_debug/' + pid + '/'
+function inspect_pid(pid, url) {
   $('#node_inspector .title').html('Debugging: ' + pid + '')
-  $('#node_inspector_frame').attr('src', src)
+  $('#node_inspector_frame').attr('src', url)
   $('#node_inspector_frame').css('border', '1px solid black')
 }
 

http://git-wip-us.apache.org/repos/asf/couchdb/blob/45654f11/src/couchdb/couch_httpd_debug.erl
--
diff --git a/src/couchdb/couch_httpd_debug.erl 
b/src/couchdb/couch_httpd_debug.erl
index 6faf966..9ca0eab 100644
--- a/src/couchdb/couch_httpd_debug.erl
+++ b/src/couchdb/couch_httpd_debug.erl
@@ -22,7 +22,7 @@ handle_debug_req(#httpd{method='GET', 
path_parts=[_Debug]}=Req) - ok
 , ok = couch_httpd:verify_is_server_admin(Req)
 , Procs = couch_query_servers:debug_ports(javascript)
 , Pids = [ Pid || {Pid, _Port} - Procs ]
-, couch_httpd:send_json(Req, 200, {[ {ok,true}, {pids, Pids} ]})
+, couch_httpd:send_json(Req, 200, {[ {ok,true}, {pids,Pids}, 
{procs,{Procs}} ]})
 ;
 
 handle_debug_req(#httpd{method='GET', path_parts=[_Debug, Pid | 
_Rest]=Path}=Req) - ok



[5/19] git commit: A debugging page

2013-02-11 Thread jhs
A debugging page


Project: http://git-wip-us.apache.org/repos/asf/couchdb/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb/commit/374e536f
Tree: http://git-wip-us.apache.org/repos/asf/couchdb/tree/374e536f
Diff: http://git-wip-us.apache.org/repos/asf/couchdb/diff/374e536f

Branch: refs/heads/nodejs_couchdb
Commit: 374e536f1952f6a539133964a6e44582c39db540
Parents: 5ad2487
Author: Jason Smith (work) j...@iriscouch.com
Authored: Thu Feb 7 07:34:39 2013 +
Committer: Jason Smith (work) j...@iriscouch.com
Committed: Thu Feb 7 07:34:39 2013 +

--
 share/www/_sidebar.html |1 +
 share/www/debug.html|   71 ++
 2 files changed, 72 insertions(+), 0 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/couchdb/blob/374e536f/share/www/_sidebar.html
--
diff --git a/share/www/_sidebar.html b/share/www/_sidebar.html
index 271e906..52d34f6 100644
--- a/share/www/_sidebar.html
+++ b/share/www/_sidebar.html
@@ -30,6 +30,7 @@ specific language governing permissions and limitations under 
the License.
 lispanDiagnostics/spanul
   lia href=verify_install.htmlVerify Installation/a/li
   lia href=couch_tests.html?script/couch_tests.jsTest Suite/a/li
+  lia href=debug.htmlDebugger/a/li
 /ul/li
 lispanRecent Databases/span
   ul id=dbs/ul

http://git-wip-us.apache.org/repos/asf/couchdb/blob/374e536f/share/www/debug.html
--
diff --git a/share/www/debug.html b/share/www/debug.html
new file mode 100644
index 000..6c90417
--- /dev/null
+++ b/share/www/debug.html
@@ -0,0 +1,71 @@
+!DOCTYPE html
+!--
+
+Licensed under the Apache License, Version 2.0 (the License); you may not use
+this file except in compliance with the License. You may obtain a copy of the
+License at
+
+   http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software distributed
+under the License is distributed on an AS IS BASIS, WITHOUT WARRANTIES OR
+CONDITIONS OF ANY KIND, either express or implied. See the License for the
+specific language governing permissions and limitations under the License.
+
+--
+html lang=en
+  head
+titleTest Suite/title
+meta http-equiv=Content-Type content=text/html;charset=utf-8
+link rel=stylesheet href=style/layout.css?0.11.0 type=text/css
+script src=script/json2.js/script
+script src=script/sha1.js/script
+script src=script/jquery.js/script
+script src=script/jquery.couch.js/script
+script src=script/futon.js/script
+script src=script/request-min.js/script
+style
+  .is_not_admin, .is_admin {
+display: none;
+  }
+/style
+  /head
+  body
+div id=wrap
+  h1
+a href=index.htmlOverview/a
+strongVerify Install/strong
+  /h1
+  div id=content
+p class=is_not_admin
+  Sorry, only the site admin may use the debugger.
+/p
+p class=is_admin
+  These JavaScript processes are debuggable:
+/p
+ul id=query_servers
+  !--
+  libutton class=run id=runVerify Your 
Installation./buttonspan id=result/span/li
+  --
+/ul
+  /div
+/div
+script
+jQuery(function($) {
+
+request.couch('/_session', function(er, res) {
+  if(er)
+throw er
+
+  var session = res.body
+  if(!~ session.userCtx.roles.indexOf('_admin'))
+return $('.is_not_admin').show()
+
+  console.log('Confirmed admin')
+  $('.is_admin').show()
+})
+
+})
+/script
+  /body
+/html



[2/19] git commit: Set an environment variable for the debugging port

2013-02-11 Thread jhs
Set an environment variable for the debugging port


Project: http://git-wip-us.apache.org/repos/asf/couchdb/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb/commit/b5ddad2d
Tree: http://git-wip-us.apache.org/repos/asf/couchdb/tree/b5ddad2d
Diff: http://git-wip-us.apache.org/repos/asf/couchdb/diff/b5ddad2d

Branch: refs/heads/nodejs_couchdb
Commit: b5ddad2d1704743e4dc8e852c7d5ef50983f6541
Parents: c616659
Author: Jason Smith (work) j...@iriscouch.com
Authored: Sun Feb 3 14:34:09 2013 +
Committer: Jason Smith (work) j...@iriscouch.com
Committed: Sun Feb 3 14:34:09 2013 +

--
 src/couchdb/couch_query_servers.erl |9 -
 1 files changed, 8 insertions(+), 1 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/couchdb/blob/b5ddad2d/src/couchdb/couch_query_servers.erl
--
diff --git a/src/couchdb/couch_query_servers.erl 
b/src/couchdb/couch_query_servers.erl
index e29f23b..b15122b 100644
--- a/src/couchdb/couch_query_servers.erl
+++ b/src/couchdb/couch_query_servers.erl
@@ -479,7 +479,14 @@ new_process(Langs, LangLimits, Lang) -
 if (Lim == 0) or (Current  Lim) - % Lim == 0 means no limit
 % we are below the limit for our language, make a new one
 case ets:lookup(Langs, Lang) of
-[{Lang, Mod, Func, Arg}] -
+[{Lang, Mod, Func, Arg0}] -
+Arg = case {Lang, Arg0} of
+{javascript, [_OneElement]} -
+DebugPort = 5858 + random:uniform(1000),
+EnvOpt = {env, [{COUCHJS_DEBUG_PORT, 
integer_to_list(DebugPort)}]},
+Arg0 ++ [[], [EnvOpt]];
+_ - Arg0
+end,
 {ok, Pid} = apply(Mod, Func, Arg),
 erlang:monitor(process, Pid),
 true = ets:insert(LangLimits, {Lang, Lim, Current+1}),



[3/19] git commit: Associate the debugging port with the view server proc

2013-02-11 Thread jhs
Associate the debugging port with the view server proc


Project: http://git-wip-us.apache.org/repos/asf/couchdb/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb/commit/63c59c7f
Tree: http://git-wip-us.apache.org/repos/asf/couchdb/tree/63c59c7f
Diff: http://git-wip-us.apache.org/repos/asf/couchdb/diff/63c59c7f

Branch: refs/heads/nodejs_couchdb
Commit: 63c59c7f6acaf0bfc57c9d1f4c626eef7546b9a9
Parents: b5ddad2
Author: Jason Smith (work) j...@iriscouch.com
Authored: Sun Feb 3 14:39:07 2013 +
Committer: Jason Smith (work) j...@iriscouch.com
Committed: Sun Feb 3 14:39:07 2013 +

--
 src/couchdb/couch_query_servers.erl |   14 +-
 1 files changed, 9 insertions(+), 5 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/couchdb/blob/63c59c7f/src/couchdb/couch_query_servers.erl
--
diff --git a/src/couchdb/couch_query_servers.erl 
b/src/couchdb/couch_query_servers.erl
index b15122b..5a394b0 100644
--- a/src/couchdb/couch_query_servers.erl
+++ b/src/couchdb/couch_query_servers.erl
@@ -30,6 +30,7 @@
 
 -record(proc, {
 pid,
+debug_port,
 lang,
 ddoc_keys = [],
 prompt_fun,
@@ -480,18 +481,21 @@ new_process(Langs, LangLimits, Lang) -
 % we are below the limit for our language, make a new one
 case ets:lookup(Langs, Lang) of
 [{Lang, Mod, Func, Arg0}] -
-Arg = case {Lang, Arg0} of
+{Arg, DebugPort} = case {Lang, Arg0} of
 {javascript, [_OneElement]} -
-DebugPort = 5858 + random:uniform(1000),
-EnvOpt = {env, [{COUCHJS_DEBUG_PORT, 
integer_to_list(DebugPort)}]},
-Arg0 ++ [[], [EnvOpt]];
-_ - Arg0
+DbgPort = 5858 + random:uniform(1000),
+EnvOpt = {env, [{COUCHJS_DEBUG_PORT, 
integer_to_list(DbgPort)}]},
+AllArgs = Arg0 ++ [ [], [EnvOpt] ],
+{AllArgs, DbgPort};
+_ - {Arg0, nil}
 end,
+
 {ok, Pid} = apply(Mod, Func, Arg),
 erlang:monitor(process, Pid),
 true = ets:insert(LangLimits, {Lang, Lim, Current+1}),
 {ok, #proc{lang=Lang,
pid=Pid,
+   debug_port=DebugPort,
% Called via proc_prompt, proc_set_timeout, and 
proc_stop
prompt_fun={Mod, prompt},
prompt_many_fun={Mod, prompt_many},



[4/19] git commit: Import browser-request v0.2.1

2013-02-11 Thread jhs
Import browser-request v0.2.1


Project: http://git-wip-us.apache.org/repos/asf/couchdb/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb/commit/5ad24876
Tree: http://git-wip-us.apache.org/repos/asf/couchdb/tree/5ad24876
Diff: http://git-wip-us.apache.org/repos/asf/couchdb/diff/5ad24876

Branch: refs/heads/nodejs_couchdb
Commit: 5ad2487692932dd67fd3e0033225cddfd5d2fa71
Parents: 63c59c7
Author: Jason Smith (work) j...@iriscouch.com
Authored: Thu Feb 7 07:12:47 2013 +
Committer: Jason Smith (work) j...@iriscouch.com
Committed: Thu Feb 7 07:33:46 2013 +

--
 share/www/script/request-min.js |   32 ++
 share/www/script/request.js |  943 ++
 2 files changed, 975 insertions(+), 0 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/couchdb/blob/5ad24876/share/www/script/request-min.js
--
diff --git a/share/www/script/request-min.js b/share/www/script/request-min.js
new file mode 100644
index 000..b18c2aa
--- /dev/null
+++ b/share/www/script/request-min.js
@@ -0,0 +1,32 @@
+/**
+* XMLHttpRequest.js Copyright (C) 2011 Sergey Ilinsky (http://www.ilinsky.com)
+*
+* This work is free software; you can redistribute it and/or modify
+* it under the terms of the GNU Lesser General Public License as published by
+* the Free Software Foundation; either version 2.1 of the License, or
+* (at your option) any later version.
+*
+* This work is distributed in the hope that it will be useful,
+* but without any warranty; without even the implied warranty of
+* merchantability or fitness for a particular purpose. See the
+* GNU Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public License
+* along with this library; if not, write to the Free Software Foundation, Inc.,
+* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+*/
+
+// Browser-Request
+//
+// Licensed under the Apache License, Version 2.0 (the License); you may not
+// use this file except in compliance with the License. You may obtain a copy 
of
+// the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an AS IS BASIS, WITHOUT
+// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+// License for the specific language governing permissions and limitations 
under
+// the License.
+(function(){function e(){this._object=a!d?new a:new 
window.ActiveXObject(Microsoft.XMLHTTP),this._listeners=[]}function 
f(){return new e}function 
g(a){a._object.send(a._data);if(b!a._async){a.readyState=f.OPENED,j(a);while(a.readyStatef.DONE){a.readyState++,h(a);if(a._aborted)return}}}function
 
h(a){f.onreadystatechangef.onreadystatechange.apply(a),a.dispatchEvent({type:readystatechange,bubbles:!1,cancelable:!1,timeStamp:new
 Date+0})}function i(a){var 
b=a.responseXML,d=a.responseText;cdb!b.documentElementa.getResponseHeader(Content-Type).match(/[^\/]+\/[^\+]+\+xml/)(b=new
 
window.ActiveXObject(Microsoft.XMLDOM),b.async=!1,b.validateOnParse=!1,b.loadXML(d));if(b)if(cb.parseError!==0||!b.documentElement||b.documentElementb.documentElement.tagName==parsererror)return
 null;return b}function 
j(a){try{a.responseText=a._object.responseText}catch(b){}try{a.responseXML=i(a._object)}catch(b){}try{a.status=a._object.status}catch(b){}try{a.statusText=a._object.statu
 sText}catch(b){}}function k(a){a._object.onreadystatechange=new 
window.Function}var 
a=window.XMLHttpRequest,b=!!window.controllers,c=!!window.document.namespaces,d=cwindow.navigator.userAgent.match(/MSIE
 
7.0/);f.prototype=e.prototype,ba.wrapped(f.wrapped=a.wrapped),f.UNSENT=0,f.OPENED=1,f.HEADERS_RECEIVED=2,f.LOADING=3,f.DONE=4,f.prototype.UNSENT=f.UNSENT,f.prototype.OPENED=f.OPENED,f.prototype.HEADERS_RECEIVED=f.HEADERS_RECEIVED,f.prototype.LOADING=f.LOADING,f.prototype.DONE=f.DONE,f.prototype.readyState=f.UNSENT,f.prototype.responseText=,f.prototype.responseXML=null,f.prototype.status=0,f.prototype.statusText=,f.prototype.priority=NORMAL,f.prototype.onreadystatechange=null,f.onreadystatechange=null,f.onopen=null,f.onsend=null,f.onabort=null,f.prototype.open=function(a,d,e,g,i){var
 l=a.toLowerCase();if(l==connect||l==trace||l==track)throw new 
Error(18);delete this._headers,arguments.length3(e=!0),this._async=e;var 
m=this,n=this.readyState,o=null;ce(o=functi
 

[9/19] git commit: Return the query server PIDs and their associated debugger ports

2013-02-11 Thread jhs
Return the query server PIDs and their associated debugger ports


Project: http://git-wip-us.apache.org/repos/asf/couchdb/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb/commit/915c7e7b
Tree: http://git-wip-us.apache.org/repos/asf/couchdb/tree/915c7e7b
Diff: http://git-wip-us.apache.org/repos/asf/couchdb/diff/915c7e7b

Branch: refs/heads/nodejs_couchdb
Commit: 915c7e7b0b3a7092b42ffd404c2c18b5528b57c9
Parents: 44d4b5f
Author: Jason Smith (work) j...@iriscouch.com
Authored: Thu Feb 7 08:53:38 2013 +
Committer: Jason Smith (work) j...@iriscouch.com
Committed: Thu Feb 7 08:53:38 2013 +

--
 src/couchdb/couch_query_servers.erl |   16 
 1 files changed, 16 insertions(+), 0 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/couchdb/blob/915c7e7b/src/couchdb/couch_query_servers.erl
--
diff --git a/src/couchdb/couch_query_servers.erl 
b/src/couchdb/couch_query_servers.erl
index 54bad8d..b3e1c3a 100644
--- a/src/couchdb/couch_query_servers.erl
+++ b/src/couchdb/couch_query_servers.erl
@@ -22,6 +22,7 @@
 -export([filter_view/3]).
 
 -export([with_ddoc_proc/2, proc_prompt/2, ddoc_prompt/3, ddoc_proc_prompt/3, 
json_doc/1]).
+-export([debug_ports/1]).
 
 % For 210-os-proc-pool.t
 -export([get_os_process/1, ret_os_process/1]).
@@ -240,6 +241,9 @@ validate_doc_update(DDoc, EditDoc, DiskDoc, Ctx, SecObj) -
 throw({unauthorized, Message})
 end.
 
+debug_ports(Lang) -
+gen_server:call(couch_query_servers, {get_debugging, ?l2b(Lang)}).
+
 json_doc(nil) - null;
 json_doc(Doc) -
 couch_doc:to_json_obj(Doc, [revs]).
@@ -348,6 +352,18 @@ handle_call({get_proc, Lang}, From, Server) -
 Error -
 {reply, Error, Server}
 end;
+handle_call({get_debugging, Lang}, _From, Server) -
+#qserver{lang_procs=LangProcs} = Server,
+case ets:lookup(LangProcs, Lang) of
+[{Lang, Procs}] -
+Ports = lists:map(fun(#proc{pid=Pid, debug_port=Port}) -
+PidStr = io_lib:format(~w, [Pid]),
+{?l2b(PidStr), Port}
+end, Procs),
+{reply, Ports, Server};
+_ -
+{reply, [], Server}
+end;
 handle_call({unlink_proc, Pid}, _From, Server) -
 unlink(Pid),
 {reply, ok, Server};



[10/19] git commit: Strip the and from the pid keys

2013-02-11 Thread jhs
Strip the  and  from the pid keys


Project: http://git-wip-us.apache.org/repos/asf/couchdb/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb/commit/595c1eb7
Tree: http://git-wip-us.apache.org/repos/asf/couchdb/tree/595c1eb7
Diff: http://git-wip-us.apache.org/repos/asf/couchdb/diff/595c1eb7

Branch: refs/heads/nodejs_couchdb
Commit: 595c1eb7b21d65362ce3e7aa6983890f7bd82252
Parents: 915c7e7
Author: Jason Smith (work) j...@iriscouch.com
Authored: Thu Feb 7 09:41:41 2013 +
Committer: Jason Smith (work) j...@iriscouch.com
Committed: Thu Feb 7 09:41:41 2013 +

--
 src/couchdb/couch_query_servers.erl |5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/couchdb/blob/595c1eb7/src/couchdb/couch_query_servers.erl
--
diff --git a/src/couchdb/couch_query_servers.erl 
b/src/couchdb/couch_query_servers.erl
index b3e1c3a..26382d7 100644
--- a/src/couchdb/couch_query_servers.erl
+++ b/src/couchdb/couch_query_servers.erl
@@ -357,8 +357,9 @@ handle_call({get_debugging, Lang}, _From, Server) -
 case ets:lookup(LangProcs, Lang) of
 [{Lang, Procs}] -
 Ports = lists:map(fun(#proc{pid=Pid, debug_port=Port}) -
-PidStr = io_lib:format(~w, [Pid]),
-{?l2b(PidStr), Port}
+[PidStr] = io_lib:format(~w, [Pid]),
+Pids = string:substr(PidStr, 2, length(PidStr) - 2),
+{?l2b(Pids), Port}
 end, Procs),
 {reply, Ports, Server};
 _ -



[19/19] git commit: Remove unused code

2013-02-11 Thread jhs
Updated Branches:
  refs/heads/nodejs_couchdb e0278596e - 5f1f41832


Remove unused code


Project: http://git-wip-us.apache.org/repos/asf/couchdb/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb/commit/5f1f4183
Tree: http://git-wip-us.apache.org/repos/asf/couchdb/tree/5f1f4183
Diff: http://git-wip-us.apache.org/repos/asf/couchdb/diff/5f1f4183

Branch: refs/heads/nodejs_couchdb
Commit: 5f1f41832effe3ec94306ac0f2931d58a91c1888
Parents: 663792c
Author: Jason Smith (work) j...@iriscouch.com
Authored: Mon Feb 11 07:47:44 2013 +
Committer: Jason Smith (work) j...@iriscouch.com
Committed: Mon Feb 11 07:47:44 2013 +

--
 src/couchdb/couch_httpd_debug.erl |   43 
 1 files changed, 0 insertions(+), 43 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/couchdb/blob/5f1f4183/src/couchdb/couch_httpd_debug.erl
--
diff --git a/src/couchdb/couch_httpd_debug.erl 
b/src/couchdb/couch_httpd_debug.erl
index 8fa7686..c100910 100644
--- a/src/couchdb/couch_httpd_debug.erl
+++ b/src/couchdb/couch_httpd_debug.erl
@@ -116,49 +116,6 @@ request_to_iolist(#httpd{method=Method, 
mochi_req=MochiReq}) - ok
 , [Action, \r\n, Headers, \r\n]
 .
 
-%% Login handler with Browser ID.
-%handle_id_req(#httpd{method='POST'}=Req) - ok
-%, case couch_config:get(browserid, enabled)
-%of true - ok
-%, case couch_config:get(browserid, audience, undefined)
-%of undefined - ok
-%, throw({error, no_browserid_audience})
-%; Audience - ok
-%, handle_id_req(enabled, Audience, Req)
-%end
-%; _ - ok
-%% Browserid is disabled in the config.
-%, throw({error, browserid_not_enabled})
-%end
-%;
-%
-%handle_id_req(_Req) -
-%% Send 405
-%not_implemented.
-%
-%handle_id_req(enabled, Audience, #httpd{method='POST', 
mochi_req=MochiReq}=Req) -
-%ReqBody = MochiReq:recv_body(),
-%Form = case MochiReq:get_primary_header_value(content-type) of
-%% content type should be json
-%application/x-www-form-urlencoded ++ _ -
-%mochiweb_util:parse_qs(ReqBody);
-%application/json ++ _ -
-%{Pairs} = ?JSON_DECODE(ReqBody),
-%lists:map(fun({Key, Value}) -
-%  {?b2l(Key), ?b2l(Value)}
-%end, Pairs);
-%_ -
-%[]%couch_httpd:send_json(Req, 406, {error, method_not_allowed})
-%end,
-%Assertion = couch_util:get_value(assertion, Form, ),
-%case verify_id(Assertion, Audience) of
-%{error, _Reason} -
-%% Send client an error response, couch_util:send_err ...
-%not_implemented;
-%{ok, Verified_obj} - ok
-%, send_good_id(Req, Verified_obj)
-%end.
-
 
 %
 % Utilities



[7/19] git commit: A debugger server

2013-02-11 Thread jhs
A debugger server


Project: http://git-wip-us.apache.org/repos/asf/couchdb/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb/commit/41b895d1
Tree: http://git-wip-us.apache.org/repos/asf/couchdb/tree/41b895d1
Diff: http://git-wip-us.apache.org/repos/asf/couchdb/diff/41b895d1

Branch: refs/heads/nodejs_couchdb
Commit: 41b895d1f5051fc7e7d22c4f1cc29f5bcc26c2ed
Parents: ea88ce7
Author: Jason Smith (work) j...@iriscouch.com
Authored: Thu Feb 7 07:50:47 2013 +
Committer: Jason Smith (work) j...@iriscouch.com
Committed: Thu Feb 7 07:50:47 2013 +

--
 src/couchdb/Makefile.am   |2 +
 src/couchdb/couch_httpd_debug.erl |   75 
 2 files changed, 77 insertions(+), 0 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/couchdb/blob/41b895d1/src/couchdb/Makefile.am
--
diff --git a/src/couchdb/Makefile.am b/src/couchdb/Makefile.am
index 9fe19bc..fd86d59 100644
--- a/src/couchdb/Makefile.am
+++ b/src/couchdb/Makefile.am
@@ -50,6 +50,7 @@ source_files = \
 couch_httpd_db.erl \
 couch_httpd_auth.erl \
 couch_httpd_cors.erl \
+couch_httpd_debug.erl \
 couch_httpd_oauth.erl \
 couch_httpd_external.erl \
 couch_httpd_misc_handlers.erl \
@@ -108,6 +109,7 @@ compiled_files = \
 couch_httpd_auth.beam \
 couch_httpd_oauth.beam \
 couch_httpd_cors.beam \
+couch_httpd_debug.beam \
 couch_httpd_proxy.beam \
 couch_httpd_external.beam \
 couch_httpd_misc_handlers.beam \

http://git-wip-us.apache.org/repos/asf/couchdb/blob/41b895d1/src/couchdb/couch_httpd_debug.erl
--
diff --git a/src/couchdb/couch_httpd_debug.erl 
b/src/couchdb/couch_httpd_debug.erl
new file mode 100644
index 000..22a9a11
--- /dev/null
+++ b/src/couchdb/couch_httpd_debug.erl
@@ -0,0 +1,75 @@
+% Licensed under the Apache License, Version 2.0 (the License); you may not
+% use this file except in compliance with the License.  You may obtain a copy 
of
+% the License at
+%
+%   http://www.apache.org/licenses/LICENSE-2.0
+%
+% Unless required by applicable law or agreed to in writing, software
+% distributed under the License is distributed on an AS IS BASIS, WITHOUT
+% WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
+% License for the specific language governing permissions and limitations under
+% the License.
+
+-module(couch_httpd_debug).
+-include(couch_db.hrl).
+
+-export([handle_debug_req/1]).
+
+-import(couch_httpd, [header_value/2, send_method_not_allowed/2]).
+
+
+handle_debug_req(#httpd{method='GET'}=Req) - ok
+, ok = couch_httpd:verify_is_server_admin(Req)
+, couch_httpd:send_json(Req, 200, {[ {ok, true} ]})
+.
+
+%% Login handler with Browser ID.
+%handle_id_req(#httpd{method='POST'}=Req) - ok
+%, case couch_config:get(browserid, enabled)
+%of true - ok
+%, case couch_config:get(browserid, audience, undefined)
+%of undefined - ok
+%, throw({error, no_browserid_audience})
+%; Audience - ok
+%, handle_id_req(enabled, Audience, Req)
+%end
+%; _ - ok
+%% Browserid is disabled in the config.
+%, throw({error, browserid_not_enabled})
+%end
+%;
+%
+%handle_id_req(_Req) -
+%% Send 405
+%not_implemented.
+%
+%handle_id_req(enabled, Audience, #httpd{method='POST', 
mochi_req=MochiReq}=Req) -
+%ReqBody = MochiReq:recv_body(),
+%Form = case MochiReq:get_primary_header_value(content-type) of
+%% content type should be json
+%application/x-www-form-urlencoded ++ _ -
+%mochiweb_util:parse_qs(ReqBody);
+%application/json ++ _ -
+%{Pairs} = ?JSON_DECODE(ReqBody),
+%lists:map(fun({Key, Value}) -
+%  {?b2l(Key), ?b2l(Value)}
+%end, Pairs);
+%_ -
+%[]%couch_httpd:send_json(Req, 406, {error, method_not_allowed})
+%end,
+%Assertion = couch_util:get_value(assertion, Form, ),
+%case verify_id(Assertion, Audience) of
+%{error, _Reason} -
+%% Send client an error response, couch_util:send_err ...
+%not_implemented;
+%{ok, Verified_obj} - ok
+%, send_good_id(Req, Verified_obj)
+%end.
+
+
+%
+% Utilities
+%
+
+
+% vim: sts=4 sw=4 et



[1/19] git commit: ?PORT_OPTIONS is always the default for os processes

2013-02-11 Thread jhs
?PORT_OPTIONS is always the default for os processes


Project: http://git-wip-us.apache.org/repos/asf/couchdb/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb/commit/c6166597
Tree: http://git-wip-us.apache.org/repos/asf/couchdb/tree/c6166597
Diff: http://git-wip-us.apache.org/repos/asf/couchdb/diff/c6166597

Branch: refs/heads/nodejs_couchdb
Commit: c6166597ebb24ea8f9d5961cfcf143da02117486
Parents: e027859
Author: Jason Smith (work) j...@iriscouch.com
Authored: Sun Feb 3 14:33:37 2013 +
Committer: Jason Smith (work) j...@iriscouch.com
Committed: Sun Feb 3 14:33:37 2013 +

--
 src/couchdb/couch_os_process.erl |9 +++--
 1 files changed, 7 insertions(+), 2 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/couchdb/blob/c6166597/src/couchdb/couch_os_process.erl
--
diff --git a/src/couchdb/couch_os_process.erl b/src/couchdb/couch_os_process.erl
index 3a267be..dd0d5c5 100644
--- a/src/couchdb/couch_os_process.erl
+++ b/src/couchdb/couch_os_process.erl
@@ -33,8 +33,13 @@
 start_link(Command) -
 start_link(Command, []).
 start_link(Command, Options) -
-start_link(Command, Options, ?PORT_OPTIONS).
-start_link(Command, Options, PortOptions) -
+start_link(Command, Options, []).
+start_link(Command, Options, ExtraPortOptions) -
+% The ?PORT_OPTIONS are the defaults.
+PortOptions = lists:foldl(fun({Key, Val}=Option, State) -
+lists:keystore(Key, 1, State, Option)
+end, ?PORT_OPTIONS, ExtraPortOptions),
+io:format(start_link: ~p\n, [PortOptions]),
 gen_server:start_link(couch_os_process, [Command, Options, PortOptions], 
[]).
 
 stop(Pid) -



git commit: Move myself from THANKS to AUTHORS.

2013-02-11 Thread wohali
Updated Branches:
  refs/heads/master 78f305449 - 6beb66c71


Move myself from THANKS to AUTHORS.

Project: http://git-wip-us.apache.org/repos/asf/couchdb/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb/commit/6beb66c7
Tree: http://git-wip-us.apache.org/repos/asf/couchdb/tree/6beb66c7
Diff: http://git-wip-us.apache.org/repos/asf/couchdb/diff/6beb66c7

Branch: refs/heads/master
Commit: 6beb66c7179cca8b578934b6c4b6f47437e0c663
Parents: 78f3054
Author: Joan Touzet woh...@apache.org
Authored: Mon Feb 11 13:36:45 2013 -0500
Committer: Joan Touzet woh...@apache.org
Committed: Mon Feb 11 13:36:45 2013 -0500

--
 AUTHORS   |1 +
 THANKS.in |1 -
 2 files changed, 1 insertions(+), 1 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/couchdb/blob/6beb66c7/AUTHORS
--
diff --git a/AUTHORS b/AUTHORS
index 49b5ef1..8577381 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -20,5 +20,6 @@ documentation or developing software. Some of these people 
are:
  * Bob Dionne bitdid...@apache.org
  * Dave Cottlehuber d...@apache.org
  * Jason Smith j...@apache.org
+ * Joan Touzet jo...@ieee.org
 
 For a list of other credits see the `THANKS` file.

http://git-wip-us.apache.org/repos/asf/couchdb/blob/6beb66c7/THANKS.in
--
diff --git a/THANKS.in b/THANKS.in
index ec0f8d3..4ebf3f0 100644
--- a/THANKS.in
+++ b/THANKS.in
@@ -94,7 +94,6 @@ suggesting improvements or submitting changes. Some of these 
people are:
  * Fedor Indutny fe...@indutny.com
  * Tim Blair
  * Tady Walsh he...@tady.me
- * Joan Touzet jo...@ieee.org
 # Authors from commit 6c976bd and onwards are auto-inserted. If you are merging
 # a commit from a non-committer, you should not add an entry to this file. When
 # `bootstrap` is run, the actual THANKS file will be generated.