From 612b7f1e9fb87db8afaab24119c63d13e5a6fb24 Mon Sep 17 00:00:00 2001
From: Mathias Meyer <meyer@paperplanes.de>
Date: Wed, 7 Nov 2012 11:46:43 +0100
Subject: [PATCH] Switch to sentry for exceptions.

---
 Gemfile               |  2 +-
 Gemfile.lock          | 28 ++++++++++++++--------------
 lib/travis/api/app.rb |  6 +++++-
 3 files changed, 20 insertions(+), 16 deletions(-)

diff --git a/Gemfile b/Gemfile
index b0e46bfa..9ef26577 100644
--- a/Gemfile
+++ b/Gemfile
@@ -7,7 +7,7 @@ gem 'puma'
 gem 'travis-support', github: 'travis-ci/travis-support'
 gem 'travis-core',    github: 'travis-ci/travis-core'
 gem 'travis-sidekiqs', github: 'travis-ci/travis-sidekiqs', require: nil
-gem 'hubble',         github: 'roidrage/hubble'
+gem "sentry-raven",   github: 'getsentry/raven-ruby'
 gem 'yard-sinatra',   github: 'rkh/yard-sinatra'
 gem 'rack-contrib',   github: 'rack/rack-contrib'
 gem 'rack-cache',     '~> 1.2'
diff --git a/Gemfile.lock b/Gemfile.lock
index c13f1a34..20d20678 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -4,6 +4,16 @@ GIT
   specs:
     micro_migrations (0.0.1)
 
+GIT
+  remote: git://github.com/getsentry/raven-ruby.git
+  revision: 5d0e0eacbee39744bdf5b775efb3734d5b4361c7
+  specs:
+    sentry-raven (0.3)
+      faraday (~> 0.8.0.rc2)
+      hashie
+      multi_json (~> 1.0)
+      uuidtools
+
 GIT
   remote: git://github.com/rack/rack-contrib.git
   revision: b7e7c38fd02c3b5da91aa57af78b3f571c6ebcd0
@@ -30,14 +40,6 @@ GIT
     yard-sinatra (1.0.0)
       yard (~> 0.7)
 
-GIT
-  remote: git://github.com/roidrage/hubble.git
-  revision: f5e6301ac24eabeebaf8f4485d71cdcf93b2f3f8
-  specs:
-    hubble (0.1.2)
-      faraday
-      json (~> 1.6)
-
 GIT
   remote: git://github.com/travis-ci/travis-core.git
   revision: cb999efb7015007423d75df412f076f26d35b09d
@@ -149,6 +151,8 @@ GEM
     hashr (0.0.22)
     hike (1.2.1)
     hitimes (1.1.1)
+    hubble (0.1.2)
+      yajl-ruby (~> 1.1)
     i18n (0.6.1)
     journey (1.0.4)
     json (1.7.5)
@@ -223,11 +227,6 @@ GEM
     rspec-expectations (2.11.3)
       diff-lcs (~> 1.1.3)
     rspec-mocks (2.11.3)
-    sentry-raven (0.3.1)
-      faraday (~> 0.8.0.rc2)
-      hashie
-      multi_json (~> 1.0)
-      uuidtools
     sidekiq (2.5.2)
       celluloid (~> 0.12.0)
       connection_pool (~> 0.9.2)
@@ -266,6 +265,7 @@ GEM
       polyglot (>= 0.3.1)
     tzinfo (0.3.35)
     uuidtools (2.1.3)
+    yajl-ruby (1.1.0)
     yard (0.8.3)
 
 PLATFORMS
@@ -278,7 +278,6 @@ DEPENDENCIES
   factory_girl (~> 2.4.0)
   foreman
   gh!
-  hubble!
   micro_migrations!
   mocha (~> 0.12)
   pry
@@ -288,6 +287,7 @@ DEPENDENCIES
   rake (~> 0.9.2)
   rerun
   rspec (~> 2.11)
+  sentry-raven!
   travis-api!
   travis-core!
   travis-sidekiqs!
diff --git a/lib/travis/api/app.rb b/lib/travis/api/app.rb
index 3d32d35d..0bee284e 100644
--- a/lib/travis/api/app.rb
+++ b/lib/travis/api/app.rb
@@ -55,7 +55,7 @@ module Travis::Api
     def initialize
       @app = Rack::Builder.app do
         use Travis::Api::App::Cors
-        use Hubble::Rescuer, env: Travis.env, codename: ENV['CODENAME'] if Endpoint.production? && ENV['HUBBLE_ENDPOINT']
+        use Raven::Rack if Endpoint.production?
         use Rack::Protection::PathTraversal
         use Rack::SSL if Endpoint.production?
         use ActiveRecord::ConnectionAdapters::ConnectionManagement
@@ -109,6 +109,10 @@ module Travis::Api
         Sidekiq.configure_client do |config|
           config.redis = Travis.config.redis.merge(size: 1, namespace: Travis.config.sidekiq.namespace)
         end
+
+        Raven.configure do |config|
+          config.dsn = Travis.config.sentry.dsn
+        end if Travis.config.sentry
       end
 
       def self.load_endpoints