Webcommand

Build Status Maintainability Test Coverage

Webcommand lets you run commands through a Web API

Installation

Add this line to your application’s Gemfile:

ruby gem 'webcommand'

And then execute:

$ bundle

Or install it yourself as:

$ gem install webcommand

Usage

Create a config file specifying the commands you want to expose with the permitted params. yaml # my_config.yml commands: hello_world: # Parameter without validations command: 'echo "Hello {{world}}"' hehe: command: 'echo "{{name}}, are you {{state}}?"' params: # Validation can be configured with any REGEXP name: '^[a-zA-Z]+$' state: '^\S+$'

Run the webserver with the cli (OBS: See the webcommand help server for additional options):

WEBCOMMAND_CONFIGURATION=./my_config.yml webcommand server --port 3000

After that you can execute your commands throught the web api:

```sh curl -X POST http://localhost:3000/executions \ -d ‘“hehe”, “params”: { “name”: “Annie”, “state”: “Ok” }’ \ -H “Content-Type: application/json”

=> are you Ok?\n”,”stderr”:””,”exit_status”:0%

```

With Rails

…TODO…

With Docker

…TODO…

Contributing

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

License

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