Skip to content

Instantly share code, notes, and snippets.

@goldsmith
Created August 15, 2014 22:06
Show Gist options
  • Select an option

  • Save goldsmith/85de1956e34ed93aec32 to your computer and use it in GitHub Desktop.

Select an option

Save goldsmith/85de1956e34ed93aec32 to your computer and use it in GitHub Desktop.

Revisions

  1. goldsmith created this gist Aug 15, 2014.
    23 changes: 23 additions & 0 deletions Gruntfile.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,23 @@
    grunt.registerTask('purgecdn', 'Purge MaxCDN pull zone', function() {
    var done = this.async();

    grunt.config.requires('maxcdn');
    var maxcdn = grunt.config('maxcdn');

    var api = new MaxCDN(
    maxcdn.companyAlias, maxcdn.consumerKey, maxcdn.consumerSecret
    );

    grunt.log.writeln('purging cache for Pull Zone #' + maxcdn.pullZoneId + '...');
    api.del('zones/pull.json/' + maxcdn.pullZoneId + '/cache', function callback(err, response) {
    if (err) {
    grunt.log.error(JSON.parse(err.data).error.message);
    done(false);
    return;
    }

    grunt.log.writeln('successfully purged!');
    done();
    });

    });