taps 0.3.20 → 0.3.21

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/VERSION.yml +1 -1
  2. data/lib/taps/server.rb +12 -8
  3. metadata +2 -2
@@ -2,4 +2,4 @@
2
2
  :build:
3
3
  :major: 0
4
4
  :minor: 3
5
- :patch: 20
5
+ :patch: 21
@@ -1,14 +1,9 @@
1
- require 'hoptoad_notifier'
2
1
  require 'sinatra/base'
3
2
  require 'taps/config'
4
3
  require 'taps/utils'
5
4
  require 'taps/db_session'
6
5
  require 'taps/data_stream'
7
6
 
8
- HoptoadNotifier.configure do |config|
9
- config.api_key = ENV["HOPTOAD_API_KEY"]
10
- end
11
-
12
7
  module Taps
13
8
  class Server < Sinatra::Base
14
9
  use Rack::Auth::Basic do |login, password|
@@ -18,8 +13,17 @@ class Server < Sinatra::Base
18
13
  use Rack::Deflater unless ENV['NO_DEFLATE']
19
14
 
20
15
  error do
21
- HoptoadNotifier.notify(e)
22
16
  e = request.env['sinatra.error']
17
+ begin
18
+ require 'hoptoad_notifier'
19
+ HoptoadNotifier.configure do |config|
20
+ config.api_key = ENV["HOPTOAD_API_KEY"]
21
+ end
22
+ HoptoadNotifier.notify(e)
23
+ rescue LoadError
24
+ puts "An error occurred but Hoptoad was not notified. To use Hoptoad, please"
25
+ puts "install the 'hoptoad_notifier' gem and set ENV[\"HOPTOAD_API_KEY\"]"
26
+ end
23
27
  if e.kind_of?(Taps::BaseError)
24
28
  content_type "application/json"
25
29
  halt 412, { 'error_class' => e.class.to_s, 'error_message' => e.message, 'error_backtrace' => e.backtrace.join("\n") }.to_json
@@ -30,8 +34,8 @@ class Server < Sinatra::Base
30
34
 
31
35
  before do
32
36
  major, minor, patch = request.env['HTTP_TAPS_VERSION'].split('.') rescue []
33
- unless "#{major}.#{minor}" == Taps.compatible_version && patch.to_i >= 14
34
- halt 417, "Taps >= v#{Taps.compatible_version}.14 is required for this server"
37
+ unless "#{major}.#{minor}" == Taps.compatible_version && patch.to_i >= 20
38
+ halt 417, "Taps >= v#{Taps.compatible_version}.20 is required for this server"
35
39
  end
36
40
  end
37
41
 
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: taps
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.3.20
5
+ version: 0.3.21
6
6
  platform: ruby
7
7
  authors:
8
8
  - Ricardo Chimal, Jr.
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2011-03-23 00:00:00 -04:00
13
+ date: 2011-03-25 00:00:00 -04:00
14
14
  default_executable:
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency