Ruby Shell Makefile
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
bintest
etc
mrblib
test
tools/acli
.gitignore
.travis.yml
CHANGELOG.md
DOWNLOADS.md
Dockerfile
Makefile
README.md
Rakefile
build_config.rb
build_config_travis.rb
docker-compose.yml
get_macos_sdk.sh
mrbgem.rake
travis-install-libressl.sh
travis-install-wslay.sh

README.md

Build Status

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)

  • for benchmarking.

Sponsored by Evil Martians

Installation

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.

Usage

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.

Other commands:

# 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

TODO

  • Support HTTP headers

  • Reconnect support

  • Output formatters (and colorize)

Scenarios

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.

Development

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 rake test.

Requirements:

  • libtls (brew install libressl)

  • wslay (brew install wslay)

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/palkan/acli.

License

The gem is available as open source under the terms of the MIT License.