2014-06-23 23:17:31 +02:00
|
|
|
'use strict';
|
|
|
|
|
|
2016-07-20 15:45:04 +02:00
|
|
|
/* eslint-disable no-invalid-this */
|
|
|
|
|
|
2012-10-21 00:37:59 -06:00
|
|
|
var util = require('./utils.js');
|
2016-11-28 14:12:18 +00:00
|
|
|
var npmRun = require('npm-run');
|
2012-10-21 00:37:59 -06:00
|
|
|
|
|
|
|
|
module.exports = function(grunt) {
|
|
|
|
|
|
2016-07-20 15:45:04 +02:00
|
|
|
grunt.registerMultiTask('min', 'minify JS files', function() {
|
|
|
|
|
util.min(this.data, this.async());
|
2012-10-21 00:37:59 -06:00
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
2016-07-20 15:45:04 +02:00
|
|
|
grunt.registerTask('minall', 'minify all the JS files in parallel', function() {
|
2012-10-21 00:37:59 -06:00
|
|
|
var files = grunt.config('min');
|
2016-07-20 15:45:04 +02:00
|
|
|
files = Object.keys(files).map(function(key) { return files[key]; });
|
2012-10-21 00:37:59 -06:00
|
|
|
grunt.util.async.forEach(files, util.min.bind(util), this.async());
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
2016-07-20 15:45:04 +02:00
|
|
|
grunt.registerMultiTask('build', 'build JS files', function() {
|
|
|
|
|
util.build(this.data, this.async());
|
2012-10-21 00:37:59 -06:00
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
2016-07-20 15:45:04 +02:00
|
|
|
grunt.registerTask('buildall', 'build all the JS files in parallel', function() {
|
2012-10-21 00:37:59 -06:00
|
|
|
var builds = grunt.config('build');
|
2016-07-20 15:45:04 +02:00
|
|
|
builds = Object.keys(builds).map(function(key) { return builds[key]; });
|
2012-10-21 00:37:59 -06:00
|
|
|
grunt.util.async.forEach(builds, util.build.bind(util), this.async());
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
2016-07-20 15:45:04 +02:00
|
|
|
grunt.registerMultiTask('write', 'write content to a file', function() {
|
2012-10-21 00:37:59 -06:00
|
|
|
grunt.file.write(this.data.file, this.data.val);
|
|
|
|
|
grunt.log.ok('wrote to ' + this.data.file);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
2017-01-24 17:23:54 +00:00
|
|
|
grunt.registerTask('docs', 'create AngularJS docs', function() {
|
2016-11-28 14:12:18 +00:00
|
|
|
npmRun.execSync('gulp --gulpfile docs/gulpfile.js', {stdio: 'inherit'});
|
2012-10-21 00:37:59 -06:00
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
2016-07-20 15:45:04 +02:00
|
|
|
grunt.registerMultiTask('tests', '**Use `grunt test` instead**', function() {
|
2018-12-10 16:33:01 +00:00
|
|
|
util.startKarma(this.data, true, this.async());
|
2012-10-21 00:37:59 -06:00
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
2016-07-20 15:45:04 +02:00
|
|
|
grunt.registerMultiTask('autotest', 'Run and watch the unit tests with Karma', function() {
|
|
|
|
|
util.startKarma(this.data, false, this.async());
|
2012-10-21 00:37:59 -06:00
|
|
|
});
|
2013-06-28 16:47:10 -07:00
|
|
|
|
2014-01-07 11:51:32 -08:00
|
|
|
grunt.registerTask('webdriver', 'Update webdriver', function() {
|
2016-07-20 15:45:04 +02:00
|
|
|
util.updateWebdriver(this.async());
|
2014-01-07 11:51:32 -08:00
|
|
|
});
|
|
|
|
|
|
2014-01-30 22:09:09 -08:00
|
|
|
grunt.registerMultiTask('protractor', 'Run Protractor integration tests', function() {
|
2016-07-20 15:45:04 +02:00
|
|
|
util.startProtractor(this.data, this.async());
|
2014-01-07 11:51:32 -08:00
|
|
|
});
|
|
|
|
|
|
2016-07-20 15:45:04 +02:00
|
|
|
grunt.registerTask('collect-errors', 'Combine stripped error files', function() {
|
2013-06-28 16:47:10 -07:00
|
|
|
util.collectErrors();
|
|
|
|
|
});
|
2018-01-25 19:35:04 +01:00
|
|
|
|
2020-05-21 09:13:46 +01:00
|
|
|
grunt.registerTask('firebaseDocsJsonForCI', function() {
|
|
|
|
|
util.firebaseDocsJsonForCI();
|
2018-01-25 19:35:04 +01:00
|
|
|
});
|
|
|
|
|
|
2012-10-21 00:37:59 -06:00
|
|
|
};
|