tasks/dropbox.js
function createUploadPromise(filepath, destination, options) {
    return function () {
      // get the name of the file and construct the url for uploading it
      var filename = getFilename(filepath),
        dropboxPath = destination + (options.version_name ? ("/" + options.version_name + "/") : "/") + filepath,
        // read the file and start the upload, decrementing the in-flight count when complete
        // Use encoding = null to keep the file as a Buffer
        reqOptions = {
          access_token: options.access_token,
          dropboxPath: dropboxPath,
          fileBuffer: grunt.file.read(filepath, { encoding : null })
        };

      grunt.log.writeln("Uploading " + filepath + " to " + dropboxPath + "...");

      // return the upload promise
      return dropboxClient.upload(reqOptions);
    };
  }
function createUploadPromise(filepath, destination, options) {
    return function () {
      // get the name of the file and construct the url for uploading it
      var filename = getFilename(filepath),
        dropboxPath = destination + (options.version_name ? ("/" + options.version_name + "/") : "/") + filepath,
        // read the file and start the upload, decrementing the in-flight count when complete
        // Use encoding = null to keep the file as a Buffer
        reqOptions = {
          access_token: options.access_token,
          dropboxPath: dropboxPath,
          fileBuffer: grunt.file.read(filepath, { encoding : null })
        };

      grunt.log.writeln("Uploading " + filepath + " to " + dropboxPath + "...");

      // return the upload promise
      return dropboxClient.upload(reqOptions);
    };
  }
function createUploadPromise ( filepath , destination , options ) { return function ( ) { // get the name of the file and construct the url for uploading it var filename = getFilename ( filepath ) , dropboxPath = destination + ( options . version_name ? ( "/" + options . version_name + "/" ) : "/" ) + filepath , // read the file and start the upload, decrementing the in-flight count when complete // Use encoding = null to keep the file as a Buffer reqOptions = { access_token : options . access_token , dropboxPath : dropboxPath , fileBuffer : grunt . file . read ( filepath , { encoding : null } ) } ; grunt . log . writeln ( "Uploading " + filepath + " to " + dropboxPath + "..." ) ; // return the upload promise return dropboxClient . upload ( reqOptions ) ; } ; }
returns a function that creates a promise to upload the file to the destination
returns a function that creates a promise to upload the file to the destination