grunt-webdav-deploy

Deploy your zipped code to your webdav directory for use with build systems such as bower

grunt-webdav-deploy

Deploy a zipped archive to your webdav repository for use with build systems such as bower

This plugin contains destructive default options.

This plugin requires Grunt ~0.4.1

Install the grunt-webdav-deploy plugin with this command:

npm install grunt-webdav-deploy --save-dev

Once the plugin has been installed, it may be enabled inside your Gruntfile with:

grunt.loadNpmTasks('grunt-webdav-deploy');

In your project's Gruntfile, add a section named webdav_deploy to the data object passed into grunt.initConfig().

grunt.initConfig({
  webdav_deploy: {
    options: {
      // Task-specific options go here. 
      snapshot_path : 'http://example.com/snapshot',
      release_path : 'http://example.com/version',
      baseDir : './'
      basic_auth: false,
      strategy : 'SNAPSHOT',
      snapshot_filename : 'SNAPSHOT',
      overwrite_release : false,
    },
    deploy: {
      // Target-specific file lists and/or options go here. 
      files: {
        src: ['a/file', 'a/directory', 'all/files/in/dir/*', '*glob*'],
      }
    },
  },
})

Type: String Default value: none Required: (release === SNAPSHOT)

A string value that defines the repository path for snapshots.

http and https are supported

Type: Boolean Default value: none Required: false

Basic auth of the form user:password@ is supported.

The username and password are expected to be available in the environment variables

WEBDAV_USER
WEBDAV_PASS

Differing release credentials can be set in

WEBDAV_RELEASE_USER
WEBDAV_RELEASE_PASS

Type: String Default value: none Required: (release === RELEASE)

A string value that defines the repository path for releases.

http and https are supported, as is inline basic auth of the form:

http(s)://user:password@

Type: String Default value: SNAPSHOT Required : false

The deployment strategy, SNAPSHOT or RELEASE

The current archive at ${snapshot_path}/${snapshot_filename}.zip will be removed and replaced

A value of RELEASE will produce an archive name-${VERSION}.zip where VERSION is taken from the module's package.json

Type: String Default value: SNAPSHOT Required : false

The generated filename on the repository when using the SNAPSHOT strategy.

A value of TIMESTAMP will produce a file name representing the current timestamp (new Date().getTime()).

Type String Default value: zip Required : false

The suffix for the generated zip file

Type String Default value : './' Required : 'false'

The root directory to base the created zip file from

Type: Boolean Default value: false Required: false

Whether the archive produced by the RELEASE strategy will be overwritten if it exists.

This is obviously destructive and will nag if set.

In this example, the contents of the dev directory are put into SNAPSHOT.zip on the remote webdav archive

grunt.initConfig({
  webdav: {
    options: {
      snapshot_path : 'http://example.com/incoming/snapshots/myrepo'
    },
    files: {
      'dev/**/*'
    },
  },
})

In this example, the contents of the production directory are put into mymodule-0.0.1.zip on the remote webdav archive

grunt.initConfig({
  webdav: {
    options: {
      release_path : 'me:user@https://example.com/incoming/releases/myrepo'
      strategy : 'RELEASE'
    },
    files: {
      'production/**/*'
    },
  },
})

Using the following package.json

{
  "name": "mymodule",
  "description": "An example of a module using the grunt-deploy-webdav plugin",
  "version": "0.0.1",
  ...
}

In lieu of a formal styleguide, take care to maintain the existing coding style. Lint and test your code using Grunt.

  • 0.1.0 Initial release to NPM
  • 0.1.1 Added support for baseDir
  • ...
  • 0.5.1 Fixed image compression issues with node-zip thanks @xeroply