Action Cable CLI
ACLI is Action Cable command line interface written in mRuby.
It's a standalone binary which can be used:
in development to play with Action Cable channels (instead of struggling with browsers)
for acceptance testing (see Scenarios)
Checkout Downloads page for pre-compiled binaries.
Currently only MacOS (x86_64) and Linux (x86_64) are supported. PRs are welcomed for other platforms support.
We're also working on the Homebrew formula.
ACLI is an interactive tool by design, i.e. it is asking you for input if neccessary. Just run it without any arguments:
acli Enter URL: # After successful connection you receive a message: Connected to Action Cable at http://example.com/cable
Then you can run Action Cable commands:
# Subscribe to channel (without parameters) \s channel_name # Subscribe to channel with params \s+ channel_name id:1 # or interactively \s+ Enter channel ID: ... # Generate params object by providing keys and values one by one Enter key (or press ENTER to finish): ... Enter value: # After successful subscription you receive a message Subscribed to channel_name # Performing actions \p speak message:Hello! # or interactively (the same way as \s+) \p+
You can also provide URL and channel info using CLI options:
acli -u http://example.com/cable -c channel_name
You can pass channel params this way for now.
# Print help \? # Quit \q
Other command line options:
# Print usage acli -h # Print version acli -v # Quit after M incoming messages acli -u http://example.com/cable -c channel_name -m M
Support HTTP headers
Output formatters (and colorize)
Work in progress
Although ACLI has been designed to be an interactive tool, it would be great to have some automation. And here come scenarios.
Consider an example:
# Commands - subscribe: "echo" - perform: action: "ping" # Expectations - receive: data: message: "pong"
and another one:
# Commands - subscribe: "clock" # Expectations - receive: data: message: /Current time is .*/ timeout: 2 # repeat this step 5 times multiplier: 5
Running ACLI with scenario:
acli -u localhost -s echo.yml
The exit code is 0 if the scenario passes and 1 otherwise. So it can be used for black-box testing.
ACLI is built on top of mruby-cli, so it comes with Docker environment configuration.
You can run
docker-compose run compile or
docker-compose run test.
You can also build the project locally (on MacOS or Linux):
rake compile or
Bug reports and pull requests are welcome on GitHub at https://github.com/palkan/acli.
The gem is available as open source under the terms of the MIT License.