Skip to content

Commit

Permalink
Merge branch 'release/v1.1.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
Flink committed Oct 23, 2014
2 parents fec3458 + daeff64 commit 4019780
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 11 deletions.
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -15,3 +15,4 @@ spec/reports
test/tmp
test/version_tmp
tmp
tags
10 changes: 6 additions & 4 deletions README.md
@@ -1,6 +1,6 @@
# lita-gitlab-ci-hipchat

[![Build Status](https://travis-ci.org/Flink/lita-gitlab-ci-hipchat.svg?branch=develop)](https://travis-ci.org/Flink/lita-gitlab-ci-hipchat) [![Coverage Status](https://coveralls.io/repos/Flink/lita-gitlab-ci-hipchat/badge.png?branch=develop)](https://coveralls.io/r/Flink/lita-gitlab-ci-hipchat?branch=develop)
[![Gem Version](https://badge.fury.io/rb/lita-gitlab-ci-hipchat.svg)](http://badge.fury.io/rb/lita-gitlab-ci-hipchat) [![Build Status](https://travis-ci.org/Flink/lita-gitlab-ci-hipchat.svg?branch=develop)](https://travis-ci.org/Flink/lita-gitlab-ci-hipchat) [![Coverage Status](https://coveralls.io/repos/Flink/lita-gitlab-ci-hipchat/badge.png?branch=develop)](https://coveralls.io/r/Flink/lita-gitlab-ci-hipchat?branch=develop) [![Code Climate](https://codeclimate.com/github/Flink/lita-gitlab-ci-hipchat/badges/gpa.svg)](https://codeclimate.com/github/Flink/lita-gitlab-ci-hipchat) [![Dependency Status](https://gemnasium.com/Flink/lita-gitlab-ci-hipchat.svg)](https://gemnasium.com/Flink/lita-gitlab-ci-hipchat)

Receive and display nicely web hooks from GitLab CI in HipChat.

Expand All @@ -9,25 +9,27 @@ Receive and display nicely web hooks from GitLab CI in HipChat.
Add lita-gitlab-ci-hipchat to your Lita instance's Gemfile:

``` ruby
gem 'lita-gitlab-ci-hipchat'
gem 'lita-gitlab-ci-hipchat', '~> 1.1'
```


For Lita 3.x, use the 1.0 version of this gem.

## Configuration

```ruby
Lita.configure do |config|
# The API token for your bot’s user
config.handlers.gitlab_ci_hipchat.api_token = 'token'
# The room to be notified (HipChat name, not JID)
config.handlers.gitlab_ci_hipchat.room = 'my_room'
config.handlers.gitlab_ci_hipchat.room = 'my_room'
end
```

## Usage

This handler add a HTTP route at `/gitlab-ci`. So you have to add a web
hook pointing to that URL (http://lita-bot.tld/gitlab-ci).
hook pointing to that URL in GitLab CI (http://lita-bot.tld/gitlab-ci).

## License

Expand Down
10 changes: 6 additions & 4 deletions lib/lita/handlers/gitlab_ci_hipchat.rb
@@ -1,10 +1,12 @@
module Lita
module Handlers
class GitlabCiHipchat < Handler
http.post '/gitlab-ci', :receive
class GitlabCiHipchat
extend Lita::Handler::HTTPRouter

def self.default_config(config)
end
config :api_token, type: String, required: true
config :room, type: String, required: true

http.post '/gitlab-ci', :receive

def receive(request, response)
json_data = JSON.parse(request.body.read)
Expand Down
4 changes: 2 additions & 2 deletions lita-gitlab-ci-hipchat.gemspec
@@ -1,6 +1,6 @@
Gem::Specification.new do |spec|
spec.name = "lita-gitlab-ci-hipchat"
spec.version = "1.0.0"
spec.version = "1.1.0"
spec.authors = ["Loïc Guitaut"]
spec.email = ["flink@belfalas.eu"]
spec.description = %q{Receive and display nicely web hooks from GitLab CI in HipChat.}
Expand All @@ -14,7 +14,7 @@ Gem::Specification.new do |spec|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
spec.require_paths = ["lib"]

spec.add_runtime_dependency "lita", ">= 3.3"
spec.add_runtime_dependency "lita", "~> 4.0"
spec.add_runtime_dependency "hipchat", "~> 1.3.0"

spec.add_development_dependency "bundler", "~> 1.3"
Expand Down
2 changes: 1 addition & 1 deletion spec/lita/handlers/gitlab_ci_hipchat_spec.rb
@@ -1,7 +1,7 @@
require "spec_helper"

describe Lita::Handlers::GitlabCiHipchat, lita_handler: true do
it { routes_http(:post, '/gitlab-ci').to(:receive) }
it { is_expected.to route_http(:post, '/gitlab-ci').to(:receive) }

describe '#receive(request, response)' do
let(:request) { double(Rack::Request) }
Expand Down
2 changes: 2 additions & 0 deletions spec/spec_helper.rb
Expand Up @@ -9,3 +9,5 @@
require 'fabrication'
require "lita-gitlab-ci-hipchat"
require "lita/rspec"
Lita.version_3_compatibility_mode = false

0 comments on commit 4019780

Please sign in to comment.