Octogate

Gem Version 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

Requirements

  • Ruby-2.0.0 or later

Usage

Write config.rb.

token "token_string"

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

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

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

target "json_params" do
  hook_type [:push, :pull_request]
  url "http://targethost.dev/job/JobName"
  http_method :post

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

  match ->(event) {
    event.ref =~ /json_params/
  }
end

More sample is hear

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

Event Capability

  • Push Event
  • PullRequest Event

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