tasks/cubx_webpackage_bulk_upload.js
function (err, files) {
      if (err) {
        grunt.fail.fatal(err);
      }
      files.forEach(function (file) {
        var pathName = path.join(workspacePath, file);
        if (fs.statSync(pathName).isDirectory()) {
          if (file === activeWebpackage && choices.length > 0) {
            choices.splice(0, 0, file);
          } else {
            choices.push(file);
          }
        }
      });

      // get list of webpackages to upload from config
      var uploadWebpackages = grunt.config.get('workspaceConfig.uploadWebpackages');
      var i = 0;

      if (uploadWebpackages && uploadWebpackages.length) {
        // create upload list from config
        grunt.log.writeln('Webpackages to upload:');
        for (i = 0; i < uploadWebpackages.length; i++) {
          if (choices.indexOf(uploadWebpackages[i]) >= 0) {
            webpackages.push(uploadWebpackages[i]);
            grunt.log.writeln((i + 1) + ') ' + uploadWebpackages[i]);
          }
        }
        startUploads();
      } else {
        // get user decision
        choices.push('CANCEL');
        grunt.log.writeln('Please select all webpackages to upload ' +
            'or to CANCEL: ');
        for (i = 0; i < choices.length; i++) {
          grunt.log.writeln((i + 1) + ') ' + choices[i]);
        }
        var options = {
          questions: [
            {
              name: 'selectedWebpackages',
              type: 'input',
              message: 'Answer:'
            }
          ]
        };

        inquirer.prompt(options.questions).then(webpackagesSelected);
      }
    }
function (err, files) {
      if (err) {
        grunt.fail.fatal(err);
      }
      files.forEach(function (file) {
        var pathName = path.join(workspacePath, file);
        if (fs.statSync(pathName).isDirectory()) {
          if (file === activeWebpackage && choices.length > 0) {
            choices.splice(0, 0, file);
          } else {
            choices.push(file);
          }
        }
      });

      // get list of webpackages to upload from config
      var uploadWebpackages = grunt.config.get('workspaceConfig.uploadWebpackages');
      var i = 0;

      if (uploadWebpackages && uploadWebpackages.length) {
        // create upload list from config
        grunt.log.writeln('Webpackages to upload:');
        for (i = 0; i < uploadWebpackages.length; i++) {
          if (choices.indexOf(uploadWebpackages[i]) >= 0) {
            webpackages.push(uploadWebpackages[i]);
            grunt.log.writeln((i + 1) + ') ' + uploadWebpackages[i]);
          }
        }
        startUploads();
      } else {
        // get user decision
        choices.push('CANCEL');
        grunt.log.writeln('Please select all webpackages to upload ' +
            'or to CANCEL: ');
        for (i = 0; i < choices.length; i++) {
          grunt.log.writeln((i + 1) + ') ' + choices[i]);
        }
        var options = {
          questions: [
            {
              name: 'selectedWebpackages',
              type: 'input',
              message: 'Answer:'
            }
          ]
        };

        inquirer.prompt(options.questions).then(webpackagesSelected);
      }
    }
function ( err , files ) { if ( err ) { grunt . fail . fatal ( err ) ; } files . forEach ( function ( file ) { var pathName = path . join ( workspacePath , file ) ; if ( fs . statSync ( pathName ) . isDirectory ( ) ) { if ( file === activeWebpackage && choices . length > 0 ) { choices . splice ( 0 , 0 , file ) ; } else { choices . push ( file ) ; } } } ) ; // get list of webpackages to upload from config var uploadWebpackages = grunt . config . get ( 'workspaceConfig.uploadWebpackages' ) ; var i = 0 ; if ( uploadWebpackages && uploadWebpackages . length ) { // create upload list from config grunt . log . writeln ( 'Webpackages to upload:' ) ; for ( i = 0 ; i < uploadWebpackages . length ; i ++ ) { if ( choices . indexOf ( uploadWebpackages [ i ] ) >= 0 ) { webpackages . push ( uploadWebpackages [ i ] ) ; grunt . log . writeln ( ( i + 1 ) + ') ' + uploadWebpackages [ i ] ) ; } } startUploads ( ) ; } else { // get user decision choices . push ( 'CANCEL' ) ; grunt . log . writeln ( 'Please select all webpackages to upload ' + 'or to CANCEL: ' ) ; for ( i = 0 ; i < choices . length ; i ++ ) { grunt . log . writeln ( ( i + 1 ) + ') ' + choices [ i ] ) ; } var options = { questions : [ { name : 'selectedWebpackages' , type : 'input' , message : 'Answer:' } ] } ; inquirer . prompt ( options . questions ) . then ( webpackagesSelected ) ; } }
get all webpackages
get all webpackages