mnemosyne-ruby 1.0.0 → 1.0.1

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: 619bd5e8b0c8d56d2d0dd8e2634997f65fd25312
4
- data.tar.gz: 501700e283258d8642f1381f1a3a0194ab1e2b43
3
+ metadata.gz: 3be644845f56d638f37c5bbaab9e17a10cadc24b
4
+ data.tar.gz: abffc04c98a65ee9e6b24fc3d57fd2d1c53e943a
5
5
  SHA512:
6
- metadata.gz: 972cc7a4654172aae0196180f011fbbea7dfb94b8e023d39467347122203fae099d64b4bf117c9407100b99a103c48bd73d9ca253b88ef06c5e7f5f288dcddc1
7
- data.tar.gz: bd18c3daa03b4e70449c55943be7a62a0a0f16cd354022b52c6002b86d32f25436c5b6ddd22a9e71935337fc7f39977c97e83bbcfd3248cf51593b23bce66914
6
+ metadata.gz: d242c0b3f668a17253aa1c153f19d902dd0681c49bb4f001390ec6690e72a539a362c45a6f283d0260a8e10a0dc85ce7a2d7d4a230a4d86a659e328da66d7cbb
7
+ data.tar.gz: 41a21abe608d7ca68c0493ff80929addb7d85c45687b5b24861cfb4295c9b75ce91349957b17c6bc221eaec78df8f218b7f328fddfc04b821a9a3cbf23ca0a82
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.0.1
4
+
5
+ * Fix issue with `enabled` configuration flag (#1)
6
+
3
7
  ## 1.0.0
4
8
 
5
9
  * Use semantic versioning
data/lib/mnemosyne.rb CHANGED
@@ -2,6 +2,7 @@
2
2
  require 'mnemosyne/version'
3
3
 
4
4
  require 'active_support'
5
+ require 'active_support/core_ext/object/blank'
5
6
  require 'active_support/notifications'
6
7
 
7
8
  module Mnemosyne
@@ -12,7 +13,7 @@ module Mnemosyne
12
13
  require 'mnemosyne/span'
13
14
  require 'mnemosyne/trace'
14
15
 
15
- require 'mnemosyne/config'
16
+ require 'mnemosyne/configuration'
16
17
  require 'mnemosyne/client'
17
18
  require 'mnemosyne/instrumenter'
18
19
 
@@ -4,7 +4,7 @@ require 'uri'
4
4
  require 'cgi'
5
5
 
6
6
  module Mnemosyne
7
- class Config
7
+ class Configuration
8
8
  attr_reader :application
9
9
  attr_reader :hostname
10
10
  attr_reader :platform
@@ -15,19 +15,19 @@ module Mnemosyne
15
15
 
16
16
  # rubocop:disable Metrics/AbcSize
17
17
  def initialize(config)
18
- @platform = config.fetch('platform', 'default').freeze
19
- @application = config.fetch('application').freeze
18
+ @platform = config.fetch('platform', 'default').to_s.strip.freeze
19
+ @application = config.fetch('application', nil).to_s.strip.freeze
20
20
  @enabled = config.fetch('enabled', true)
21
- @hostname = config.fetch('hostname') { default_hostname }.freeze
22
- @exchange = config.fetch('exchange', 'mnemosyne').freeze
21
+ @hostname = config.fetch('hostname') { default_hostname }.to_s.strip.freeze
22
+ @exchange = config.fetch('exchange', 'mnemosyne').to_s.freeze
23
23
  @logger = config.fetch('logger') { Logger.new($stdout) }
24
24
 
25
25
  server = config.fetch('server', 'amqp://localhost')
26
26
  @amqp = AMQ::Settings.configure(server).freeze
27
- @server = make_amqp_uri(@amqp).freeze
27
+ @server = make_amqp_uri(@amqp).to_s.freeze
28
28
 
29
- raise 'Application must be configured' unless application.present?
30
- raise 'Hostname must be configured' unless hostname.present?
29
+ raise ArgumentError.new('Application is required') if application.blank?
30
+ raise ArgumentError.new('Hostname is required') if hostname.blank?
31
31
  end
32
32
 
33
33
  def enabled?
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  require 'rails'
3
4
 
4
5
  module Mnemosyne
@@ -7,11 +8,12 @@ module Mnemosyne
7
8
  config = app.config_for('mnemosyne')
8
9
 
9
10
  config['application'] ||= app.class.name.underscore.titleize
11
+ config['logger'] ||= Rails.logger
10
12
 
11
- config['logger'] ||= Rails.logger
12
- config['enabled'] ||= config.key?('server')
13
+ # If server is configured mnemosyne should be enabled by default
14
+ config['enabled'] = config.key?('server') unless config.key?('enabled')
13
15
 
14
- config = ::Mnemosyne::Config.new(config)
16
+ config = ::Mnemosyne::Configuration.new(config)
15
17
 
16
18
  if config.enabled?
17
19
  ::Mnemosyne::Instrumenter.start!(config)
@@ -4,7 +4,7 @@ module Mnemosyne
4
4
  module VERSION
5
5
  MAJOR = 1
6
6
  MINOR = 0
7
- PATCH = 0
7
+ PATCH = 1
8
8
  STAGE = nil
9
9
 
10
10
  STRING = [MAJOR, MINOR, PATCH, STAGE].reject(&:nil?).join('.')
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mnemosyne-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jan Graichen
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-04-03 00:00:00.000000000 Z
11
+ date: 2017-04-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bunny
@@ -128,7 +128,7 @@ files:
128
128
  - lib/mnemosyne.rb
129
129
  - lib/mnemosyne/client.rb
130
130
  - lib/mnemosyne/clock.rb
131
- - lib/mnemosyne/config.rb
131
+ - lib/mnemosyne/configuration.rb
132
132
  - lib/mnemosyne/global.rb
133
133
  - lib/mnemosyne/instrumenter.rb
134
134
  - lib/mnemosyne/middleware/acfs.rb