sapience 0.1.9 → 0.1.10

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 39e155af8dbe1159b4b409fed3f1c38d1aa88cf0
4
- data.tar.gz: 4d49d889a237f8dbd67bf0cb1880387c24e1cb2f
3
+ metadata.gz: 3967a4729eeba64c34677f98a849602f5fd986fe
4
+ data.tar.gz: de551242cfbacd423e53b933647858f235ae205d
5
5
  SHA512:
6
- metadata.gz: 0311c050dcf515ab0065b30bf238b06ecd6c9097d928267ed9577e383f027f1369297673a0659054cd378df07f455107bb45f8e7e4e8a45a3cfd1252b32dc384
7
- data.tar.gz: caaad7563aa780619c6ec95ceb04da80b61804cec4317bc9d47cb3a4f9016cba3bfe36dbae102eb6ae965b5f53c2658af3f135aca1c88d13993286fd289fd2aa
6
+ metadata.gz: 0d84f5cad6e1688ba5036b1df539e74a63b2d5548a1b80bae6ffefa8f743824d293c1ecd0fad522e321675237ace46ff4e034a054e95009fc1ea223fdf1b385b
7
+ data.tar.gz: 69f34cd2f76e8f8fe161a8536b35c1b82bc055b6d43a4fe106b49acccdc9c342820c75bec17c48af8043009357f34e7902c92be7fdcda8f8ae7b7099bda1e26a
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## v0.1.10
2
+
3
+ - Set tags to `{ environment: Sapience.environment }` for sentry
4
+
1
5
  ## v0.1.9
2
6
 
3
7
  - Support sneakers timing implementation
@@ -43,16 +43,17 @@ module Sapience
43
43
 
44
44
  options[:level] ||= :error
45
45
  Raven.configure do |config|
46
- config.dsn = options.delete(:dsn)
46
+ config.dsn = options.delete(:dsn)
47
+ config.tags = { environment: Sapience.environment }
47
48
  end
49
+
48
50
  super(options, &block)
49
51
  end
50
52
 
51
53
  def validate_options!(options = {})
52
54
  fail ArgumentError, "Options should be a Hash" unless options.is_a?(Hash)
53
- fail ArgumentError, "Options need to have the key :dsn" unless options.key?(:dsn)
54
- dsn_valid = options[:dsn] =~ URI::DEFAULT_PARSER.regexp[:ABS_URI]
55
- fail ArgumentError, "The :dsn key is not a valid URI" unless dsn_valid
55
+ dsn_valid = options[:dsn].to_s =~ URI::DEFAULT_PARSER.regexp[:ABS_URI]
56
+ fail ArgumentError, "The :dsn key (#{options[:dsn]}) is not a valid URI" unless dsn_valid
56
57
  end
57
58
 
58
59
  # Send an error notification to sentry
@@ -21,17 +21,13 @@ module Sapience
21
21
  @@configured = nil
22
22
 
23
23
  # Logging levels in order of most detailed to most severe
24
- LEVELS = [:trace, :debug, :info, :warn, :error, :fatal]
24
+ LEVELS = [:trace, :debug, :info, :warn, :error, :fatal].freeze
25
+ DEFAULT_ENV = "default".freeze
25
26
 
26
27
  def self.config
27
28
  @@config ||= begin
28
29
  config = ConfigLoader.load_from_file
29
- env = config[environment]
30
- unless env
31
- puts "Missing configuration for #{environment} environment. Sapience is going to use default configuration"
32
- env = config.fetch("default")
33
- end
34
- Configuration.new(env)
30
+ Configuration.new(config[environment])
35
31
  end
36
32
  end
37
33
 
@@ -54,7 +50,12 @@ module Sapience
54
50
  def self.environment
55
51
  ENV.fetch("RAILS_ENV") do
56
52
  ENV.fetch("RACK_ENV") do
57
- ::Rails.env if defined?(::Rails) && ::Rails.respond_to?(:env)
53
+ if defined?(::Rails) && ::Rails.respond_to?(:env)
54
+ ::Rails.env
55
+ else
56
+ puts "Sapience is going to use default configuration"
57
+ DEFAULT_ENV
58
+ end
58
59
  end
59
60
  end
60
61
  end
@@ -1,3 +1,3 @@
1
1
  module Sapience
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: sapience
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
  - Mikael Henriksson