flpjck/flapjack — pull request #466 by damncabbage (2014-04-01 18:57:21+00:00)
Title: CLI utility for submission of arbitrary events as JSON

(Intended to address #408.)

This PR adds `bin/flapjack-feed-events`, which feeds once-off and streams of JSON-encoded events into the `events` queue for Flapjack to process.

It uses the [yajl-ruby library for SAX-like JSON parsing](https://github.com/brianmario/yajl-ruby#parsing), which means we can have the script handle both one-shots and long-running streams in the same way; in both cases, it parses until the STDIN pipe closes or the file ends.

```
Usage: bin/flapjack-feed-events [OPTIONS]

Options
-c, --config [PATH] PATH to the config file to use.
-f, --from [FILE] path to the FILE to process; if not provided,
defaults to STDIN.
```

Caveat: The Cucumber features written for this are a little rubbish. I can't for the life of me figure out how come up with a sane way of passing expected output that contains quotes (eg. JSON) to a `Then` line; suggestions welcome. :grimacing: