<commit_before>/*!
 * thymus.js Gruntfile
 * http://thymusjs.org
 * Copyright 2013-present Akira LLC
 * Licensed under MIT (https://github.com/ugate/thymus/blob/master/LICENSE)
 */
var exec = require('child_process').exec;
var browsers = require('./grunt/browsers');
var fabricator = require('./grunt/fabricator');
fabricator.basePath = '.';

module.exports = function(grunt) {
	'use strict';

	// Force use of Unix newlines
	grunt.util.linefeed = '\n';
	RegExp.quote = function(string) {
		return string.replace(/[-\\^$*+?.()|[\]{}]/g, '\\$&');
	};

	var pkg = grunt.file.readJSON('package.json');
	grunt
			.initConfig({
				pkg : pkg,
				banner : '/*!\n'
						+ ' * <%= pkg.name %>.js v<%= pkg.version %> (<%= pkg.homepage %>)\n'
						+ ' * Copyright 2013-<%= grunt.template.today("yyyy") %> <%= pkg.author %>\n'
						+ ' * Licensed under <%= _.pluck(pkg.licenses, "type") %> (<%= _.pluck(pkg.licenses, "url") %>)\n'
						+ ' */\n',
				jqueryCheck : 'if (typeof jQuery === \'undefined\') { throw new Error(\'<%= pkg.name %>.js requires jQuery\') }\n\n',
				sourceFiles : 'js/*.js',

				// Task configuration.
				clean : {
					dist : [ fabricator.distPath ]
				},

				uglify : {
					options : {
						report : 'min'
					},
					js : {
						options : {
							banner : '<%= banner %>'
						},
						src : fabricator.distScriptPath + pkg.name + '.js',
						dest : fabricator.distScriptPath + pkg.name + '.min.js'
					},
					docs : {
						options : {
							preserveComments : 'some'
						},
						src : [ fabricator.devDocsScriptPath + 'app.js',
								fabricator.devDocsScriptPath + 'loader.js' ],
						dest : fabricator.distDocsScriptPath + 'docs.min.js'
					}
				},

				copy : {
					dist : {
						expand : true,
						src : [ '**/**/*.{htm,html,css,js,md,png,ico}',
								'!**/{node_modules,lib,Gruntfile,grunt}/**' ],
						dest : fabricator.distPath,
						options : {
							mode : true,
							process : function(contents, path) {
								// use distribution packaged script
								if (typeof contents === 'string') {
									return fabricator.replaceSrciptTagSrcById(
											pkg.name, contents, function(from,
													to) {
												grunt.log.writeln('\nUpdated\n'
														+ from + '\nto:\n' + to
														+ '\nfor: ' + path);
											});
								}
								return contents;
							}
						}
					}
				},

				qunit : {
					// options : {
					// inject : 'js/test/unit/phantom.js'
					// },
					// files : 'js/test/*.html'
					all : {
						options : {
							urls : [ 'http://<%= connect.server.options.hostname %>:<%= connect.server.options.port %>/'
									+ fabricator.testScriptPath
									+ fabricator.testMainFile ]
						}
					}
				},

				connect : {
					server : {
						options : {
							port : 3000,
							base : '.',
							hostname : pkg.name + '-test-host'
						}
					}
				},

				watch : {
					src : {
						files : fabricator.jsFiles,
						tasks : [ 'qunit' ]
					},
					test : {
						files : fabricator.jsFiles,
						tasks : [ 'qunit' ]
					}
				},

				sed : {
					versionNumber : {
						pattern : (function() {
							var old = grunt.option('oldver');
							return old ? RegExp.quote(old) : old;
						})(),
						replacement : grunt.option('newver'),
						recursive : true
					}
				},

				'saucelabs-qunit' : {
					all : {
						options : {
							build : process.env.TRAVIS_JOB_ID,
							testname : process.env.TRAVIS_BUILD_NUMBER,
							concurrency : 10,
							urls : [ 'http://<%= connect.server.options.hostname %>:<%= connect.server.options.port %>/'
									+ fabricator.testScriptPath
									+ fabricator.testMainFile ],
							tags : [ process.env.TRAVIS_BRANCH,
									process.env.TRAVIS_REPO_SLUG,
									process.env.TRAVIS_BUILD_DIR ],
							browsers : browsers
						}
					}
				}
			});

	// Load tasks from package
	for ( var key in grunt.file.readJSON('package.json').devDependencies) {
		if (key !== 'grunt' && key.indexOf('grunt') === 0) {
			grunt.loadNpmTasks(key);
		}
	}

	// suppress "key" options in verbose mode
	var writeflags = grunt.log.writeflags;
	grunt.log.writeflags = function(obj, prefix) {
		if (typeof obj === 'object' && obj && obj.key) {
			var obj2 = JSON.parse(JSON.stringify(obj));
			obj2.key = '[SECURE]';
			return writeflags(obj2, prefix);
		}
		return writeflags(obj, prefix);
	};

	// Custom tasks
	grunt.registerTask('includes', 'Process JS inclusions',
			function() {
				grunt.log.writeln('Processing script includes');
				var incCnt = 0;
				var script = fabricator.processScriptIncludes(null, null,
						function(parentPath, incPath) {
							incCnt++;
							return grunt.file.read(incPath);
						});
				var js = fabricator.distScriptPath + pkg.name + '.js';
				grunt.file.write(js, script);
				grunt.log.writeln('Generated ' + js + ' from ' + incCnt
						+ ' inclusions');
			});
	grunt.registerTask('release', 'Check for and tag release', function() {
		require('./grunt/tasks/release').call(this, fabricator.distPath);
	});

	// Test tasks
	// TODO : move includes/copy
	var buildTasks = [ /* 'clean', */'includes', 'copy:dist', 'connect',
			'qunit' ];
	// Only run Sauce Labs tests if there's a Sauce access key
	if (typeof process.env.SAUCE_ACCESS_KEY !== 'undefined' &&
	// Skip Sauce if running a different subset of the test suite
	(!process.env.THX_TEST || process.env.THX_TEST === 'sauce-js-unit')) {
		// testSubtasks.push('saucelabs-qunit');
	}
	buildTasks.push('uglify:js');
	buildTasks.push('uglify:docs');
	buildTasks.push('release');
	grunt.registerTask('test', buildTasks);

	// Distribution tasks
	var distSubtasks = [ 'uglify:js', 'uglyfy:docs', 'release' ];
	grunt.registerTask('dist', distSubtasks);

	// Default tasks
	grunt.registerTask('default', [ 'test', 'dist' ]);

	// Version numbering task.
	// grunt change-version-number --oldver=A.B.C --newver=X.Y.Z
	// This can be overzealous, so its changes should always be manually
	// reviewed!
	// grunt.registerTask('change-version-number', 'sed');
};<commit_msg>Release v1.0.0-beta.4<commit_after>/*!
 * thymus.js Gruntfile
 * http://thymusjs.org
 * Copyright 2013-present Akira LLC
 * Licensed under MIT (https://github.com/ugate/thymus/blob/master/LICENSE)
 */
var exec = require('child_process').exec;
var browsers = require('./grunt/browsers');
var fabricator = require('./grunt/fabricator');
fabricator.basePath = '.';

module.exports = function(grunt) {
	'use strict';

	// Force use of Unix newlines
	grunt.util.linefeed = '\n';
	RegExp.quote = function(string) {
		return string.replace(/[-\\^$*+?.()|[\]{}]/g, '\\$&');
	};

	var pkg = grunt.file.readJSON('package.json');
	grunt
			.initConfig({
				pkg : pkg,
				banner : '/*!\n'
						+ ' * <%= pkg.name %>.js v<%= pkg.version %> (<%= pkg.homepage %>)\n'
						+ ' * Copyright 2013-<%= grunt.template.today("yyyy") %> <%= pkg.author %>\n'
						+ ' * Licensed under <%= _.pluck(pkg.licenses, "type") %> (<%= _.pluck(pkg.licenses, "url") %>)\n'
						+ ' */\n',
				jqueryCheck : 'if (typeof jQuery === \'undefined\') { throw new Error(\'<%= pkg.name %>.js requires jQuery\') }\n\n',
				sourceFiles : 'js/*.js',

				// Task configuration.
				clean : {
					dist : [ fabricator.distPath ]
				},

				uglify : {
					options : {
						report : 'min'
					},
					js : {
						options : {
							banner : '<%= banner %>'
						},
						src : fabricator.distScriptPath + pkg.name + '.js',
						dest : fabricator.distScriptPath + pkg.name + '.min.js'
					},
					docs : {
						options : {
							preserveComments : 'some'
						},
						src : [ fabricator.devDocsScriptPath + 'app.js',
								fabricator.devDocsScriptPath + 'loader.js' ],
						dest : fabricator.distDocsScriptPath + 'docs.min.js'
					}
				},

				copy : {
					dist : {
						expand : true,
						src : [ '**/**/*.{htm,html,css,js,md,png,ico}',
								'!**/{node_modules,lib,Gruntfile,grunt}/**' ],
						dest : fabricator.distPath,
						options : {
							mode : true,
							process : function(contents, path) {
								// use distribution packaged script
								if (typeof contents === 'string') {
									return fabricator.replaceSrciptTagSrcById(
											pkg.name, contents, function(from,
													to) {
												grunt.log.writeln('\nUpdated\n'
														+ from + '\nto:\n' + to
														+ '\nfor: ' + path);
											});
								}
								return contents;
							}
						}
					}
				},

				qunit : {
					// options : {
					// inject : 'js/test/unit/phantom.js'
					// },
					// files : 'js/test/*.html'
					all : {
						options : {
							urls : [ 'http://<%= connect.server.options.hostname %>:<%= connect.server.options.port %>/'
									+ fabricator.testScriptPath
									+ fabricator.testMainFile ]
						}
					}
				},

				connect : {
					server : {
						options : {
							port : 3000,
							base : '.',
							hostname : pkg.name + '-test-host'
						}
					}
				},

				watch : {
					src : {
						files : fabricator.jsFiles,
						tasks : [ 'qunit' ]
					},
					test : {
						files : fabricator.jsFiles,
						tasks : [ 'qunit' ]
					}
				},

				sed : {
					versionNumber : {
						pattern : (function() {
							var old = grunt.option('oldver');
							return old ? RegExp.quote(old) : old;
						})(),
						replacement : grunt.option('newver'),
						recursive : true
					}
				},

				'saucelabs-qunit' : {
					all : {
						options : {
							build : process.env.TRAVIS_JOB_ID,
							testname : process.env.TRAVIS_BUILD_NUMBER,
							concurrency : 10,
							urls : [ 'http://<%= connect.server.options.hostname %>:<%= connect.server.options.port %>/'
									+ fabricator.testScriptPath
									+ fabricator.testMainFile ],
							tags : [ process.env.TRAVIS_BRANCH,
									process.env.TRAVIS_REPO_SLUG,
									process.env.TRAVIS_BUILD_DIR ],
							browsers : browsers
						}
					}
				}
			});

	// Load tasks from package
	for ( var key in grunt.file.readJSON('package.json').devDependencies) {
		if (key !== 'grunt' && key.indexOf('grunt') === 0) {
			grunt.loadNpmTasks(key);
		}
	}

	// suppress "key" options in verbose mode
	var writeflags = grunt.log.writeflags;
	grunt.log.writeflags = function(obj, prefix) {
		if (typeof obj === 'object' && obj && obj.key) {
			var obj2 = JSON.parse(JSON.stringify(obj));
			obj2.key = '[SECURE]';
			return writeflags(obj2, prefix);
		}
		return writeflags(obj, prefix);
	};

	// Custom tasks
	grunt.registerTask('includes', 'Process JS inclusions',
			function() {
				grunt.log.writeln('Processing script includes');
				var incCnt = 0;
				var script = fabricator.processScriptIncludes(null, null,
						function(parentPath, incPath) {
							incCnt++;
							return grunt.file.read(incPath);
						});
				var js = fabricator.distScriptPath + pkg.name + '.js';
				grunt.file.write(js, script);
				grunt.log.writeln('Generated ' + js + ' from ' + incCnt
						+ ' inclusions');
			});
	grunt.registerTask('release', 'Check for and tag release', function() {
		require('./grunt/tasks/release').call(grunt, fabricator.distPath);
	});

	// Test tasks
	// TODO : move includes/copy
	var buildTasks = [ /* 'clean', */'includes', 'copy:dist', 'connect',
			'qunit' ];
	// Only run Sauce Labs tests if there's a Sauce access key
	if (typeof process.env.SAUCE_ACCESS_KEY !== 'undefined' &&
	// Skip Sauce if running a different subset of the test suite
	(!process.env.THX_TEST || process.env.THX_TEST === 'sauce-js-unit')) {
		// testSubtasks.push('saucelabs-qunit');
	}
	buildTasks.push('uglify:js');
	buildTasks.push('uglify:docs');
	buildTasks.push('release');
	grunt.registerTask('test', buildTasks);

	// Distribution tasks
	var distSubtasks = [ 'uglify:js', 'uglyfy:docs', 'release' ];
	grunt.registerTask('dist', distSubtasks);

	// Default tasks
	grunt.registerTask('default', [ 'test', 'dist' ]);

	// Version numbering task.
	// grunt change-version-number --oldver=A.B.C --newver=X.Y.Z
	// This can be overzealous, so its changes should always be manually
	// reviewed!
	// grunt.registerTask('change-version-number', 'sed');
};<|endoftext|>


<commit_before>var request = require('request');

var safari_browsers = [
		{
			browserName: 'safari',
			platform: 'OS X 10.10',
			version: '8.0'
		},
		{
			browserName: 'safari',
			platform: 'OS X 10.9',
			version: '7.0'
		}
	],
	chrome_browsers = [
		{
			browserName: 'chrome',
			platform: 'OS X 10.10',
			version: '42.0'
		},
		{
			browserName: 'chrome',
			platform: 'OS X 10.10',
			version: '41.0'
		},
		{
			browserName: 'chrome',
			platform: 'OS X 10.10',
			version: '40.0'
		}/*,
		{
			browserName: 'chrome',
			platform: 'OS X 10.10',
			version: '39.0'
		},
		{
			browserName: 'chrome',
			platform: 'OS X 10.10',
			version: '38.0'
		},
		{
			browserName: 'chrome',
			platform: 'OS X 10.10',
			version: '37.0'
		}*/
	],

	firefox_browsers = [
		{
			browserName: 'firefox',
			platform: 'OS X 10.10',
			version: '37'
		},
		{
			browserName: 'firefox',
			platform: 'OS X 10.10',
			version: '36'
		},
		{
			browserName: 'firefox',
			platform: 'OS X 10.10',
			version: '35'
		}/*,
		{
			browserName: 'firefox',
			platform: 'OS X 10.10',
			version: '34'
		},
		{
			browserName: 'firefox',
			platform: 'OS X 10.10',
			version: '33'
		},
		{
			browserName: 'firefox',
			platform: 'OS X 10.10',
			version: '32'
		}*/
	],

	ios_browsers = [
		{
			appiumVersion: '1.4.7',
			browserName: 'Safari',
			deviceName: 'iPhone Simulator',
			platformName: 'iOS',
			platformVersion: '8.2'
		},
		{
			appiumVersion: '1.4.7',
			browserName: 'Safari',
			deviceName: 'iPhone Simulator',
			platformName: 'iOS',
			platformVersion: '8.1'
		},
		{
			appiumVersion: '1.4.7',
			browserName: 'Safari',
			deviceName: 'iPhone Simulator',
			platformName: 'iOS',
			platformVersion: '8.0'
		},
		{
			appiumVersion: '1.4.7',
			browserName: 'Safari',
			deviceName: 'iPhone Simulator',
			platformName: 'iOS',
			platformVersion: '7.1'
		},
		{
			appiumVersion: '1.4.7',
			browserName: 'Safari',
			deviceName: 'iPhone Simulator',
			platformName: 'iOS',
			platformVersion: '7.0'
		}/*,
		{
			browserName: 'iphone',
			platform: 'OS X 10.10',
			version: '6.1'
		},
		{
			browserName: 'iphone',
			platform: 'OS X 10.10',
			version: '6.0'
		},
		{
			browserName: 'iphone',
			platform: 'OS X 10.10',
			version: '5.1'
		}*/
	],

	android_browsers = [
		{
			browserName: 'android',
			platform: 'Linux',
			version: '5.1'
		},
		{
			browserName: 'android',
			platform: 'Linux',
			version: '5.0'
		},
		{
			browserName: 'android',
			platform: 'Linux',
			version: '4.4'
		},
		{
			browserName: 'android',
			platform: 'Linux',
			version: '4.3'
		},
		{
			browserName: 'android',
			platform: 'Linux',
			version: '4.2'
		},
		{
			browserName: 'android',
			platform: 'Linux',
			version: '4.1'
		},
		{
			browserName: 'android',
			platform: 'Linux',
			version: '4.0'
		}
	],

	ie_browsers = [
		{
			browserName: 'internet explorer',
			platform: 'Windows 7',
			version: '11.0'
		},
		{
			browserName: 'internet explorer',
			platform: 'Windows 7',
			version: '10.0'
		},
		{
			browserName: 'internet explorer',
			platform: 'Windows 7',
			version: '9.0'
		}
	];

module.exports = function(grunt) {
	grunt.initConfig({
		'saucelabs-mocha': {
			all: {
				options: {
					username: 'branchmetrics',
					// I have Cordova tests on saucelabs disabled for now. There are a few issues with dependencies I need to work out
					urls: ['http://127.0.0.1:9999/test/test.html', 'http://127.0.0.1:9999/test/integration-test.html'/*, 'http://127.0.0.1:9999/test/cordova-integration-test.html'*/],
					tunnelTimeout: 5,
					throttled: 10,
					maxRetries: 3,
					build: grunt.file.readJSON('package.json')["build"],
					pollInterval: 2000,         // (ms) Note: pollInterval * statusCheckAttempts should = 'max-duration'
					statusCheckAttempts: 360,   // So if you change one of these, adjust 'max-duration' accordingly
					'max-duration': 720,        // (s)
					testname: 'Web SDK Tests',
					browsers: safari_browsers.concat(chrome_browsers,
						firefox_browsers,
						ios_browsers,
						android_browsers,
						ie_browsers)
				}
			}
		},
		connect: {
			server: {
				options: {
					port: 9999,
					base: ''
				}
			}
		}
	});

	// Loading dependencies
	for (var key in grunt.file.readJSON("package.json").devDependencies) {
		if (key !== "grunt" && key.indexOf("grunt") === 0) grunt.loadNpmTasks(key);
	}

	grunt.loadNpmTasks('grunt-saucelabs');
	grunt.loadNpmTasks('grunt-contrib-connect');
	grunt.loadNpmTasks('grunt-browserstack-tunnel');
	grunt.registerTask('test', ['connect', 'saucelabs-mocha']);
};
<commit_msg>switch back to Selenium<commit_after>var request = require('request');

var safari_browsers = [
		{
			browserName: 'safari',
			platform: 'OS X 10.10',
			version: '8.0'
		},
		{
			browserName: 'safari',
			platform: 'OS X 10.9',
			version: '7.0'
		}
	],
	chrome_browsers = [
		{
			browserName: 'chrome',
			platform: 'OS X 10.10',
			version: '42.0'
		},
		{
			browserName: 'chrome',
			platform: 'OS X 10.10',
			version: '41.0'
		},
		{
			browserName: 'chrome',
			platform: 'OS X 10.10',
			version: '40.0'
		}/*,
		{
			browserName: 'chrome',
			platform: 'OS X 10.10',
			version: '39.0'
		},
		{
			browserName: 'chrome',
			platform: 'OS X 10.10',
			version: '38.0'
		},
		{
			browserName: 'chrome',
			platform: 'OS X 10.10',
			version: '37.0'
		}*/
	],

	firefox_browsers = [
		{
			browserName: 'firefox',
			platform: 'OS X 10.10',
			version: '37'
		},
		{
			browserName: 'firefox',
			platform: 'OS X 10.10',
			version: '36'
		},
		{
			browserName: 'firefox',
			platform: 'OS X 10.10',
			version: '35'
		}/*,
		{
			browserName: 'firefox',
			platform: 'OS X 10.10',
			version: '34'
		},
		{
			browserName: 'firefox',
			platform: 'OS X 10.10',
			version: '33'
		},
		{
			browserName: 'firefox',
			platform: 'OS X 10.10',
			version: '32'
		}*/
	],

	ios_browsers = [
		{
			browserName: 'iphone',
			deviceName: 'iPhone Simulator',
			platform: 'OS X 10.10',
			platformVersion: '8.2'
		},
		{
			browserName: 'iphone',
			deviceName: 'iPhone Simulator',
			platform: 'OS X 10.10',
			platformVersion: '8.1'
		},
		{
			browserName: 'iphone',
			deviceName: 'iPhone Simulator',
			platform: 'OS X 10.10',
			platformVersion: '8.0'
		},
		{
			browserName: 'iphone',
			deviceName: 'iPhone Simulator',
			platform: 'OS X 10.10',
			platformVersion: '7.1'
		},
		{
			browserName: 'iphone',
			deviceName: 'iPhone Simulator',
			platform: 'OS X 10.10',
			platformVersion: '7.0'
		}/*,
		{
			browserName: 'iphone',
			platform: 'OS X 10.10',
			version: '6.1'
		},
		{
			browserName: 'iphone',
			platform: 'OS X 10.10',
			version: '6.0'
		},
		{
			browserName: 'iphone',
			platform: 'OS X 10.10',
			version: '5.1'
		}*/
	],

	android_browsers = [
		{
			browserName: 'android',
			platform: 'Linux',
			version: '5.1'
		},
		{
			browserName: 'android',
			platform: 'Linux',
			version: '5.0'
		},
		{
			browserName: 'android',
			platform: 'Linux',
			version: '4.4'
		},
		{
			browserName: 'android',
			platform: 'Linux',
			version: '4.3'
		},
		{
			browserName: 'android',
			platform: 'Linux',
			version: '4.2'
		},
		{
			browserName: 'android',
			platform: 'Linux',
			version: '4.1'
		},
		{
			browserName: 'android',
			platform: 'Linux',
			version: '4.0'
		}
	],

	ie_browsers = [
		{
			browserName: 'internet explorer',
			platform: 'Windows 7',
			version: '11.0'
		},
		{
			browserName: 'internet explorer',
			platform: 'Windows 7',
			version: '10.0'
		},
		{
			browserName: 'internet explorer',
			platform: 'Windows 7',
			version: '9.0'
		}
	];

module.exports = function(grunt) {
	grunt.initConfig({
		'saucelabs-mocha': {
			all: {
				options: {
					username: 'branchmetrics',
					// I have Cordova tests on saucelabs disabled for now. There are a few issues with dependencies I need to work out
					urls: ['http://127.0.0.1:9999/test/test.html', 'http://127.0.0.1:9999/test/integration-test.html'/*, 'http://127.0.0.1:9999/test/cordova-integration-test.html'*/],
					tunnelTimeout: 5,
					throttled: 10,
					maxRetries: 3,
					build: grunt.file.readJSON('package.json')["build"],
					pollInterval: 2000,         // (ms) Note: pollInterval * statusCheckAttempts should = 'max-duration'
					statusCheckAttempts: 360,   // So if you change one of these, adjust 'max-duration' accordingly
					'max-duration': 720,        // (s)
					testname: 'Web SDK Tests',
					browsers: safari_browsers.concat(chrome_browsers,
						firefox_browsers,
						ios_browsers,
						android_browsers,
						ie_browsers)
				}
			}
		},
		connect: {
			server: {
				options: {
					port: 9999,
					base: ''
				}
			}
		}
	});

	// Loading dependencies
	for (var key in grunt.file.readJSON("package.json").devDependencies) {
		if (key !== "grunt" && key.indexOf("grunt") === 0) grunt.loadNpmTasks(key);
	}

	grunt.loadNpmTasks('grunt-saucelabs');
	grunt.loadNpmTasks('grunt-contrib-connect');
	grunt.loadNpmTasks('grunt-browserstack-tunnel');
	grunt.registerTask('test', ['connect', 'saucelabs-mocha']);
};
<|endoftext|>


<commit_before>module.exports = function(grunt) {
  grunt.initConfig({
    pkg: grunt.file.readJSON('package.json'),
    uglify: {
      options: {
        banner: '/*! <%= pkg.name %> <%= grunt.template.today("yyyy-mm-dd") %> Copyright (c) 2014 <%= pkg.author %> under a BSD3 License. \n\nThis package contains Geocoder-JS, Copyright (c) 2013 Brandon Morrison under an MIT License:\n\nThe MIT License (MIT)\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the "Software"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE.\n*/'
      },
      dist: {
        files: {
          // just minified
          'dist/js/<%= pkg.name %>.min.js': [ 'src/js/<%= pkg.name %>.js' ],
          // minified w/ geocoder
          'dist/js/<%= pkg.name %>-pack.min.js': [
            'bower_components/geocoder-js/dist/geocoder.js',
            'src/js/<%= pkg.name %>.js'
          ]
        }
      }
    },
    sass: {
      dist: {
        options: {
          style: 'compressed'
        },
        files: {
          'dist/css/jquery.findyourrep.min.css': 'src/css/jquery.findyourrep.css.scss'
        }
      },
      editable: {
        options: {
          style: 'expanded'
        },
        files: {
          'dist/css/jquery.findyourrep.css': 'src/css/jquery.findyourrep.css.scss'
        }
      }
    },
    connect: {
      server: {
        options: {
          open: "http://localhost:8000/example",
          keepalive: true
        }
      }
    },
    watch: {
      css: {
        files: 'src/css/*.scss',
        tasks: ['sass']
      },
      scripts: {
        files: 'src/js/*.js',
        tasks: ['uglify']
      }
    }
  });

  grunt.loadNpmTasks('grunt-contrib-uglify');
  grunt.loadNpmTasks('grunt-contrib-connect');
  grunt.loadNpmTasks('grunt-contrib-sass');
  grunt.loadNpmTasks('grunt-contrib-watch');
  grunt.registerTask('default', ['uglify', 'sass']);
  grunt.registerTask('watch', ['watch']);
  grunt.registerTask('demo', ['uglify', 'sass', 'connect']);
};<commit_msg>Fix banner build so I don't have to delete geocoder license every time<commit_after>module.exports = function(grunt) {
  grunt.initConfig({
    pkg: grunt.file.readJSON('package.json'),
    uglify: {
      standalone: {
        options: {
          banner: '/*! <%= pkg.name %> <%= grunt.template.today("yyyy-mm-dd") %> Copyright (c) 2014 <%= pkg.author %>, released under a BSD3 License.*/\n'
        },
        files: {
          'dist/js/<%= pkg.name %>.min.js': [ 'src/js/<%= pkg.name %>.js' ]
        }
      },
      packaged: {
        options: {
          banner: '/*! <%= pkg.name %> <%= grunt.template.today("yyyy-mm-dd") %> Copyright (c) 2014 <%= pkg.author %> under a BSD3 License. \n\nThis package contains Geocoder-JS, Copyright (c) 2013 Brandon Morrison under an MIT License:\n\nThe MIT License (MIT)\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the "Software"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE.\n*/\n'
        },
        files: {
          'dist/js/<%= pkg.name %>-pack.min.js': [
            'bower_components/geocoder-js/dist/geocoder.js',
            'src/js/<%= pkg.name %>.js'
          ]
        }
      }
    },
    sass: {
      dist: {
        options: {
          style: 'compressed'
        },
        files: {
          'dist/css/jquery.findyourrep.min.css': 'src/css/jquery.findyourrep.css.scss'
        }
      },
      editable: {
        options: {
          style: 'expanded'
        },
        files: {
          'dist/css/jquery.findyourrep.css': 'src/css/jquery.findyourrep.css.scss'
        }
      }
    },
    connect: {
      server: {
        options: {
          open: "http://localhost/example",
          port: 80,
          keepalive: true
        }
      }
    },
    watch: {
      css: {
        files: 'src/css/*.scss',
        tasks: ['sass']
      },
      scripts: {
        files: 'src/js/*.js',
        tasks: ['uglify']
      }
    }
  });

  grunt.loadNpmTasks('grunt-contrib-uglify');
  grunt.loadNpmTasks('grunt-contrib-connect');
  grunt.loadNpmTasks('grunt-contrib-sass');
  grunt.loadNpmTasks('grunt-contrib-watch');
  grunt.registerTask('default', ['uglify', 'sass']);
  grunt.registerTask('watch', ['watch']);
  grunt.registerTask('demo', ['uglify', 'sass', 'connect']);
};<|endoftext|>


<commit_before>module.exports = function(grunt)
{

    'use strict';

    var exec = require('child_process').exec;
    var fs = require('fs');
    var manifest = eval('(' + fs.readFileSync('app.nw/package.json', {encoding: 'utf8'}) + ')');

    /**
     * Runs the app
     * Use the "--dev" option to enable toolbars and debug
     */
    grunt.registerTask('run', function()
    {
        setDevMode(grunt.option('dev') === true);
        var done = this.async();
        var child = exec('node_modules/nw/nwjs/nwjs.app/Contents/MacOS/nwjs app.nw');
        child.stdout.on('data', grunt.log.write);
        child.stderr.on('data', grunt.log.write);
        child.on('close', done);
    });

    /**
     * Builds the app
     */
    grunt.registerTask('build', function()
    {
        var app_name = manifest.name + '.app';
        var done = this.async();
        grunt.log.writeln('Cleaning...');
        exec('rm -r .mas; mkdir .mas', function(error, stdout, stderr)
        {
            grunt.log.writeln('Creating empty application...');
            exec('cp -r node_modules/nw/nwjs/nwjs.app .mas/' + app_name, function(error, stdout, stderr)
            {
                grunt.log.writeln('Installing icon...');
                exec('cp assets/icns/icon.icns .mas/' + app_name + '/Contents/Resources/nw.icns', function(error, stdout, stderr)
                {
                    grunt.log.writeln('Installing plist...');
                    var plist = fillTemplate(fs.readFileSync('assets/plist/info.plist', {encoding: 'utf8'}), manifest);
                    fs.writeFile('.mas/' + app_name + '/Contents/Info.plist', plist, function(error)
                    {
                        grunt.log.writeln('Installing app files...');
                        exec('cp -r app.nw .mas/' + app_name + '/Contents/Resources', function(error, stdout, stderr)
                        {
                            done();
                        });
                    });
                });
            });
        });
    });

    /**
     * Signs the app
     */
    grunt.registerTask('sign', function()
    {
        var app_name = manifest.name + '.app';
        var done = this.async();
        var identity = 'LK7U6U8DZ4' // @todo move this elsewhere
        var bundle_id = manifest.bundle_identifier;
        var command = getSignCommand(identity, bundle_id, 'assets/entitlements/child.plist', '.mas/' + app_name + '/Contents/Frameworks/nwjs Helper.app');
        exec(command, function(error, stdout, stderr)
        {
            grunt.log.writeln(stdout);
            grunt.log.writeln(stderr);
            var command = getSignCommand(identity, bundle_id, 'assets/entitlements/child.plist', '.mas/' + app_name + '/Contents/Frameworks/nwjs Helper EH.app');
            exec(command, function(error, stdout, stderr)
            {
                grunt.log.writeln(stdout);
                grunt.log.writeln(stderr);
                var command = getSignCommand(identity, bundle_id, 'assets/entitlements/child.plist', '.mas/' + app_name + '/Contents/Frameworks/nwjs Helper NP.app');
                exec(command, function(error, stdout, stderr)
                {
                    grunt.log.writeln(stdout);
                    grunt.log.writeln(stderr);
                    var command = getSignCommand(identity, bundle_id, 'assets/entitlements/parent.plist', '.mas/' + app_name + '');
                    exec(command, function(error, stdout, stderr)
                    {
                        grunt.log.writeln(stdout);
                        grunt.log.writeln(stderr);
                        done();
                    });
                });
            });
        });
    });

    /**
     * Gets a codesign command
     * @param identity
     * @param bundle_id
     * @param entitlement_path
     * @param app_path
     */
    function getSignCommand(identity, bundle_id, entitlement_path, app_path)
    {
        return 'codesign --deep -s ' + identity + ' -i ' + bundle_id + ' --entitlements ' + entitlement_path + ' "' + app_path + '"';
    }

    /**
     * Fills a template file with an object
     */
    function fillTemplate(template, object)
    {
        for (var property in object)
        {
            var regex = new RegExp('{{' + property + '}}', 'g');
            template = template.replace(regex, object[property]);
        }
        return template;
    }

    /**
     * Toggles dev mode
     * @param enable
     */
    function setDevMode(enable)
    {
        grunt.file.write('./app/.dev', enable ? '1' : '0', {encoding: 'utf8'});
    }

};<commit_msg>Fixes dev mode in Gruntfile<commit_after>module.exports = function(grunt)
{

    'use strict';

    var exec = require('child_process').exec;
    var fs = require('fs');
    var manifest = eval('(' + fs.readFileSync('app.nw/package.json', {encoding: 'utf8'}) + ')');

    /**
     * Runs the app
     * Use the "--dev" option to enable toolbars and debug
     */
    grunt.registerTask('run', function()
    {
        setDevMode(grunt.option('dev') === true);
        var done = this.async();
        var child = exec('node_modules/nw/nwjs/nwjs.app/Contents/MacOS/nwjs app.nw');
        child.stdout.on('data', grunt.log.write);
        child.stderr.on('data', grunt.log.write);
        child.on('close', done);
    });

    /**
     * Builds the app
     */
    grunt.registerTask('build', function()
    {
        var app_name = manifest.name + '.app';
        var done = this.async();
        grunt.log.writeln('Cleaning...');
        setDevMode(false);
        exec('rm -r .mas; mkdir .mas', function(error, stdout, stderr)
        {
            grunt.log.writeln('Creating empty application...');
            exec('cp -r node_modules/nw/nwjs/nwjs.app .mas/' + app_name, function(error, stdout, stderr)
            {
                grunt.log.writeln('Installing icon...');
                exec('cp assets/icns/icon.icns .mas/' + app_name + '/Contents/Resources/nw.icns', function(error, stdout, stderr)
                {
                    grunt.log.writeln('Installing plist...');
                    var plist = fillTemplate(fs.readFileSync('assets/plist/info.plist', {encoding: 'utf8'}), manifest);
                    fs.writeFile('.mas/' + app_name + '/Contents/Info.plist', plist, function(error)
                    {
                        grunt.log.writeln('Installing app files...');
                        exec('cp -r app.nw .mas/' + app_name + '/Contents/Resources', function(error, stdout, stderr)
                        {
                            done();
                        });
                    });
                });
            });
        });
    });

    /**
     * Signs the app
     */
    grunt.registerTask('sign', function()
    {
        var app_name = manifest.name + '.app';
        var done = this.async();
        var identity = 'LK7U6U8DZ4' // @todo move this elsewhere
        var bundle_id = manifest.bundle_identifier;
        var command = getSignCommand(identity, bundle_id, 'assets/entitlements/child.plist', '.mas/' + app_name + '/Contents/Frameworks/nwjs Helper.app');
        exec(command, function(error, stdout, stderr)
        {
            grunt.log.writeln(stdout);
            grunt.log.writeln(stderr);
            var command = getSignCommand(identity, bundle_id, 'assets/entitlements/child.plist', '.mas/' + app_name + '/Contents/Frameworks/nwjs Helper EH.app');
            exec(command, function(error, stdout, stderr)
            {
                grunt.log.writeln(stdout);
                grunt.log.writeln(stderr);
                var command = getSignCommand(identity, bundle_id, 'assets/entitlements/child.plist', '.mas/' + app_name + '/Contents/Frameworks/nwjs Helper NP.app');
                exec(command, function(error, stdout, stderr)
                {
                    grunt.log.writeln(stdout);
                    grunt.log.writeln(stderr);
                    var command = getSignCommand(identity, bundle_id, 'assets/entitlements/parent.plist', '.mas/' + app_name + '');
                    exec(command, function(error, stdout, stderr)
                    {
                        grunt.log.writeln(stdout);
                        grunt.log.writeln(stderr);
                        done();
                    });
                });
            });
        });
    });

    /**
     * Gets a codesign command
     * @param identity
     * @param bundle_id
     * @param entitlement_path
     * @param app_path
     */
    function getSignCommand(identity, bundle_id, entitlement_path, app_path)
    {
        return 'codesign --deep -s ' + identity + ' -i ' + bundle_id + ' --entitlements ' + entitlement_path + ' "' + app_path + '"';
    }

    /**
     * Fills a template file with an object
     */
    function fillTemplate(template, object)
    {
        for (var property in object)
        {
            var regex = new RegExp('{{' + property + '}}', 'g');
            template = template.replace(regex, object[property]);
        }
        return template;
    }

    /**
     * Toggles dev mode
     * @param enable
     */
    function setDevMode(enable)
    {
        grunt.file.write('./app.nw/.dev', enable ? '1' : '0', {encoding: 'utf8'});
    }

};<|endoftext|>


<commit_before>/**
 * bxSlider
 *
 * Steven Wanderski
 *
 * Copyright (c) 2014
 * Licensed under the MIT license.
 */
module.exports = function(grunt) {

  var path = require('path');

  if (!grunt.file.isDir('bower_components')) {
    grunt.fail.fatal('>> Please run "bower install" before continuing.');
  }
  require('load-grunt-tasks')(grunt);

  grunt
    .initConfig({
      pkg: grunt.file.readJSON('package.json'),
      app: grunt.file.readJSON('_config.json'),
      vendor: 'bower_components',

      // assemble
      assemble: {
        options: {
          flatten: false,
          expand: true,
          production: false,
          assets: '<%= app.docs.dest %>/assets',
          postprocess: require('pretty'),
          mybaseDir: path.resolve('<%= app.docs.dest %>'),

          // metadata
          pkg: '<%= pkg %>',
          app: '<%= app %>',
          data: ['<%= app.docs.src %>/data/*.{json,yml}'],
          helpers: ['handlebars-helpers'],

          // templates
          partials: '<%= app.docs.templates %>/partials/*.hbs',
          layoutdir: '<%= app.docs.layouts %>/'
        },
        index: {
          options: {
            layout: 'home.hbs'
          },
          files: [{
            expand: true,
            cwd: '<%= app.docs.pages %>/',
            src: '*.hbs',
            dest: '<%= app.docs.dest %>/'
          }]
        },
        demos: {
          options: {
            layout: 'demos.hbs'
          },
          files: [{
            expand: true,
            cwd: '<%= app.docs.pages %>/demos/',
            src: '*.hbs',
            dest: '<%= app.docs.dest %>/demos'
          }]
        },
        docs: {
          options: {
            layout: 'docs.hbs'
          },
          files: [{
            expand: true,
            cwd: '<%= app.docs.pages %>/docs/',
            src: '*.hbs',
            dest: '<%= app.docs.dest %>/docs'
          }]
        }
      },

      // clean
      clean: {
        docs: ['<%= app.docs.dest %>/**/*.*'],
        dist: ['dist/**/*.*']
      },

      // less
      less: {
        docs: {
          options: {
            compress: true,
            paths: ['<%= app.docs.src %>/assets/less/', 'bower_components/bootstrap/less/']
          },
          files: {
            '<%= app.docs.dest %>/assets/css/docs.min.css': '<%= app.docs.src %>/assets/less/docs.less'
          }
        },
        dist: {
          options: {
            compress: false
          },
          files: [{
            expand: true,
            flatten: true,
            cwd: 'src/less/',
            src: '*less',
            dest: 'src/css/',
            ext: '.css',
            extDot: 'last'
          }]
        }
      },

      // concat
      concat: {
        docs: {
          src: [
            'bower_components/bootstrap/js/transition.js',
            'bower_components/bootstrap/js/alert.js',
            'bower_components/bootstrap/js/button.js',
            'bower_components/bootstrap/js/carousel.js',
            'bower_components/bootstrap/js/collapse.js',
            'bower_components/bootstrap/js/dropdown.js',
            'bower_components/bootstrap/js/modal.js',
            'bower_components/bootstrap/js/tooltip.js',
            'bower_components/bootstrap/js/popover.js',
            'bower_components/bootstrap/js/scrollspy.js',
            'bower_components/bootstrap/js/tab.js',
            'bower_components/bootstrap/js/affix.js',
            'bower_components/highlightjs/highlight.pack.js'
          ],
          dest: '<%= app.docs.dest %>/assets/js/vendor.js'
        },
        dist: {
          options: {
            banner: '/**\n' + ' * bxSlider v<%= pkg.version %>\n' +
              ' * Copyright 2013-<%= grunt.template.today("yyyy") %> <%= pkg.author.name %>\n' +
              ' * Written while drinking Belgian ales and listening to jazz\n\n' +
              ' * Licensed under <%= pkg.license.type %> (<%= pkg.license.url %>)\n' + ' */\n\n'
          },
          files: {
            'dist/jquery.<%= pkg.name %>.css': ['src/css/*.css'],
            'dist/jquery.<%= pkg.name %>.js': '<%= app.src.scripts %>'
          }
        }
      },

      cssmin: {
        options: {
          banner: '/**\n' + ' * bxSlider v<%= pkg.version %>\n' +
            ' * Copyright 2013-<%= grunt.template.today("yyyy") %> <%= pkg.author.name %>\n' +
            ' * Written while drinking Belgian ales and listening to jazz\n\n' +
            ' * Licensed under <%= pkg.license.type %> (<%= pkg.license.url %>)\n' + ' */\n\n'
        },
        dist: {
          files: {
            'dist/jquery.<%= pkg.name %>.min.css': ['src/css/*.css']
          }
        }
      },

      // jshint
      jshint: {
        options: {
          jshintrc: 'src/js/.jshintrc'
        },
        dist: {
          src: ['<%= app.src.scripts %>', 'Gruntfile.js']
        }
      },

      //jscs
      jscs: {
        options: {
          config: 'src/js/.jscsrc',
          reporter: 'text.js',
          reporterOutput: 'jscs.report.txt'
        },
        dist: {
          src: ['<%= app.src.scripts %>', 'Gruntfile.js']
        }
      },

      // uglify
      uglify: {
        options: {
          banner: '/**\n' + ' * bxSlider v<%= pkg.version %>\n' +
            ' * Copyright 2013-<%= grunt.template.today("yyyy") %> <%= pkg.author.name %>\n' +
            ' * Written while drinking Belgian ales and listening to jazz\n\n' +
            ' * Licensed under <%= pkg.license.type %> (<%= pkg.license.url %>)\n' + ' */\n\n'
        },
        dist: {
          files: {
            'dist/jquery.<%= pkg.name %>.min.js': '<%= app.src.scripts %>'
          }
        }
      },

      // copy
      copy: {
        distImages: {
          expand: true,
          flatten: true,
          cwd: 'src/',
          src: ['images/*.*'],
          dest: 'dist/images'
        },

        distVendor: {
          expand: true,
          flatten: true,
          cwd: 'src/',
          src: ['vendor/*.*'],
          dest: 'dist/vendor'
        },

        distToDocs: {
          expand: true,
          cwd: 'dist/',
          src: ['**/*.*'],
          dest: '<%= app.docs.dest %>/assets/bxslider'
        },

        srcToDocs: {
          expand: true,
          cwd: 'src/js',
          src: ['**/*.js'],
          dest: '<%= app.docs.dest %>/assets/bxslider/src'
        },

        docsAssets: {
          expand: true,
          cwd: '<%= app.docs.src %>/assets/',
          src: ['css/*.css', 'vendors/*.js', 'vendors/*.map', 'img/*.*', 'js/*.*'],
          dest: '<%= app.docs.dest %>/assets/'
        },

        docsHighlightAssets: {
          expand: true,
          cwd: 'bower_components/highlightjs/',
          src: 'styles/*.css',
          dest: '<%= app.docs.dest %>/assets/css/'
        },

        readme: {
          files: [{
            'dist/LICENSE.md': 'LICENSE.md',
            'dist/README.md': 'README.md'
          }]
        }
      },

      // connect
      connect: {
        options: {
          port: 9000,
          open: true,
          livereload: true,
          hostname: 'localhost'
        },
        docs: {
          options: {
            base: '<%= app.docs.dest %>'
          }
        }
      },

      // watch
      watch: {
        options: {
          livereload: true
        },
        templates: {
          files: ['<%= app.docs.templates %>/**/*.hbs'],
          tasks: ['assemble']
        },
        less: {
          files: ['<%= app.docs.src %>/assets/**/*.less'],
          tasks: ['less:docs']
        },
        lessDist: {
          files: ['src/**/*.less'],
          tasks: ['less:dist', 'concat:dist', 'cssmin:dist', 'copy:distToDocs']
        },
        jsDocs: {
          files: ['<%= app.docs.src %>/assets/**/*.js'],
          tasks: ['copy:docsAssets']
        },
        js: {
          files: ['src/**/*.js'],
          tasks: ['jscs:dist', 'jshint:dist', 'uglify:dist', 'concat:dist', 'copy:distToDocs', 'copy:srcToDocs']
        },
        helpers: {
          files: ['<%= app.src %>/helpers/*.js'],
          tasks: ['assemble']
        }
      },

      // compress zip
      compress: {
        zip: {
          options: {
            archive: 'download/<%= pkg.version %>/bxslider.zip'
          },
          files: [{
            expand: true,
            cwd: 'dist/',
            src: ['**'],
            dest: 'bxslider.<%= pkg.version %>'
          }]
        }
      }
    });

  grunt.loadNpmTasks('assemble');

  // tasks
  grunt.registerTask('dist', ['clean:dist', 'less:dist', 'jshint:dist', 'concat:dist', 'cssmin:dist', 'copy:distImages', 'copy:distVendor', 'uglify:dist', 'copy:readme']);

  grunt.registerTask('docs', ['clean:docs', 'assemble', 'less:docs', 'concat:docs', 'copy:docsAssets', 'copy:docsHighlightAssets', 'copy:distToDocs']);

  grunt.registerTask('default', ['dist', 'docs']);

  grunt.registerTask('watch', ['connect:docs', 'watch']);

  grunt.registerTask('zip', ['compress']);

};
<commit_msg>reverted gruntfile changes<commit_after>/**
 * bxSlider
 *
 * Steven Wanderski
 *
 * Copyright (c) 2014
 * Licensed under the MIT license.
 */
module.exports = function(grunt) {

  var path = require('path');

  if (!grunt.file.isDir('bower_components')) {
    grunt.fail.fatal('>> Please run "bower install" before continuing.');
  }
  require('load-grunt-tasks')(grunt);

  grunt
    .initConfig({
      pkg: grunt.file.readJSON('package.json'),
      app: grunt.file.readJSON('_config.json'),
      vendor: 'bower_components',

      // assemble
      assemble: {
        options: {
          flatten: false,
          expand: true,
          production: false,
          assets: '<%= app.docs.dest %>/assets',
          postprocess: require('pretty'),
          mybaseDir: path.resolve('<%= app.docs.dest %>'),

          // metadata
          pkg: '<%= pkg %>',
          app: '<%= app %>',
          data: ['<%= app.docs.src %>/data/*.{json,yml}'],
          helpers: ['handlebars-helpers'],

          // templates
          partials: '<%= app.docs.templates %>/partials/*.hbs',
          layoutdir: '<%= app.docs.layouts %>/'
        },
        index: {
          options: {
            layout: 'home.hbs'
          },
          files: [{
            expand: true,
            cwd: '<%= app.docs.pages %>/',
            src: '*.hbs',
            dest: '<%= app.docs.dest %>/'
          }]
        },
        demos: {
          options: {
            layout: 'demos.hbs'
          },
          files: [{
            expand: true,
            cwd: '<%= app.docs.pages %>/demos/',
            src: '*.hbs',
            dest: '<%= app.docs.dest %>/demos'
          }]
        },
        docs: {
          options: {
            layout: 'docs.hbs'
          },
          files: [{
            expand: true,
            cwd: '<%= app.docs.pages %>/docs/',
            src: '*.hbs',
            dest: '<%= app.docs.dest %>/docs'
          }]
        }
      },

      // clean
      clean: {
        docs: ['<%= app.docs.dest %>/**/*.*'],
        dist: ['dist/**/*.*']
      },

      // less
      less: {
        docs: {
          options: {
            compress: true,
            paths: ['<%= app.docs.src %>/assets/less/', 'bower_components/bootstrap/less/']
          },
          files: {
            '<%= app.docs.dest %>/assets/css/docs.min.css': '<%= app.docs.src %>/assets/less/docs.less'
          }
        },
        dist: {
          options: {
            compress: false
          },
          files: [{
            expand: true,
            flatten: true,
            cwd: 'src/less/',
            src: '*less',
            dest: 'src/css/',
            ext: '.css',
            extDot: 'last'
          }]
        }
      },

      // concat
      concat: {
        docs: {
          src: [
            'bower_components/bootstrap/js/transition.js',
            'bower_components/bootstrap/js/alert.js',
            'bower_components/bootstrap/js/button.js',
            'bower_components/bootstrap/js/carousel.js',
            'bower_components/bootstrap/js/collapse.js',
            'bower_components/bootstrap/js/dropdown.js',
            'bower_components/bootstrap/js/modal.js',
            'bower_components/bootstrap/js/tooltip.js',
            'bower_components/bootstrap/js/popover.js',
            'bower_components/bootstrap/js/scrollspy.js',
            'bower_components/bootstrap/js/tab.js',
            'bower_components/bootstrap/js/affix.js',
            'bower_components/highlightjs/highlight.pack.js'
          ],
          dest: '<%= app.docs.dest %>/assets/js/vendor.js'
        },
        dist: {
          options: {
            banner: '/**\n' + ' * bxSlider v<%= pkg.version %>\n' +
              ' * Copyright 2013-<%= grunt.template.today("yyyy") %> <%= pkg.author.name %>\n' +
              ' * Written while drinking Belgian ales and listening to jazz\n\n' +
              ' * Licensed under <%= pkg.license.type %> (<%= pkg.license.url %>)\n' + ' */\n\n'
          },
          files: {
            'dist/jquery.<%= pkg.name %>.css': ['src/css/*.css'],
            'dist/jquery.<%= pkg.name %>.js': '<%= app.src.scripts %>'
          }
        }
      },

      cssmin: {
        options: {
          banner: '/**\n' + ' * bxSlider v<%= pkg.version %>\n' +
            ' * Copyright 2013-<%= grunt.template.today("yyyy") %> <%= pkg.author.name %>\n' +
            ' * Written while drinking Belgian ales and listening to jazz\n\n' +
            ' * Licensed under <%= pkg.license.type %> (<%= pkg.license.url %>)\n' + ' */\n\n'
        },
        dist: {
          files: {
            'dist/jquery.<%= pkg.name %>.min.css': ['src/css/*.css']
          }
        }
      },

      // jshint
      jshint: {
        options: {
          jshintrc: 'src/js/.jshintrc'
        },
        dist: {
          src: ['<%= app.src.scripts %>', 'Gruntfile.js']
        }
      },

      //jscs
      jscs: {
        options: {
          config: 'src/js/.jscsrc',
          reporter: 'text.js',
          reporterOutput: 'jscs.report.txt'
        },
        dist: {
          src: ['<%= app.src.scripts %>', 'Gruntfile.js']
        }
      },

      // uglify
      uglify: {
        options: {
          banner: '/**\n' + ' * bxSlider v<%= pkg.version %>\n' +
            ' * Copyright 2013-<%= grunt.template.today("yyyy") %> <%= pkg.author.name %>\n' +
            ' * Written while drinking Belgian ales and listening to jazz\n\n' +
            ' * Licensed under <%= pkg.license.type %> (<%= pkg.license.url %>)\n' + ' */\n\n'
        },
        dist: {
          files: {
            'dist/jquery.<%= pkg.name %>.min.js': '<%= app.src.scripts %>'
          }
        }
      },

      // copy
      copy: {
        distImages: {
          expand: true,
          flatten: true,
          cwd: 'src/',
          src: ['images/*.*'],
          dest: 'dist/images'
        },

        distVendor: {
          expand: true,
          flatten: true,
          cwd: 'src/',
          src: ['vendor/*.*'],
          dest: 'dist/vendor'
        },

        distToDocs: {
          expand: true,
          cwd: 'dist/',
          src: ['**/*.*'],
          dest: '<%= app.docs.dest %>/assets/bxslider'
        },

        srcToDocs: {
          expand: true,
          cwd: 'src/js',
          src: ['**/*.js'],
          dest: '<%= app.docs.dest %>/assets/bxslider/src'
        },

        docsAssets: {
          expand: true,
          cwd: '<%= app.docs.src %>/assets/',
          src: ['css/*.css', 'vendors/*.js', 'vendors/*.map', 'img/*.*', 'js/*.*'],
          dest: '<%= app.docs.dest %>/assets/'
        },

        docsHighlightAssets: {
          expand: true,
          cwd: 'bower_components/highlightjs/',
          src: 'styles/*.css',
          dest: '<%= app.docs.dest %>/assets/css/'
        },

        readme: {
          files: [{
            'dist/LICENSE.md': 'LICENSE.md',
            'dist/README.md': 'README.md'
          }]
        }
      },

      // connect
      connect: {
        options: {
          port: 9000,
          open: true,
          livereload: true,
          hostname: 'localhost'
        },
        docs: {
          options: {
            base: '<%= app.docs.dest %>'
          }
        }
      },

      // watch
      watch: {
        options: {
          livereload: true
        },
        templates: {
          files: ['<%= app.docs.templates %>/**/*.hbs'],
          tasks: ['assemble']
        },
        less: {
          files: ['<%= app.docs.src %>/assets/**/*.less'],
          tasks: ['less:docs']
        },
        lessDist: {
          files: ['src/**/*.less'],
          tasks: ['less:dist', 'concat:dist', 'cssmin:dist', 'copy:distToDocs']
        },
        jsDocs: {
          files: ['<%= app.docs.src %>/assets/**/*.js'],
          tasks: ['copy:docsAssets']
        },
        js: {
          files: ['src/**/*.js'],
          tasks: ['jscs:dist', 'jshint:dist', 'uglify:dist', 'concat:dist', 'copy:distToDocs', 'copy:srcToDocs']
        },
        helpers: {
          files: ['<%= app.src %>/helpers/*.js'],
          tasks: ['assemble']
        }
      },

      // compress zip
      compress: {
        zip: {
          options: {
            archive: 'download/<%= pkg.version %>/bxslider.zip'
          },
          files: [{
            expand: true,
            cwd: 'dist/',
            src: ['**'],
            dest: 'bxslider.<%= pkg.version %>'
          }]
        }
      }
    });

  grunt.loadNpmTasks('assemble');

  // tasks
  grunt.registerTask('dist', ['clean:dist', 'less:dist', 'jshint:dist', 'concat:dist', 'cssmin:dist', 'copy:distImages', 'copy:distVendor', 'jscs:dist', 'uglify:dist', 'copy:readme']);

  grunt.registerTask('docs', ['clean:docs', 'assemble', 'less:docs', 'concat:docs', 'copy:docsAssets', 'copy:docsHighlightAssets', 'copy:distToDocs']);

  grunt.registerTask('default', ['dist', 'docs']);

  grunt.registerTask('watch', ['connect:docs', 'watch']);

  grunt.registerTask('zip', ['compress']);

};
<|endoftext|>


<commit_before>module.exports = function( grunt ) {

	"use strict";

	var distpaths = [
			"dist/jquery.js",
			"dist/jquery.min.map",
			"dist/jquery.min.js"
		],
		readOptionalJSON = function( filepath ) {
			var data = {};
			try {
				data = grunt.file.readJSON( filepath );
			} catch(e) {}
			return data;
		};

	grunt.initConfig({
		pkg: grunt.file.readJSON("package.json"),
		dst: readOptionalJSON("dist/.destination.json"),
		compare_size: {
			files: distpaths
		},
		selector: {
			"src/selector.js": [
				"src/sizzle-jquery.js",
				"src/sizzle/sizzle.js"
			]
		},
		build: {
			"dist/jquery.js": [
				"src/intro.js",
				"src/core.js",
				"src/callbacks.js",
				"src/deferred.js",
				"src/support.js",
				"src/data.js",
				"src/queue.js",
				"src/attributes.js",
				"src/event.js",
				"src/selector.js",
				"src/traversing.js",
				"src/manipulation.js",

				{ flag: "css", src: "src/css.js" },
				"src/serialize.js",
				{ flag: "ajax", src: "src/ajax.js" },
				{ flag: "ajax/script", src: "src/ajax/script.js", needs: ["ajax"]  },
				{ flag: "ajax/jsonp", src: "src/ajax/jsonp.js", needs: [ "ajax", "ajax/script" ]  },
				{ flag: "ajax/xhr", src: "src/ajax/xhr.js", needs: ["ajax"]  },
				{ flag: "effects", src: "src/effects.js", needs: ["css"] },
				{ flag: "offset", src: "src/offset.js", needs: ["css"] },
				{ flag: "dimensions", src: "src/dimensions.js", needs: ["css"] },
				{ flag: "deprecated", src: "src/deprecated.js" },

				"src/exports.js",
				"src/outro.js"
			]
		},

		jshint: {
			dist: {
				src: [ "dist/jquery.js" ],
				options: {
					jshintrc: "src/.jshintrc"
				}
			},
			grunt: {
				src: [ "Gruntfile.js" ],
				options: {
					jshintrc: ".jshintrc"
				}
			},
			tests: {
				// TODO: Once .jshintignore is supported, use that instead.
				// issue located here: https://github.com/gruntjs/grunt-contrib-jshint/issues/1
				src: [ "test/data/{test,testinit,testrunner}.js", "test/unit/**/*.js" ],
				options: {
					jshintrc: "test/.jshintrc"
				}
			}
		},

		testswarm: {
			tests: "ajax attributes callbacks core css data deferred dimensions effects event manipulation offset queue selector serialize support traversing Sizzle".split(" ")
		},

		watch: {
			files: [ "<%= jshint.grunt.src %>", "<%= jshint.tests.src %>", "src/**/*.js" ],
			tasks: "dev"
		},

		uglify: {
			all: {
				files: {
					"dist/jquery.min.js": [ "dist/jquery.js" ]
				},
				options: {
					banner: "/*! jQuery v<%= pkg.version %> jquery.com | jquery.org/license */",
					sourceMap: "dist/jquery.min.map",
					beautify: {
						ascii_only: true
					}
				}
			}
		}
	});

	grunt.registerTask( "testswarm", function( commit, configFile ) {
		var jobName,
			testswarm = require( "testswarm" ),
			testUrls = [],
			pull = /PR-(\d+)/.exec( commit ),
			config = grunt.file.readJSON( configFile ).jquery,
			tests = grunt.config([ this.name, "tests" ]);

		if ( pull ) {
			jobName = "jQuery pull #" + pull[ 1 ] + "";
		} else {
			jobName = "jQuery commit #" + commit.substr( 0, 10 ) + "";
		}

		tests.forEach(function( test ) {
			testUrls.push( config.testUrl + commit + "/test/index.html?module=" + test );
		});

		testswarm({
			url: config.swarmUrl,
			pollInterval: 10000,
			timeout: 1000 * 60 * 30,
			done: this.async()
		}, {
			authUsername: config.authUsername,
			authToken: config.authToken,
			jobName: jobName,
			runMax: config.runMax,
			"runNames[]": tests,
			"runUrls[]": testUrls,
			"browserSets[]": config.browserSets
		});
	});

	// Build src/selector.js
	grunt.registerMultiTask( "selector", "Build src/selector.js", function() {

		var name = this.file.dest,
				files = this.file.src,
				sizzle = {
					api: grunt.file.read( files[0] ),
					src: grunt.file.read( files[1] )
				},
				compiled, parts;

		/**

			sizzle-jquery.js -> sizzle between "EXPOSE" blocks,
			replace define & window.Sizzle assignment

			// EXPOSE
			if ( typeof define === "function" && define.amd ) {
				define(function() { return Sizzle; });
			} else {
				window.Sizzle = Sizzle;
			}
			// EXPOSE

			Becomes...

			Sizzle.attr = jQuery.attr;
			jQuery.find = Sizzle;
			jQuery.expr = Sizzle.selectors;
			jQuery.expr[":"] = jQuery.expr.pseudos;
			jQuery.unique = Sizzle.uniqueSort;
			jQuery.text = Sizzle.getText;
			jQuery.isXMLDoc = Sizzle.isXML;
			jQuery.contains = Sizzle.contains;

		 */

		// Break into 3 pieces
		parts = sizzle.src.split("// EXPOSE");
		// Replace the if/else block with api
		parts[1] = sizzle.api;
		// Rejoin the pieces
		compiled = parts.join("");

		grunt.verbose.write("Injected sizzle-jquery.js into sizzle.js");

		// Write concatenated source to file
		grunt.file.write( name, compiled );

		// Fail task if errors were logged.
		if ( this.errorCount ) {
			return false;
		}

		// Otherwise, print a success message.
		grunt.log.writeln( "File '" + name + "' created." );
	});

	// Special "alias" task to make custom build creation less grawlix-y
	grunt.registerTask( "custom", function() {
		var done = this.async(),
				args = [].slice.call(arguments),
				modules = args.length ? args[0].replace(/,/g, ":") : "";

		// Translation example
		//
		//   grunt custom:+ajax,-dimensions,-effects,-offset
		//
		// Becomes:
		//
		//   grunt build:*:*:+ajax:-dimensions:-effects:-offset

		grunt.log.writeln( "Creating custom build...\n" );

		grunt.util.spawn({
			cmd: process.platform === "win32" ? "grunt.cmd" : "grunt",
			args: [ "build:*:*:" + modules, "uglify", "dist" ]
		}, function( err, result ) {
			if ( err ) {
				grunt.verbose.error();
				done( err );
				return;
			}

			grunt.log.writeln( result.stdout.replace("Done, without errors.", "") );

			done();
		});
	});

	// Special concat/build task to handle various jQuery build requirements
	//
	grunt.registerMultiTask(
		"build",
		"Concatenate source (include/exclude modules with +/- flags), embed date/version",
		function() {
			// Concat specified files.
			var compiled = "",
				modules = this.flags,
				optIn = !modules["*"],
				explicit = optIn || Object.keys(modules).length > 1,
				name = this.file.dest,
				src = this.file.srcRaw,
				deps = {},
				excluded = {},
				version = grunt.config( "pkg.version" ),
				excluder = function( flag, needsFlag ) {
					// optIn defaults implicit behavior to weak exclusion
					if ( optIn && !modules[ flag ] && !modules[ "+" + flag ] ) {
						excluded[ flag ] = false;
					}

					// explicit or inherited strong exclusion
					if ( excluded[ needsFlag ] || modules[ "-" + flag ] ) {
						excluded[ flag ] = true;

					// explicit inclusion overrides weak exclusion
					} else if ( excluded[ needsFlag ] === false &&
						( modules[ flag ] || modules[ "+" + flag ] ) ) {

						delete excluded[ needsFlag ];

						// ...all the way down
						if ( deps[ needsFlag ] ) {
							deps[ needsFlag ].forEach(function( subDep ) {
								modules[ needsFlag ] = true;
								excluder( needsFlag, subDep );
							});
						}
					}
				};

			// append commit id to version
			if ( process.env.COMMIT ) {
				version += " " + process.env.COMMIT;
			}

			// figure out which files to exclude based on these rules in this order:
			//  dependency explicit exclude
			//  > explicit exclude
			//  > explicit include
			//  > dependency implicit exclude
			//  > implicit exclude
			// examples:
			//  *                  none (implicit exclude)
			//  *:*                all (implicit include)
			//  *:*:-css           all except css and dependents (explicit > implicit)
			//  *:*:-css:+effects  same (excludes effects because explicit include is trumped by explicit exclude of dependency)
			//  *:+effects         none except effects and its dependencies (explicit include trumps implicit exclude of dependency)
			src.forEach(function( filepath ) {
				var flag = filepath.flag;

				if ( flag ) {

					excluder(flag);

					// check for dependencies
					if ( filepath.needs ) {
						deps[ flag ] = filepath.needs;
						filepath.needs.forEach(function( needsFlag ) {
							excluder( flag, needsFlag );
						});
					}
				}
			});

			// append excluded modules to version
			if ( Object.keys( excluded ).length ) {
				version += " -" + Object.keys( excluded ).join( ",-" );
				// set pkg.version to version with excludes, so minified file picks it up
				grunt.config.set( "pkg.version", version );
			}

			// conditionally concatenate source
			src.forEach(function( filepath ) {
				var flag = filepath.flag,
						specified = false,
						omit = false,
						message = "";

				if ( flag ) {
					if ( excluded[ flag ] !== undefined ) {
						message = ( "Excluding " + flag ).red;
						specified = true;
						omit = true;
					} else {
						message = ( "Including " + flag ).green;

						// If this module was actually specified by the
						// builder, then st the flag to include it in the
						// output list
						if ( modules[ "+" + flag ] ) {
							specified = true;
						}
					}

					// Only display the inclusion/exclusion list when handling
					// an explicit list.
					//
					// Additionally, only display modules that have been specified
					// by the user
					if ( explicit && specified ) {
						grunt.log.writetableln([ 27, 30 ], [
							message,
							( "(" + filepath.src + ")").grey
						]);
					}

					filepath = filepath.src;
				}

				if ( !omit ) {
					compiled += grunt.file.read( filepath );
				}
			});

			// Embed Version
			// Embed Date
			compiled = compiled.replace( /@VERSION/g, version )
				.replace( "@DATE", function () {
					var date = new Date();

					// YYYY-MM-DD
					return [
						date.getFullYear(),
						date.getMonth() + 1,
						date.getDate()
					].join( "-" );
				});

			// Write concatenated source to file
			grunt.file.write( name, compiled );

			// Fail task if errors were logged.
			if ( this.errorCount ) {
				return false;
			}

			// Otherwise, print a success message.
			grunt.log.writeln( "File '" + name + "' created." );
		});

	// Process files for distribution
	grunt.registerTask( "dist", function() {
		var flags, paths, stored;

		// Check for stored destination paths
		// ( set in dist/.destination.json )
		stored = Object.keys( grunt.config("dst") );

		// Allow command line input as well
		flags = Object.keys( this.flags );

		// Combine all output target paths
		paths = [].concat( stored, flags ).filter(function( path ) {
			return path !== "*";
		});

		// Ensure the dist files are pure ASCII
		var fs = require("fs"),
			nonascii = false;

		distpaths.forEach(function( filename ) {
			var text = fs.readFileSync( filename, "utf8" ),
			i, c;
			if ( text.length !== Buffer.byteLength( text, "utf8" ) ) {
				grunt.log.writeln( filename + ": Non-ASCII characters detected:" );
				for ( i = 0; i < text.length; i++ ) {
					c = text.charCodeAt( i );
					if ( c > 127 ) {
						grunt.log.writeln( "- position " + i + ": " + c );
						grunt.log.writeln( "-- " + text.substring( i - 20, i + 20 ) );
						nonascii = true;
						break;
					}
				}
			}

			// Modify map so that it points to files in the same folder;
			// see https://github.com/mishoo/UglifyJS2/issues/47
			if ( /\.map$/.test( filename ) ) {
				text = text.replace( /"dist\//g, "\"" );
				fs.writeFileSync( filename, text, "utf-8" );
			}

			// Optionally copy dist files to other locations
			paths.forEach(function( path ) {
				var created;

				if ( !/\/$/.test( path ) ) {
					path += "/";
				}

				created = path + filename.replace( "dist/", "" );
				grunt.file.write( created, text );
				grunt.log.writeln( "File '" + created + "' created." );
			});
		});

		return !nonascii;
	});

	// Load grunt tasks from NPM packages
	grunt.loadNpmTasks("grunt-compare-size");
	grunt.loadNpmTasks("grunt-git-authors");
	grunt.loadNpmTasks("grunt-update-submodules");
	grunt.loadNpmTasks("grunt-contrib-watch");
	grunt.loadNpmTasks("grunt-contrib-jshint");
	grunt.loadNpmTasks("grunt-contrib-uglify");

	// Default grunt
	grunt.registerTask( "default", [ "update_submodules", "selector", "build:*:*", "jshint", "uglify", "dist:*", "compare_size" ] );

	// Short list as a high frequency watch task
	grunt.registerTask( "dev", [ "selector", "build:*:*", "jshint" ] );
};
<commit_msg>Set testswarm browsersets to "popular-no-old-ie"<commit_after>module.exports = function( grunt ) {

	"use strict";

	var distpaths = [
			"dist/jquery.js",
			"dist/jquery.min.map",
			"dist/jquery.min.js"
		],
		readOptionalJSON = function( filepath ) {
			var data = {};
			try {
				data = grunt.file.readJSON( filepath );
			} catch(e) {}
			return data;
		};

	grunt.initConfig({
		pkg: grunt.file.readJSON("package.json"),
		dst: readOptionalJSON("dist/.destination.json"),
		compare_size: {
			files: distpaths
		},
		selector: {
			"src/selector.js": [
				"src/sizzle-jquery.js",
				"src/sizzle/sizzle.js"
			]
		},
		build: {
			"dist/jquery.js": [
				"src/intro.js",
				"src/core.js",
				"src/callbacks.js",
				"src/deferred.js",
				"src/support.js",
				"src/data.js",
				"src/queue.js",
				"src/attributes.js",
				"src/event.js",
				"src/selector.js",
				"src/traversing.js",
				"src/manipulation.js",

				{ flag: "css", src: "src/css.js" },
				"src/serialize.js",
				{ flag: "ajax", src: "src/ajax.js" },
				{ flag: "ajax/script", src: "src/ajax/script.js", needs: ["ajax"]  },
				{ flag: "ajax/jsonp", src: "src/ajax/jsonp.js", needs: [ "ajax", "ajax/script" ]  },
				{ flag: "ajax/xhr", src: "src/ajax/xhr.js", needs: ["ajax"]  },
				{ flag: "effects", src: "src/effects.js", needs: ["css"] },
				{ flag: "offset", src: "src/offset.js", needs: ["css"] },
				{ flag: "dimensions", src: "src/dimensions.js", needs: ["css"] },
				{ flag: "deprecated", src: "src/deprecated.js" },

				"src/exports.js",
				"src/outro.js"
			]
		},

		jshint: {
			dist: {
				src: [ "dist/jquery.js" ],
				options: {
					jshintrc: "src/.jshintrc"
				}
			},
			grunt: {
				src: [ "Gruntfile.js" ],
				options: {
					jshintrc: ".jshintrc"
				}
			},
			tests: {
				// TODO: Once .jshintignore is supported, use that instead.
				// issue located here: https://github.com/gruntjs/grunt-contrib-jshint/issues/1
				src: [ "test/data/{test,testinit,testrunner}.js", "test/unit/**/*.js" ],
				options: {
					jshintrc: "test/.jshintrc"
				}
			}
		},

		testswarm: {
			tests: "ajax attributes callbacks core css data deferred dimensions effects event manipulation offset queue selector serialize support traversing Sizzle".split(" ")
		},

		watch: {
			files: [ "<%= jshint.grunt.src %>", "<%= jshint.tests.src %>", "src/**/*.js" ],
			tasks: "dev"
		},

		uglify: {
			all: {
				files: {
					"dist/jquery.min.js": [ "dist/jquery.js" ]
				},
				options: {
					banner: "/*! jQuery v<%= pkg.version %> jquery.com | jquery.org/license */",
					sourceMap: "dist/jquery.min.map",
					beautify: {
						ascii_only: true
					}
				}
			}
		}
	});

	grunt.registerTask( "testswarm", function( commit, configFile ) {
		var jobName,
			testswarm = require( "testswarm" ),
			testUrls = [],
			pull = /PR-(\d+)/.exec( commit ),
			config = grunt.file.readJSON( configFile ).jquery,
			tests = grunt.config([ this.name, "tests" ]);

		if ( pull ) {
			jobName = "jQuery pull #" + pull[ 1 ] + "";
		} else {
			jobName = "jQuery commit #" + commit.substr( 0, 10 ) + "";
		}

		tests.forEach(function( test ) {
			testUrls.push( config.testUrl + commit + "/test/index.html?module=" + test );
		});

		testswarm({
			url: config.swarmUrl,
			pollInterval: 10000,
			timeout: 1000 * 60 * 30,
			done: this.async()
		}, {
			authUsername: config.authUsername,
			authToken: config.authToken,
			jobName: jobName,
			runMax: config.runMax,
			"runNames[]": tests,
			"runUrls[]": testUrls,
			"browserSets[]": "popular-no-old-ie"
		});
	});

	// Build src/selector.js
	grunt.registerMultiTask( "selector", "Build src/selector.js", function() {

		var name = this.file.dest,
				files = this.file.src,
				sizzle = {
					api: grunt.file.read( files[0] ),
					src: grunt.file.read( files[1] )
				},
				compiled, parts;

		/**

			sizzle-jquery.js -> sizzle between "EXPOSE" blocks,
			replace define & window.Sizzle assignment

			// EXPOSE
			if ( typeof define === "function" && define.amd ) {
				define(function() { return Sizzle; });
			} else {
				window.Sizzle = Sizzle;
			}
			// EXPOSE

			Becomes...

			Sizzle.attr = jQuery.attr;
			jQuery.find = Sizzle;
			jQuery.expr = Sizzle.selectors;
			jQuery.expr[":"] = jQuery.expr.pseudos;
			jQuery.unique = Sizzle.uniqueSort;
			jQuery.text = Sizzle.getText;
			jQuery.isXMLDoc = Sizzle.isXML;
			jQuery.contains = Sizzle.contains;

		 */

		// Break into 3 pieces
		parts = sizzle.src.split("// EXPOSE");
		// Replace the if/else block with api
		parts[1] = sizzle.api;
		// Rejoin the pieces
		compiled = parts.join("");

		grunt.verbose.write("Injected sizzle-jquery.js into sizzle.js");

		// Write concatenated source to file
		grunt.file.write( name, compiled );

		// Fail task if errors were logged.
		if ( this.errorCount ) {
			return false;
		}

		// Otherwise, print a success message.
		grunt.log.writeln( "File '" + name + "' created." );
	});

	// Special "alias" task to make custom build creation less grawlix-y
	grunt.registerTask( "custom", function() {
		var done = this.async(),
				args = [].slice.call(arguments),
				modules = args.length ? args[0].replace(/,/g, ":") : "";

		// Translation example
		//
		//   grunt custom:+ajax,-dimensions,-effects,-offset
		//
		// Becomes:
		//
		//   grunt build:*:*:+ajax:-dimensions:-effects:-offset

		grunt.log.writeln( "Creating custom build...\n" );

		grunt.util.spawn({
			cmd: process.platform === "win32" ? "grunt.cmd" : "grunt",
			args: [ "build:*:*:" + modules, "uglify", "dist" ]
		}, function( err, result ) {
			if ( err ) {
				grunt.verbose.error();
				done( err );
				return;
			}

			grunt.log.writeln( result.stdout.replace("Done, without errors.", "") );

			done();
		});
	});

	// Special concat/build task to handle various jQuery build requirements
	//
	grunt.registerMultiTask(
		"build",
		"Concatenate source (include/exclude modules with +/- flags), embed date/version",
		function() {
			// Concat specified files.
			var compiled = "",
				modules = this.flags,
				optIn = !modules["*"],
				explicit = optIn || Object.keys(modules).length > 1,
				name = this.file.dest,
				src = this.file.srcRaw,
				deps = {},
				excluded = {},
				version = grunt.config( "pkg.version" ),
				excluder = function( flag, needsFlag ) {
					// optIn defaults implicit behavior to weak exclusion
					if ( optIn && !modules[ flag ] && !modules[ "+" + flag ] ) {
						excluded[ flag ] = false;
					}

					// explicit or inherited strong exclusion
					if ( excluded[ needsFlag ] || modules[ "-" + flag ] ) {
						excluded[ flag ] = true;

					// explicit inclusion overrides weak exclusion
					} else if ( excluded[ needsFlag ] === false &&
						( modules[ flag ] || modules[ "+" + flag ] ) ) {

						delete excluded[ needsFlag ];

						// ...all the way down
						if ( deps[ needsFlag ] ) {
							deps[ needsFlag ].forEach(function( subDep ) {
								modules[ needsFlag ] = true;
								excluder( needsFlag, subDep );
							});
						}
					}
				};

			// append commit id to version
			if ( process.env.COMMIT ) {
				version += " " + process.env.COMMIT;
			}

			// figure out which files to exclude based on these rules in this order:
			//  dependency explicit exclude
			//  > explicit exclude
			//  > explicit include
			//  > dependency implicit exclude
			//  > implicit exclude
			// examples:
			//  *                  none (implicit exclude)
			//  *:*                all (implicit include)
			//  *:*:-css           all except css and dependents (explicit > implicit)
			//  *:*:-css:+effects  same (excludes effects because explicit include is trumped by explicit exclude of dependency)
			//  *:+effects         none except effects and its dependencies (explicit include trumps implicit exclude of dependency)
			src.forEach(function( filepath ) {
				var flag = filepath.flag;

				if ( flag ) {

					excluder(flag);

					// check for dependencies
					if ( filepath.needs ) {
						deps[ flag ] = filepath.needs;
						filepath.needs.forEach(function( needsFlag ) {
							excluder( flag, needsFlag );
						});
					}
				}
			});

			// append excluded modules to version
			if ( Object.keys( excluded ).length ) {
				version += " -" + Object.keys( excluded ).join( ",-" );
				// set pkg.version to version with excludes, so minified file picks it up
				grunt.config.set( "pkg.version", version );
			}

			// conditionally concatenate source
			src.forEach(function( filepath ) {
				var flag = filepath.flag,
						specified = false,
						omit = false,
						message = "";

				if ( flag ) {
					if ( excluded[ flag ] !== undefined ) {
						message = ( "Excluding " + flag ).red;
						specified = true;
						omit = true;
					} else {
						message = ( "Including " + flag ).green;

						// If this module was actually specified by the
						// builder, then st the flag to include it in the
						// output list
						if ( modules[ "+" + flag ] ) {
							specified = true;
						}
					}

					// Only display the inclusion/exclusion list when handling
					// an explicit list.
					//
					// Additionally, only display modules that have been specified
					// by the user
					if ( explicit && specified ) {
						grunt.log.writetableln([ 27, 30 ], [
							message,
							( "(" + filepath.src + ")").grey
						]);
					}

					filepath = filepath.src;
				}

				if ( !omit ) {
					compiled += grunt.file.read( filepath );
				}
			});

			// Embed Version
			// Embed Date
			compiled = compiled.replace( /@VERSION/g, version )
				.replace( "@DATE", function () {
					var date = new Date();

					// YYYY-MM-DD
					return [
						date.getFullYear(),
						date.getMonth() + 1,
						date.getDate()
					].join( "-" );
				});

			// Write concatenated source to file
			grunt.file.write( name, compiled );

			// Fail task if errors were logged.
			if ( this.errorCount ) {
				return false;
			}

			// Otherwise, print a success message.
			grunt.log.writeln( "File '" + name + "' created." );
		});

	// Process files for distribution
	grunt.registerTask( "dist", function() {
		var flags, paths, stored;

		// Check for stored destination paths
		// ( set in dist/.destination.json )
		stored = Object.keys( grunt.config("dst") );

		// Allow command line input as well
		flags = Object.keys( this.flags );

		// Combine all output target paths
		paths = [].concat( stored, flags ).filter(function( path ) {
			return path !== "*";
		});

		// Ensure the dist files are pure ASCII
		var fs = require("fs"),
			nonascii = false;

		distpaths.forEach(function( filename ) {
			var text = fs.readFileSync( filename, "utf8" ),
			i, c;
			if ( text.length !== Buffer.byteLength( text, "utf8" ) ) {
				grunt.log.writeln( filename + ": Non-ASCII characters detected:" );
				for ( i = 0; i < text.length; i++ ) {
					c = text.charCodeAt( i );
					if ( c > 127 ) {
						grunt.log.writeln( "- position " + i + ": " + c );
						grunt.log.writeln( "-- " + text.substring( i - 20, i + 20 ) );
						nonascii = true;
						break;
					}
				}
			}

			// Modify map so that it points to files in the same folder;
			// see https://github.com/mishoo/UglifyJS2/issues/47
			if ( /\.map$/.test( filename ) ) {
				text = text.replace( /"dist\//g, "\"" );
				fs.writeFileSync( filename, text, "utf-8" );
			}

			// Optionally copy dist files to other locations
			paths.forEach(function( path ) {
				var created;

				if ( !/\/$/.test( path ) ) {
					path += "/";
				}

				created = path + filename.replace( "dist/", "" );
				grunt.file.write( created, text );
				grunt.log.writeln( "File '" + created + "' created." );
			});
		});

		return !nonascii;
	});

	// Load grunt tasks from NPM packages
	grunt.loadNpmTasks("grunt-compare-size");
	grunt.loadNpmTasks("grunt-git-authors");
	grunt.loadNpmTasks("grunt-update-submodules");
	grunt.loadNpmTasks("grunt-contrib-watch");
	grunt.loadNpmTasks("grunt-contrib-jshint");
	grunt.loadNpmTasks("grunt-contrib-uglify");

	// Default grunt
	grunt.registerTask( "default", [ "update_submodules", "selector", "build:*:*", "jshint", "uglify", "dist:*", "compare_size" ] );

	// Short list as a high frequency watch task
	grunt.registerTask( "dev", [ "selector", "build:*:*", "jshint" ] );
};
<|endoftext|>


<commit_before>
module.exports = function(grunt) {

  // test purpose
  var d = __dirname+"/vendors/phantomizer-html-assets";

  var src_dir = d+"/demo/in/";
  var out_dir = d+"/demo/out/";
  var meta_dir = d+"/demo/out/";
  // test purpose

  grunt.initConfig({
    pkg: grunt.file.readJSON('package.json')

    // test purpose
    ,"out_dir":out_dir
    ,"meta_dir":meta_dir

    //-
    ,'phantomizer-html-assets': {
      options: {
        "file_suffix": "-opt"
        ,"in_request": "/some.html"
        ,"out_path": "<%= out_dir %>/"
        ,"meta_path": "<%= meta_dir %>/"
        ,"requirejs_src":"/js/require.js"
        ,"requirejs_baseUrl": "/js/"
        ,"manifest": true
        ,"htmlcompressor": true
        ,"imgcompressor": true
        ,"phantomizer-htmlcompressor":{
          options: {
            "compress-js":true
            ,"compress-css":true
          }
        }
        ,"phantomizer-uglifyjs":{
          banner: ''
          ,beautify: false
          ,report: false
        }
        ,"phantomizer-requirejs":{
          "baseUrl": src_dir+"js"
          ,"paths": {
            "almond": src_dir+"js/almond-0.2.5"
            ,"jquery": src_dir+"js/jquery-1.10.2.min"
          }
          ,"optimize": "none"
          ,"wrap": true
          ,"name": "almond"
        }
        ,"phantomizer-imgopt":{
          "optimizationLevel": 3
        }
        ,"img_variance":{
          "\.(png|jpeg|jpg)$":"@2x.$1"
        }
        ,"phantomizer-requirecss":{
          "optimizeCss": "standard"
        }
        ,"paths":[src_dir]
      }
      ,test: {
        options:{
          "file_suffix": "-test"
          ,"in_file": src_dir+"/index.html"
          ,"out": "<%= out_dir %>/index.html"
          ,"out_path": "<%= out_dir %>/"
          ,"meta_path": "<%= meta_dir %>/"
          ,"meta": "<%= meta_dir %>/index-build.html"
        }
      }
    },
    // test purpose
    docco: {
      debug: {
        src: [
          'tasks/build.js'
        ],
        options: {
          layout:'linear',
          output: 'documentation/'
        }
      }
    },
    'gh-pages': {
      options: {
        base: '.',
        add: true
      },
      src: ['documentation/**']
    },
    release: {
      options: {
        bump: true,
        add: false,
        commit: false,
        npm: false,
        npmtag: true,
        tagName: '<%= version %>',
        github: {
          repo: 'maboiteaspam/phantomizer-html-assets',
          usernameVar: 'GITHUB_USERNAME',
          passwordVar: 'GITHUB_PASSWORD'
        }
      }
    }
  });

  // test purpose
  grunt.loadNpmTasks('phantomizer-requirejs');
  grunt.loadNpmTasks('phantomizer-htmlcompressor');
  grunt.loadNpmTasks('phantomizer-uglifyjs');
  grunt.loadNpmTasks('phantomizer-html-assets');

  grunt.registerTask('default',
    [
      'phantomizer-html-assets:test'
    ]);
  // test purpose

  grunt.loadNpmTasks('grunt-docco');
  grunt.loadNpmTasks('grunt-gh-pages');
  grunt.loadNpmTasks('grunt-release');
  grunt.registerTask('cleanup-grunt-temp', [],function(){
    var wrench = require('wrench');
    wrench.rmdirSyncRecursive(__dirname + '/.grunt', !true);
    wrench.rmdirSyncRecursive(__dirname + '/documentation', !true);
  });

  // to generate and publish the docco style documentation
  // execute this
  // grunt
  grunt.registerTask('default', ['docco','gh-pages', 'cleanup-grunt-temp']);

  // to release the project in a new version
  // use one of those commands
  // grunt --no-write -v release # test only
  // grunt release:patch
  // grunt release:minor
  // grunt release:major
  // grunt release:prerelease
};
<commit_msg>Release support<commit_after>
module.exports = function(grunt) {

  grunt.initConfig({
    pkg: grunt.file.readJSON('package.json'),
    docco: {
      debug: {
        src: [
          'tasks/build.js'
        ],
        options: {
          layout:'linear',
          output: 'documentation/'
        }
      }
    },
    'gh-pages': {
      options: {
        base: '.',
        add: true
      },
      src: ['documentation/**']
    },
    release: {
      options: {
        npm: false, //default: true
        // true will apply the version number as the tag
        npmtag: true, //default: no tag
        tagName: '<%= version %>', //default: '<%= version %>'
        github: {
          repo: 'maboiteaspam/phantomizer-html-assets',
          usernameVar: 'GITHUB_USERNAME',
          passwordVar: 'GITHUB_PASSWORD'
        }
      }
    }
  });

  // test purpose
  grunt.loadNpmTasks('phantomizer-requirejs');
  grunt.loadNpmTasks('phantomizer-htmlcompressor');
  grunt.loadNpmTasks('phantomizer-uglifyjs');
  grunt.loadNpmTasks('phantomizer-html-assets');

  grunt.registerTask('default',
    [
      'phantomizer-html-assets:test'
    ]);
  // test purpose

  grunt.loadNpmTasks('grunt-docco');
  grunt.loadNpmTasks('grunt-gh-pages');
  grunt.loadNpmTasks('grunt-release');
  grunt.registerTask('cleanup-grunt-temp', [],function(){
    var wrench = require('wrench');
    wrench.rmdirSyncRecursive(__dirname + '/.grunt', !true);
    wrench.rmdirSyncRecursive(__dirname + '/documentation', !true);
  });

  // to generate and publish the docco style documentation
  // execute this
  // grunt
  grunt.registerTask('default', ['docco','gh-pages', 'cleanup-grunt-temp']);

  // to release the project in a new version
  // use one of those commands
  // grunt --no-write -v release # test only
  // grunt release:patch
  // grunt release:minor
  // grunt release:major
  // grunt release:prerelease
};
<|endoftext|>


<commit_before>module.exports = function(grunt) {

	grunt.initConfig({
		clean: {
			dist: {
				src: ['dist']
			}
		},
		copy: {
			main: {
				files: [
				{expand: true, flatten: true, src: ['src/lib/ace/mode-json.js'], dest: './'},
				{expand: true, flatten: true, src: ['src/lib/ace/worker-json.js'], dest: './'},
				{expand: true, flatten: true, src: ['src/kopf/theme-kopf.js'], dest: './'}
				]
			}
		},
		concat: {
			vendorjs: {
				src: [
					'src/lib/jquery/jquery-1.10.2.min.js',
					'src/lib/angularjs/angular.min.js',
					'src/lib/ace/ace.js',
					'src/lib/jsontree/jsontree.min.js',
					'src/lib/bootstrap/js/bootstrap.js'
				],
				dest: 'dist/lib.js'
			},
			vendorcss: {
				src: [
					'src/lib/bootstrap/css/bootstrap.css'
				],
				dest: 'dist/lib.css'
			},
			appjs: {
				src: [
					'src/kopf/controllers.js',
					'src/kopf/elastic_client.js'
				],
				dest: 'dist/kopf.js'
			},
			appcss: {
				src: [
					'src/kopf/kopf.css',
				],
				dest: 'dist/kopf.css'
			},

		},
		connect: {
			server: {
				options: {
					port: 9000,
					base: '.',
					keepalive: true
				}
			}
		}
	});
	grunt.loadNpmTasks('grunt-contrib-clean');
	grunt.loadNpmTasks('grunt-contrib-concat');
	grunt.loadNpmTasks('grunt-contrib-connect');
	grunt.loadNpmTasks('grunt-contrib-copy');
	grunt.registerTask('build', ['clean', 'copy', 'concat']);
	grunt.registerTask('server', ['clean', 'copy', 'concat','connect:server']);

};
<commit_msg>added watch task for grunt<commit_after>module.exports = function(grunt) {

	grunt.initConfig({
		clean: {
			dist: {
				src: ['dist']
			}
		},
		watch: {
		  scripts: {
		    files: ['src/kopf/*.*'],
		    tasks: ['build'],
		    options: {
		      spawn: false,
		    },
		  },
		},
		copy: {
			main: {
				files: [
				{expand: true, flatten: true, src: ['src/lib/ace/mode-json.js'], dest: './'},
				{expand: true, flatten: true, src: ['src/lib/ace/worker-json.js'], dest: './'},
				{expand: true, flatten: true, src: ['src/kopf/theme-kopf.js'], dest: './'}
				]
			}
		},
		concat: {
			vendorjs: {
				src: [
					'src/lib/jquery/jquery-1.10.2.min.js',
					'src/lib/angularjs/angular.min.js',
					'src/lib/ace/ace.js',
					'src/lib/jsontree/jsontree.min.js',
					'src/lib/bootstrap/js/bootstrap.js'
				],
				dest: 'dist/lib.js'
			},
			vendorcss: {
				src: [
					'src/lib/bootstrap/css/bootstrap.css'
				],
				dest: 'dist/lib.css'
			},
			appjs: {
				src: [
					'src/kopf/controllers.js',
					'src/kopf/elastic_client.js'
				],
				dest: 'dist/kopf.js'
			},
			appcss: {
				src: [
					'src/kopf/kopf.css',
				],
				dest: 'dist/kopf.css'
			},

		},
		connect: {
			server: {
				options: {
					port: 9000,
					base: '.',
					keepalive: true
				}
			}
		}
	});
	grunt.loadNpmTasks('grunt-contrib-clean');
	grunt.loadNpmTasks('grunt-contrib-concat');
	grunt.loadNpmTasks('grunt-contrib-connect');
	grunt.loadNpmTasks('grunt-contrib-copy');
	grunt.loadNpmTasks('grunt-contrib-watch');
	grunt.registerTask('build', ['clean', 'copy', 'concat']);
	grunt.registerTask('server', ['clean', 'copy', 'concat','connect:server']);

};
<|endoftext|>


<commit_before>#!/usr/bin/env node
/*!
 * -----------
 * ITPDB®-Data
 * -----------
 * Data of ITPDB — A manually curated dedicated ion transport proteins database.
 * _____________________________________________________________________________
 *
 * Grunt, http://gruntjs.com/ — The JavaScript Task Runner.
 * _____________________________________________________________________________
 *
 * Architecture and Code Handcrafted by Prabhat Kumar.
 * Architectuur en Code handgemaakt door Prabhat Kumar.
 * @author    : Prabhat Kumar [http://prabhatkumar.org/].
 * @copyright : Prabhat Kumar [http://prabhatkumar.org/].
 * @copyright : Sequømics Research [http://research.sequomics.com/].
 * @copyright : Sequømics Corporation [http://sequomics.com/].
 * _____________________________________________________________________________
 *
 * @date      : 10-Dec-2016
 * @license   : Apache, version 2.0
 * @require   : Node.js®
 * @require   : NPM
 * @require   : grunt-cli
 * @build     : SEED™ — Skövde
 *              └────── A Sequømics Product — http://seed.sequomics.com/.
 * _____________________________________________________________________________
 *
 * --/The Heart of Build System/-- of "ITPDB®-Data".
 * _____________________________________________________________________________
 */

// global __dirname: true
// global require: true

// # Usage: $ node -v
// # Usage: $ npm -v
// # Usage: $ grunt -version

// Invoking strict mode.
"use strict";

// To load required Node module.
// -----------------------------
var os         = require('os');
var fs         = require('fs');

// To load required NPM modules.
// -----------------------------
var chalk      = require('chalk');
var glob       = require('glob');

// Default color defined.
// ----------------------
var noop       = chalk.red;
var yeep       = chalk.green;
var okay       = chalk.blue;
var boop       = chalk.cyan;
var goop       = chalk.gray;

///-------------------
// An object literals.
///-------------------
var build = {
  // Non-identifier property names are quoted.
  "system"     : "SEED™",
  "name"       : "Skövde",
  "year"       : "2016",
  "audience"   : "for all scientist and computational biologist."
};
<commit_msg>Initial commit<commit_after>#!/usr/bin/env node
/*!
 * -----------
 * ITPDB®-Data
 * -----------
 * Data of ITPDB — A manually curated dedicated ion transport proteins database.
 * _____________________________________________________________________________
 *
 * Grunt, http://gruntjs.com/ — The JavaScript Task Runner.
 * _____________________________________________________________________________
 *
 * Architecture and Code Handcrafted by Prabhat Kumar.
 * Architectuur en Code handgemaakt door Prabhat Kumar.
 * @author    : Prabhat Kumar [http://prabhatkumar.org/].
 * @copyright : Prabhat Kumar [http://prabhatkumar.org/].
 * @copyright : Sequømics Research [http://research.sequomics.com/].
 * @copyright : Sequømics Corporation [http://sequomics.com/].
 * _____________________________________________________________________________
 *
 * @date      : 10-Dec-2016
 * @license   : Apache, version 2.0
 * @require   : Node.js®
 * @require   : NPM
 * @require   : grunt-cli
 * @build     : SEED™ — Skövde
 *              └────── A Sequømics Product — http://seed.sequomics.com/.
 * _____________________________________________________________________________
 *
 * --/The Heart of Build System/-- of "ITPDB®-Data".
 * _____________________________________________________________________________
 */

// global __dirname: true
// global require: true

// # Usage: $ node -v
// # Usage: $ npm -v
// # Usage: $ grunt -version

// Invoking strict mode.
"use strict";

// To load required Node module.
// -----------------------------
var os         = require('os');
var fs         = require('fs');

// To load required NPM modules.
// -----------------------------
var chalk      = require('chalk');
var glob       = require('glob');

// Default color defined.
// ----------------------
var noop       = chalk.red;
var yeep       = chalk.green;
var okay       = chalk.blue;
var boop       = chalk.cyan;
var goop       = chalk.gray;

///-------------------
// An object literals.
///-------------------
var build = {
  // Non-identifier property names are quoted.
  "system"     : "SEED™",
  "name"       : "Skövde",
  "year"       : "2016",
  "audience"   : "for all scientist and computational biologist."
};

// ----------------------------------------------------------------------------------------------------------
// All Grunt Operations Defined... |------------------------------------------| 02/Jan/2017 | SEED™ — Skövde.
//                           Copyright © 2016, Prabhat Kumar, All rights reserved.
// ----------------------------------------------------------------------------------------------------------
<|endoftext|>