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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c144e62c278f13143d315ec0209e53e6176c8263
4
- data.tar.gz: 38ad38c0d63240503557b90ec4fbebda1d7c0290
3
+ metadata.gz: 8807b21688381b37af1d8677b657628acc42f878
4
+ data.tar.gz: d3479936f895ad06b1e7d7f5d8c47a8c92403e4f
5
5
  SHA512:
6
- metadata.gz: 9f7055198d0701fd56421e08ae76900642342c839e44354c588f7730791654a3838e5ddfe1401203b8804b37ddfd973602b1a4d921daecf731fe463635f005aa
7
- data.tar.gz: 0a5417145c2afa6de0e2c20107bbd9de15abd5f664de61189efe6e5da992b8aa43fcc96ce05489b0c77db4b8f48a807eef9d6ae61f0135d2bb7ff3a484484c30
6
+ metadata.gz: 010627710f99d987d3cf4c2c48ddca4d283fd18472b2b007fd5b41e1348beca239363655b3e00039ea2a2defa983892832ac0da89261ee76863e9c72060ba64e
7
+ data.tar.gz: d5d1b1a48ddc6f067eba05827678a964de7523edfa1f94d7a541b32c993b878a712e8a3e73fe273946646c3a219bb1cc901ff6d8056113acb291bc40229e4f6a
@@ -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: "* *Url*: #{request.url}\n* *Controller*: #{controller.controller_name}\n* *Action*: #{controller.action_name}\n* *Params*: #{params}\n* *Error*: #{exception.backtrace[0]}",
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
@@ -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
@@ -1,3 +1,3 @@
1
1
  module Croket
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
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.1
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-23 00:00:00.000000000 Z
11
+ date: 2015-12-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rest-client