hoptoad_notifier 2.4.10 → 2.4.11

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -155,7 +155,7 @@ end
155
155
 
156
156
  LOCAL_GEM_ROOT = File.join(GEM_ROOT, 'tmp', 'local_gems').freeze
157
157
  RAILS_VERSIONS = IO.read('SUPPORTED_RAILS_VERSIONS').strip.split("\n")
158
- LOCAL_GEMS = [['sham_rack', nil], ['capistrano', nil], ['sqlite3-ruby', nil], ['sinatra', nil]] +
158
+ LOCAL_GEMS = [['sham_rack', nil], ['capistrano', nil], ['sqlite3-ruby', nil], ['sinatra', nil], ['rake', '0.8.7']] +
159
159
  RAILS_VERSIONS.collect { |version| ['rails', version] }
160
160
 
161
161
  desc "Vendor test gems: Run this once to prepare your test environment"
@@ -10,3 +10,5 @@
10
10
  3.0.3
11
11
  3.0.4
12
12
  3.0.5
13
+ 3.0.6
14
+ 3.0.7
@@ -1,4 +1,5 @@
1
1
  require 'builder'
2
+ require 'socket'
2
3
 
3
4
  module HoptoadNotifier
4
5
  class Notice
@@ -65,6 +66,9 @@ module HoptoadNotifier
65
66
  # A URL for more information about the notifier library sending this notice
66
67
  attr_reader :notifier_url
67
68
 
69
+ # The host name where this error occurred (if any)
70
+ attr_reader :hostname
71
+
68
72
  def initialize(args)
69
73
  self.args = args
70
74
  self.exception = args[:exception]
@@ -95,6 +99,8 @@ module HoptoadNotifier
95
99
  "#{exception.class.name}: #{exception.message}"
96
100
  end
97
101
 
102
+ self.hostname = local_hostname
103
+
98
104
  also_use_rack_params_filters
99
105
  find_session_data
100
106
  clean_params
@@ -153,6 +159,7 @@ module HoptoadNotifier
153
159
  notice.tag!("server-environment") do |env|
154
160
  env.tag!("project-root", project_root)
155
161
  env.tag!("environment-name", environment_name)
162
+ env.tag!("hostname", hostname)
156
163
  end
157
164
  end
158
165
  xml.to_s
@@ -185,7 +192,7 @@ module HoptoadNotifier
185
192
  :backtrace_filters, :parameters, :params_filters,
186
193
  :environment_filters, :session_data, :project_root, :url, :ignore,
187
194
  :ignore_by_filters, :notifier_name, :notifier_url, :notifier_version,
188
- :component, :action, :cgi_data, :environment_name
195
+ :component, :action, :cgi_data, :environment_name, :hostname
189
196
 
190
197
  # Arguments given in the initializer
191
198
  attr_accessor :args
@@ -333,5 +340,9 @@ module HoptoadNotifier
333
340
  end
334
341
  end
335
342
 
343
+ def local_hostname
344
+ Socket.gethostname
345
+ end
346
+
336
347
  end
337
348
  end
@@ -59,7 +59,7 @@ module HoptoadNotifier
59
59
  url << ":#{request.port}"
60
60
  end
61
61
 
62
- url << request.request_uri
62
+ url << request.fullpath
63
63
  url
64
64
  end
65
65
  end
@@ -1,3 +1,3 @@
1
1
  module HoptoadNotifier
2
- VERSION = "2.4.9".freeze
2
+ VERSION = "2.4.11".freeze
3
3
  end
@@ -112,6 +112,8 @@ class ActionControllerCatcherTest < Test::Unit::TestCase
112
112
  controller.stubs(:rescue_action_in_public_without_hoptoad)
113
113
  opts[:request].query_parameters = opts[:request].query_parameters.merge(opts[:params] || {})
114
114
  opts[:request].session = ActionController::TestSession.new(opts[:session] || {})
115
+ # Prevents request.fullpath from crashing Rails in tests
116
+ opts[:request].env['REQUEST_URI'] = opts[:request].request_uri
115
117
  controller.process(opts[:request], opts[:response])
116
118
  controller
117
119
  end
@@ -55,6 +55,11 @@ class NoticeTest < Test::Unit::TestCase
55
55
  assert_equal url, notice.url
56
56
  end
57
57
 
58
+ should "set the host name" do
59
+ notice = build_notice
60
+ assert_equal hostname, notice.hostname
61
+ end
62
+
58
63
  should "accept a backtrace from an exception or hash" do
59
64
  array = ["user.rb:34:in `crazy'"]
60
65
  exception = build_exception
@@ -241,6 +246,7 @@ class NoticeTest < Test::Unit::TestCase
241
246
 
242
247
  assert_valid_node(@document, "//server-environment/project-root", "RAILS_ROOT")
243
248
  assert_valid_node(@document, "//server-environment/environment-name", "RAILS_ENV")
249
+ assert_valid_node(@document, "//server-environment/hostname", hostname)
244
250
  end
245
251
  end
246
252
 
@@ -421,7 +427,7 @@ class NoticeTest < Test::Unit::TestCase
421
427
  end
422
428
 
423
429
  def assert_valid_notice_document(document)
424
- xsd_path = File.join(File.dirname(__FILE__), "hoptoad_2_0.xsd")
430
+ xsd_path = File.join(File.dirname(__FILE__), "hoptoad_2_2.xsd")
425
431
  schema = Nokogiri::XML::Schema.new(IO.read(xsd_path))
426
432
  errors = schema.validate(document)
427
433
  assert errors.empty?, errors.collect{|e| e.message }.join
@@ -445,4 +451,9 @@ class NoticeTest < Test::Unit::TestCase
445
451
  ["app/models/user.rb:13:in `magic'",
446
452
  "app/controllers/users_controller.rb:8:in `index'"]
447
453
  end
454
+
455
+ def hostname
456
+ `hostname`.chomp
457
+ end
458
+
448
459
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hoptoad_notifier
3
3
  version: !ruby/object:Gem::Version
4
- hash: 11
4
+ hash: 9
5
5
  prerelease:
6
6
  segments:
7
7
  - 2
8
8
  - 4
9
- - 10
10
- version: 2.4.10
9
+ - 11
10
+ version: 2.4.11
11
11
  platform: ruby
12
12
  authors:
13
13
  - thoughtbot, inc
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-05-03 00:00:00 Z
18
+ date: 2011-05-26 00:00:00 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  name: builder