grunt-ftp-diff-deployer

Incrementally push differences to FTP server.

grunt-ftp-diff-deployer

Incrementally push differences to FTP server.

This plugin requires Grunt ~0.4.1

If you haven't used Grunt before, be sure to check out the Getting Started guide, as it explains how to create a Gruntfile as well as install and use Grunt plugins. Once you're familiar with that process, you may install this plugin with this command:

npm install grunt-ftp-diff-deployer --save-dev

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

grunt.loadNpmTasks('grunt-ftp-diff-deployer');

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

grunt.initConfig({
  'ftp-diff-deployer': {
    options: {
      // Task-specific options go here. 
    },
    your_target: {
      // Target-specific file lists and/or options go here. 
    },
  },
});

All available options and default values.

{
  host: 'localhost',
  port: 21,
  auth: {
    username: '',
    password: ''
  },
  diff: 'simple',
  memory: './.grunt/grunt-ftp-diff-deployer/memory.{taskTarget}.json',
  exclude: [],
  reporter: 'simple', //{ simple | null } 
  src: null, //(Required) 
  dest: null, //(Required) 
  retry: 3
}

Type: String
Default value: localhost

FTP host to which the files will be uploaded.

Type: Number
Default value: 21

Port of the host to connect to.

Type: Object
Default value: { username: '', password: '' }

Object holding the credentials for the server. If username and password are both null, anonymous authentication will be used.

Type: String

Path to the source directory, containing the files that will be uploaded to the server.

Type: String

Path to the destination directory (on the server) where all the files will be uploaded.

Type: String[]
Default value: []

Array of patterns that will be used to exclude some files from the diff.

Type: String
Default value: simple
Possible values: simple

Diff method to use to compute the differences to upload to the server. For more informations, go to ftp-diff-deployer.

Simple diff method provides another option:

  • memory: Path to the file used to keep track of the uploaded files.

Type: String
Default value: simple
Possible values: simple, null

Type of reporter to use. For more informations, go to ftp-diff-deployer.

Type: Number
Default value: 3

Number of attempts to try before declaring failure and throwing an error.

In this example, we upload the directory www to the server ftp.example.com, providing username and password for authentication.

grunt.initConfig({
  'ftp-diff-deployer': {
    options: {},
    www: {
      options: {
        host: 'ftp.example.com',
        auth: {
          username: 'foo',
          password: 'bar'
        },
        src: 'www',
        dest: '/'
      }
    }
  }
});

In this example, we upload the directory www to the server ftp.example.com, providing username and password for authentication. All that annoying Thumbs.db files are excluded from the diff, and no output is shown.

grunt.initConfig({
  'ftp-diff-deployer': {
    options: {},
    www: {
      options: {
        host: 'ftp.example.com',
        auth: {
          username: 'foo',
          password: 'bar'
        },
        src: 'www',
        dest: '/',
        exclude: [ '[Tt]humbs.db' ],
        reporter: 'null'
      }
    }
  }
});

In this example, we upload the directory www to the server ftp.example.com, using anonymous authentication

grunt.initConfig({
  'ftp-diff-deployer': {
    options: {},
    www: {
      options: {
        host: 'ftp.example.com',
        src: 'www',
        dest: '/'
      }
    }
  }
});