Upload 10 files at a time, plus other minor changes #5

Closed
wants to merge 2 commits into
from

Projects

None yet

2 participants

Contributor
altano commented Jul 5, 2013
  • My editor stripped trailing spaces. Please forgive me :)
  • There were also some minor spacing/indentation inconsistencies I
    fixed.
  • Changed behavior to upload 10 files at a time instead of uploading
    each file one at a time. This drastically improves performance of
    the task.
  • Added maxNumberOfConcurrentUploads option which defaults to 10 to
    control the above behavior.
  • There were two 'latedef' entries in .jshintrc file. In addition to
    removing the redundant one, I sorted them to make such a future
    mistake less likely.
altano added some commits Jul 5, 2013
@altano altano Make 10 uploads at a time plus misc minor changes
- My editor stripped trailing spaces. Please forgive me :)
- There were also some minor spacing/indentation inconsistencies I
  fixed.
- Changed behavior to upload 10 files at a time instead of uploading
  each file one at a time.  This *drastically* improves performance of
  the task.
- Added maxNumberOfConcurrentUploads option which defaults to 10 to
  control the above behavior.
- There were two 'latedef' entries in .jshintrc file. In addition to
  removing the redundant one, I sorted them to make such a future
  mistake less likely.
bdc0788
@altano altano Remove maskBaseDir and destPrefix options
I've replaced the plugin's current technique of taking an array of
sources and options to generate the destination with support for the
standard Grunt source/destination mapping.

The maskBaseDir and destPrefix options required users to learn
options specific to this task that could be accomplished using Grunt's
standardized file mapping utilities instead. Allowing the user to use
Grunt's file configuration means:
    1. The user doesn't have to learn something new.
    2. The user can weild Grunt's much more powerful options.
    3. There is less code in the plugin.

For example, these are equivalent:

Old way, using makeBaseDir and destPrefix:

    css: {
      options: {
        destPrefix: '<%= pkg.version %>/'
        maskBaseDir: '../web/Content/'
      },
      src: ['../web/Content/**/*','!../web/Content/themes/**/*']
    }

New way, using standard Grunt conventions:

    css: {
      files: [{
        expand: true,
        cwd: '../web/Content',
        dest: '<%= pkg.version %>/',
        src: ['**/*', '!themes/**/*']
      }]
    }
15efc3d
Owner
jstott commented Jul 5, 2013

Completely agree with adding ConcurrentUploads - feature definitely required.

I like the better approach to source/destination mapping, but one feature becomes lost is maskBaseDir. In this case, the destination files maintain the file directory paths.

css: {
        files: [
            {
            expand: true,
            cwd: 'web/Content/',
            dest: '<%= pkg.version %>/',
            src: ['**/*', '!themes/**/*']
          }
        ]
      },

Will copy the content to the containerName prefix, but with paths intact:

azureblob:css - Create blob containter [assets] ...OK
        Copy index.css => assets/web/Content/index.css >> skip copy ok

The flatten:true option for files didn't strip the directory paths as I thought it might, so am currently looking into that (see if its me, syntax, or what)? Ultimately, I'd like to be able to mask off the directory layer, such that the file would be copied to "assets/index.css" vs "assets/web/Content/index.css".

Owner
jstott commented Jul 5, 2013

All is working as expected - will push shortly. Excellent, thank you!

Contributor
altano commented Jul 5, 2013

Hah, great. I was just writing a reply trying to figure out why it was working on my end but not yours. In short, for anyone else in the future who is reading this, 'cwd' is supposed to act as maskBaseDir and all destinations are relative to the path provided in cwd, without including cwd.

Also, Jim, my apologies, I didn't realize checking in again would pollute this pull request. I was planning on making a second pull request with the second set of changes. If you'd like, I can try to make a second, clean pull request that doesn't contain the removal of maskBaseDir and destPrefix and close this pull request, if you'd like to treat these changes as separate pull requests?

@altano altano closed this Jul 5, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment