From b8d73018b4a674594d76957a6ea97e74f9784c44 Mon Sep 17 00:00:00 2001 From: Konstantin Raev Date: Mon, 21 Apr 2014 01:08:30 +1200 Subject: [PATCH] some documentation --- README.md | 64 +++++++++++++++++++++++++++++++++++++++++++++++--- package.json | 66 ++++++++++++++++++++++++++-------------------------- 2 files changed, 94 insertions(+), 36 deletions(-) diff --git a/README.md b/README.md index 2b9298a..2dc389e 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,62 @@ -gulp-deploy-azure-cdn -===================== +# deploy-azure-cdn -Gulp task to deploy assets to azure CDN +A node package for copying a directory to Azure CDN storage. +Also it provides a gulp plugin interface for easy deploy with (gulp)[http://gulpjs.com/] + +Azure SDK uses by default the environment variables AZURE_STORAGE_ACCOUNT and AZURE_STORAGE_ACCESS_KEY. +Custom connection arguments can be set in options. + +## Installing + +``` +npm install deploy-azure-cdn +``` + +## Exported interface + +- gulpPlugin: function(deployOptions) - to use with gulp +- vanilla: function(deployOptions, files, logger, cb) - to use directly in node.js + +parameters: +- deployOptions - azure cdn and upload configs + - serviceOptions: [] - custom arguments to azure.createBlobService + - containerName: null - container name, required + - containerOptions: {publicAccessLevel: "blob"} - container options + - folder: '', // path within container. Default is root directory of container + - deleteExistingBlobs: true, // set it to false to skip recursive deleting blobs in folder + - concurrentUploadThreads : 10, // number of concurrent uploads, choose best for your network condition + - gzip: false, // true if want to gzip the files before uploading. File will be zipped only if compressed file is smaller than original + - metadata: {cacheControl: 'public, max-age=31556926'} // metadata for each uploaded file + - testRun: false, // set to true if you just want to check connectivity and see deployment logs. No blobs will be removed or uplaoded. +- files: [] - array of files objects to be deployed + - cwd - current working directory path + - path - absolute path of file +- logger - logger compatible with gutil.log(param1, param2...) +- cb - node callback + + +## Using in Gulp example +```javascript +var deployCdn = require('gulp-deploy-azure-cdn'); + +gulp.task('upload-app-to-azure', function () { + return gulp.src(['build/**/*'], { + cwd: 'build' + }).pipe(deployCdn.gulpPlugin({ + containerName: 'test', + serviceOptions: ['', ''], + folder: 'build-0.0.1/', + zip: true, + deleteExistingBlobs: true, + metadata: { + cacheControl: 'public, max-age=31530000', // cache in browser + cacheControlHeader: 'public, max-age=31530000' // cache in azure CDN. As this data does not change, we set it to 1 year + } + })) +}); + +``` + +## Grunt plugin +See my other repository: https://github.com/bestander/grunt-azure-cdn-deploy. +Code is very similar but less structured. \ No newline at end of file diff --git a/package.json b/package.json index 8505b49..4a692e4 100644 --- a/package.json +++ b/package.json @@ -1,35 +1,35 @@ { - "name": "gulp-deploy-azure-cdn", - "version": "0.1.0", - "description": "A gulp task to deploy assets to Windows Azure CDN", - "main": "index.js", - "scripts": { - "test": "echo \"Error: no test specified\" && exit 1" - }, - "repository": { - "type": "git", - "url": "git://github.com/bestander/gulp-deploy-azure-cdn.git" - }, - "keywords": [ - "gulpplugin", - "azure", - "deployment", - "cdn", - "upload" - ], - "author": "Konstantin Raev", - "license": "MIT", - "bugs": { - "url": "https://github.com/bestander/gulp-deploy-azure-cdn/issues" - }, - "homepage": "https://github.com/bestander/gulp-deploy-azure-cdn", - "dependencies": { - "azure": "^0.8.1", - "mime": "^1.2.11", - "gulp-util": "^2.2.14", - "through2": "^0.4.1", - "q": "^1.0.1", - "node.extend": "^1.0.10", - "async": "^0.6.1" - } + "name": "deploy-azure-cdn", + "version": "0.1.1", + "description": "A package that deploys a groupt of files to Azure CDN. Can be used with gulp.", + "main": "index.js", + "repository": { + "type": "git", + "url": "git://github.com/bestander/deploy-azure-cdn.git" + }, + "keywords": [ + "gulp", + "gulpfriendly", + "gulpplugin", + "azure", + "deployment", + "cdn", + "upload" + + ], + "author": "Konstantin Raev", + "license": "MIT", + "bugs": { + "url": "https://github.com/bestander/deploy-azure-cdn/issues" + }, + "homepage": "https://github.com/bestander/deploy-azure-cdn", + "dependencies": { + "azure": "^0.8.1", + "mime": "^1.2.11", + "gulp-util": "^2.2.14", + "through2": "^0.4.1", + "q": "^1.0.1", + "node.extend": "^1.0.10", + "async": "^0.6.1" + } }