Return-Path: X-Original-To: apmail-couchdb-commits-archive@www.apache.org Delivered-To: apmail-couchdb-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 91958108AA for ; Mon, 22 Jul 2013 10:25:39 +0000 (UTC) Received: (qmail 12447 invoked by uid 500); 22 Jul 2013 10:25:31 -0000 Delivered-To: apmail-couchdb-commits-archive@couchdb.apache.org Received: (qmail 12286 invoked by uid 500); 22 Jul 2013 10:25:31 -0000 Mailing-List: contact commits-help@couchdb.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@couchdb.apache.org Delivered-To: mailing list commits@couchdb.apache.org Received: (qmail 10480 invoked by uid 99); 22 Jul 2013 10:25:19 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 22 Jul 2013 10:25:19 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id 3CFBD8B06F9; Mon, 22 Jul 2013 10:25:19 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: jan@apache.org To: commits@couchdb.apache.org Date: Mon, 22 Jul 2013 10:26:00 -0000 Message-Id: <891cdb2aaa3c494cab5cf3a8894c04a6@git.apache.org> In-Reply-To: <10f5b68774524227a2f788b7e382a844@git.apache.org> References: <10f5b68774524227a2f788b7e382a844@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [43/50] [abbrv] git commit: updated refs/heads/1684-feature-db-updates to ea07223 Improved development server Fauton: Much faster and simpler build server. Only updates changed files, uses requirejs to load necessary dependancies. Fixes COUCHDB-1846 Project: http://git-wip-us.apache.org/repos/asf/couchdb/repo Commit: http://git-wip-us.apache.org/repos/asf/couchdb/commit/9b64526d Tree: http://git-wip-us.apache.org/repos/asf/couchdb/tree/9b64526d Diff: http://git-wip-us.apache.org/repos/asf/couchdb/diff/9b64526d Branch: refs/heads/1684-feature-db-updates Commit: 9b64526db9e22de0c94fd6065186336ad423f4c0 Parents: 03d1b7e Author: Garren Smith Authored: Thu Jun 27 16:17:59 2013 +0200 Committer: Garren Smith Committed: Mon Jul 15 14:21:19 2013 +0200 ---------------------------------------------------------------------- src/fauxton/Gruntfile.js | 83 +- src/fauxton/app/api.js | 2 +- src/fauxton/app/app.js | 1 - src/fauxton/app/config.js | 3 +- src/fauxton/app/main.js | 13 +- src/fauxton/app/modules/documents/views.js | 2 +- src/fauxton/assets/index.underscore | 4 +- src/fauxton/assets/js/libs/require.js | 1112 +++++++-------- .../assets/less/bootstrap/tests/buttons.html | 139 -- .../assets/less/bootstrap/tests/css-tests.css | 139 -- .../assets/less/bootstrap/tests/css-tests.html | 1296 ------------------ .../less/bootstrap/tests/forms-responsive.html | 71 - .../assets/less/bootstrap/tests/forms.html | 179 --- .../less/bootstrap/tests/navbar-fixed-top.html | 104 -- .../less/bootstrap/tests/navbar-static-top.html | 107 -- .../assets/less/bootstrap/tests/navbar.html | 107 -- src/fauxton/package.json | 16 +- src/fauxton/settings.json.default | 23 +- src/fauxton/tasks/couchserver.js | 73 +- src/fauxton/tasks/fauxton.js | 2 +- src/fauxton/tasks/helper.js | 6 +- 21 files changed, 707 insertions(+), 2775 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/couchdb/blob/9b64526d/src/fauxton/Gruntfile.js ---------------------------------------------------------------------- diff --git a/src/fauxton/Gruntfile.js b/src/fauxton/Gruntfile.js index 7c9d4ec..886272d 100644 --- a/src/fauxton/Gruntfile.js +++ b/src/fauxton/Gruntfile.js @@ -78,22 +78,33 @@ module.exports = function(grunt) { theAssets.img.push(imgPath + "/**"); } }); - grunt.log.write(theAssets.img[0]); return theAssets; }(); var templateSettings = function(){ var defaultSettings = { - "src": "assets/index.underscore", - "dest": "dist/debug/index.html", - "variables": { - "assets_root": "./", - "requirejs": "require.js", - "base": null + "development": { + "src": "assets/index.underscore", + "dest": "dist/debug/index.html", + "variables": { + "requirejs": "/assets/js/libs/require.js", + "css": "./css/index.css", + "base": null + } + }, + "release": { + "src": "assets/index.underscore", + "dest": "dist/debug/index.html", + "variables": { + "requirejs": "./js/require.js", + "css": "./css/index.css", + "base": null + } } }; + var settings = helper.readSettingsFile(); - return {template: settings.template || defaultSettings}; + return settings.template || defaultSettings; }(); grunt.initConfig({ @@ -154,7 +165,7 @@ module.exports = function(grunt) { // index.html. concat: { requirejs: { - src: ["assets/js/libs/almond.js", "dist/debug/templates.js", "dist/debug/require.js"], + src: [ "assets/js/libs/require.js", "dist/debug/templates.js", "dist/debug/require.js"], dest: "dist/debug/js/require.js" }, @@ -206,8 +217,17 @@ module.exports = function(grunt) { }, watch: { - files: helper.watchFiles(["./app/**/*", "./assets/**/*"]), - tasks: ['debug', 'template'] + js: { + files: helper.watchFiles(['.js'], ["./app/**/*.js", '!./app/load_addons.js',"./assets/**/*.js"]), + tasks: ['watchRun'], + }, + style: { + files: helper.watchFiles(['.less','.css'],["./app/**/*.css","./app/**/*.less","./assets/**/*.css", "./assets/**/*.less"]), + tasks: ['less', 'concat:index_css'], + }, + options: { + nospawn: true, + } }, requirejs: { @@ -225,8 +245,8 @@ module.exports = function(grunt) { // Do not wrap everything in an IIFE. wrap: false, - optimize: "none" - } + optimize: "none", + } } }, @@ -294,6 +314,16 @@ 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); + } + /*} else if (!!filepath.match(/.css$|.less$/)) { + grunt.task.run(['less', 'concat:index_css']); + }*/ + }); + /* * Load Grunt plugins */ @@ -302,11 +332,23 @@ module.exports = function(grunt) { // Load the couchapp task grunt.loadNpmTasks('grunt-couchapp'); // Load the copy task - grunt.loadNpmTasks('grunt-contrib'); + grunt.loadNpmTasks('grunt-contrib-watch'); // Load the exec task grunt.loadNpmTasks('grunt-exec'); // Load Require.js task - grunt.loadNpmTasks('grunt-requirejs'); + grunt.loadNpmTasks('grunt-contrib-requirejs'); + // Load Copy task + grunt.loadNpmTasks('grunt-contrib-copy'); + // Load Clean task + grunt.loadNpmTasks('grunt-contrib-clean'); + // Load jshint task + grunt.loadNpmTasks('grunt-contrib-jshint'); + // Load jst task + grunt.loadNpmTasks('grunt-contrib-jst'); + // Load less task + grunt.loadNpmTasks('grunt-contrib-less'); + // Load concat task + grunt.loadNpmTasks('grunt-contrib-concat'); // Load UglifyJS task grunt.loadNpmTasks('grunt-contrib-uglify'); // Load CSSMin task @@ -326,7 +368,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', 'requirejs', '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']); @@ -334,9 +376,12 @@ 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', 'build', '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:development', 'copy:debug']); + + grunt.registerTask('watchRun', ['dependencies']); // build a release grunt.registerTask('release', ['test' ,'dependencies', 'build', 'minify', 'copy:dist']); @@ -348,7 +393,7 @@ module.exports = function(grunt) { // make a minimized install that is server by mochiweb under _utils grunt.registerTask('couchdb', ['release', 'copy:couchdb']); // make an install that can be deployed as a couchapp - grunt.registerTask('couchapp_setup', ['build', 'minify', 'copy:dist']); + grunt.registerTask('couchapp_setup', ['release']); // install fauxton as couchapp grunt.registerTask('couchapp_install', ['rmcouchdb:fauxton', 'mkcouchdb:fauxton', 'couchapp:fauxton']); // setup and install fauxton as couchapp http://git-wip-us.apache.org/repos/asf/couchdb/blob/9b64526d/src/fauxton/app/api.js ---------------------------------------------------------------------- diff --git a/src/fauxton/app/api.js b/src/fauxton/app/api.js index 4732528..0f3923e 100644 --- a/src/fauxton/app/api.js +++ b/src/fauxton/app/api.js @@ -78,7 +78,7 @@ function(app, Fauxton) { } return $.when(deferreds); - }, + }; FauxtonAPI.addRoute = function(route) { app.router.route(route.route, route.name, route.callback); http://git-wip-us.apache.org/repos/asf/couchdb/blob/9b64526d/src/fauxton/app/app.js ---------------------------------------------------------------------- diff --git a/src/fauxton/app/app.js b/src/fauxton/app/app.js index be0136d..df0894a 100644 --- a/src/fauxton/app/app.js +++ b/src/fauxton/app/app.js @@ -56,7 +56,6 @@ function($, _, Backbone, Helpers) { } else { // Put fetch into `async-mode`. done = this.async(); - // Seek out the template asynchronously. return $.ajax({ url: app.root + path }).then(function(contents) { done(JST[path] = _.template(contents)); http://git-wip-us.apache.org/repos/asf/couchdb/blob/9b64526d/src/fauxton/app/config.js ---------------------------------------------------------------------- diff --git a/src/fauxton/app/config.js b/src/fauxton/app/config.js index c7ae1d6..d7d3b40 100644 --- a/src/fauxton/app/config.js +++ b/src/fauxton/app/config.js @@ -20,6 +20,8 @@ require.config({ "nv.d3": "../assets/js/libs/nv.d3" }, + baseUrl: '/', + shim: { // Backbone library depends on lodash and jQuery. backbone: { @@ -51,5 +53,4 @@ require.config({ "plugins/jquery.form": ["jquery"] } - }); http://git-wip-us.apache.org/repos/asf/couchdb/blob/9b64526d/src/fauxton/app/main.js ---------------------------------------------------------------------- diff --git a/src/fauxton/app/main.js b/src/fauxton/app/main.js index 2f8f8fa..c06b0c4 100644 --- a/src/fauxton/app/main.js +++ b/src/fauxton/app/main.js @@ -23,16 +23,7 @@ function(app, Router) { // Get the absolute root. var root = location.protocol + "//" + location.host + app.root; - // Ensure the root is part of the anchor href, meaning it's relative. - if (href.prop && href.prop.slice(0, root.length) === root) { - // Stop the default event to ensure the link will not cause a page - // refresh. - evt.preventDefault(); - - // `Backbone.history.navigate` is sufficient for all Routers and will - // trigger the correct events. The Router's internal `navigate` method - // calls this anyways. The fragment is sliced from the root. - Backbone.history.navigate(href.attr, true); - } + evt.preventDefault(); + Backbone.history.navigate(href.attr, true); }); }); http://git-wip-us.apache.org/repos/asf/couchdb/blob/9b64526d/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 59e3b7d..6c92cfa 100644 --- a/src/fauxton/app/modules/documents/views.js +++ b/src/fauxton/app/modules/documents/views.js @@ -764,7 +764,7 @@ function(app, FauxtonAPI, Documents, pouchdb, Codemirror, JSHint) { var that = this, promise, - viewName = this.$('#index-name').val(); + viewName = this.$('#index-name').val(), ddocName = this.$('#ddoc :selected').val(), ddoc = this.getCurrentDesignDoc(); http://git-wip-us.apache.org/repos/asf/couchdb/blob/9b64526d/src/fauxton/assets/index.underscore ---------------------------------------------------------------------- diff --git a/src/fauxton/assets/index.underscore b/src/fauxton/assets/index.underscore index e29b4c4..7ccb930 100644 --- a/src/fauxton/assets/index.underscore +++ b/src/fauxton/assets/index.underscore @@ -24,7 +24,7 @@ Project Fauxton - +