kubelink 0.1.9 → 0.1.10

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
  SHA256:
3
- metadata.gz: '0284b3f6e76487c42fbb8cb02004dfc4467b02c538aa8e144e4f71943a63ec44'
4
- data.tar.gz: 1eeb5368d899a6a0937d2ddab58ab25a5eae83409d318ee65041b973660cfdfa
3
+ metadata.gz: ebe01e105678e63dae11e3d45728ff797e474abefcbb2fb8c098ba9d09e70ca5
4
+ data.tar.gz: '08651159712216d8ee4e3abdfa471616904a72a5c1ef9eceed977f08d8a63ca5'
5
5
  SHA512:
6
- metadata.gz: 0e33724714ffa6faa94ccbf1f93ad3e86a7b896fe66effabaac9dd572f15a8a2512910e0a279ef56911b8a05abd02db18e2ec009179bac205c1c27ef74ca9f09
7
- data.tar.gz: dfc98706f27b336077753de16777b7b3709e4bd4fc4d91a6e8bf04099408705fb082fdc7a11578177a61fbbc147b78955ae35b986f6b5020d4c0539fc1510760
6
+ metadata.gz: a91493aec8df9e12aa40b3a51bb6c99c25c9d79dbf965cec526404e52bc0360ef7f7f392fc491636a579a5d9c49f81e4d70d048ce9f191228114ec8faabff656
7
+ data.tar.gz: d0985050e630df6cf30cf81e62ed6dcbd2a37bbbcc5eb707ab4d81a36427d2a1bc586d248517e968599045a223fd893d9abba98addbd8faff2450926d810293b
@@ -1,16 +1,26 @@
1
1
  module Kubelink
2
2
  class Sentry < Rails::Railtie
3
+ def self.sentry_dsn
4
+ @dsn ||= begin
5
+ u = URI.parse(ENV['SENTRY_DSN'])
6
+ u.password = nil
7
+ u.to_s
8
+ rescue
9
+ nil
10
+ end
11
+ end
12
+
3
13
  initializer "kubelink.sentry_integration" do
4
14
  ActiveSupport.on_load :action_view do
5
15
  include Helpers
6
16
  end
7
17
 
8
- if ENV.key?('SENTRY_DSN')
18
+ if Sentry.sentry_dsn
9
19
  require 'raven'
10
20
 
11
21
  Raven.configure do |config|
12
- config.dsn = ENV['SENTRY_DSN']
13
- config.release = ENV['RAILS_COMMIT']
22
+ config.dsn = Sentry.sentry_dsn
23
+ config.release = ENV['RAILS_COMMIT'] if ENV.key?('RAILS_COMMIT')
14
24
  end
15
25
 
16
26
  ActiveSupport.on_load :action_controller do
@@ -22,16 +32,6 @@ module Kubelink
22
32
  end
23
33
 
24
34
  module Helpers
25
- def sentry_dsn
26
- @dsn ||= begin
27
- u = URI.parse(ENV['SENTRY_DSN'])
28
- u.password = nil
29
- u.to_s
30
- rescue
31
- nil
32
- end
33
- end
34
-
35
35
  def sentry_include_tag
36
36
  return unless sentry_dsn.present?
37
37
 
@@ -39,7 +39,7 @@ module Kubelink
39
39
 
40
40
  [ javascript_include_tag(script, crossorigin: :anonymous),
41
41
  javascript_tag(nonce: true) do
42
- %Q{Sentry.init({ dsn: "#{sentry_dsn}" });}.html_safe
42
+ %Q{Sentry.init({ dsn: "#{Sentry.sentry_dsn}" });}.html_safe
43
43
  end
44
44
  ].join("\n").html_safe
45
45
  end
@@ -53,7 +53,6 @@ module Kubelink
53
53
  end
54
54
 
55
55
  def set_raven_context
56
- return unless helpers.sentry_dsn
57
56
  Raven.extra_context(params: params.dup.permit!.to_hash, url: request.url)
58
57
  Raven.user_context(ip_address: request.remote_ip)
59
58
  end
@@ -1,3 +1,3 @@
1
1
  module Kubelink
2
- VERSION = '0.1.9'
2
+ VERSION = '0.1.10'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kubelink
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.9
4
+ version: 0.1.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Martino di Filippo