Gump

安装Installation

在Gemfile中添加

Add this line to your application's Gemfile:

gem 'gump'

然后执行

And then execute:

$ bundle install

或者,你可以手动安装

Or install it yourself as:

$ gem install gump

使用Use

配置方式

只需以API开始注释,以DESCPARAMSRETURNGETPOST等标记注释行即可。

先创建一个待测试的项目,文件bigsword.ru

require "bigsword"

# API
# DESC gump hello
# PARAMS  name
# RETURN  string
# GET /hello/:name
get "/hello/:name" do
    "hello Gump! I'm #{params[:name]}"
end

# API
# DESC gump haha POST
# PARAMS  name
# RETURN  string
# POST /haha/:name
post "/haha/:name" do
    "haha Gump! I'm #{params[:name]},and this is post"
end

run Proc.new { |env| _call env }

先把这个项目跑起来

$ rackup bigsword.ru

再启动gump服务

由于我们使用到了puma来启动ruby服务,所以需要要gemfile里面添加gem "puma"

# gump  查看帮助
$ gump start

License

See the LICENSE.