croket 0.0.1 → 0.0.2
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/lib/croket.rb +22 -1
- data/lib/croket/configuration.rb +6 -1
- data/lib/croket/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8807b21688381b37af1d8677b657628acc42f878
|
4
|
+
data.tar.gz: d3479936f895ad06b1e7d7f5d8c47a8c92403e4f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 010627710f99d987d3cf4c2c48ddca4d283fd18472b2b007fd5b41e1348beca239363655b3e00039ea2a2defa983892832ac0da89261ee76863e9c72060ba64e
|
7
|
+
data.tar.gz: d5d1b1a48ddc6f067eba05827678a964de7523edfa1f94d7a541b32c993b878a712e8a3e73fe273946646c3a219bb1cc901ff6d8056113acb291bc40229e4f6a
|
data/lib/croket.rb
CHANGED
@@ -26,6 +26,10 @@ module Croket
|
|
26
26
|
def notify exception, opts = {}
|
27
27
|
l = configuration.logger
|
28
28
|
l.debug "[CROKET] notify about '#{exception}' #{opts['rack.errors']}"
|
29
|
+
if configuration.environment_blacklist.include? configuration.environment.to_sym
|
30
|
+
l.debug "[CROKET] notification was disabled for '#{configuration.environment}'"
|
31
|
+
return
|
32
|
+
end
|
29
33
|
controller = opts['action_controller.instance']
|
30
34
|
request = ::Rack::Request.new(opts)
|
31
35
|
params = request.env['action_dispatch.request.parameters']
|
@@ -34,7 +38,7 @@ module Croket
|
|
34
38
|
payload: {
|
35
39
|
issue: {
|
36
40
|
title: "#{exception}",
|
37
|
-
description:
|
41
|
+
description: generate_description(request, controller, params, exception),
|
38
42
|
category: 'crash',
|
39
43
|
package: configuration.package,
|
40
44
|
environment: configuration.environment,
|
@@ -46,6 +50,23 @@ module Croket
|
|
46
50
|
|
47
51
|
end
|
48
52
|
|
53
|
+
private
|
54
|
+
|
55
|
+
def generate_description request, controller, params, exception
|
56
|
+
out = li('Url', request.url)
|
57
|
+
if controller
|
58
|
+
out += li('Controller', controller.controller_name)
|
59
|
+
out += li('Action', controller.action_name)
|
60
|
+
end
|
61
|
+
out += li('Params', params)
|
62
|
+
out += li('Error', exception.backtrace.first)
|
63
|
+
out
|
64
|
+
end
|
65
|
+
|
66
|
+
def li key, value
|
67
|
+
"* *#{key}*: #{value}\n"
|
68
|
+
end
|
69
|
+
|
49
70
|
end
|
50
71
|
|
51
72
|
end
|
data/lib/croket/configuration.rb
CHANGED
@@ -8,9 +8,14 @@ Created on 2015-04-08
|
|
8
8
|
|
9
9
|
module Croket
|
10
10
|
class Configuration
|
11
|
-
attr_accessor :api_key, :host, :package, :root_path, :logger, :environment
|
11
|
+
attr_accessor :api_key, :host, :package, :root_path, :logger, :environment, :environment_blacklist
|
12
12
|
|
13
13
|
def initialize
|
14
|
+
@host = 'croket.mobi'
|
15
|
+
@logger = ::Rails.logger
|
16
|
+
@root_path = ::Rails.root
|
17
|
+
@environment = ::Rails.env
|
18
|
+
@environment_blacklist = [:test, :development]
|
14
19
|
end
|
15
20
|
|
16
21
|
end
|
data/lib/croket/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: croket
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nikolay Moskvin
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-12-
|
11
|
+
date: 2015-12-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rest-client
|