0.1.0 • Published 9 years ago

grunt-pusher v0.1.0

Weekly downloads
1
License
MIT
Repository
github
Last release
9 years ago

grunt-pusher

Send events through Pusher

Getting Started

If you haven't used grunt before, be sure to check out the Getting Started guide.

From the same directory as your project's Gruntfile and package.json, install this plugin with the following command:

npm install grunt-pusher --save-dev

Once that's done, add this line to your project's Gruntfile:

grunt.loadNpmTasks('grunt-pusher');

If the plugin has been installed correctly, running grunt --help at the command line should list the newly-installed plugin's task or tasks. In addition, the plugin should be listed in package.json as a devDependency, which ensures that it will be installed whenever the npm install command is run.

The "pusher" task

Overview

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

grunt.initConfig({
  pusher: {
    options: {
      // Task-specific options go here.
    },
    your_target: {
      // Target-specific options go here.
    },
  },
})

Options

options.appId

Type: String

Your Pusher application id

options.secret

Type: String

Your Pusher application secret

options.key

Type: String

Your Pusher application key

options.channel

Type: String|Array

The channel (or channels) to send the event to

options.event

Type: String

The event name

options.payload

Type: Object Default value: {}

The payload to send with the event

Usage Examples

Default Options

In this example, the bar event is sent through the foo channel with an empty payload.

pusher: {
  options: {
    appId: "my-pusher-app-id",
    secret: "my-pusher-app-secret",
    key: "my-pusher-app-key"
  },
  main: {
    options: {
      channel: "foo",
      event: "bar"
    }
  }
}

Contributing

In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code using grunt.

Release History

  • 2014-11-27   v0.1.0   Initial release.