gerrit-stream
basic stream wrapper for gerrit
Last updated 8 years ago by fivetanley .
MIT · Repository · Original npm · Tarball · package.json
$ cnpm install gerrit-stream 
SYNC missed versions from official npm registry.

GerritStream

A minimal wrapper for getting information out of gerrit's stream-events SSH hook.

API

First, you'll need a GerritProcess to work with:

GerritProcess

constructor( host, [,port], [,gerritCommand] )

port defaults to gerrit's default (29418 ) if not provided.

gerritCommand defaults to stream-events if not provided.

var GerritProcess = require( 'gerrit-stream' ).GerritProcess
  , gerritProcess = new GerritProcess( host )

GerritStream

A GerritStream can have many "subscribers", or writable Streams listen to data passed into it from the GerritProcess. If you pass in a subscribing Stream, note you'll be getting the raw Buffer back from the process.

You'll need to pass gerritProcess.stdout to the GerritStream constructor. If you use stderror or stdin for some reason, just pass that in instead.

constructor( gerritProcess )

var gerritStream = new GerritStream( gerritProcess.stdout )

addSubscriber( stream )

Adds a subscriber stream to listen for data events on the GerritStream.

gerritStream.addSubscriberStream

removeSubscriber( stream )

Removes a subscriber Stream. Stops the GerritStream instance from calling write on the subscriber Stream.

Utility Functions

This library includes a few helper functions that generate JSONStreams.

var stream = require( 'gerrit-process' ).JSONStreams.eventName

Any of the JSONStreams sort based on the type key in the root of the JSON document. { "type": "changeset-restored" } maps to JSONStreams.changesetRestored

List of JSONStreams available on JSONStreams:

  • patchsetCreated
  • changeAbandoned
  • changeRestored
  • changeAbandoned
  • changeRestored
  • changeMerged
  • commentAdded
  • refUpdated

Current Tags

  • 0.0.1                                ...           latest (8 years ago)

1 Versions

  • 0.0.1                                ...           8 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 1
Last Day 0
Last Week 0
Last Month 0
Dependencies (1)
Dev Dependencies (3)

Copyright 2014 - 2016 © taobao.org |