couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From robertkowal...@apache.org
Subject [1/2] fauxton commit: updated refs/heads/master to 123881d
Date Thu, 16 Apr 2015 16:43:19 GMT
Repository: couchdb-fauxton
Updated Branches:
  refs/heads/master 592001668 -> 123881d42


cleanup: one place for url / port

save port and couchurl in one place instead of cluttering it all
over our Gruntfiles

PR: #384
PR-URL: https://github.com/apache/couchdb-fauxton/pull/384
Reviewed-By: Benjamin Keen <ben.keen@gmail.com>


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

Branch: refs/heads/master
Commit: 730e856dcc6f8716e1a797d6bf0fabe27a62cbc9
Parents: 5920016
Author: Robert Kowalski <robertkowalski@apache.org>
Authored: Wed Apr 15 20:28:59 2015 +0200
Committer: Robert Kowalski <robertkowalski@apache.org>
Committed: Thu Apr 16 18:44:29 2015 +0200

----------------------------------------------------------------------
 Gruntfile.js         | 40 ++++++++++++++++++++--------------------
 tasks/couchserver.js |  7 ++++---
 tasks/helper.js      |  3 +++
 3 files changed, 27 insertions(+), 23 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/730e856d/Gruntfile.js
----------------------------------------------------------------------
diff --git a/Gruntfile.js b/Gruntfile.js
index dbcc9ed..1b02c7d 100644
--- a/Gruntfile.js
+++ b/Gruntfile.js
@@ -19,15 +19,15 @@
 "use strict";
 
 module.exports = function (grunt) {
-  var helper = require('./tasks/helper').init(grunt),
-  _ = grunt.util._,
-  fs = require('fs');
+  var helper = require('./tasks/helper.js'),
+      initHelper = helper.init(grunt),
+      _ = grunt.util._,
+      fs = require('fs');
 
   var couch_config = function () {
-
     var default_couch_config = {
       fauxton: {
-        db: 'http://localhost:5984/fauxton',
+        db: helper.couch + 'fauxton',
         app: './couchapp.js',
         options: {
           okay_if_missing: true
@@ -35,13 +35,13 @@ module.exports = function (grunt) {
       }
     };
 
-    var settings_couch_config = helper.readSettingsFile().couch_config;
+    var settings_couch_config = initHelper.readSettingsFile().couch_config;
     return settings_couch_config || default_couch_config;
   }();
 
   var cleanableAddons =  function () {
     var theListToClean = [];
-    helper.processAddons(function (addon) {
+    initHelper.processAddons(function (addon) {
       // Only clean addons that are included from a local dir
       if (addon.path) {
         theListToClean.push("app/addons/" + addon.name);
@@ -73,7 +73,7 @@ module.exports = function (grunt) {
       // fauxton.css should load first
       css: ["assets/css/*.css", "dist/debug/css/fauxton.css"]
     };
-    helper.processAddons(function (addon) {
+    initHelper.processAddons(function (addon) {
       // Less files from addons
       var root = addon.path || "app/addons/" + addon.name;
       var lessPath = root + "/assets/less";
@@ -120,9 +120,9 @@ module.exports = function (grunt) {
       }
     };
 
-    var settings = helper.readSettingsFile();
+    var settings = initHelper.readSettingsFile();
 
-    var i18n = JSON.stringify(helper.readI18nFile(), null, ' ');
+    var i18n = JSON.stringify(initHelper.readI18nFile(), null, ' ');
 
     Object.keys(settings.template).forEach(function (key) {
       settings.template[key].app.i18n = i18n;
@@ -137,13 +137,13 @@ module.exports = function (grunt) {
     // against a remote CouchDB-compatible server.
     var defaults = {
       dist: './dist/debug/',
-      port: 8000,
+      port: helper.devServerPort,
       proxy: {
-        target: "http://localhost:5984/"
+        target: helper.couch
       }
     };
 
-    return helper.readSettingsFile().couchserver || defaults;
+    return initHelper.readSettingsFile().couchserver || defaults;
   }();
 
   var config = {
@@ -284,21 +284,21 @@ module.exports = function (grunt) {
 
     watch: {
       js: {
-        files: helper.watchFiles(['.js'], ["./app/**/*.js", '!./app/load_addons.js', "./assets/**/*.js",
"./test/**/*.js"]),
+        files: initHelper.watchFiles(['.js'], ["./app/**/*.js", '!./app/load_addons.js',
"./assets/**/*.js", "./test/**/*.js"]),
         tasks: ['watchRun'],
       },
       jsx: {
-        files: helper.watchFiles(['.jsx'], ["./app/**/*.jsx", '!./app/load_addons.jsx', "./assets/**/*.jsx",
"./test/**/*.jsx"]),
+        files: initHelper.watchFiles(['.jsx'], ["./app/**/*.jsx", '!./app/load_addons.jsx',
"./assets/**/*.jsx", "./test/**/*.jsx"]),
         tasks: ['watchRun'],
       },
       style: {
-        files: helper.watchFiles(['.less', '.css'], ["./app/**/*.css", "./app/**/*.less",
"./assets/**/*.css", "./assets/**/*.less"]),
+        files: initHelper.watchFiles(['.less', '.css'], ["./app/**/*.css", "./app/**/*.less",
"./assets/**/*.css", "./assets/**/*.less"]),
         tasks: ['clean:watch', 'dependencies', 'less', 'concat:index_css'],
       },
       html: {
         // the index.html is added in as a dummy file incase there is no
         // html dependancies this will break. So we need one include pattern
-        files: helper.watchFiles(['.html'], ['./index.html']),
+        files: initHelper.watchFiles(['.html'], ['./index.html']),
         tasks: ['clean:watch', 'dependencies']
       },
       options: {
@@ -402,7 +402,7 @@ module.exports = function (grunt) {
     mochaSetup: {
       default: {
         files: {
-          src: helper.watchFiles(['[Ss]pec.js'], ['./app/addons/**/*[Ss]pec.js', './app/addons/**/*[Ss]pec.react.js',
'./app/core/**/*[Ss]pec.js'])
+          src: initHelper.watchFiles(['[Ss]pec.js'], ['./app/addons/**/*[Ss]pec.js', './app/addons/**/*[Ss]pec.react.js',
'./app/core/**/*[Ss]pec.js'])
         },
         template: 'test/test.config.underscore',
         config: './app/config.js'
@@ -426,7 +426,7 @@ module.exports = function (grunt) {
     },
 
     exec: {
-      check_selenium: helper.check_selenium,
+      check_selenium: initHelper.check_selenium,
       start_nightWatch: {
         command: __dirname + '/node_modules/nightwatch/bin/nightwatch' +
         ' -c ' + __dirname + '/test/nightwatch_tests/nightwatch.json'
@@ -436,7 +436,7 @@ module.exports = function (grunt) {
     // generates the nightwatch.json file with appropriate content for this env
     initNightwatch: {
       default: {
-        settings: helper.readSettingsFile(),
+        settings: initHelper.readSettingsFile(),
         template: 'test/nightwatch_tests/nightwatch.json.underscore',
         dest: 'test/nightwatch_tests/nightwatch.json'
       }

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/730e856d/tasks/couchserver.js
----------------------------------------------------------------------
diff --git a/tasks/couchserver.js b/tasks/couchserver.js
index 63784ec..9b21d9b 100644
--- a/tasks/couchserver.js
+++ b/tasks/couchserver.js
@@ -21,17 +21,18 @@ module.exports = function (grunt) {
         send = require('send'),
         urlLib = require('url'),
         options = grunt.config('couchserver'),
-        _ = grunt.util._;
+        _ = grunt.util._,
+        helper = require('./helper.js');
 
     // Options
     var dist_dir = options.dist || './dist/debug/',
         app_dir = './app',
-        port = options.port || 8000,
+        port = options.port,
         setContentSecurityPolicy = _.isUndefined(options.contentSecurityPolicy) ? true :
options.contentSecurityPolicy;
 
     // Proxy options with default localhost
     var proxy_settings = options.proxy || {
-      target: "http://localhost:5984/"
+      target: helper.couch
     };
 
     // inform grunt that this task is async

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/730e856d/tasks/helper.js
----------------------------------------------------------------------
diff --git a/tasks/helper.js b/tasks/helper.js
index abfc01f..66f3a91 100644
--- a/tasks/helper.js
+++ b/tasks/helper.js
@@ -13,6 +13,9 @@
 var fs = require('fs'),
     path = require('path');
 
+exports.devServerPort = 8000;
+exports.couch = 'http://localhost:5984/';
+
 exports.init = function (grunt) {
   var _ = grunt.util._,
       platform = process.platform;


Mime
View raw message