Octogate

Build Status Code Climate

Github hook proxy server of Sinatra Framework.

You can write about request destination in Ruby DSL

Installation

Add this line to your application's Gemfile:

gem 'octogate'

And then execute:

$ bundle

Or install it yourself as:

$ gem install octogate

Usage

Write config.rb.

token "token_string"

target "jenkins" do
  hook_type [:push, :pull_request]
  url "http://targethost.dev/job/CommitStage"
  http_method :get

  parameter_type :query
  params key1: "value1", key2: "value2"

  match -> {
    hook.ref =~ /master/
  }
end

target "jenkins2" do
  hook_type [:push, :pull_request]
  url "http://targethost2.dev/job/CommitStage"
  http_method :get

  parameter_type :json
  params key1: "value1", key2: "value2"

  match -> {
    !(hook.ref =~ /master/)
  }
end

And launch server.

% bundle exec octogate -h
Usage: octogate [options]
    -c config                        Set config file (default = ./config.rb)
    -p port                          Set port number (default = 4567)
    -o address                       Set address to bind (default = 0.0.0.0)

% bundle exec octogate -c config.rb
# => Endpoint is http://hostname:4567/token_string

Contributing

  1. Fork it ( https://github.com/joker1007/octogate/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request