rollbar 1.2.11 → 1.2.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +8 -0
- data/README.md +2 -2
- data/THANKS.md +2 -0
- data/lib/rollbar/rake.rb +32 -6
- data/lib/rollbar/truncation/frames_strategy.rb +10 -10
- data/lib/rollbar/truncation/min_body_strategy.rb +7 -7
- data/lib/rollbar/util/hash.rb +24 -0
- data/lib/rollbar/util.rb +17 -17
- data/lib/rollbar/version.rb +1 -1
- data/lib/rollbar.rb +4 -1
- data/rollbar.gemspec +1 -0
- data/spec/rollbar/rake_spec.rb +34 -0
- data/spec/rollbar/truncation/frames_strategy_spec.rb +11 -11
- data/spec/rollbar/truncation/min_body_strategy_spec.rb +16 -16
- data/spec/rollbar/truncation/strings_strategy_spec.rb +14 -14
- data/spec/rollbar/util/hash_spec.rb +22 -0
- data/spec/support/fixture_helpers.rb +0 -17
- data/spec/support/shared_contexts.rb +1 -1
- metadata +21 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d7d45f060a4cd05cfc90f7594dea1826eb5d7e0f
|
4
|
+
data.tar.gz: 0c877c9d5dab1ccdade96748f28cf7268e03865c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3b87159bca2a58f15dbb5550d7861b5a80209cb2ce62b624559e3a6f7ff768110fec7e9a379ad9e7943dfcc9af3910cafb1ce49a32eca101f1b7295544fbe036
|
7
|
+
data.tar.gz: e3050f14f5a86a5773368cb424762c05e930a125da0d35fe92535553261a649acb7118250b48711fad800453a9c6380dc6fb5be6ba4b7099af8b10b967b9e4c8
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,13 @@
|
|
1
1
|
# Change Log
|
2
2
|
|
3
|
+
## 1.2.12
|
4
|
+
|
5
|
+
Bug fixes:
|
6
|
+
|
7
|
+
- Fix bug introduced in 1.2.11 that broke the sidekiq async handler. See [#190](https://github.com/rollbar/rollbar-gem/issues/190)
|
8
|
+
- Skip Rake monkeypatch for Rake < 0.9.0. Fixes [#187](https://github.com/rollbar/rollbar-gem/issues/187)
|
9
|
+
|
10
|
+
|
3
11
|
## 1.2.11
|
4
12
|
|
5
13
|
New features:
|
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Rollbar notifier for Ruby [](https://travis-ci.org/rollbar/rollbar-gem/branches)
|
2
2
|
|
3
3
|
<!-- RemoveNext -->
|
4
4
|
Ruby gem for reporting exceptions, errors, and log messages to [Rollbar](https://rollbar.com).
|
@@ -9,7 +9,7 @@ Ruby gem for reporting exceptions, errors, and log messages to [Rollbar](https:/
|
|
9
9
|
|
10
10
|
Add this line to your application's Gemfile:
|
11
11
|
|
12
|
-
gem 'rollbar', '~> 1.2.
|
12
|
+
gem 'rollbar', '~> 1.2.12'
|
13
13
|
|
14
14
|
And then execute:
|
15
15
|
|
data/THANKS.md
CHANGED
@@ -14,12 +14,14 @@ Huge thanks to the following contributors (by github username). For the most up-
|
|
14
14
|
- [dlackty](https://github.com/dlackty)
|
15
15
|
- [fab](https://github.com/fab)
|
16
16
|
- [firstbanco](https://github.com/firstbanco)
|
17
|
+
- [flomotlik](https://github.com/flomotlik)
|
17
18
|
- [Florent2](https://github.com/Florent2)
|
18
19
|
- [gersmann](https://github.com/gersmann)
|
19
20
|
- [grosser](https://github.com/grosser)
|
20
21
|
- [ixti](https://github.com/ixti)
|
21
22
|
- [jeremyvdw](https://github.com/jeremyvdw)
|
22
23
|
- [johnknott](https://github.com/johnknott)
|
24
|
+
- [jonah-williams](https://github.com/jonah-williams)
|
23
25
|
- [jondeandres](https://github.com/jondeandres)
|
24
26
|
- [JoshuaOSHickman](https://github.com/JoshuaOSHickman)
|
25
27
|
- [juggler](https://github.com/juggler)
|
data/lib/rollbar/rake.rb
CHANGED
@@ -1,12 +1,38 @@
|
|
1
1
|
require 'rake'
|
2
2
|
|
3
|
-
module
|
4
|
-
|
5
|
-
|
3
|
+
module Rollbar
|
4
|
+
module Rake
|
5
|
+
def self.patch!
|
6
|
+
skip_patch && return unless patch?
|
6
7
|
|
7
|
-
|
8
|
-
|
9
|
-
|
8
|
+
::Rake::Application.class_eval do
|
9
|
+
alias_method :orig_display_error_message, :display_error_message
|
10
|
+
|
11
|
+
def display_error_message(ex)
|
12
|
+
Rollbar.error(ex)
|
13
|
+
orig_display_error_message(ex)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
def self.skip_patch
|
19
|
+
warn('[Rollbar] Rollbar is disabled for Rake tasks since your Rake version is under 0.9.x. Please upgrade to 0.9.x or higher.')
|
20
|
+
end
|
21
|
+
|
22
|
+
def self.patch?
|
23
|
+
major, minor, *_ = rake_version.split('.').map(&:to_i)
|
24
|
+
|
25
|
+
major > 0 || major == 0 && minor > 8
|
26
|
+
end
|
27
|
+
|
28
|
+
def self.rake_version
|
29
|
+
if Object.const_defined?('RAKEVERSION')
|
30
|
+
return RAKEVERSION
|
31
|
+
elsif Rake.const_defined?('VERSION')
|
32
|
+
return Rake::VERSION
|
33
|
+
end
|
10
34
|
end
|
11
35
|
end
|
12
36
|
end
|
37
|
+
|
38
|
+
Rollbar::Rake.patch!
|
@@ -11,9 +11,9 @@ module Rollbar
|
|
11
11
|
|
12
12
|
def call(payload)
|
13
13
|
new_payload = payload.clone
|
14
|
-
body = new_payload['data'][
|
14
|
+
body = new_payload['data']['body']
|
15
15
|
|
16
|
-
if body[
|
16
|
+
if body['trace_chain']
|
17
17
|
truncate_trace_chain(body)
|
18
18
|
else
|
19
19
|
truncate_trace(body)
|
@@ -23,19 +23,19 @@ module Rollbar
|
|
23
23
|
end
|
24
24
|
|
25
25
|
def truncate_trace(body)
|
26
|
-
trace_data = body[
|
27
|
-
frames = trace_data[
|
28
|
-
trace_data[
|
26
|
+
trace_data = body['trace']
|
27
|
+
frames = trace_data['frames']
|
28
|
+
trace_data['frames'] = select_frames(frames)
|
29
29
|
|
30
|
-
body[
|
30
|
+
body['trace']['frames'] = select_frames(body['trace']['frames'])
|
31
31
|
end
|
32
32
|
|
33
33
|
def truncate_trace_chain(body)
|
34
|
-
chain = body[
|
34
|
+
chain = body['trace_chain']
|
35
35
|
|
36
|
-
body[
|
37
|
-
frames = trace_data[
|
38
|
-
trace_data[
|
36
|
+
body['trace_chain'] = chain.map do |trace_data|
|
37
|
+
frames = trace_data['frames']
|
38
|
+
trace_data['frames'] = select_frames(frames)
|
39
39
|
trace_data
|
40
40
|
end
|
41
41
|
end
|
@@ -11,14 +11,14 @@ module Rollbar
|
|
11
11
|
|
12
12
|
def call(payload)
|
13
13
|
new_payload = payload.clone
|
14
|
-
body = new_payload['data'][
|
14
|
+
body = new_payload['data']['body']
|
15
15
|
|
16
|
-
if body[
|
17
|
-
body[
|
16
|
+
if body['trace_chain']
|
17
|
+
body['trace_chain'] = body['trace_chain'].map do |trace_data|
|
18
18
|
truncate_trace_data(trace_data)
|
19
19
|
end
|
20
20
|
else
|
21
|
-
body[
|
21
|
+
body['trace'] = truncate_trace_data(body['trace'])
|
22
22
|
end
|
23
23
|
|
24
24
|
|
@@ -26,9 +26,9 @@ module Rollbar
|
|
26
26
|
end
|
27
27
|
|
28
28
|
def truncate_trace_data(trace_data)
|
29
|
-
trace_data[
|
30
|
-
trace_data[
|
31
|
-
trace_data[
|
29
|
+
trace_data['exception'].delete('description')
|
30
|
+
trace_data['exception']['message'] = trace_data['exception']['message'][0, 255]
|
31
|
+
trace_data['frames'] = select_frames(trace_data['frames'], 1)
|
32
32
|
|
33
33
|
trace_data
|
34
34
|
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
module Rollbar
|
2
|
+
module Util
|
3
|
+
module Hash
|
4
|
+
def self.deep_stringify_keys(hash)
|
5
|
+
hash.reduce({}) do |h, (key, value)|
|
6
|
+
h[key.to_s] = map_value(value, :deep_stringify_keys)
|
7
|
+
|
8
|
+
h
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
def self.map_value(thing, m)
|
13
|
+
case thing
|
14
|
+
when ::Hash
|
15
|
+
send(m, thing)
|
16
|
+
when Array
|
17
|
+
thing.map { |v| map_value(v, m) }
|
18
|
+
else
|
19
|
+
thing
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
data/lib/rollbar/util.rb
CHANGED
@@ -4,8 +4,8 @@ module Rollbar
|
|
4
4
|
if obj.is_a?(Array)
|
5
5
|
for i in 0 ... obj.size
|
6
6
|
value = obj[i]
|
7
|
-
|
8
|
-
if value.is_a?(Hash) || value.is_a?(Array)
|
7
|
+
|
8
|
+
if value.is_a?(::Hash) || value.is_a?(Array)
|
9
9
|
self.iterate_and_update(value, block)
|
10
10
|
else
|
11
11
|
obj[i] = block.call(value)
|
@@ -13,42 +13,42 @@ module Rollbar
|
|
13
13
|
end
|
14
14
|
else
|
15
15
|
key_updates = []
|
16
|
-
|
16
|
+
|
17
17
|
obj.each do |k, v|
|
18
18
|
new_key = nil
|
19
|
-
|
20
|
-
if v.is_a?(Hash) || v.is_a?(Array)
|
19
|
+
|
20
|
+
if v.is_a?(::Hash) || v.is_a?(Array)
|
21
21
|
self.iterate_and_update(v, block)
|
22
22
|
new_key = block.call(k)
|
23
23
|
else
|
24
24
|
new_key = block.call(k)
|
25
25
|
obj[k] = block.call(v)
|
26
26
|
end
|
27
|
-
|
27
|
+
|
28
28
|
if new_key != k
|
29
29
|
key_updates.push([k, new_key])
|
30
30
|
end
|
31
31
|
end
|
32
|
-
|
32
|
+
|
33
33
|
key_updates.each do |old_key, new_key|
|
34
34
|
obj[new_key] = obj[old_key]
|
35
35
|
obj.delete(old_key)
|
36
36
|
end
|
37
37
|
end
|
38
38
|
end
|
39
|
-
|
39
|
+
|
40
40
|
def self.iterate_and_update_hash(hash, block)
|
41
41
|
hash.each do |k, v|
|
42
|
-
if v.is_a?(Hash)
|
42
|
+
if v.is_a?(::Hash)
|
43
43
|
self.iterate_and_update_hash(v, block)
|
44
44
|
else
|
45
45
|
hash[k] = block.call(k, v)
|
46
46
|
end
|
47
47
|
end
|
48
48
|
end
|
49
|
-
|
49
|
+
|
50
50
|
def self.deep_copy(obj)
|
51
|
-
if obj.is_a?(Hash)
|
51
|
+
if obj.is_a?(::Hash)
|
52
52
|
result = obj.clone
|
53
53
|
obj.each {|k, v| result[k] = deep_copy(v)}
|
54
54
|
result
|
@@ -61,10 +61,10 @@ module Rollbar
|
|
61
61
|
obj
|
62
62
|
end
|
63
63
|
end
|
64
|
-
|
64
|
+
|
65
65
|
def self.deep_merge(hash1, hash2)
|
66
66
|
hash2.each_key do |k|
|
67
|
-
if hash1[k].is_a? Hash and hash2[k].is_a? Hash
|
67
|
+
if hash1[k].is_a? ::Hash and hash2[k].is_a? ::Hash
|
68
68
|
hash1[k] = deep_merge(hash1[k], hash2[k])
|
69
69
|
elsif hash1[k].is_a? Array and hash2[k].is_a? Array
|
70
70
|
hash1[k] += deep_copy(hash2[k])
|
@@ -72,17 +72,17 @@ module Rollbar
|
|
72
72
|
hash1[k] = deep_copy(hash2[k])
|
73
73
|
end
|
74
74
|
end
|
75
|
-
|
75
|
+
|
76
76
|
hash1
|
77
77
|
end
|
78
|
-
|
78
|
+
|
79
79
|
def self.truncate(str, length)
|
80
80
|
ellipsis = '...'
|
81
|
-
|
81
|
+
|
82
82
|
if str.length <= length or str.length <= ellipsis.length
|
83
83
|
return str
|
84
84
|
end
|
85
|
-
|
85
|
+
|
86
86
|
str.unpack("U*").slice(0, length - ellipsis.length).pack("U*") + ellipsis
|
87
87
|
end
|
88
88
|
end
|
data/lib/rollbar/version.rb
CHANGED
data/lib/rollbar.rb
CHANGED
@@ -599,7 +599,10 @@ module Rollbar
|
|
599
599
|
end
|
600
600
|
|
601
601
|
def dump_payload(payload)
|
602
|
-
|
602
|
+
# Ensure all keys are strings since we can receive the payload inline or
|
603
|
+
# from an async handler job, which can be serialized.
|
604
|
+
stringified_payload = Rollbar::Util::Hash.deep_stringify_keys(payload)
|
605
|
+
result = Truncation.truncate(stringified_payload)
|
603
606
|
return result unless Truncation.truncate?(result)
|
604
607
|
|
605
608
|
original_size = MultiJson.dump(payload).bytesize
|
data/rollbar.gemspec
CHANGED
@@ -0,0 +1,34 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'rollbar/rake'
|
3
|
+
|
4
|
+
describe Rollbar::Rake do
|
5
|
+
let(:application) { Rake::Application.new }
|
6
|
+
let(:exception) { Exception.new }
|
7
|
+
|
8
|
+
context 'with supported rake version' do
|
9
|
+
before do
|
10
|
+
allow(Rollbar::Rake).to receive(:rake_version).and_return('0.9.0')
|
11
|
+
end
|
12
|
+
|
13
|
+
it 'reports error to Rollbar' do
|
14
|
+
expect(Rollbar::Rake).not_to receive(:skip_patch)
|
15
|
+
expect(Rollbar).to receive(:error).with(exception)
|
16
|
+
expect(application).to receive(:orig_display_error_message).with(exception)
|
17
|
+
|
18
|
+
Rollbar::Rake.patch! # Really here Rake is already patched
|
19
|
+
application.display_error_message(exception)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
context 'with unsupported rake version' do
|
24
|
+
before do
|
25
|
+
allow(Rollbar::Rake).to receive(:rake_version).and_return('0.8.7')
|
26
|
+
end
|
27
|
+
|
28
|
+
it 'reports error to Rollbar' do
|
29
|
+
expect(Rollbar::Rake).to receive(:skip_patch)
|
30
|
+
|
31
|
+
Rollbar::Rake.patch!
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
@@ -9,16 +9,16 @@ describe Rollbar::Truncation::FramesStrategy do
|
|
9
9
|
describe '.call', :fixture => :payload do
|
10
10
|
context 'with trace key' do
|
11
11
|
let(:payload_fixture) { 'payloads/sample.trace.json' }
|
12
|
-
let(:frames) { payload['data'][
|
12
|
+
let(:frames) { payload['data']['body']['trace']['frames'].clone }
|
13
13
|
|
14
14
|
before do
|
15
|
-
payload['data'][
|
15
|
+
payload['data']['body']['trace']['frames'] = expand_frames(frames)
|
16
16
|
end
|
17
17
|
|
18
18
|
it 'returns a new payload with 300 frames' do
|
19
|
-
result =
|
19
|
+
result = MultiJson.load(described_class.call(payload))
|
20
20
|
|
21
|
-
new_frames = result[
|
21
|
+
new_frames = result['data']['body']['trace']['frames']
|
22
22
|
|
23
23
|
expect(new_frames.count).to be_eql(300)
|
24
24
|
expect(new_frames.first).to be_eql(frames.first)
|
@@ -29,19 +29,19 @@ describe Rollbar::Truncation::FramesStrategy do
|
|
29
29
|
context 'with trace_chain key' do
|
30
30
|
let(:payload_fixture) { 'payloads/sample.trace_chain.json' }
|
31
31
|
|
32
|
-
let(:frames1) { payload['data'][
|
33
|
-
let(:frames2) { payload['data'][
|
32
|
+
let(:frames1) { payload['data']['body']['trace_chain'][0]['frames'].clone }
|
33
|
+
let(:frames2) { payload['data']['body']['trace_chain'][1]['frames'].clone }
|
34
34
|
|
35
35
|
before do
|
36
|
-
payload['data'][
|
37
|
-
payload['data'][
|
36
|
+
payload['data']['body']['trace_chain'][0]['frames'] = expand_frames(frames1)
|
37
|
+
payload['data']['body']['trace_chain'][1]['frames'] = expand_frames(frames2)
|
38
38
|
end
|
39
39
|
|
40
40
|
it 'returns a new payload with 300 frames for each chain item' do
|
41
|
-
result =
|
41
|
+
result = MultiJson.load(described_class.call(payload))
|
42
42
|
|
43
|
-
new_frames1 = result[
|
44
|
-
new_frames2 = result[
|
43
|
+
new_frames1 = result['data']['body']['trace_chain'][0]['frames']
|
44
|
+
new_frames2 = result['data']['body']['trace_chain'][1]['frames']
|
45
45
|
|
46
46
|
expect(new_frames1.count).to be_eql(300)
|
47
47
|
expect(new_frames1.first).to be_eql(frames1.first)
|
@@ -7,40 +7,40 @@ describe Rollbar::Truncation::MinBodyStrategy do
|
|
7
7
|
|
8
8
|
context 'with trace key ' do
|
9
9
|
let(:payload_fixture) { 'payloads/sample.trace.json' }
|
10
|
-
let!(:frames) { payload['data'][
|
10
|
+
let!(:frames) { payload['data']['body']['trace']['frames'].clone }
|
11
11
|
|
12
12
|
before do
|
13
|
-
payload['data'][
|
13
|
+
payload['data']['body']['trace']['exception']['message'] = message
|
14
14
|
end
|
15
15
|
|
16
16
|
it 'truncates the exception message and frames array' do
|
17
|
-
result =
|
17
|
+
result = MultiJson.load(described_class.call(payload))
|
18
18
|
|
19
|
-
trace = result[
|
20
|
-
expect(trace[
|
21
|
-
expect(trace[
|
19
|
+
trace = result['data']['body']['trace']
|
20
|
+
expect(trace['frames']).to have(2).items
|
21
|
+
expect(trace['exception']['message']).to be_eql('a' * 255)
|
22
22
|
end
|
23
23
|
end
|
24
24
|
|
25
25
|
context 'with trace_chain key ' do
|
26
26
|
let(:payload_fixture) { 'payloads/sample.trace_chain.json' }
|
27
|
-
let!(:frames1) { payload['data'][
|
28
|
-
let!(:frames2) { payload['data'][
|
27
|
+
let!(:frames1) { payload['data']['body']['trace_chain'][0]['frames'].clone }
|
28
|
+
let!(:frames2) { payload['data']['body']['trace_chain'][1]['frames'].clone }
|
29
29
|
|
30
30
|
before do
|
31
|
-
payload['data'][
|
32
|
-
payload['data'][
|
31
|
+
payload['data']['body']['trace_chain'][0]['exception']['message'] = message
|
32
|
+
payload['data']['body']['trace_chain'][1]['exception']['message'] = message
|
33
33
|
end
|
34
34
|
|
35
35
|
it 'truncates the exception message and frames array' do
|
36
|
-
result =
|
36
|
+
result = MultiJson.load(described_class.call(payload))
|
37
37
|
|
38
|
-
traces = result[
|
39
|
-
expect(traces[0][
|
40
|
-
expect(traces[0][
|
38
|
+
traces = result['data']['body']['trace_chain']
|
39
|
+
expect(traces[0]['frames']).to have(2).items
|
40
|
+
expect(traces[0]['exception']['message']).to be_eql('a' * 255)
|
41
41
|
|
42
|
-
expect(traces[1][
|
43
|
-
expect(traces[1][
|
42
|
+
expect(traces[1]['frames']).to have(2).items
|
43
|
+
expect(traces[1]['exception']['message']).to be_eql('a' * 255)
|
44
44
|
end
|
45
45
|
end
|
46
46
|
end
|
@@ -8,36 +8,36 @@ describe Rollbar::Truncation::StringsStrategy do
|
|
8
8
|
let(:long_message) { 'a' * 2000 }
|
9
9
|
let(:payload) do
|
10
10
|
{
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
11
|
+
'truncated' => long_message,
|
12
|
+
'not_truncated' => '123456',
|
13
|
+
'hash' => {
|
14
|
+
'inner_truncated' => long_message,
|
15
|
+
'inner_not_truncated' => '567',
|
16
|
+
'array' => ['12345678', '12', { 'inner_inner' => long_message }]
|
17
17
|
}
|
18
18
|
}
|
19
19
|
end
|
20
20
|
|
21
21
|
it 'should truncate all nested strings in the payload' do
|
22
|
-
result =
|
22
|
+
result = MultiJson.load(described_class.call(payload))
|
23
23
|
|
24
|
-
expect(result[
|
25
|
-
expect(result[
|
26
|
-
expect(result[
|
24
|
+
expect(result['truncated'].size).to be_eql(1024)
|
25
|
+
expect(result['hash']['inner_truncated'].size).to be_eql(1024)
|
26
|
+
expect(result['hash']['array'][2]['inner_inner'].size).to be_eql(1024)
|
27
27
|
end
|
28
28
|
|
29
29
|
context 'with utf8 strings' do
|
30
30
|
let(:long_message) { 'Ŝǻмρļẻ śţяịņģ' + 'a' * 2000 }
|
31
31
|
let(:payload) do
|
32
32
|
{
|
33
|
-
|
34
|
-
|
33
|
+
'truncated' => long_message,
|
34
|
+
'not_truncated' => '123456',
|
35
35
|
}
|
36
36
|
end
|
37
37
|
|
38
38
|
it 'should truncate utf8 strings properly' do
|
39
|
-
result =
|
40
|
-
expect(result[
|
39
|
+
result = MultiJson.load(described_class.call(payload))
|
40
|
+
expect(result['truncated']).to match(/^Ŝǻмρļẻ śţяịņģa*\.{3}/)
|
41
41
|
end
|
42
42
|
end
|
43
43
|
|
@@ -0,0 +1,22 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'rollbar/util/hash'
|
3
|
+
|
4
|
+
describe Rollbar::Util::Hash do
|
5
|
+
let(:value) do
|
6
|
+
{
|
7
|
+
:foo => 'bar',
|
8
|
+
:bar => {
|
9
|
+
:foo => 'bar',
|
10
|
+
:bar => [{:foo => 'bar'}]
|
11
|
+
},
|
12
|
+
}
|
13
|
+
end
|
14
|
+
|
15
|
+
it 'converts the symbol keys to string' do
|
16
|
+
new_hash = described_class.deep_stringify_keys(value)
|
17
|
+
|
18
|
+
expect(new_hash['foo']).to be_eql('bar')
|
19
|
+
expect(new_hash['bar']['foo']).to be_eql('bar')
|
20
|
+
expect(new_hash['bar']['bar'][0]['foo']).to be_eql('bar')
|
21
|
+
end
|
22
|
+
end
|
@@ -7,21 +7,4 @@ module FixtureHelpers
|
|
7
7
|
def load_payload_fixture(relative_path)
|
8
8
|
MultiJson.load(File.read(fixture_file(relative_path)))
|
9
9
|
end
|
10
|
-
|
11
|
-
def symbolize_recursive(hash)
|
12
|
-
{}.tap do |h|
|
13
|
-
hash.each { |key, value| h[key.to_sym] = map_value(value) }
|
14
|
-
end
|
15
|
-
end
|
16
|
-
|
17
|
-
def map_value(thing)
|
18
|
-
case thing
|
19
|
-
when Hash
|
20
|
-
symbolize_recursive(thing)
|
21
|
-
when Array
|
22
|
-
thing.map { |v| map_value(v) }
|
23
|
-
else
|
24
|
-
thing
|
25
|
-
end
|
26
|
-
end
|
27
10
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rollbar
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.12
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Rollbar, Inc.
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-12-
|
11
|
+
date: 2014-12-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: multi_json
|
@@ -164,6 +164,20 @@ dependencies:
|
|
164
164
|
- - '>='
|
165
165
|
- !ruby/object:Gem::Version
|
166
166
|
version: '0'
|
167
|
+
- !ruby/object:Gem::Dependency
|
168
|
+
name: rake
|
169
|
+
requirement: !ruby/object:Gem::Requirement
|
170
|
+
requirements:
|
171
|
+
- - '>='
|
172
|
+
- !ruby/object:Gem::Version
|
173
|
+
version: 0.9.0
|
174
|
+
type: :development
|
175
|
+
prerelease: false
|
176
|
+
version_requirements: !ruby/object:Gem::Requirement
|
177
|
+
requirements:
|
178
|
+
- - '>='
|
179
|
+
- !ruby/object:Gem::Version
|
180
|
+
version: 0.9.0
|
167
181
|
description: Rails plugin to catch and send exceptions to Rollbar
|
168
182
|
email:
|
169
183
|
- support@rollbar.com
|
@@ -226,6 +240,7 @@ files:
|
|
226
240
|
- lib/rollbar/truncation/raw_strategy.rb
|
227
241
|
- lib/rollbar/truncation/strings_strategy.rb
|
228
242
|
- lib/rollbar/util.rb
|
243
|
+
- lib/rollbar/util/hash.rb
|
229
244
|
- lib/rollbar/version.rb
|
230
245
|
- rollbar.gemspec
|
231
246
|
- spec/controllers/home_controller_spec.rb
|
@@ -293,10 +308,12 @@ files:
|
|
293
308
|
- spec/rollbar/logger_proxy_spec.rb
|
294
309
|
- spec/rollbar/middleware/rack/builder_spec.rb
|
295
310
|
- spec/rollbar/middleware/sinatra_spec.rb
|
311
|
+
- spec/rollbar/rake_spec.rb
|
296
312
|
- spec/rollbar/truncation/frames_strategy_spec.rb
|
297
313
|
- spec/rollbar/truncation/min_body_strategy_spec.rb
|
298
314
|
- spec/rollbar/truncation/strings_strategy_spec.rb
|
299
315
|
- spec/rollbar/truncation_spec.rb
|
316
|
+
- spec/rollbar/util/hash_spec.rb
|
300
317
|
- spec/rollbar_bc_spec.rb
|
301
318
|
- spec/rollbar_spec.rb
|
302
319
|
- spec/spec_helper.rb
|
@@ -394,10 +411,12 @@ test_files:
|
|
394
411
|
- spec/rollbar/logger_proxy_spec.rb
|
395
412
|
- spec/rollbar/middleware/rack/builder_spec.rb
|
396
413
|
- spec/rollbar/middleware/sinatra_spec.rb
|
414
|
+
- spec/rollbar/rake_spec.rb
|
397
415
|
- spec/rollbar/truncation/frames_strategy_spec.rb
|
398
416
|
- spec/rollbar/truncation/min_body_strategy_spec.rb
|
399
417
|
- spec/rollbar/truncation/strings_strategy_spec.rb
|
400
418
|
- spec/rollbar/truncation_spec.rb
|
419
|
+
- spec/rollbar/util/hash_spec.rb
|
401
420
|
- spec/rollbar_bc_spec.rb
|
402
421
|
- spec/rollbar_spec.rb
|
403
422
|
- spec/spec_helper.rb
|