grunt-yakjs.js
function gruntYakTask(grunt) {
    'use strict';

    /**
     * @type {!Array<string>}
     */
    let filesToUpload = [];

    /**
     * @type {RequestSender}
     */
    let requestSender;

    /**
     * Register task for grunt.
     */
    grunt.registerMultiTask('yakjs', 'A grunt task to update the YAKjs via rest API.', function task() {
        /**
         * This tasks sends several http request asynchronous.
         * So let's get the done callback from the task runner.
         */
        let done = this.async();

        /**
         * @type {!TaskOptions}
         */
        let options = this.options(new TaskOptions());

        filesToUpload = [];

        this.files.forEach(file => {
            filesToUpload = filesToUpload.concat(file.src);
        });

        let logger = {
            log: grunt.log.writeln,
            error: grunt.log.error
        };

        uploadFiles(filesToUpload, options, logger)
            .then(() => {
                grunt.log.writeln('');
                grunt.log.ok('All files uploaded.');
            })
            .then(() => {
                return clearModuleCache(options, logger);
            })
            .then(() => {
                return startInstances(options, logger);
            })
            .then(done)
            .catch((message, error) => {
                grunt.log.writeln('');
                grunt.log.error(JSON.stringify(message, null, 4));
                grunt.fatal('One or more files could not be uploaded.');
                done();
            });
    });
}
function gruntYakTask(grunt) {
    'use strict';

    /**
     * @type {!Array<string>}
     */
    let filesToUpload = [];

    /**
     * @type {RequestSender}
     */
    let requestSender;

    /**
     * Register task for grunt.
     */
    grunt.registerMultiTask('yakjs', 'A grunt task to update the YAKjs via rest API.', function task() {
        /**
         * This tasks sends several http request asynchronous.
         * So let's get the done callback from the task runner.
         */
        let done = this.async();

        /**
         * @type {!TaskOptions}
         */
        let options = this.options(new TaskOptions());

        filesToUpload = [];

        this.files.forEach(file => {
            filesToUpload = filesToUpload.concat(file.src);
        });

        let logger = {
            log: grunt.log.writeln,
            error: grunt.log.error
        };

        uploadFiles(filesToUpload, options, logger)
            .then(() => {
                grunt.log.writeln('');
                grunt.log.ok('All files uploaded.');
            })
            .then(() => {
                return clearModuleCache(options, logger);
            })
            .then(() => {
                return startInstances(options, logger);
            })
            .then(done)
            .catch((message, error) => {
                grunt.log.writeln('');
                grunt.log.error(JSON.stringify(message, null, 4));
                grunt.fatal('One or more files could not be uploaded.');
                done();
            });
    });
}
function gruntYakTask ( grunt ) { 'use strict' ; /**
     * @type {!Array<string>}
     */ let filesToUpload = [ ] ; /**
     * @type {RequestSender}
     */ let requestSender ; /**
     * Register task for grunt.
     */ grunt . registerMultiTask ( 'yakjs' , 'A grunt task to update the YAKjs via rest API.' , function task ( ) { /**
         * This tasks sends several http request asynchronous.
         * So let's get the done callback from the task runner.
         */ let done = this . async ( ) ; /**
         * @type {!TaskOptions}
         */ let options = this . options ( new TaskOptions ( ) ) ; filesToUpload = [ ] ; this . files . forEach ( file => { filesToUpload = filesToUpload . concat ( file . src ) ; } ) ; let logger = { log : grunt . log . writeln , error : grunt . log . error } ; uploadFiles ( filesToUpload , options , logger ) . then ( ( ) => { grunt . log . writeln ( '' ) ; grunt . log . ok ( 'All files uploaded.' ) ; } ) . then ( ( ) => { return clearModuleCache ( options , logger ) ; } ) . then ( ( ) => { return startInstances ( options , logger ) ; } ) . then ( done ) . catch ( ( message , error ) => { grunt . log . writeln ( '' ) ; grunt . log . error ( JSON . stringify ( message , null , 4 ) ) ; grunt . fatal ( 'One or more files could not be uploaded.' ) ; done ( ) ; } ) ; } ) ; }
Registers tasks for grunt
@param {?} grunt
Registers tasks for grunt