Browse files

first commit

  • Loading branch information...
0 parents commit 997ac5d03806bae6a172adeed241641e207e4f30 @tkellen tkellen committed Oct 3, 2012
Showing with 13,535 additions and 0 deletions.
  1. +3 −0 .gitignore
  2. +1 −0 AUTHORS
  3. 0 CHANGELOG
  4. +43 −0 Gruntfile.js
  5. +22 −0 LICENSE-MIT
  6. +3 −0 README.md
  7. 0 docs/examples.md
  8. 0 docs/options.md
  9. 0 docs/overview.md
  10. +37 −0 package.json
  11. +58 −0 tasks/init/commonjs.js
  12. +4 −0 tasks/init/commonjs/rename.json
  13. +1 −0 tasks/init/commonjs/root/.gitignore
  14. +15 −0 tasks/init/commonjs/root/.jshintrc
  15. +73 −0 tasks/init/commonjs/root/Gruntfile.js
  16. +57 −0 tasks/init/commonjs/root/README.md
  17. +13 −0 tasks/init/commonjs/root/lib/.jshintrc
  18. +17 −0 tasks/init/commonjs/root/lib/name.js
  19. +36 −0 tasks/init/commonjs/root/test/name_test.js
  20. +82 −0 tasks/init/gruntfile.js
  21. +87 −0 tasks/init/gruntfile/root/Gruntfile.js
  22. +68 −0 tasks/init/gruntplugin.js
  23. +4 −0 tasks/init/gruntplugin/rename.json
  24. +3 −0 tasks/init/gruntplugin/root/.gitignore
  25. +82 −0 tasks/init/gruntplugin/root/Gruntfile.js
  26. +92 −0 tasks/init/gruntplugin/root/README.md
  27. +51 −0 tasks/init/gruntplugin/root/tasks/name.js
  28. +1 −0 tasks/init/gruntplugin/root/test/expected/custom_options
  29. +1 −0 tasks/init/gruntplugin/root/test/expected/default_options
  30. +1 −0 tasks/init/gruntplugin/root/test/fixtures/123
  31. +1 −0 tasks/init/gruntplugin/root/test/fixtures/testing
  32. +48 −0 tasks/init/gruntplugin/root/test/name_test.js
  33. +83 −0 tasks/init/jquery.js
  34. +5 −0 tasks/init/jquery/rename.json
  35. +1 −0 tasks/init/jquery/root/.gitignore
  36. +15 −0 tasks/init/jquery/root/.jshintrc
  37. +35 −0 tasks/init/jquery/root/CONTRIBUTING.md
  38. +76 −0 tasks/init/jquery/root/Gruntfile.js
  39. +30 −0 tasks/init/jquery/root/README.md
  40. +12 −0 tasks/init/jquery/root/libs/jquery-loader.js
  41. +9,404 −0 tasks/init/jquery/root/libs/jquery/jquery.js
  42. +232 −0 tasks/init/jquery/root/libs/qunit/qunit.css
  43. +1,659 −0 tasks/init/jquery/root/libs/qunit/qunit.js
  44. +15 −0 tasks/init/jquery/root/src/.jshintrc
  45. +38 −0 tasks/init/jquery/root/src/name.js
  46. +32 −0 tasks/init/jquery/root/test/.jshintrc
  47. +31 −0 tasks/init/jquery/root/test/name.html
  48. +60 −0 tasks/init/jquery/root/test/name_test.js
  49. +202 −0 tasks/init/licenses/LICENSE-Apache-2.0
  50. +278 −0 tasks/init/licenses/LICENSE-GPL-2.0
  51. +22 −0 tasks/init/licenses/LICENSE-MIT
  52. +1 −0 tasks/init/misc/placeholder
  53. +59 −0 tasks/init/node.js
  54. +4 −0 tasks/init/node/rename.json
  55. +1 −0 tasks/init/node/root/.gitignore
  56. +15 −0 tasks/init/node/root/.jshintrc
  57. +43 −0 tasks/init/node/root/Gruntfile.js
  58. +27 −0 tasks/init/node/root/README.md
  59. +13 −0 tasks/init/node/root/lib/name.js
  60. +36 −0 tasks/init/node/root/test/name_test.js
  61. +46 −0 tasks/lib/git.js
  62. +156 −0 tasks/lib/prompt.js
3 .gitignore
@@ -0,0 +1,3 @@
+node_modules
+npm-debug.log
+tmp
1 AUTHORS
@@ -0,0 +1 @@
+"Cowboy" Ben Alman (http://benalman.com)
0 CHANGELOG
No changes.
43 Gruntfile.js
@@ -0,0 +1,43 @@
+/*
+ * grunt-contrib-init
+ * https://gruntjs.com/
+ *
+ * Copyright (c) 2012 "Cowboy" Ben Alman, contributors
+ * Licensed under the MIT license.
+ */
+
+'use strict';
+
+module.exports = function(grunt) {
+
+ // Project configuration.
+ grunt.initConfig({
+ jshint: {
+ all: [
+ 'Gruntfile.js',
+ 'tasks/*.js'
+ ],
+ options: {
+ curly: true,
+ eqeqeq: true,
+ immed: true,
+ latedef: true,
+ newcap: true,
+ noarg: true,
+ sub: true,
+ undef: true,
+ boss: true,
+ eqnull: true,
+ node: true,
+ es5: true
+ }
+ }
+ });
+
+ // Actually load this plugin's task(s).
+ grunt.loadTasks('tasks');
+
+ // By default, lint and run all tests.
+ grunt.registerTask('default', ['jshint']);
+
+};
22 LICENSE-MIT
@@ -0,0 +1,22 @@
+Copyright (c) 2012 "Cowboy" Ben Alman, contributors
+
+Permission is hereby granted, free of charge, to any person
+obtaining a copy of this software and associated documentation
+files (the "Software"), to deal in the Software without
+restriction, including without limitation the rights to use,
+copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the
+Software is furnished to do so, subject to the following
+conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+OTHER DEALINGS IN THE SOFTWARE.
3 README.md
@@ -0,0 +1,3 @@
+# grunt-init (unreleased, for grunt v0.4.0a)
+
+> Generate project scaffolding from a template.
0 docs/examples.md
No changes.
0 docs/options.md
No changes.
0 docs/overview.md
No changes.
37 package.json
@@ -0,0 +1,37 @@
+{
+ "name": "grunt-init",
+ "description": "Generate project scaffolding from a template.",
+ "version": "0.4.0",
+ "homepage": "https://github.com/gruntjs/grunt-init",
+ "author": {
+ "name": "Grunt Team",
+ "url": "http://gruntjs.com/"
+ },
+ "repository": {
+ "type": "git",
+ "url": "git://github.com/gruntjs/grunt-init.git"
+ },
+ "bugs": {
+ "url": "https://github.com/gruntjs/grunt-init/issues"
+ },
+ "licenses": [
+ {
+ "type": "MIT",
+ "url": "https://github.com/gruntjs/grunt-init/blob/master/LICENSE-MIT"
+ }
+ ],
+ "main": "Gruntfile.js",
+ "engines": {
+ "node": ">= 0.6.0"
+ },
+ "dependencies": {
+ "prompt": "~0.1.12",
+ "semver": "~1.0.14"
+ },
+ "devDependencies": {
+ "grunt": "~0.4.0a"
+ },
+ "keywords": [
+ "gruntplugin"
+ ]
+}
58 tasks/init/commonjs.js
@@ -0,0 +1,58 @@
+/*
+ * grunt
+ * http://gruntjs.com/
+ *
+ * Copyright (c) 2012 "Cowboy" Ben Alman
+ * Licensed under the MIT license.
+ * https://github.com/gruntjs/grunt/blob/master/LICENSE-MIT
+ */
+
+'use strict';
+
+// Basic template description.
+exports.description = 'Create a commonjs module, including Nodeunit unit tests.';
+
+// Template-specific notes to be displayed before question prompts.
+exports.notes = '';
+
+// Any existing file or directory matching this wildcard will cause a warning.
+exports.warnOn = '*';
+
+// The actual init template.
+exports.template = function(grunt, init, done) {
+
+ init.process({}, [
+ // Prompt for these values.
+ init.prompt('name'),
+ init.prompt('description'),
+ init.prompt('version'),
+ init.prompt('repository'),
+ init.prompt('homepage'),
+ init.prompt('bugs'),
+ init.prompt('licenses'),
+ init.prompt('author_name'),
+ init.prompt('author_email'),
+ init.prompt('author_url'),
+ init.prompt('node_version'),
+ init.prompt('main'),
+ init.prompt('npm_test', 'grunt nodeunit')
+ ], function(err, props) {
+ props.keywords = [];
+
+ // Files to copy (and process).
+ var files = init.filesToCopy(props);
+
+ // Add properly-named license files.
+ init.addLicenseFiles(files, props.licenses);
+
+ // Actually copy (and process) files.
+ init.copyAndProcess(files, props);
+
+ // Generate package.json file.
+ init.writePackageJSON('package.json', props);
+
+ // All done!
+ done();
+ });
+
+};
4 tasks/init/commonjs/rename.json
@@ -0,0 +1,4 @@
+{
+ "lib/name.js": "lib/{%= name %}.js",
+ "test/name_test.js": "test/{%= name %}_test.js"
+}
1 tasks/init/commonjs/root/.gitignore
@@ -0,0 +1 @@
+/node_modules/
15 tasks/init/commonjs/root/.jshintrc
@@ -0,0 +1,15 @@
+{
+ "curly": true,
+ "eqeqeq": true,
+ "immed": true,
+ "latedef": true,
+ "newcap": true,
+ "noarg": true,
+ "sub": true,
+ "undef": true,
+ "unused": true,
+ "boss": true,
+ "eqnull": true,
+ "node": true,
+ "es5": true
+}
73 tasks/init/commonjs/root/Gruntfile.js
@@ -0,0 +1,73 @@
+'use strict';
+
+module.exports = function(grunt) {
+
+ // Project configuration.
+ grunt.initConfig({
+ // Metadata.
+ pkg: grunt.file.readJSON('package.json'),
+ banner: '/*! <%= pkg.name %> - v<%= pkg.version %> - ' +
+ '<%= grunt.template.today("yyyy-mm-dd") %>\n' +
+ '<%= pkg.homepage ? "* " + pkg.homepage + "\\n" : "" %>' +
+ '* Copyright (c) <%= grunt.template.today("yyyy") %> <%= pkg.author.name %>;' +
+ ' Licensed <%= _.pluck(pkg.licenses, "type").join(", ") %> */\n',
+ // Task configuration.
+ concat: {
+ options: {
+ banner: '<%= banner %>',
+ stripBanners: true
+ },
+ dist: {
+ src: ['lib/<%= pkg.name %>.js'],
+ dest: 'dist/<%= pkg.name %>.js'
+ },
+ },
+ uglify: {
+ options: {
+ banner: '<%= banner %>'
+ },
+ dist: {
+ src: '<%= concat.dist.dest %>',
+ dest: 'dist/<%= pkg.name %>.min.js'
+ },
+ },
+ nodeunit: {
+ files: ['test/**/*.js']
+ },
+ jshint: {
+ options: {
+ jshintrc: '.jshintrc'
+ },
+ gruntfile: {
+ src: 'Gruntfile.js'
+ },
+ lib: {
+ options: {
+ jshintrc: 'lib/.jshintrc'
+ },
+ src: ['lib/**/*.js']
+ },
+ test: {
+ src: ['test/**/*.js']
+ },
+ },
+ watch: {
+ gruntfile: {
+ files: '<%= jshint.gruntfile.src %>',
+ tasks: ['jshint:gruntfile']
+ },
+ lib: {
+ files: '<%= jshint.lib.src %>',
+ tasks: ['jshint:lib', 'nodeunit']
+ },
+ test: {
+ files: '<%= jshint.test.src %>',
+ tasks: ['jshint:test', 'nodeunit']
+ },
+ },
+ });
+
+ // Default task.
+ grunt.registerTask('default', ['jshint', 'nodeunit', 'concat', 'uglify']);
+
+};
57 tasks/init/commonjs/root/README.md
@@ -0,0 +1,57 @@
+# {%= name %}
+
+{%= description %}
+
+## Getting Started
+### On the server
+Install the module with: `npm install {%= name %}`
+
+```javascript
+var {%= js_safe_name %} = require('{%= name %}');
+{%= js_safe_name %}.awesome(); // "awesome"
+```
+
+### In the browser
+Download the [production version][min] or the [development version][max].
+
+[min]: https://raw.github.com/{%= git_user %}/{%= git_repo %}/master/dist/{%= name %}.min.js
+[max]: https://raw.github.com/{%= git_user %}/{%= git_repo %}/master/dist/{%= name %}.js
+
+In your web page:
+
+```html
+<script src="dist/{%= name %}.min.js"></script>
+<script>
+awesome(); // "awesome"
+</script>
+```
+
+In your code, you can attach {%= name %}'s methods to any object.
+
+```html
+<script>
+var exports = Bocoup.utils;
+</script>
+<script src="dist/{%= name %}.min.js"></script>
+<script>
+Bocoup.utils.awesome(); // "awesome"
+</script>
+```
+
+## Documentation
+_(Coming soon)_
+
+## Examples
+_(Coming soon)_
+
+## Contributing
+In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code using [grunt](http://gruntjs.com/).
+
+_Also, please don't edit files in the "dist" subdirectory as they are generated via grunt. You'll find source code in the "lib" subdirectory!_
+
+## Release History
+_(Nothing yet)_
+
+## License
+Copyright (c) {%= grunt.template.today('yyyy') %} {%= author_name %}
+Licensed under the {%= licenses.join(', ') %} license{%= licenses.length === 1 ? '' : 's' %}.
13 tasks/init/commonjs/root/lib/.jshintrc
@@ -0,0 +1,13 @@
+{
+ "curly": true,
+ "eqeqeq": true,
+ "immed": true,
+ "latedef": true,
+ "newcap": true,
+ "noarg": true,
+ "sub": true,
+ "undef": true,
+ "boss": true,
+ "eqnull": true,
+ "predef": ["exports"]
+}
17 tasks/init/commonjs/root/lib/name.js
@@ -0,0 +1,17 @@
+/*
+ * {%= name %}
+ * {%= homepage %}
+ *
+ * Copyright (c) {%= grunt.template.today('yyyy') %} {%= author_name %}
+ * Licensed under the {%= licenses.join(', ') %} license{%= licenses.length === 1 ? '' : 's' %}.
+ */
+
+(function(exports) {
+
+ 'use strict';
+
+ exports.awesome = function() {
+ return 'awesome';
+ };
+
+}(typeof exports === 'object' && exports || this));
36 tasks/init/commonjs/root/test/name_test.js
@@ -0,0 +1,36 @@
+'use strict';
+
+var {%= js_test_safe_name %} = require('../lib/{%= name %}.js');
+
+/*
+ ======== A Handy Little Nodeunit Reference ========
+ https://github.com/caolan/nodeunit
+
+ Test methods:
+ test.expect(numAssertions)
+ test.done()
+ Test assertions:
+ test.ok(value, [message])
+ test.equal(actual, expected, [message])
+ test.notEqual(actual, expected, [message])
+ test.deepEqual(actual, expected, [message])
+ test.notDeepEqual(actual, expected, [message])
+ test.strictEqual(actual, expected, [message])
+ test.notStrictEqual(actual, expected, [message])
+ test.throws(block, [error], [message])
+ test.doesNotThrow(block, [error], [message])
+ test.ifError(value)
+*/
+
+exports['awesome'] = {
+ setUp: function(done) {
+ // setup here
+ done();
+ },
+ 'no args': function(test) {
+ test.expect(1);
+ // tests here
+ test.equal({%= js_test_safe_name %}.awesome(), 'awesome', 'should be awesome.');
+ test.done();
+ }
+};
82 tasks/init/gruntfile.js
@@ -0,0 +1,82 @@
+/*
+ * grunt
+ * http://gruntjs.com/
+ *
+ * Copyright (c) 2012 "Cowboy" Ben Alman
+ * Licensed under the MIT license.
+ * https://github.com/gruntjs/grunt/blob/master/LICENSE-MIT
+ */
+
+'use strict';
+
+// Basic template description.
+exports.description = 'Create a basic Gruntfile.';
+
+// Template-specific notes to be displayed before question prompts.
+exports.notes = 'This template tries to guess file and directory paths, but ' +
+ 'you will most likely need to edit the generated Gruntfile.js file before ' +
+ 'running grunt. _If you run grunt after generating the Gruntfile, and ' +
+ 'it exits with errors, edit the file!_';
+
+// Any existing file or directory matching this wildcard will cause a warning.
+exports.warnOn = 'Gruntfile.js';
+
+// The actual init template.
+exports.template = function(grunt, init, done) {
+
+ init.process({}, [
+ // Prompt for these values.
+ {
+ name: 'dom',
+ message: 'Is the DOM involved in ANY way?',
+ default: 'Y/n',
+ warning: 'Yes: QUnit unit tests + JSHint "browser" globals. No: Nodeunit unit tests.'
+ },
+ {
+ name: 'min_concat',
+ message: 'Will files be concatenated or minified?',
+ default: 'Y/n',
+ warning: 'Yes: min + concat tasks. No: nothing to see here.'
+ },
+ {
+ name: 'package_json',
+ message: 'Will you have a package.json file?',
+ default: 'Y/n',
+ warning: 'This changes how filenames are determined and banners are generated.'
+ }
+ ], function(err, props) {
+ props.dom = /y/i.test(props.dom);
+ props.min_concat = /y/i.test(props.min_concat);
+ props.package_json = /y/i.test(props.package_json);
+ props.test_task = props.dom ? 'qunit' : 'nodeunit';
+ props.file_name = props.package_json ? '<%= pkg.name %>' : 'FILE_NAME';
+
+ // Find the first `preferred` item existing in `arr`.
+ function prefer(arr, preferred) {
+ for (var i = 0; i < preferred.length; i++) {
+ if (arr.indexOf(preferred[i]) !== -1) {
+ return preferred[i];
+ }
+ }
+ return preferred[0];
+ }
+
+ // Guess at some directories, if they exist.
+ var dirs = grunt.file.expandDirs('*').map(function(d) { return d.slice(0, -1); });
+ props.lib_dir = prefer(dirs, ['lib', 'src']);
+ props.test_dir = prefer(dirs, ['test', 'tests', 'unit', 'spec']);
+
+ // Maybe this should be extended to support more libraries. Patches welcome!
+ props.jquery = grunt.file.expandFiles('**/jquery*.js').length > 0;
+
+ // Files to copy (and process).
+ var files = init.filesToCopy(props);
+
+ // Actually copy (and process) files.
+ init.copyAndProcess(files, props);
+
+ // All done!
+ done();
+ });
+
+};
87 tasks/init/gruntfile/root/Gruntfile.js
@@ -0,0 +1,87 @@
+/*global module:false*/
+module.exports = function(grunt) {
+
+ // Project configuration.
+ grunt.initConfig({{% if (min_concat) { %}
+ // Metadata.{% if (package_json) { %}
+ pkg: grunt.file.readJSON('package.json'),
+ banner: '/*! <%= pkg.title || pkg.name %> - v<%= pkg.version %> - ' +
+ '<%= grunt.template.today("yyyy-mm-dd") %>\n' +
+ '<%= pkg.homepage ? "* " + pkg.homepage + "\\n" : "" %>' +
+ '* Copyright (c) <%= grunt.template.today("yyyy") %> <%= pkg.author.name %>;' +
+ ' Licensed <%= _.pluck(pkg.licenses, "type").join(", ") %> */\n',{% } else { %}
+ meta: {
+ version: '0.1.0'
+ },
+ banner: '/*! PROJECT_NAME - v<%= meta.version %> - ' +
+ '<%= grunt.template.today("yyyy-mm-dd") %>\n' +
+ '* http://PROJECT_WEBSITE/\n' +
+ '* Copyright (c) <%= grunt.template.today("yyyy") %> ' +
+ 'YOUR_NAME; Licensed MIT */\n',{% } } %}
+ // Task configuration.{% if (min_concat) { %}
+ concat: {
+ options: {
+ banner: '<%= banner %>',
+ stripBanners: true
+ },
+ dist: {
+ src: ['{%= lib_dir %}/{%= file_name %}.js'],
+ dest: 'dist/{%= file_name %}.js'
+ }
+ },
+ uglify: {
+ options: {
+ banner: '<%= banner %>'
+ },
+ dist: {
+ src: '<%= concat.dist.dest %>',
+ dest: 'dist/{%= file_name %}.min.js'
+ }
+ },{% } %}
+ jshint: {
+ options: {
+ curly: true,
+ eqeqeq: true,
+ immed: true,
+ latedef: true,
+ newcap: true,
+ noarg: true,
+ sub: true,
+ undef: true,
+ unused: true,
+ boss: true,
+ eqnull: true,{% if (dom) { %}
+ browser: true,{% } %}
+ globals: {{% if (jquery) { %}
+ jQuery: true
+ {% } %}}
+ },
+ gruntfile: {
+ src: 'Gruntfile.js'
+ },
+ lib_test: {
+ src: ['{%= lib_dir %}/**/*.js', '{%= test_dir %}/**/*.js']
+ }
+ },{% if (dom) { %}
+ {%= test_task %}: {
+ files: ['{%= test_dir %}/**/*.html']
+ },{% } else { %}
+ {%= test_task %}: {
+ files: ['{%= test_dir %}/**/*.js']
+ },{% } %}
+ watch: {
+ gruntfile: {
+ files: '<%= jshint.gruntfile.src %>',
+ tasks: ['jshint:gruntfile']
+ },
+ lib_test: {
+ files: '<%= jshint.lib_test.src %>',
+ tasks: ['jshint:lib_test', '{%= test_task %}']
+ }
+ }
+ });
+
+ // Default task.
+ grunt.registerTask('default', ['jshint', '{%= test_task %}'{%= min_concat ? ", 'concat', 'uglify'" : "" %}]);
+
+};
68 tasks/init/gruntplugin.js
@@ -0,0 +1,68 @@
+/*
+ * grunt
+ * http://gruntjs.com/
+ *
+ * Copyright (c) 2012 "Cowboy" Ben Alman
+ * Licensed under the MIT license.
+ * https://github.com/gruntjs/grunt/blob/master/LICENSE-MIT
+ */
+
+'use strict';
+
+// Basic template description.
+exports.description = 'Create a grunt plugin, including Nodeunit unit tests.';
+
+// Template-specific notes to be displayed before question prompts.
+exports.notes = 'The grunt plugin system is still under development. For ' +
+ 'more information, see the docs at https://github.com/gruntjs/grunt/blob/master/docs/plugins.md';
+
+// Any existing file or directory matching this wildcard will cause a warning.
+exports.warnOn = '*';
+
+// The actual init template.
+exports.template = function(grunt, init, done) {
+
+ init.process({type: 'grunt'}, [
+ // Prompt for these values.
+ init.prompt('name', function(value, props, done) {
+ // Prepend grunt- to default name.
+ done(null, 'grunt-' + value);
+ }),
+ init.prompt('description', 'The best grunt plugin ever.'),
+ init.prompt('version'),
+ init.prompt('repository'),
+ init.prompt('homepage'),
+ init.prompt('bugs'),
+ init.prompt('licenses'),
+ init.prompt('author_name'),
+ init.prompt('author_email'),
+ init.prompt('author_url'),
+ init.prompt('grunt_version'),
+ init.prompt('node_version', grunt.package.engines.node)
+ ], function(err, props) {
+ // Set a few grunt-plugin-specific properties.
+ props.short_name = props.name.replace(/^grunt[\-_]?/, '').replace(/[\W_]+/g, '_').replace(/^(\d)/, '_$1');
+ props.main = 'Gruntfile.js';
+ props.npm_test = 'grunt test';
+ props.keywords = ['gruntplugin'];
+ props.devDependencies = {
+ 'grunt-contrib-clean': '0.4.0a'
+ };
+
+ // Files to copy (and process).
+ var files = init.filesToCopy(props);
+
+ // Add properly-named license files.
+ init.addLicenseFiles(files, props.licenses);
+
+ // Actually copy (and process) files.
+ init.copyAndProcess(files, props);
+
+ // Generate package.json file.
+ init.writePackageJSON('package.json', props);
+
+ // All done!
+ done();
+ });
+
+};
4 tasks/init/gruntplugin/rename.json
@@ -0,0 +1,4 @@
+{
+ "tasks/name.js": "tasks/{%= short_name %}.js",
+ "test/name_test.js": "test/{%= short_name %}_test.js"
+}
3 tasks/init/gruntplugin/root/.gitignore
@@ -0,0 +1,3 @@
+node_modules
+npm-debug.log
+tmp
82 tasks/init/gruntplugin/root/Gruntfile.js
@@ -0,0 +1,82 @@
+/*
+ * {%= name %}
+ * {%= homepage %}
+ *
+ * Copyright (c) {%= grunt.template.today('yyyy') %} {%= author_name %}
+ * Licensed under the {%= licenses.join(', ') %} license{%= licenses.length === 1 ? '' : 's' %}.
+ */
+
+'use strict';
+
+module.exports = function(grunt) {
+
+ // Project configuration.
+ grunt.initConfig({
+ jshint: {
+ all: [
+ 'Gruntfile.js',
+ 'tasks/*.js',
+ '<config:nodeunit.tests>'
+ ],
+ options: {
+ curly: true,
+ eqeqeq: true,
+ immed: true,
+ latedef: true,
+ newcap: true,
+ noarg: true,
+ sub: true,
+ undef: true,
+ boss: true,
+ eqnull: true,
+ node: true,
+ es5: true,
+ },
+ },
+
+ // Before generating any new files, remove any previously-created files.
+ clean: {
+ tests: ['tmp'],
+ },
+
+ // Configuration to be run (and then tested).
+ {%= short_name %}: {
+ default_options: {
+ options: {
+ },
+ files: {
+ 'tmp/default_options': ['test/fixtures/testing', 'test/fixtures/123'],
+ },
+ },
+ custom_options: {
+ options: {
+ separator: ': ',
+ punctuation: ' !!!',
+ },
+ files: {
+ 'tmp/custom_options': ['test/fixtures/testing', 'test/fixtures/123'],
+ },
+ },
+ },
+
+ // Unit tests.
+ nodeunit: {
+ tests: ['test/*_test.js'],
+ },
+
+ });
+
+ // Actually load this plugin's task(s).
+ grunt.loadTasks('tasks');
+
+ // The clean plugin helps in testing.
+ grunt.loadNpmTasks('grunt-contrib-clean');
+
+ // Whenever the "test" task is run, first clean the "tmp" dir, then run this
+ // plugin's task(s), then test the result.
+ grunt.registerTask('test', ['clean', '{%= short_name %}', 'nodeunit']);
+
+ // By default, lint and run all tests.
+ grunt.registerTask('default', ['jshint', 'test']);
+
+};
92 tasks/init/gruntplugin/root/README.md
@@ -0,0 +1,92 @@
+# {%= name %}
+
+> {%= description %}
+
+## Getting Started
+_If you haven't used [grunt][] before, be sure to check out the [Getting Started][] guide._
+
+Install this grunt plugin next to your project's [Gruntfile][Getting Started] with the following command. This will also add the plugin to your project's `package.json` file as a `devDependency`.
+
+```
+npm install {%= name %} --save-dev
+```
+
+Then add this line to your project's Gruntfile:
+
+```javascript
+grunt.loadNpmTasks('{%= name %}');
+```
+
+If the plugin was installed correctly, running `grunt --help` at the command line should list the newly-installed plugin's task(s) as a local Npm module task.
+
+[grunt]: http://gruntjs.com/
+[Getting Started]: https://github.com/gruntjs/grunt/blob/devel/docs/getting_started.md
+
+## Overview
+In your project's Gruntfile, add a section named `{%= short_name %}` to the data object passed into `grunt.initConfig()`.
+
+```js
+grunt.initConfig({
+ {%= short_name %}: {
+ options: {
+ // Task-specific options go here.
+ },
+ your_target: {
+ // Target-specific file lists and/or options go here.
+ },
+ },
+})
+```
+
+## Options
+
+### options.separator
+Type: `String`
+Default value: `', '`
+
+A string value that is used to do something with whatever.
+
+### options.punctuation
+Type: `String`
+Default value: `'.'`
+
+A string value that is used to do something else with whatever else.
+
+## Usage Examples
+
+### Default Options
+In this example, the default options are used to do something with whatever. So if the `testing` file has the content `Testing` and the `123` file had the content `1 2 3`, the generated result would be `Testing, 1 2 3.`
+
+```js
+grunt.initConfig({
+ {%= short_name %}: {
+ options: {},
+ files: {
+ 'dest/default_options': ['src/testing', 'src/123'],
+ },
+ },
+})
+```
+
+### Custom Options
+In this example, custom options are used to do something else with whatever else. So if the `testing` file has the content `Testing` and the `123` file had the content `1 2 3`, the generated result in this case would be `Testing: 1 2 3 !!!`
+
+```js
+grunt.initConfig({
+ {%= short_name %}: {
+ options: {
+ separator: ': ',
+ punctuation: ' !!!',
+ },
+ files: {
+ 'dest/default_options': ['src/testing', 'src/123'],
+ },
+ },
+})
+```
+
+## Contributing
+In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code using [grunt][].
+
+## Release History
+_(Nothing yet)_
51 tasks/init/gruntplugin/root/tasks/name.js
@@ -0,0 +1,51 @@
+/*
+ * {%= name %}
+ * {%= homepage %}
+ *
+ * Copyright (c) {%= grunt.template.today('yyyy') %} {%= author_name %}
+ * Licensed under the {%= licenses.join(', ') %} license{%= licenses.length === 1 ? '' : 's' %}.
+ */
+
+'use strict';
+
+module.exports = function(grunt) {
+
+ // Please see the grunt documentation for more information regarding task
+ // creation: https://github.com/gruntjs/grunt/blob/devel/docs/toc.md
+
+ grunt.registerMultiTask('{%= short_name %}', 'Your task description goes here.', function() {
+ // Merge task-specific and/or target-specific options with these defaults.
+ var options = this.options({
+ punctuation: '.',
+ separator: ', '
+ });
+
+ // Iterate over all specified file groups.
+ this.files.forEach(function(fileObj) {
+ // The source files to be concatenated. The "nonull" option is used
+ // to retain invalid files/patterns so they can be warned about.
+ var files = grunt.file.expand({nonull: true}, fileObj.src);
+
+ // Concat specified files.
+ var src = files.map(function(filepath) {
+ // Warn if a source file/pattern was invalid.
+ if (!grunt.file.exists(filepath)) {
+ grunt.log.error('Source file "' + filepath + '" not found.');
+ return '';
+ }
+ // Read file source.
+ return grunt.file.read(filepath);
+ }).join(options.separator);
+
+ // Handle options.
+ src += options.punctuation;
+
+ // Write the destination file.
+ grunt.file.write(fileObj.dest, src);
+
+ // Print a success message.
+ grunt.log.writeln('File "' + fileObj.dest + '" created.');
+ });
+ });
+
+};
1 tasks/init/gruntplugin/root/test/expected/custom_options
@@ -0,0 +1 @@
+Testing: 1 2 3 !!!
1 tasks/init/gruntplugin/root/test/expected/default_options
@@ -0,0 +1 @@
+Testing, 1 2 3.
1 tasks/init/gruntplugin/root/test/fixtures/123
@@ -0,0 +1 @@
+1 2 3
1 tasks/init/gruntplugin/root/test/fixtures/testing
@@ -0,0 +1 @@
+Testing
48 tasks/init/gruntplugin/root/test/name_test.js
@@ -0,0 +1,48 @@
+'use strict';
+
+var grunt = require('grunt');
+
+/*
+ ======== A Handy Little Nodeunit Reference ========
+ https://github.com/caolan/nodeunit
+
+ Test methods:
+ test.expect(numAssertions)
+ test.done()
+ Test assertions:
+ test.ok(value, [message])
+ test.equal(actual, expected, [message])
+ test.notEqual(actual, expected, [message])
+ test.deepEqual(actual, expected, [message])
+ test.notDeepEqual(actual, expected, [message])
+ test.strictEqual(actual, expected, [message])
+ test.notStrictEqual(actual, expected, [message])
+ test.throws(block, [error], [message])
+ test.doesNotThrow(block, [error], [message])
+ test.ifError(value)
+*/
+
+exports.{%= short_name %} = {
+ setUp: function(done) {
+ // setup here if necessary
+ done();
+ },
+ default_options: function(test) {
+ test.expect(1);
+
+ var actual = grunt.file.read('tmp/default_options');
+ var expected = grunt.file.read('test/expected/default_options');
+ test.equal(actual, expected, 'should describe what the default behavior is.');
+
+ test.done();
+ },
+ custom_options: function(test) {
+ test.expect(1);
+
+ var actual = grunt.file.read('tmp/custom_options');
+ var expected = grunt.file.read('test/expected/custom_options');
+ test.equal(actual, expected, 'should describe what the custom option(s) behavior is.');
+
+ test.done();
+ },
+};
83 tasks/init/jquery.js
@@ -0,0 +1,83 @@
+/*
+ * grunt
+ * http://gruntjs.com/
+ *
+ * Copyright (c) 2012 "Cowboy" Ben Alman
+ * Licensed under the MIT license.
+ * https://github.com/gruntjs/grunt/blob/master/LICENSE-MIT
+ */
+
+'use strict';
+
+// Basic template description.
+exports.description = 'Create a jQuery plugin, including QUnit unit tests.';
+
+// Template-specific notes to be displayed before question prompts.
+exports.notes = '_Project name_ should not contain "jquery" or "js" and ' +
+ 'should be a unique ID not already in use at plugins.jquery.com. _Project ' +
+ 'title_ should be a human-readable title, and doesn\'t need to contain ' +
+ 'the word "jQuery", although it may. For example, a plugin titled "Awesome ' +
+ 'jQuery Plugin" might have the name "awesome-plugin". For more information ' +
+ 'please see the documentation at ' +
+ 'https://github.com/jquery/plugins.jquery.com/blob/master/docs/manifest.md';
+
+// Any existing file or directory matching this wildcard will cause a warning.
+exports.warnOn = '*';
+
+// The actual init template.
+exports.template = function(grunt, init, done) {
+
+ init.process({type: 'jquery'}, [
+ // Prompt for these values.
+ init.prompt('name'),
+ init.prompt('title', function(value, data, done) {
+ // Fix jQuery capitalization.
+ value = value.replace(/jquery/gi, 'jQuery');
+ done(null, value);
+ }),
+ init.prompt('description', 'The best jQuery plugin ever.'),
+ init.prompt('version'),
+ init.prompt('repository'),
+ init.prompt('homepage'),
+ init.prompt('bugs'),
+ init.prompt('licenses', 'MIT'),
+ init.prompt('author_name'),
+ init.prompt('author_email'),
+ init.prompt('author_url'),
+ init.prompt('jquery_version')
+ ], function(err, props) {
+ // A few additional properties.
+ props.jqueryjson = props.name + '.jquery.json';
+ props.dependencies = {jquery: props.jquery_version || '>= 1'};
+ props.keywords = [];
+
+ // Files to copy (and process).
+ var files = init.filesToCopy(props);
+
+ // Add properly-named license files.
+ init.addLicenseFiles(files, props.licenses);
+
+ // Actually copy (and process) files.
+ init.copyAndProcess(files, props, {noProcess: 'libs/**'});
+
+ // Generate package.json file, used by npm and grunt.
+ init.writePackageJSON('package.json', {
+ name: 'jquery-plugin',
+ version: '0.0.0-ignored',
+ npm_test: 'grunt qunit',
+ // TODO: pull from grunt's package.json
+ node_version: '>= 0.6.0',
+ });
+
+ // Generate jquery.json file.
+ init.writePackageJSON(props.jqueryjson, props, function(pkg, props) {
+ // The jQuery site needs the "bugs" value as a string.
+ if ('bugs' in props) { pkg.bugs = props.bugs; }
+ return pkg;
+ });
+
+ // All done!
+ done();
+ });
+
+};
5 tasks/init/jquery/rename.json
@@ -0,0 +1,5 @@
+{
+ "src/name.js": "src/{%= name %}.js",
+ "test/name_test.js": "test/{%= name %}_test.js",
+ "test/name.html": "test/{%= name %}.html"
+}
1 tasks/init/jquery/root/.gitignore
@@ -0,0 +1 @@
+/node_modules/
15 tasks/init/jquery/root/.jshintrc
@@ -0,0 +1,15 @@
+{
+ "curly": true,
+ "eqeqeq": true,
+ "immed": true,
+ "latedef": true,
+ "newcap": true,
+ "noarg": true,
+ "sub": true,
+ "undef": true,
+ "unused": true,
+ "boss": true,
+ "eqnull": true,
+ "node": true,
+ "es5": true
+}
35 tasks/init/jquery/root/CONTRIBUTING.md
@@ -0,0 +1,35 @@
+# Contributing
+
+## Important notes
+Please don't edit files in the `dist` subdirectory as they are generated via grunt. You'll find source code in the `src` subdirectory!
+
+### Code style
+Regarding code style like indentation and whitespace, **follow the conventions you see used in the source already.**
+
+### PhantomJS
+While grunt can run the included unit tests via [PhantomJS](http://phantomjs.org/), this shouldn't be considered a substitute for the real thing. Please be sure to test the `test/*.html` unit test file(s) in _actual_ browsers.
+
+See the [Why does grunt complain that PhantomJS isn't installed?](https://github.com/gruntjs/grunt/blob/master/docs/faq.md#why-does-grunt-complain-that-phantomjs-isnt-installed) guide in the [Grunt FAQ](https://github.com/gruntjs/grunt/blob/master/docs/faq.md) for help with installing or troubleshooting PhantomJS.
+
+## Modifying the code
+First, ensure that you have the latest [Node.js](http://nodejs.org/) and [npm](http://npmjs.org/) installed.
+
+Test that grunt is installed globally by running `grunt --version` at the command-line. If grunt isn't installed globally, run `npm install -g grunt` to install the latest version. _You may need to run `sudo npm install -g grunt`._
+
+_Note that in Windows, you may have to run `grunt.cmd` instead of `grunt`._
+
+1. Fork and clone the repo.
+1. Run `npm install` to install all dependencies (including grunt).
+1. Run `grunt` to grunt this project.
+
+Assuming that you don't see any red, you're ready to go. Just be sure to run `grunt` after making any changes, to ensure that nothing is broken.
+
+## Submitting pull requests
+
+1. Create a new branch, please don't work in your `master` branch directly.
+1. Add failing tests for the change you want to make. Run `grunt` to see the tests fail.
+1. Fix stuff.
+1. Run `grunt` to see if the tests pass. Repeat steps 2-4 until done.
+1. Open `test/*.html` unit test file(s) in actual browser to ensure tests pass everywhere.
+1. Update the documentation to reflect any changes.
+1. Push to your fork and submit a pull request.
76 tasks/init/jquery/root/Gruntfile.js
@@ -0,0 +1,76 @@
+'use strict';
+
+module.exports = function(grunt) {
+
+ // Project configuration.
+ grunt.initConfig({
+ // Metadata.
+ pkg: grunt.file.readJSON('{%= jqueryjson %}'),
+ banner: '/*! <%= pkg.title || pkg.name %> - v<%= pkg.version %> - ' +
+ '<%= grunt.template.today("yyyy-mm-dd") %>\n' +
+ '<%= pkg.homepage ? "* " + pkg.homepage + "\\n" : "" %>' +
+ '* Copyright (c) <%= grunt.template.today("yyyy") %> <%= pkg.author.name %>;' +
+ ' Licensed <%= _.pluck(pkg.licenses, "type").join(", ") %> */\n',
+ // Task configuration.
+ concat: {
+ options: {
+ banner: '<%= banner %>',
+ stripBanners: true
+ },
+ dist: {
+ src: ['src/<%= pkg.name %>.js'],
+ dest: 'dist/<%= pkg.name %>.js'
+ },
+ },
+ uglify: {
+ options: {
+ banner: '<%= banner %>'
+ },
+ dist: {
+ src: '<%= concat.dist.dest %>',
+ dest: 'dist/<%= pkg.name %>.min.js'
+ },
+ },
+ qunit: {
+ files: ['test/**/*.html']
+ },
+ jshint: {
+ gruntfile: {
+ options: {
+ jshintrc: '.jshintrc'
+ },
+ src: 'Gruntfile.js'
+ },
+ src: {
+ options: {
+ jshintrc: 'src/.jshintrc'
+ },
+ src: ['src/**/*.js']
+ },
+ test: {
+ options: {
+ jshintrc: 'test/.jshintrc'
+ },
+ src: ['test/**/*.js']
+ },
+ },
+ watch: {
+ gruntfile: {
+ files: '<%= jshint.gruntfile.src %>',
+ tasks: ['jshint:gruntfile']
+ },
+ src: {
+ files: '<%= jshint.src.src %>',
+ tasks: ['jshint:src', 'qunit']
+ },
+ test: {
+ files: '<%= jshint.test.src %>',
+ tasks: ['jshint:test', 'qunit']
+ },
+ },
+ });
+
+ // Default task.
+ grunt.registerTask('default', ['jshint', 'qunit', 'concat', 'uglify']);
+
+};
30 tasks/init/jquery/root/README.md
@@ -0,0 +1,30 @@
+# {%= title || name %}
+
+{%= description %}
+
+## Getting Started
+Download the [production version][min] or the [development version][max].
+
+[min]: https://raw.github.com/{%= git_user %}/{%= git_repo %}/master/dist/{%= name %}.min.js
+[max]: https://raw.github.com/{%= git_user %}/{%= git_repo %}/master/dist/{%= name %}.js
+
+In your web page:
+
+```html
+<script src="jquery.js"></script>
+<script src="dist/{%= name %}.min.js"></script>
+<script>
+jQuery(function($) {
+ $.awesome(); // "awesome"
+});
+</script>
+```
+
+## Documentation
+_(Coming soon)_
+
+## Examples
+_(Coming soon)_
+
+## Release History
+_(Nothing yet)_
12 tasks/init/jquery/root/libs/jquery-loader.js
@@ -0,0 +1,12 @@
+(function() {
+ // Default to the local version.
+ var path = '../libs/jquery/jquery.js';
+ // Get any jquery=___ param from the query string.
+ var jqversion = location.search.match(/[?&]jquery=(.*?)(?=&|$)/);
+ // If a version was specified, use that version from code.jquery.com.
+ if (jqversion) {
+ path = 'http://code.jquery.com/jquery-' + jqversion[1] + '.js';
+ }
+ // This is the only time I'll ever use document.write, I promise!
+ document.write('<script src="' + path + '"></script>');
+}());
9,404 tasks/init/jquery/root/libs/jquery/jquery.js
9,404 additions, 0 deletions not shown because the diff is too large. Please use a local Git client to view these changes.
232 tasks/init/jquery/root/libs/qunit/qunit.css
@@ -0,0 +1,232 @@
+/**
+ * QUnit v1.4.0 - A JavaScript Unit Testing Framework
+ *
+ * http://docs.jquery.com/QUnit
+ *
+ * Copyright (c) 2012 John Resig, Jörn Zaefferer
+ * Dual licensed under the MIT (MIT-LICENSE.txt)
+ * or GPL (GPL-LICENSE.txt) licenses.
+ */
+
+/** Font Family and Sizes */
+
+#qunit-tests, #qunit-header, #qunit-banner, #qunit-testrunner-toolbar, #qunit-userAgent, #qunit-testresult {
+ font-family: "Helvetica Neue Light", "HelveticaNeue-Light", "Helvetica Neue", Calibri, Helvetica, Arial, sans-serif;
+}
+
+#qunit-testrunner-toolbar, #qunit-userAgent, #qunit-testresult, #qunit-tests li { font-size: small; }
+#qunit-tests { font-size: smaller; }
+
+
+/** Resets */
+
+#qunit-tests, #qunit-tests ol, #qunit-header, #qunit-banner, #qunit-userAgent, #qunit-testresult {
+ margin: 0;
+ padding: 0;
+}
+
+
+/** Header */
+
+#qunit-header {
+ padding: 0.5em 0 0.5em 1em;
+
+ color: #8699a4;
+ background-color: #0d3349;
+
+ font-size: 1.5em;
+ line-height: 1em;
+ font-weight: normal;
+
+ border-radius: 15px 15px 0 0;
+ -moz-border-radius: 15px 15px 0 0;
+ -webkit-border-top-right-radius: 15px;
+ -webkit-border-top-left-radius: 15px;
+}
+
+#qunit-header a {
+ text-decoration: none;
+ color: #c2ccd1;
+}
+
+#qunit-header a:hover,
+#qunit-header a:focus {
+ color: #fff;
+}
+
+#qunit-header label {
+ display: inline-block;
+}
+
+#qunit-banner {
+ height: 5px;
+}
+
+#qunit-testrunner-toolbar {
+ padding: 0.5em 0 0.5em 2em;
+ color: #5E740B;
+ background-color: #eee;
+}
+
+#qunit-userAgent {
+ padding: 0.5em 0 0.5em 2.5em;
+ background-color: #2b81af;
+ color: #fff;
+ text-shadow: rgba(0, 0, 0, 0.5) 2px 2px 1px;
+}
+
+
+/** Tests: Pass/Fail */
+
+#qunit-tests {
+ list-style-position: inside;
+}
+
+#qunit-tests li {
+ padding: 0.4em 0.5em 0.4em 2.5em;
+ border-bottom: 1px solid #fff;
+ list-style-position: inside;
+}
+
+#qunit-tests.hidepass li.pass, #qunit-tests.hidepass li.running {
+ display: none;
+}
+
+#qunit-tests li strong {
+ cursor: pointer;
+}
+
+#qunit-tests li a {
+ padding: 0.5em;
+ color: #c2ccd1;
+ text-decoration: none;
+}
+#qunit-tests li a:hover,
+#qunit-tests li a:focus {
+ color: #000;
+}
+
+#qunit-tests ol {
+ margin-top: 0.5em;
+ padding: 0.5em;
+
+ background-color: #fff;
+
+ border-radius: 15px;
+ -moz-border-radius: 15px;
+ -webkit-border-radius: 15px;
+
+ box-shadow: inset 0px 2px 13px #999;
+ -moz-box-shadow: inset 0px 2px 13px #999;
+ -webkit-box-shadow: inset 0px 2px 13px #999;
+}
+
+#qunit-tests table {
+ border-collapse: collapse;
+ margin-top: .2em;
+}
+
+#qunit-tests th {
+ text-align: right;
+ vertical-align: top;
+ padding: 0 .5em 0 0;
+}
+
+#qunit-tests td {
+ vertical-align: top;
+}
+
+#qunit-tests pre {
+ margin: 0;
+ white-space: pre-wrap;
+ word-wrap: break-word;
+}
+
+#qunit-tests del {
+ background-color: #e0f2be;
+ color: #374e0c;
+ text-decoration: none;
+}
+
+#qunit-tests ins {
+ background-color: #ffcaca;
+ color: #500;
+ text-decoration: none;
+}
+
+/*** Test Counts */
+
+#qunit-tests b.counts { color: black; }
+#qunit-tests b.passed { color: #5E740B; }
+#qunit-tests b.failed { color: #710909; }
+
+#qunit-tests li li {
+ margin: 0.5em;
+ padding: 0.4em 0.5em 0.4em 0.5em;
+ background-color: #fff;
+ border-bottom: none;
+ list-style-position: inside;
+}
+
+/*** Passing Styles */
+
+#qunit-tests li li.pass {
+ color: #5E740B;
+ background-color: #fff;
+ border-left: 26px solid #C6E746;
+}
+
+#qunit-tests .pass { color: #528CE0; background-color: #D2E0E6; }
+#qunit-tests .pass .test-name { color: #366097; }
+
+#qunit-tests .pass .test-actual,
+#qunit-tests .pass .test-expected { color: #999999; }
+
+#qunit-banner.qunit-pass { background-color: #C6E746; }
+
+/*** Failing Styles */
+
+#qunit-tests li li.fail {
+ color: #710909;
+ background-color: #fff;
+ border-left: 26px solid #EE5757;
+ white-space: pre;
+}
+
+#qunit-tests > li:last-child {
+ border-radius: 0 0 15px 15px;
+ -moz-border-radius: 0 0 15px 15px;
+ -webkit-border-bottom-right-radius: 15px;
+ -webkit-border-bottom-left-radius: 15px;
+}
+
+#qunit-tests .fail { color: #000000; background-color: #EE5757; }
+#qunit-tests .fail .test-name,
+#qunit-tests .fail .module-name { color: #000000; }
+
+#qunit-tests .fail .test-actual { color: #EE5757; }
+#qunit-tests .fail .test-expected { color: green; }
+
+#qunit-banner.qunit-fail { background-color: #EE5757; }
+
+
+/** Result */
+
+#qunit-testresult {
+ padding: 0.5em 0.5em 0.5em 2.5em;
+
+ color: #2b81af;
+ background-color: #D2E0E6;
+
+ border-bottom: 1px solid white;
+}
+
+/** Fixture */
+
+#qunit-fixture {
+ position: absolute;
+ top: -10000px;
+ left: -10000px;
+ width: 1000px;
+ height: 1000px;
+}
1,659 tasks/init/jquery/root/libs/qunit/qunit.js
@@ -0,0 +1,1659 @@
+/**
+ * QUnit v1.4.0 - A JavaScript Unit Testing Framework
+ *
+ * http://docs.jquery.com/QUnit
+ *
+ * Copyright (c) 2012 John Resig, Jörn Zaefferer
+ * Dual licensed under the MIT (MIT-LICENSE.txt)
+ * or GPL (GPL-LICENSE.txt) licenses.
+ */
+
+(function(window) {
+
+var defined = {
+ setTimeout: typeof window.setTimeout !== "undefined",
+ sessionStorage: (function() {
+ var x = "qunit-test-string";
+ try {
+ sessionStorage.setItem(x, x);
+ sessionStorage.removeItem(x);
+ return true;
+ } catch(e) {
+ return false;
+ }
+ }())
+};
+
+var testId = 0,
+ toString = Object.prototype.toString,
+ hasOwn = Object.prototype.hasOwnProperty;
+
+var Test = function(name, testName, expected, async, callback) {
+ this.name = name;
+ this.testName = testName;
+ this.expected = expected;
+ this.async = async;
+ this.callback = callback;
+ this.assertions = [];
+};
+Test.prototype = {
+ init: function() {
+ var tests = id("qunit-tests");
+ if (tests) {
+ var b = document.createElement("strong");
+ b.innerHTML = "Running " + this.name;
+ var li = document.createElement("li");
+ li.appendChild( b );
+ li.className = "running";
+ li.id = this.id = "test-output" + testId++;
+ tests.appendChild( li );
+ }
+ },
+ setup: function() {
+ if (this.module != config.previousModule) {
+ if ( config.previousModule ) {
+ runLoggingCallbacks('moduleDone', QUnit, {
+ name: config.previousModule,
+ failed: config.moduleStats.bad,
+ passed: config.moduleStats.all - config.moduleStats.bad,
+ total: config.moduleStats.all
+ } );
+ }
+ config.previousModule = this.module;
+ config.moduleStats = { all: 0, bad: 0 };
+ runLoggingCallbacks( 'moduleStart', QUnit, {
+ name: this.module
+ } );
+ } else if (config.autorun) {
+ runLoggingCallbacks( 'moduleStart', QUnit, {
+ name: this.module
+ } );
+ }
+
+ config.current = this;
+ this.testEnvironment = extend({
+ setup: function() {},
+ teardown: function() {}
+ }, this.moduleTestEnvironment);
+
+ runLoggingCallbacks( 'testStart', QUnit, {
+ name: this.testName,
+ module: this.module
+ });
+
+ // allow utility functions to access the current test environment
+ // TODO why??
+ QUnit.current_testEnvironment = this.testEnvironment;
+
+ if ( !config.pollution ) {
+ saveGlobal();
+ }
+ if ( config.notrycatch ) {
+ this.testEnvironment.setup.call(this.testEnvironment);
+ return;
+ }
+ try {
+ this.testEnvironment.setup.call(this.testEnvironment);
+ } catch(e) {
+ QUnit.pushFailure( "Setup failed on " + this.testName + ": " + e.message, extractStacktrace( e, 1 ) );
+ }
+ },
+ run: function() {
+ config.current = this;
+ if ( this.async ) {
+ QUnit.stop();
+ }
+
+ if ( config.notrycatch ) {
+ this.callback.call(this.testEnvironment);
+ return;
+ }
+ try {
+ this.callback.call(this.testEnvironment);
+ } catch(e) {
+ QUnit.pushFailure( "Died on test #" + (this.assertions.length + 1) + ": " + e.message, extractStacktrace( e, 1 ) );
+ // else next test will carry the responsibility
+ saveGlobal();
+
+ // Restart the tests if they're blocking
+ if ( config.blocking ) {
+ QUnit.start();
+ }
+ }
+ },
+ teardown: function() {
+ config.current = this;
+ if ( config.notrycatch ) {
+ this.testEnvironment.teardown.call(this.testEnvironment);
+ return;
+ } else {
+ try {
+ this.testEnvironment.teardown.call(this.testEnvironment);
+ } catch(e) {
+ QUnit.pushFailure( "Teardown failed on " + this.testName + ": " + e.message, extractStacktrace( e, 1 ) );
+ }
+ }
+ checkPollution();
+ },
+ finish: function() {
+ config.current = this;
+ if ( this.expected != null && this.expected != this.assertions.length ) {
+ QUnit.pushFailure( "Expected " + this.expected + " assertions, but " + this.assertions.length + " were run" );
+ } else if ( this.expected == null && !this.assertions.length ) {
+ QUnit.pushFailure( "Expected at least one assertion, but none were run - call expect(0) to accept zero assertions." );
+ }
+
+ var good = 0, bad = 0,
+ li, i,
+ tests = id("qunit-tests");
+
+ config.stats.all += this.assertions.length;
+ config.moduleStats.all += this.assertions.length;
+
+ if ( tests ) {
+ var ol = document.createElement("ol");
+
+ for ( i = 0; i < this.assertions.length; i++ ) {
+ var assertion = this.assertions[i];
+
+ li = document.createElement("li");
+ li.className = assertion.result ? "pass" : "fail";
+ li.innerHTML = assertion.message || (assertion.result ? "okay" : "failed");
+ ol.appendChild( li );
+
+ if ( assertion.result ) {
+ good++;
+ } else {
+ bad++;
+ config.stats.bad++;
+ config.moduleStats.bad++;
+ }
+ }
+
+ // store result when possible
+ if ( QUnit.config.reorder && defined.sessionStorage ) {
+ if (bad) {
+ sessionStorage.setItem("qunit-test-" + this.module + "-" + this.testName, bad);
+ } else {
+ sessionStorage.removeItem("qunit-test-" + this.module + "-" + this.testName);
+ }
+ }
+
+ if (bad === 0) {
+ ol.style.display = "none";
+ }
+
+ var b = document.createElement("strong");
+ b.innerHTML = this.name + " <b class='counts'>(<b class='failed'>" + bad + "</b>, <b class='passed'>" + good + "</b>, " + this.assertions.length + ")</b>";
+
+ var a = document.createElement("a");
+ a.innerHTML = "Rerun";
+ a.href = QUnit.url({ filter: getText([b]).replace(/\([^)]+\)$/, "").replace(/(^\s*|\s*$)/g, "") });
+
+ addEvent(b, "click", function() {
+ var next = b.nextSibling.nextSibling,
+ display = next.style.display;
+ next.style.display = display === "none" ? "block" : "none";
+ });
+
+ addEvent(b, "dblclick", function(e) {
+ var target = e && e.target ? e.target : window.event.srcElement;
+ if ( target.nodeName.toLowerCase() == "span" || target.nodeName.toLowerCase() == "b" ) {
+ target = target.parentNode;
+ }
+ if ( window.location && target.nodeName.toLowerCase() === "strong" ) {
+ window.location = QUnit.url({ filter: getText([target]).replace(/\([^)]+\)$/, "").replace(/(^\s*|\s*$)/g, "") });
+ }
+ });
+
+ li = id(this.id);
+ li.className = bad ? "fail" : "pass";
+ li.removeChild( li.firstChild );
+ li.appendChild( b );
+ li.appendChild( a );
+ li.appendChild( ol );
+
+ } else {
+ for ( i = 0; i < this.assertions.length; i++ ) {
+ if ( !this.assertions[i].result ) {
+ bad++;
+ config.stats.bad++;
+ config.moduleStats.bad++;
+ }
+ }
+ }
+
+ QUnit.reset();
+
+ runLoggingCallbacks( 'testDone', QUnit, {
+ name: this.testName,
+ module: this.module,
+ failed: bad,
+ passed: this.assertions.length - bad,
+ total: this.assertions.length
+ } );
+ },
+
+ queue: function() {
+ var test = this;
+ synchronize(function() {
+ test.init();
+ });
+ function run() {
+ // each of these can by async
+ synchronize(function() {
+ test.setup();
+ });
+ synchronize(function() {
+ test.run();
+ });
+ synchronize(function() {
+ test.teardown();
+ });
+ synchronize(function() {
+ test.finish();
+ });
+ }
+ // defer when previous test run passed, if storage is available
+ var bad = QUnit.config.reorder && defined.sessionStorage && +sessionStorage.getItem("qunit-test-" + this.module + "-" + this.testName);
+ if (bad) {
+ run();
+ } else {
+ synchronize(run, true);
+ }
+ }
+
+};
+
+var QUnit = {
+
+ // call on start of module test to prepend name to all tests
+ module: function(name, testEnvironment) {
+ config.currentModule = name;
+ config.currentModuleTestEnviroment = testEnvironment;
+ },
+
+ asyncTest: function(testName, expected, callback) {
+ if ( arguments.length === 2 ) {
+ callback = expected;
+ expected = null;
+ }
+
+ QUnit.test(testName, expected, callback, true);
+ },
+
+ test: function(testName, expected, callback, async) {
+ var name = '<span class="test-name">' + escapeInnerText(testName) + '</span>';
+
+ if ( arguments.length === 2 ) {
+ callback = expected;
+ expected = null;
+ }
+
+ if ( config.currentModule ) {
+ name = '<span class="module-name">' + config.currentModule + "</span>: " + name;
+ }
+
+ if ( !validTest(config.currentModule + ": " + testName) ) {
+ return;
+ }
+
+ var test = new Test(name, testName, expected, async, callback);
+ test.module = config.currentModule;
+ test.moduleTestEnvironment = config.currentModuleTestEnviroment;
+ test.queue();
+ },
+
+ // Specify the number of expected assertions to gurantee that failed test (no assertions are run at all) don't slip through.
+ expect: function(asserts) {
+ config.current.expected = asserts;
+ },
+
+ // Asserts true.
+ // @example ok( "asdfasdf".length > 5, "There must be at least 5 chars" );
+ ok: function(result, msg) {
+ if (!config.current) {
+ throw new Error("ok() assertion outside test context, was " + sourceFromStacktrace(2));
+ }
+ result = !!result;
+ var details = {
+ result: result,
+ message: msg
+ };
+ msg = escapeInnerText(msg || (result ? "okay" : "failed"));
+ if ( !result ) {
+ var source = sourceFromStacktrace(2);
+ if (source) {
+ details.source = source;
+ msg += '<table><tr class="test-source"><th>Source: </th><td><pre>' + escapeInnerText(source) + '</pre></td></tr></table>';
+ }
+ }
+ runLoggingCallbacks( 'log', QUnit, details );
+ config.current.assertions.push({
+ result: result,
+ message: msg
+ });
+ },
+
+ // Checks that the first two arguments are equal, with an optional message. Prints out both actual and expected values.
+ // @example equal( format("Received {0} bytes.", 2), "Received 2 bytes." );
+ equal: function(actual, expected, message) {
+ QUnit.push(expected == actual, actual, expected, message);
+ },
+
+ notEqual: function(actual, expected, message) {
+ QUnit.push(expected != actual, actual, expected, message);
+ },
+
+ deepEqual: function(actual, expected, message) {
+ QUnit.push(QUnit.equiv(actual, expected), actual, expected, message);
+ },
+
+ notDeepEqual: function(actual, expected, message) {
+ QUnit.push(!QUnit.equiv(actual, expected), actual, expected, message);
+ },
+
+ strictEqual: function(actual, expected, message) {
+ QUnit.push(expected === actual, actual, expected, message);
+ },
+
+ notStrictEqual: function(actual, expected, message) {
+ QUnit.push(expected !== actual, actual, expected, message);
+ },
+
+ raises: function(block, expected, message) {
+ var actual, ok = false;
+
+ if (typeof expected === 'string') {
+ message = expected;
+ expected = null;
+ }
+
+ try {
+ block();
+ } catch (e) {
+ actual = e;
+ }
+
+ if (actual) {
+ // we don't want to validate thrown error
+ if (!expected) {
+ ok = true;
+ // expected is a regexp
+ } else if (QUnit.objectType(expected) === "regexp") {
+ ok = expected.test(actual);
+ // expected is a constructor
+ } else if (actual instanceof expected) {
+ ok = true;
+ // expected is a validation function which returns true is validation passed
+ } else if (expected.call({}, actual) === true) {
+ ok = true;
+ }
+ }
+
+ QUnit.ok(ok, message);
+ },
+
+ start: function(count) {
+ config.semaphore -= count || 1;
+ if (config.semaphore > 0) {
+ // don't start until equal number of stop-calls
+ return;
+ }
+ if (config.semaphore < 0) {
+ // ignore if start is called more often then stop
+ config.semaphore = 0;
+ }
+ // A slight delay, to avoid any current callbacks
+ if ( defined.setTimeout ) {
+ window.setTimeout(function() {
+ if (config.semaphore > 0) {
+ return;
+ }
+ if ( config.timeout ) {
+ clearTimeout(config.timeout);
+ }
+
+ config.blocking = false;
+ process(true);
+ }, 13);
+ } else {
+ config.blocking = false;
+ process(true);
+ }
+ },
+
+ stop: function(count) {
+ config.semaphore += count || 1;
+ config.blocking = true;
+
+ if ( config.testTimeout && defined.setTimeout ) {
+ clearTimeout(config.timeout);
+ config.timeout = window.setTimeout(function() {
+ QUnit.ok( false, "Test timed out" );
+ config.semaphore = 1;
+ QUnit.start();
+ }, config.testTimeout);
+ }
+ }
+};
+
+//We want access to the constructor's prototype
+(function() {
+ function F(){}
+ F.prototype = QUnit;
+ QUnit = new F();
+ //Make F QUnit's constructor so that we can add to the prototype later
+ QUnit.constructor = F;
+}());
+
+// deprecated; still export them to window to provide clear error messages
+// next step: remove entirely
+QUnit.equals = function() {
+ QUnit.push(false, false, false, "QUnit.equals has been deprecated since 2009 (e88049a0), use QUnit.equal instead");
+};
+QUnit.same = function() {
+ QUnit.push(false, false, false, "QUnit.same has been deprecated since 2009 (e88049a0), use QUnit.deepEqual instead");
+};
+
+// Maintain internal state
+var config = {
+ // The queue of tests to run
+ queue: [],
+
+ // block until document ready
+ blocking: true,
+
+ // when enabled, show only failing tests
+ // gets persisted through sessionStorage and can be changed in UI via checkbox
+ hidepassed: false,
+
+ // by default, run previously failed tests first
+ // very useful in combination with "Hide passed tests" checked
+ reorder: true,
+
+ // by default, modify document.title when suite is done
+ altertitle: true,
+
+ urlConfig: ['noglobals', 'notrycatch'],
+
+ //logging callback queues
+ begin: [],
+ done: [],
+ log: [],
+ testStart: [],
+ testDone: [],
+ moduleStart: [],
+ moduleDone: []
+};
+
+// Load paramaters
+(function() {
+ var location = window.location || { search: "", protocol: "file:" },
+ params = location.search.slice( 1 ).split( "&" ),
+ length = params.length,
+ urlParams = {},
+ current;
+
+ if ( params[ 0 ] ) {
+ for ( var i = 0; i < length; i++ ) {
+ current = params[ i ].split( "=" );
+ current[ 0 ] = decodeURIComponent( current[ 0 ] );
+ // allow just a key to turn on a flag, e.g., test.html?noglobals
+ current[ 1 ] = current[ 1 ] ? decodeURIComponent( current[ 1 ] ) : true;
+ urlParams[ current[ 0 ] ] = current[ 1 ];
+ }
+ }
+
+ QUnit.urlParams = urlParams;
+ config.filter = urlParams.filter;
+
+ // Figure out if we're running the tests from a server or not
+ QUnit.isLocal = location.protocol === 'file:';
+}());
+
+// Expose the API as global variables, unless an 'exports'
+// object exists, in that case we assume we're in CommonJS - export everything at the end
+if ( typeof exports === "undefined" || typeof require === "undefined" ) {
+ extend(window, QUnit);
+ window.QUnit = QUnit;
+}
+
+// define these after exposing globals to keep them in these QUnit namespace only
+extend(QUnit, {
+ config: config,
+
+ // Initialize the configuration options
+ init: function() {
+ extend(config, {
+ stats: { all: 0, bad: 0 },
+ moduleStats: { all: 0, bad: 0 },
+ started: +new Date(),
+ updateRate: 1000,
+ blocking: false,
+ autostart: true,
+ autorun: false,
+ filter: "",
+ queue: [],
+ semaphore: 0
+ });
+
+ var qunit = id( "qunit" );
+ if ( qunit ) {
+ qunit.innerHTML =
+ '<h1 id="qunit-header">' + escapeInnerText( document.title ) + '</h1>' +
+ '<h2 id="qunit-banner"></h2>' +
+ '<div id="qunit-testrunner-toolbar"></div>' +
+ '<h2 id="qunit-userAgent"></h2>' +
+ '<ol id="qunit-tests"></ol>';
+ }
+
+ var tests = id( "qunit-tests" ),
+ banner = id( "qunit-banner" ),
+ result = id( "qunit-testresult" );
+
+ if ( tests ) {
+ tests.innerHTML = "";
+ }
+
+ if ( banner ) {
+ banner.className = "";
+ }
+
+ if ( result ) {
+ result.parentNode.removeChild( result );
+ }
+
+ if ( tests ) {
+ result = document.createElement( "p" );
+ result.id = "qunit-testresult";
+ result.className = "result";
+ tests.parentNode.insertBefore( result, tests );
+ result.innerHTML = 'Running...<br/>&nbsp;';
+ }
+ },
+
+ // Resets the test setup. Useful for tests that modify the DOM.
+ // If jQuery is available, uses jQuery's html(), otherwise just innerHTML.
+ reset: function() {
+ if ( window.jQuery ) {
+ jQuery( "#qunit-fixture" ).html( config.fixture );
+ } else {
+ var main = id( 'qunit-fixture' );
+ if ( main ) {
+ main.innerHTML = config.fixture;
+ }
+ }
+ },
+
+ // Trigger an event on an element.
+ // @example triggerEvent( document.body, "click" );
+ triggerEvent: function( elem, type, event ) {
+ if ( document.createEvent ) {
+ event = document.createEvent("MouseEvents");
+ event.initMouseEvent(type, true, true, elem.ownerDocument.defaultView,
+ 0, 0, 0, 0, 0, false, false, false, false, 0, null);
+ elem.dispatchEvent( event );
+
+ } else if ( elem.fireEvent ) {
+ elem.fireEvent("on"+type);
+ }
+ },
+
+ // Safe object type checking
+ is: function( type, obj ) {
+ return QUnit.objectType( obj ) == type;
+ },
+
+ objectType: function( obj ) {
+ if (typeof obj === "undefined") {
+ return "undefined";
+
+ // consider: typeof null === object
+ }
+ if (obj === null) {
+ return "null";
+ }
+
+ var type = toString.call( obj ).match(/^\[object\s(.*)\]$/)[1] || '';
+
+ switch (type) {
+ case 'Number':
+ if (isNaN(obj)) {
+ return "nan";
+ }
+ return "number";
+ case 'String':
+ case 'Boolean':
+ case 'Array':
+ case 'Date':
+ case 'RegExp':
+ case 'Function':
+ return type.toLowerCase();
+ }
+ if (typeof obj === "object") {
+ return "object";
+ }
+ return undefined;
+ },
+
+ push: function(result, actual, expected, message) {
+ if (!config.current) {
+ throw new Error("assertion outside test context, was " + sourceFromStacktrace());
+ }
+ var details = {
+ result: result,
+ message: message,
+ actual: actual,
+ expected: expected
+ };
+
+ message = escapeInnerText(message) || (result ? "okay" : "failed");
+ message = '<span class="test-message">' + message + "</span>";
+ var output = message;
+ if (!result) {
+ expected = escapeInnerText(QUnit.jsDump.parse(expected));
+ actual = escapeInnerText(QUnit.jsDump.parse(actual));
+ output += '<table><tr class="test-expected"><th>Expected: </th><td><pre>' + expected + '</pre></td></tr>';
+ if (actual != expected) {
+ output += '<tr class="test-actual"><th>Result: </th><td><pre>' + actual + '</pre></td></tr>';
+ output += '<tr class="test-diff"><th>Diff: </th><td><pre>' + QUnit.diff(expected, actual) +'</pre></td></tr>';
+ }
+ var source = sourceFromStacktrace();
+ if (source) {
+ details.source = source;
+ output += '<tr class="test-source"><th>Source: </th><td><pre>' + escapeInnerText(source) + '</pre></td></tr>';
+ }
+ output += "</table>";
+ }
+
+ runLoggingCallbacks( 'log', QUnit, details );
+
+ config.current.assertions.push({
+ result: !!result,
+ message: output
+ });
+ },
+
+ pushFailure: function(message, source) {
+ var details = {
+ result: false,
+ message: message
+ };
+ var output = escapeInnerText(message);
+ if (source) {
+ details.source = source;
+ output += '<table><tr class="test-source"><th>Source: </th><td><pre>' + escapeInnerText(source) + '</pre></td></tr></table>';
+ }
+ runLoggingCallbacks( 'log', QUnit, details );
+ config.current.assertions.push({
+ result: false,
+ message: output
+ });
+ },
+
+ url: function( params ) {
+ params = extend( extend( {}, QUnit.urlParams ), params );
+ var querystring = "?",
+ key;
+ for ( key in params ) {
+ if ( !hasOwn.call( params, key ) ) {
+ continue;
+ }
+ querystring += encodeURIComponent( key ) + "=" +
+ encodeURIComponent( params[ key ] ) + "&";