couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gar...@apache.org
Subject [8/8] git commit: updated refs/heads/1846-dev-server-improvements to 038cbc9
Date Wed, 03 Jul 2013 15:34:50 GMT
much improved dev server performance


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

Branch: refs/heads/1846-dev-server-improvements
Commit: 038cbc993fbd71b145f07234349e333d1be7b11f
Parents: 2bf0c76
Author: Garren Smith <garren.smith@gmail.com>
Authored: Wed Jul 3 17:34:17 2013 +0200
Committer: Garren Smith <garren.smith@gmail.com>
Committed: Wed Jul 3 17:34:17 2013 +0200

----------------------------------------------------------------------
 src/fauxton/Gruntfile.js          | 50 ++++++++++++++++++++++++----------
 src/fauxton/settings.json.default | 23 ++++++++++++----
 src/fauxton/tasks/couchserver.js  |  2 --
 src/fauxton/tasks/fauxton.js      |  3 +-
 4 files changed, 55 insertions(+), 23 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb/blob/038cbc99/src/fauxton/Gruntfile.js
----------------------------------------------------------------------
diff --git a/src/fauxton/Gruntfile.js b/src/fauxton/Gruntfile.js
index 2a3fe96..afb97ed 100644
--- a/src/fauxton/Gruntfile.js
+++ b/src/fauxton/Gruntfile.js
@@ -84,16 +84,28 @@ module.exports = function(grunt) {
 
   var templateSettings = function(){
     var defaultSettings = {
-      "src": "assets/index.underscore",
-      "dest": "dist/debug/index.html",
-      "variables": {
-        "assets_root": "./",
-        "requirejs": "require.js",
-        "base": null
+      "develpment": {
+        "src": "assets/index.underscore",
+        "dest": "dist/debug/index.html",
+        "variables": {
+          "assets_root": "/assets/",
+          "requirejs": "libs/require.js",
+          "base": null
+        }
+      },
+      "release": {
+        "src": "assets/index.underscore",
+        "dest": "dist/debug/index.html",
+        "variables": {
+          "assets_root": "./",
+          "requirejs": "require.js",
+          "base": null
+        }
       }
     };
+
     var settings = helper.readSettingsFile();
-    return {template: settings.template || defaultSettings};
+    return settings.template || defaultSettings;
   }();
 
   grunt.initConfig({
@@ -154,8 +166,7 @@ module.exports = function(grunt) {
     // index.html.
     concat: {
       requirejs: {
-       // src: [ "dist/debug/templates.js", "assets/js/libs/require.js"],
-        src: [ "assets/js/libs/require.js"],
+        src: [ "dist/debug/templates.js", "assets/js/libs/require.js"],
         dest: "dist/debug/js/require.js"
       },
 
@@ -207,8 +218,11 @@ module.exports = function(grunt) {
     },
 
     watch: {
-      files: './app/**/*',
-      tasks: ['watchRun']
+      files: ['./app/**/*', '!./app/load_addons.js'],
+      tasks: ['watchRun'],
+      options: {
+        nospawn: true,
+      }
     },
 
     requirejs: {
@@ -297,6 +311,13 @@ module.exports = function(grunt) {
 
   });
 
+  // on watch events configure jshint:all to only run on changed file
+  grunt.event.on('watch', function(action, filepath) {
+    if (!!filepath.match(/.js$/)) {
+      grunt.config(['jshint', 'all'], filepath);
+    }
+  });
+
   /*
    * Load Grunt plugins
    */
@@ -341,7 +362,7 @@ module.exports = function(grunt) {
   // Fetch dependencies (from git or local dir), lint them and make load_addons
   grunt.registerTask('dependencies', ['get_deps', 'jshint', 'gen_load_addons:default']);
   // build templates, js and css
-  grunt.registerTask('build', ['jst', 'concat:requirejs', 'less', 'concat:index_css', 'template']);
+  grunt.registerTask('build', ['less', 'concat:index_css', 'jst', 'requirejs', 'concat:requirejs',
'template:release']);
   // minify code and css, ready for release.
   grunt.registerTask('minify', ['uglify', 'cssmin:compress']);
 
@@ -349,9 +370,10 @@ module.exports = function(grunt) {
    * Build the app in either dev, debug, or release mode
    */
   // dev server
-  grunt.registerTask('dev', ['debug', 'couchserver']);
+  grunt.registerTask('dev', ['debugDev', 'couchserver']);
   // build a debug release
-  grunt.registerTask('debug', ['test', 'dependencies', 'concat:requirejs','less', 'concat:index_css',
'template', 'copy:debug']);
+  grunt.registerTask('debug', ['test', 'dependencies', 'concat:requirejs','less', 'concat:index_css',
'template:development', 'copy:debug']);
+  grunt.registerTask('debugDev', ['test', 'dependencies', 'less', 'concat:index_css', 'template',
'copy:debug']);
   //grunt.registerTask('watchRun', ['jshint', 'dependencies', 'less', 'concat:index_css'
]);
   grunt.registerTask('watchRun', ['jshint', 'dependencies' ]);
   // build a release

http://git-wip-us.apache.org/repos/asf/couchdb/blob/038cbc99/src/fauxton/settings.json.default
----------------------------------------------------------------------
diff --git a/src/fauxton/settings.json.default b/src/fauxton/settings.json.default
index 9716ceb..8fabe09 100644
--- a/src/fauxton/settings.json.default
+++ b/src/fauxton/settings.json.default
@@ -7,12 +7,23 @@
   { "name": "auth" }
   ],
     "template": {
-      "src": "assets/index.underscore",
-      "dest": "dist/debug/index.html",
-      "variables": {
-        "assets_root": "./",
-        "requirejs": "require.js",
-        "base": null
+      "develpment": {
+        "src": "assets/index.underscore",
+        "dest": "dist/debug/index.html",
+        "variables": {
+          "assets_root": "/assets/",
+          "requirejs": "libs/require.js",
+          "base": null
+        }
+      },
+      "release": {
+        "src": "assets/index.underscore",
+        "dest": "dist/debug/index.html",
+        "variables": {
+          "assets_root": "./",
+          "requirejs": "require.js",
+          "base": null
+        }
       }
     },
 

http://git-wip-us.apache.org/repos/asf/couchdb/blob/038cbc99/src/fauxton/tasks/couchserver.js
----------------------------------------------------------------------
diff --git a/src/fauxton/tasks/couchserver.js b/src/fauxton/tasks/couchserver.js
index 1ed5c16..f85339c 100644
--- a/src/fauxton/tasks/couchserver.js
+++ b/src/fauxton/tasks/couchserver.js
@@ -52,11 +52,9 @@ module.exports = function (grunt) {
       } else if (!!url.match(/\.css$|\/js\/|img/)) {
         // serve any javascript or css files from dist debug dir
         filePath = path.join(dist_dir,req.url);
-        console.log('css', url, filePath);
       } else if (!!url.match(/\.js$|\.html$/)) {
         // server js from app directory
         filePath = path.join(app_dir,req.url.replace('/_utils/fauxton/app',''));
-        console.log('less', url, filePath);
       } else if (url === '/' && accept[0] !== 'application/json') {
         // serve main index file from here
         filePath = path.join(dist_dir, 'index.html');

http://git-wip-us.apache.org/repos/asf/couchdb/blob/038cbc99/src/fauxton/tasks/fauxton.js
----------------------------------------------------------------------
diff --git a/src/fauxton/tasks/fauxton.js b/src/fauxton/tasks/fauxton.js
index a26f9f8..c2ec80e 100644
--- a/src/fauxton/tasks/fauxton.js
+++ b/src/fauxton/tasks/fauxton.js
@@ -20,8 +20,9 @@ module.exports = function(grunt) {
     grunt.file.write(data.dest, tmpl(data.variables));
   });
 
-  grunt.registerMultiTask('get_deps', 'Fetch external dependencies', function() {
+  grunt.registerMultiTask('get_deps', 'Fetch external dependencies', function(version) {
     grunt.log.writeln("Fetching external dependencies");
+    console.log('boom', version, arguments);
 
     var path = require('path');
     var done = this.async();


Mime
View raw message