From 6ba69d45d6ac48c18cdce57e35a23a84fdff2653 Mon Sep 17 00:00:00 2001 From: Xavier Spriet Date: Fri, 5 Jun 2015 11:37:25 -0400 Subject: [PATCH 01/21] Set up load-grunt-tasks * Import and configure `loadNpmTasks` module. * Remove manual `loadNpmTasks` calls. --- Gruntfile.js | 6 ++---- package.json | 3 ++- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/Gruntfile.js b/Gruntfile.js index bd90d175..26ca62d4 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -1,6 +1,8 @@ 'use strict'; module.exports = function(grunt) { + require('load-grunt-tasks')(grunt); + grunt.initConfig({ 'git-describe': { options: { @@ -42,9 +44,6 @@ module.exports = function(grunt) { } }); - grunt.loadNpmTasks('grunt-closurecompiler'); - grunt.loadNpmTasks('grunt-contrib-qunit'); - grunt.registerTask('git-describe', function() { var _spawn = require("grunt-util-spawn")(grunt); @@ -85,4 +84,3 @@ module.exports = function(grunt) { grunt.registerTask('build', ['default', 'copy-dist']); grunt.registerTask('travis', ['closurecompiler:minify', 'qunit']); }; - diff --git a/package.json b/package.json index 66ef555d..7bd499fd 100644 --- a/package.json +++ b/package.json @@ -10,7 +10,8 @@ "grunt-cli": "^0.1.13", "grunt-closurecompiler": "^0.9.9", "grunt-contrib-qunit": "^0.7.0", - "grunt-util-spawn": "^0.0.2" + "grunt-util-spawn": "^0.0.2", + "load-grunt-tasks": "^3.2.0" }, "scripts": { "test": "grunt travis --verbose" From d2bceb977523decaca88ee233f002976925919ff Mon Sep 17 00:00:00 2001 From: Xavier Spriet Date: Fri, 5 Jun 2015 12:29:01 -0400 Subject: [PATCH 02/21] Gruntfile enhancements * Use `git-contrib-copy` instead of `grunt.file.copy` paired with a custom task. * Build in `.tmp/build` instead of `gen`. * Add `.tmp` to `.gitignore`. * Remove `git-describe` config since that only applies when using the `git-describe` module, not a custom task. * Use `grunt.util.spawn` in `git-describe` task and nuke dependency to `grunt-util-spawn` module. * Break down grunt tasks into atomic tasks (`build`, `test:unit`, `travis`, `default` and `release`). --- .gitignore | 1 + Gruntfile.js | 33 +++++++++++++++++---------------- package.json | 2 +- 3 files changed, 19 insertions(+), 17 deletions(-) diff --git a/.gitignore b/.gitignore index 955852e2..11e6aad6 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,4 @@ extension/Handlebar.js upload.py gen/ node_modules/ +.tmp diff --git a/Gruntfile.js b/Gruntfile.js index 26ca62d4..e9d50bc6 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -4,17 +4,11 @@ module.exports = function(grunt) { require('load-grunt-tasks')(grunt); grunt.initConfig({ - 'git-describe': { - options: { - - }, - 'run': {} - }, closurecompiler: { minify: { requiresConfig: 'git-revision', files: { - "gen/axs_testing.js": [ + ".tmp/build/axs_testing.js": [ "./lib/closure-library/closure/goog/base.js", "./src/js/axs.js", "./src/js/BrowserUtils.js", @@ -39,18 +33,26 @@ module.exports = function(grunt) { } } }, + qunit: { all: ['test/index.html'] + }, + + copy: { + dist: { + expand: true, + cwd: '.tmp/build', + src: '**/*', + dest: 'dist/js' + } } }); grunt.registerTask('git-describe', function() { - var _spawn = require("grunt-util-spawn")(grunt); - // Start async task var done = this.async(); - _spawn({ + grunt.util.spawn({ "cmd" : "git", "args" : [ "rev-parse", "HEAD" ], "opts" : { @@ -76,11 +78,10 @@ module.exports = function(grunt) { grunt.task.run('git-describe'); }); - grunt.registerTask('copy-dist', function() { - grunt.file.copy('gen/axs_testing.js', 'dist/js/axs_testing.js'); - }); + grunt.registerTask('build', ['save-revision', 'closurecompiler:minify']); + grunt.registerTask('test:unit', ['qunit']); - grunt.registerTask('default', ['save-revision', 'closurecompiler:minify', 'qunit']); - grunt.registerTask('build', ['default', 'copy-dist']); - grunt.registerTask('travis', ['closurecompiler:minify', 'qunit']); + grunt.registerTask('travis', ['closurecompiler:minify', 'test:unit']); + grunt.registerTask('default', ['build', 'test:unit']); + grunt.registerTask('release', ['build', 'test:unit', 'copy:dist']); }; diff --git a/package.json b/package.json index 7bd499fd..663a1b59 100644 --- a/package.json +++ b/package.json @@ -9,8 +9,8 @@ "grunt": "^0.4.5", "grunt-cli": "^0.1.13", "grunt-closurecompiler": "^0.9.9", + "grunt-contrib-copy": "^0.8.0", "grunt-contrib-qunit": "^0.7.0", - "grunt-util-spawn": "^0.0.2", "load-grunt-tasks": "^3.2.0" }, "scripts": { From ba3362482dc410b7336b45520d1e286beac0d8b1 Mon Sep 17 00:00:00 2001 From: Xavier Spriet Date: Fri, 5 Jun 2015 12:31:14 -0400 Subject: [PATCH 03/21] Remove dist from master branch --- .gitignore | 5 +- dist/js/.gitkeep | 0 dist/js/axs_testing.js | 2050 ---------------------------------------- 3 files changed, 4 insertions(+), 2051 deletions(-) delete mode 100644 dist/js/.gitkeep delete mode 100644 dist/js/axs_testing.js diff --git a/.gitignore b/.gitignore index 11e6aad6..41574824 100644 --- a/.gitignore +++ b/.gitignore @@ -4,4 +4,7 @@ extension/Handlebar.js upload.py gen/ node_modules/ -.tmp +.tmp/ + +# Only include dist in `stable` branch. +dist/ diff --git a/dist/js/.gitkeep b/dist/js/.gitkeep deleted file mode 100644 index e69de29b..00000000 diff --git a/dist/js/axs_testing.js b/dist/js/axs_testing.js deleted file mode 100644 index 7236b238..00000000 --- a/dist/js/axs_testing.js +++ /dev/null @@ -1,2050 +0,0 @@ -/* - * Copyright 2015 Google Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * Generated from http://github.com/GoogleChrome/accessibility-developer-tools/tree/a33b34feb4bf5c6990c9d88f98c3c8e3115168ab - * - * See project README for build steps. - */ - -// AUTO-GENERATED CONTENT BELOW: DO NOT EDIT! See above for details. - -var COMPILED = !0, goog = goog || {}; -goog.global = this; -goog.isDef = function(a) { - return void 0 !== a; -}; -goog.exportPath_ = function(a, b, c) { - a = a.split("."); - c = c || goog.global; - a[0] in c || !c.execScript || c.execScript("var " + a[0]); - for (var d;a.length && (d = a.shift());) { - !a.length && goog.isDef(b) ? c[d] = b : c = c[d] ? c[d] : c[d] = {}; - } -}; -goog.define = function(a, b) { - var c = b; - COMPILED || (goog.global.CLOSURE_UNCOMPILED_DEFINES && Object.prototype.hasOwnProperty.call(goog.global.CLOSURE_UNCOMPILED_DEFINES, a) ? c = goog.global.CLOSURE_UNCOMPILED_DEFINES[a] : goog.global.CLOSURE_DEFINES && Object.prototype.hasOwnProperty.call(goog.global.CLOSURE_DEFINES, a) && (c = goog.global.CLOSURE_DEFINES[a])); - goog.exportPath_(a, c); -}; -goog.DEBUG = !0; -goog.LOCALE = "en"; -goog.TRUSTED_SITE = !0; -goog.STRICT_MODE_COMPATIBLE = !1; -goog.provide = function(a) { - if (!COMPILED) { - if (goog.isProvided_(a)) { - throw Error('Namespace "' + a + '" already declared.'); - } - delete goog.implicitNamespaces_[a]; - for (var b = a;(b = b.substring(0, b.lastIndexOf("."))) && !goog.getObjectByName(b);) { - goog.implicitNamespaces_[b] = !0; - } - } - goog.exportPath_(a); -}; -goog.setTestOnly = function(a) { - if (COMPILED && !goog.DEBUG) { - throw a = a || "", Error("Importing test-only code into non-debug environment" + a ? ": " + a : "."); - } -}; -goog.forwardDeclare = function(a) { -}; -COMPILED || (goog.isProvided_ = function(a) { - return !goog.implicitNamespaces_[a] && goog.isDefAndNotNull(goog.getObjectByName(a)); -}, goog.implicitNamespaces_ = {}); -goog.getObjectByName = function(a, b) { - for (var c = a.split("."), d = b || goog.global, e;e = c.shift();) { - if (goog.isDefAndNotNull(d[e])) { - d = d[e]; - } else { - return null; - } - } - return d; -}; -goog.globalize = function(a, b) { - var c = b || goog.global, d; - for (d in a) { - c[d] = a[d]; - } -}; -goog.addDependency = function(a, b, c) { - if (goog.DEPENDENCIES_ENABLED) { - var d; - a = a.replace(/\\/g, "/"); - for (var e = goog.dependencies_, f = 0;d = b[f];f++) { - e.nameToPath[d] = a, a in e.pathToNames || (e.pathToNames[a] = {}), e.pathToNames[a][d] = !0; - } - for (d = 0;b = c[d];d++) { - a in e.requires || (e.requires[a] = {}), e.requires[a][b] = !0; - } - } -}; -goog.ENABLE_DEBUG_LOADER = !0; -goog.require = function(a) { - if (!COMPILED && !goog.isProvided_(a)) { - if (goog.ENABLE_DEBUG_LOADER) { - var b = goog.getPathFromDeps_(a); - if (b) { - goog.included_[b] = !0; - goog.writeScripts_(); - return; - } - } - a = "goog.require could not find: " + a; - goog.global.console && goog.global.console.error(a); - throw Error(a); - } -}; -goog.basePath = ""; -goog.nullFunction = function() { -}; -goog.identityFunction = function(a, b) { - return a; -}; -goog.abstractMethod = function() { - throw Error("unimplemented abstract method"); -}; -goog.addSingletonGetter = function(a) { - a.getInstance = function() { - if (a.instance_) { - return a.instance_; - } - goog.DEBUG && (goog.instantiatedSingletons_[goog.instantiatedSingletons_.length] = a); - return a.instance_ = new a; - }; -}; -goog.instantiatedSingletons_ = []; -goog.DEPENDENCIES_ENABLED = !COMPILED && goog.ENABLE_DEBUG_LOADER; -goog.DEPENDENCIES_ENABLED && (goog.included_ = {}, goog.dependencies_ = {pathToNames:{}, nameToPath:{}, requires:{}, visited:{}, written:{}}, goog.inHtmlDocument_ = function() { - var a = goog.global.document; - return "undefined" != typeof a && "write" in a; -}, goog.findBasePath_ = function() { - if (goog.global.CLOSURE_BASE_PATH) { - goog.basePath = goog.global.CLOSURE_BASE_PATH; - } else { - if (goog.inHtmlDocument_()) { - for (var a = goog.global.document.getElementsByTagName("script"), b = a.length - 1;0 <= b;--b) { - var c = a[b].src, d = c.lastIndexOf("?"), d = -1 == d ? c.length : d; - if ("base.js" == c.substr(d - 7, 7)) { - goog.basePath = c.substr(0, d - 7); - break; - } - } - } - } -}, goog.importScript_ = function(a) { - var b = goog.global.CLOSURE_IMPORT_SCRIPT || goog.writeScriptTag_; - !goog.dependencies_.written[a] && b(a) && (goog.dependencies_.written[a] = !0); -}, goog.writeScriptTag_ = function(a) { - if (goog.inHtmlDocument_()) { - var b = goog.global.document; - if ("complete" == b.readyState) { - if (/\bdeps.js$/.test(a)) { - return !1; - } - throw Error('Cannot write "' + a + '" after document load'); - } - b.write('