Project

webcommand

0.0
No release in over 3 years
Low commit activity in last 3 years
Runs commands from a webpage
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 2.0
>= 0
>= 0
~> 13.0
~> 3.0

Runtime

~> 1.0
~> 2.1.0
~> 2.0.7
~> 0.20.3
~> 0.9.0
 Project Readme

Webcommand

Build Status Maintainability Test Coverage

Webcommand lets you run commands through a Web API

Installation

Add this line to your application's Gemfile:

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.

# 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:

curl -X POST http://localhost:3000/executions \
-d '{"command": "hehe", "params": { "name": "Annie", "state": "Ok"} }' \
-H "Content-Type: application/json"

#=> {"stdout":"Annie, 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.