dogcatcher 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/lib/dogcatcher/markdown.rb +15 -2
- data/lib/dogcatcher/notice.rb +4 -1
- data/lib/dogcatcher/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
NDJlNGE0ZDAzYTUwMmU4Yjk2ODZhM2MzMmExNDIyNzAwZTUwZTE2NA==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
MmYyYTM5NTE2ZmJmOWIxNTk5OTAzM2M4NTcxMjdlYzhmZmEyNGVlZQ==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
YWRiMTg1NDM4MjAyZmUxN2ZiYjkzNzA1NjM4MzAzZmU5OTI3NGQwOTFhNTIy
|
10
|
+
ZDMxZTBkYmMwYjAyZWI0NjM4MDY2MDRhODllOGFmNDM1NzYxNmIzZDE0ZGEx
|
11
|
+
ZjEyZTY3NWUyNDIyOWRhNjU1MDM1NDRhZDljZDM0NmU5ZWY3MTc=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
YzFlZmUyMTUxYWYwNWViOTRjOTNjZTAyYTQ1ZjU2OGY4ZjI4YzE0ZDMwZWI5
|
14
|
+
OTZjYjEyNzgyNGI2YzBlMzY5NGQzNzQwMDkwNzVlODliMTMxNjc0ZTBiY2Q1
|
15
|
+
YTdhODBmNmViZGI3NTQ4NTk2Yjk0NzcxNzU3ZTRlZWE4NTEwNmE=
|
data/lib/dogcatcher/markdown.rb
CHANGED
@@ -16,8 +16,15 @@ module Dogcatcher
|
|
16
16
|
#
|
17
17
|
# @param [String] str text to include in the code block
|
18
18
|
# @param [String] language of the code block
|
19
|
-
|
20
|
-
|
19
|
+
# @param [FixNum] max_len Length at which to truncate the content of the
|
20
|
+
# code block. Length includes block backticks and language. Negative
|
21
|
+
# numbers disable the maximum length.
|
22
|
+
def code_block(str, language = nil, max_len = -1)
|
23
|
+
if max_len > 0
|
24
|
+
max_len -= code_block_builder('', language).length # Subtract markdown overhead
|
25
|
+
str = str[0..max_len-1] if str.length > max_len
|
26
|
+
end
|
27
|
+
@result << code_block_builder(str, language)
|
21
28
|
end
|
22
29
|
|
23
30
|
# Gets the result string formatted in Markdown.
|
@@ -26,5 +33,11 @@ module Dogcatcher
|
|
26
33
|
def result
|
27
34
|
['%%%', "\n", *@result, "\n", '%%%'].join('')
|
28
35
|
end
|
36
|
+
|
37
|
+
private
|
38
|
+
|
39
|
+
def code_block_builder(str, language)
|
40
|
+
['```', language, "\n", str, "\n```\n"].join('')
|
41
|
+
end
|
29
42
|
end
|
30
43
|
end
|
data/lib/dogcatcher/notice.rb
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
module Dogcatcher
|
2
2
|
class Notice
|
3
|
+
MAX_MESSAGE_SIZE = 4000
|
4
|
+
|
3
5
|
# Name of the source that caught the exception
|
4
6
|
attr_accessor :notifier
|
5
7
|
|
@@ -27,7 +29,8 @@ module Dogcatcher
|
|
27
29
|
backtrace = @config.backtrace_cleaner.clean(exception.backtrace)
|
28
30
|
markdown = Markdown.new
|
29
31
|
metadata.each { |key, value| markdown.bullet("#{key}: #{value}") }
|
30
|
-
markdown.
|
32
|
+
max_block_size = MAX_MESSAGE_SIZE - markdown.result.length - 10
|
33
|
+
markdown.code_block(backtrace.join("\n"), 'text', max_block_size)
|
31
34
|
markdown.result
|
32
35
|
end
|
33
36
|
|
data/lib/dogcatcher/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dogcatcher
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ben Vidulich
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-05-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|