You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by ga...@apache.org on 2013/07/08 18:00:09 UTC
[16/21] git commit: updated refs/heads/1846-dev-server-improvements
to 5da4bbf
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/804d4fe8
Tree: http://git-wip-us.apache.org/repos/asf/couchdb/tree/804d4fe8
Diff: http://git-wip-us.apache.org/repos/asf/couchdb/diff/804d4fe8
Branch: refs/heads/1846-dev-server-improvements
Commit: 804d4fe803468b2b841e431301ad7c5aaf855eb8
Parents: 4d06c10
Author: Garren Smith <ga...@gmail.com>
Authored: Wed Jul 3 17:34:17 2013 +0200
Committer: Garren Smith <ga...@gmail.com>
Committed: Mon Jul 8 17:22:48 2013 +0200
----------------------------------------------------------------------
src/fauxton/Gruntfile.js | 47 ++++++++++++++++++++++++++--------
src/fauxton/settings.json.default | 23 ++++++++++++-----
src/fauxton/tasks/couchserver.js | 2 --
src/fauxton/tasks/fauxton.js | 3 ++-
4 files changed, 55 insertions(+), 20 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/couchdb/blob/804d4fe8/src/fauxton/Gruntfile.js
----------------------------------------------------------------------
diff --git a/src/fauxton/Gruntfile.js b/src/fauxton/Gruntfile.js
index be970bc..90b37cf 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({
@@ -206,8 +218,13 @@ module.exports = function(grunt) {
},
watch: {
- files: helper.watchFiles(["./app/**/*", "./assets/**/*"]),
+ files: helper.watchFiles(["./app/**/*", "./assets/**/*", '!./app/load_addons.js']),
tasks: ['watchRun']
+ files: ['./app/**/*', ≈],
+ tasks: ['watchRun'],
+ options: {
+ nospawn: true,
+ }
},
requirejs: {
@@ -296,6 +313,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
*/
@@ -340,7 +364,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']);
@@ -348,9 +372,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/804d4fe8/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/804d4fe8/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/804d4fe8/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();