couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From robertkowal...@apache.org
Subject fauxton commit: updated refs/heads/master to 8f84268
Date Thu, 26 Nov 2015 13:53:11 GMT
Repository: couchdb-fauxton
Updated Branches:
  refs/heads/master f4ff1c5f6 -> 8f84268cf


build: add json suffix to json files

adding a .json suffix to our json files enables us to use the
faster native `require` from node instead of grunts wrapper
around the file api with a json parser.

decoupling the reading from grunt enables us to slice out small
parts of our build without a hard dependency to the grunt
monolith.

notes:

 - throw instead of silently fail in case of a missing
   settings.json. if the settings.json is missing fauxton can't
   run, there is no reason to return a stub

PR: #581
PR-URL: https://github.com/apache/couchdb-fauxton/pull/581
Reviewed-By: Michelle Phung <michellep@apache.org>


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

Branch: refs/heads/master
Commit: 8f84268cf9d8d16d13bc43068edc31483193b2a0
Parents: f4ff1c5
Author: Robert Kowalski <robertkowalski@apache.org>
Authored: Wed Nov 25 15:56:28 2015 +0100
Committer: Robert Kowalski <robertkowalski@apache.org>
Committed: Thu Nov 26 14:53:03 2015 +0100

----------------------------------------------------------------------
 .gitignore                 |  2 +
 i18n.json.default          | 15 -------
 i18n.json.default.json     | 15 +++++++
 settings.json.default      | 87 -----------------------------------------
 settings.json.default.json | 87 +++++++++++++++++++++++++++++++++++++++++
 tasks/fauxton.js           |  4 +-
 tasks/helper.js            | 12 +++---
 7 files changed, 112 insertions(+), 110 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/8f84268c/.gitignore
----------------------------------------------------------------------
diff --git a/.gitignore b/.gitignore
index 988ac27..5420277 100644
--- a/.gitignore
+++ b/.gitignore
@@ -22,6 +22,8 @@ app/addons/*
 settings.json*
 i18n.json
 !settings.json.default
+!settings.json.default.json
+!i18n.json.default.json
 test/test.config.js
 app/initialize.js
 .module-cache

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/8f84268c/i18n.json.default
----------------------------------------------------------------------
diff --git a/i18n.json.default b/i18n.json.default
deleted file mode 100644
index 2773f3f..0000000
--- a/i18n.json.default
+++ /dev/null
@@ -1,15 +0,0 @@
-{
-  "en_US": {
-    "mango-descripton": "Mango is an easy way to find documents on predefined indexes.",
-    "new-mango-index": "Mango Indexes",
-    "mango-help-title": "Mango",
-    "run-query-with-mango": "Run A Query with Mango",
-    "mango-title-editor": "Mango Query",
-    "mango-descripton-index-editor": "Mango is an easy way to find documents on predefined
indexes. <br/><br/>Create an Index to query it afterwards. The example in the
editor shows how to create an index for the field '_id'. <br/><br/>The Indexes
that you already created are listed on the right.",
-    "mango-additional-indexes-heading": "Your additional Indexes:",
-    "mango-indexeditor-title": "Mango",
-    "couchdb-productname": "Apache CouchDB",
-    "cors-disable-cors-prompt": "Are you sure? Disabling CORS will overwrite your specific
origin domains.",
-    "cors-notice": "Cross-Origin Resource Sharing (CORS) lets you connect to remote servers
directly from the browser, so you can host browser-based apps on static pages and talk directly
with CouchDB to load your data."
-  }
-}

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/8f84268c/i18n.json.default.json
----------------------------------------------------------------------
diff --git a/i18n.json.default.json b/i18n.json.default.json
new file mode 100644
index 0000000..2773f3f
--- /dev/null
+++ b/i18n.json.default.json
@@ -0,0 +1,15 @@
+{
+  "en_US": {
+    "mango-descripton": "Mango is an easy way to find documents on predefined indexes.",
+    "new-mango-index": "Mango Indexes",
+    "mango-help-title": "Mango",
+    "run-query-with-mango": "Run A Query with Mango",
+    "mango-title-editor": "Mango Query",
+    "mango-descripton-index-editor": "Mango is an easy way to find documents on predefined
indexes. <br/><br/>Create an Index to query it afterwards. The example in the
editor shows how to create an index for the field '_id'. <br/><br/>The Indexes
that you already created are listed on the right.",
+    "mango-additional-indexes-heading": "Your additional Indexes:",
+    "mango-indexeditor-title": "Mango",
+    "couchdb-productname": "Apache CouchDB",
+    "cors-disable-cors-prompt": "Are you sure? Disabling CORS will overwrite your specific
origin domains.",
+    "cors-notice": "Cross-Origin Resource Sharing (CORS) lets you connect to remote servers
directly from the browser, so you can host browser-based apps on static pages and talk directly
with CouchDB to load your data."
+  }
+}

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/8f84268c/settings.json.default
----------------------------------------------------------------------
diff --git a/settings.json.default b/settings.json.default
deleted file mode 100644
index aae7608..0000000
--- a/settings.json.default
+++ /dev/null
@@ -1,87 +0,0 @@
-{
-  "deps": [
-  { "name": "fauxton" },
-  { "name": "components" },
-  { "name": "databases" },
-  { "name": "documents" },
-  { "name": "setup" },
-  { "name": "activetasks" },
-  { "name": "cluster" },
-  { "name": "config" },
-  { "name": "replication" },
-  { "name": "cors" },
-  { "name": "permissions" },
-  { "name": "compaction" },
-  { "name": "auth" },
-  { "name": "verifyinstall" }
-  ],
-    "template": {
-      "development": {
-        "src": "assets/index.underscore",
-        "dest": "dist/debug/index.html",
-        "variables": {
-          "requirejs": "/assets/js/libs/require.js",
-          "css": "./css/index.css",
-          "base": null
-        },
-        "app": {
-          "root": "/",
-          "host": "../..",
-          "version": "1.0.dev",
-          "bundled": false
-        }
-      },
-      "release": {
-        "src": "assets/index.underscore",
-        "dest": "dist/debug/index.html",
-        "variables": {
-          "requirejs": "./js/REQUIREJS_FILE",
-          "css": "./css/CSS_FILE",
-          "base": null
-        },
-        "app": {
-          "root": "/_utils/",
-          "host": "../..",
-          "version": "1.0",
-          "bundled": true
-        }
-      },
-      "couchapp": {
-        "src": "assets/index.underscore",
-        "dest": "dist/debug/index.html",
-        "variables": {
-          "requirejs": "./js/REQUIREJS_FILE",
-          "css": "./css/CSS_FILE",
-          "base": null
-        },
-        "app": {
-          "root": "/",
-          "host": "../../..",
-          "version": "1.0",
-          "bundled": true
-        }
-      }
-    },
-
-    "couch_config": {
-      "fauxton": {
-        "db": "http://localhost:5984/fauxton",
-        "app": "./couchapp.js",
-        "options": {
-          "okay_if_missing": true
-        }
-      }
-    },
-
-    "nightwatch": {
-      "fauxton_username": "tester",
-      "password": "testerpass",
-      "fauxton_host": "localhost",
-      "fauxton_port": "8000",
-      "db_host": "localhost",
-      "db_port": "5984",
-      "custom_commands_path": ["test/nightwatch_tests/custom-commands", "test/nightwatch_tests/custom-commands/auth"],
-      "globals_path": "test/nightwatch_tests/helpers/helpers.js",
-      "selenium_port": "4444"
-    }
-}

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/8f84268c/settings.json.default.json
----------------------------------------------------------------------
diff --git a/settings.json.default.json b/settings.json.default.json
new file mode 100644
index 0000000..aae7608
--- /dev/null
+++ b/settings.json.default.json
@@ -0,0 +1,87 @@
+{
+  "deps": [
+  { "name": "fauxton" },
+  { "name": "components" },
+  { "name": "databases" },
+  { "name": "documents" },
+  { "name": "setup" },
+  { "name": "activetasks" },
+  { "name": "cluster" },
+  { "name": "config" },
+  { "name": "replication" },
+  { "name": "cors" },
+  { "name": "permissions" },
+  { "name": "compaction" },
+  { "name": "auth" },
+  { "name": "verifyinstall" }
+  ],
+    "template": {
+      "development": {
+        "src": "assets/index.underscore",
+        "dest": "dist/debug/index.html",
+        "variables": {
+          "requirejs": "/assets/js/libs/require.js",
+          "css": "./css/index.css",
+          "base": null
+        },
+        "app": {
+          "root": "/",
+          "host": "../..",
+          "version": "1.0.dev",
+          "bundled": false
+        }
+      },
+      "release": {
+        "src": "assets/index.underscore",
+        "dest": "dist/debug/index.html",
+        "variables": {
+          "requirejs": "./js/REQUIREJS_FILE",
+          "css": "./css/CSS_FILE",
+          "base": null
+        },
+        "app": {
+          "root": "/_utils/",
+          "host": "../..",
+          "version": "1.0",
+          "bundled": true
+        }
+      },
+      "couchapp": {
+        "src": "assets/index.underscore",
+        "dest": "dist/debug/index.html",
+        "variables": {
+          "requirejs": "./js/REQUIREJS_FILE",
+          "css": "./css/CSS_FILE",
+          "base": null
+        },
+        "app": {
+          "root": "/",
+          "host": "../../..",
+          "version": "1.0",
+          "bundled": true
+        }
+      }
+    },
+
+    "couch_config": {
+      "fauxton": {
+        "db": "http://localhost:5984/fauxton",
+        "app": "./couchapp.js",
+        "options": {
+          "okay_if_missing": true
+        }
+      }
+    },
+
+    "nightwatch": {
+      "fauxton_username": "tester",
+      "password": "testerpass",
+      "fauxton_host": "localhost",
+      "fauxton_port": "8000",
+      "db_host": "localhost",
+      "db_port": "5984",
+      "custom_commands_path": ["test/nightwatch_tests/custom-commands", "test/nightwatch_tests/custom-commands/auth"],
+      "globals_path": "test/nightwatch_tests/helpers/helpers.js",
+      "selenium_port": "4444"
+    }
+}

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/8f84268c/tasks/fauxton.js
----------------------------------------------------------------------
diff --git a/tasks/fauxton.js b/tasks/fauxton.js
index 66b7398..db1dc89 100644
--- a/tasks/fauxton.js
+++ b/tasks/fauxton.js
@@ -28,7 +28,7 @@ module.exports = function (grunt) {
     var done = this.async(),
         data = this.data,
         target = data.target || 'app/addons/',
-        settingsFile = fs.existsSync(data.src) ? data.src : 'settings.json.default',
+        settingsFile = fs.existsSync(data.src) ? data.src : 'settings.json.default.json',
         settings = grunt.file.readJSON(settingsFile),
         _ = grunt.util._;
 
@@ -78,7 +78,7 @@ module.exports = function (grunt) {
   grunt.registerMultiTask('gen_load_addons', 'Generate the load_addons.js file', function
() {
     var data = this.data,
         _ = grunt.util._,
-        settingsFile = fs.existsSync(data.src) ? data.src : 'settings.json.default',
+        settingsFile = fs.existsSync(data.src) ? data.src : 'settings.json.default.json',
         settings = grunt.file.readJSON(settingsFile),
         template = 'app/load_addons.js.underscore',
         dest = 'app/load_addons.js',

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/8f84268c/tasks/helper.js
----------------------------------------------------------------------
diff --git a/tasks/helper.js b/tasks/helper.js
index 4b4095e..56e6170 100644
--- a/tasks/helper.js
+++ b/tasks/helper.js
@@ -24,19 +24,19 @@ exports.init = function (grunt) {
     readSettingsFile: function () {
       if (fs.existsSync("settings.json")) {
         return grunt.file.readJSON("settings.json");
-      } else if (fs.existsSync("settings.json.default")) {
-        return grunt.file.readJSON("settings.json.default");
-      } else {
-        return {deps: []};
+      } else if (fs.existsSync('settings.json.default.json')) {
+        return grunt.file.readJSON('settings.json.default.json');
       }
+
+      throw new Error('settings.json file missing');
     },
 
     readI18nFile: function () {
       if (fs.existsSync('i18n.json')) {
         return grunt.file.readJSON('i18n.json');
       }
-      if (fs.existsSync('i18n.json.default')) {
-        return grunt.file.readJSON('i18n.json.default');
+      if (fs.existsSync('i18n.json.default.json')) {
+        return grunt.file.readJSON('i18n.json.default.json');
       }
 
       throw new Error('i18n file missing');


Mime
View raw message