fastly_nsq 1.13.1 → 1.14.0

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
- SHA1:
3
- metadata.gz: fe5f821a6bb5bd6af76cc175f01a84b64ef9af71
4
- data.tar.gz: 5199dbad2e9238e52bd696ef01582dc7c0d46701
2
+ SHA256:
3
+ metadata.gz: 6a40b18d43363206c94cbb448ba4ac54a2af31420a7fe89bada891d704513dde
4
+ data.tar.gz: ce9b562df928b8d46466f52be7dab00aba65fb3a4f0301b0c76d5647fa8c639a
5
5
  SHA512:
6
- metadata.gz: db022dcaab20d18ba13b68f1e5f8bb128883d5a94672215d920a84856f107a930b0af77f1db26de7bcfced4954b9c47c175b0834733fb872f629925e9e4a9ada
7
- data.tar.gz: 6bae07517c8ba657b31f53c80810c8d44686c2bb3bb461ecfd359bd8b666a18dff5525f83467eff63959322c225c87a1c27cf2738808ec42af90775fff575503
6
+ metadata.gz: e33edc84dde18aed11956c98a412944d08694403c5237cb02b61bddfa0087e9589dd0cfdf214939c1446205bab79afe8ad7c24a0863231307e07e3353ca7548f
7
+ data.tar.gz: 2f1f3cb6c36e13d181f742caec494ed31f0b4f2275ced090849b878ec8c40f6da6d852724ba7adc244aba7b0a99b1932459a5dc026e9e8cbd5998a77ad6dfc96
@@ -1,7 +1,14 @@
1
1
  # Change Log
2
2
 
3
- ## [v1.13.1](https://github.com/fastly/fastly_nsq/tree/v1.13.1)
3
+ ## [v1.14.0](https://github.com/fastly/fastly_nsq/tree/v1.14.0)
4
4
 
5
+ [Full Changelog](https://github.com/fastly/fastly_nsq/compare/v1.13.1...v1.14.0)
6
+
7
+ **Merged pull requests:**
8
+
9
+ - set Nsq.logger when setting logger [\#92](https://github.com/fastly/fastly_nsq/pull/92) ([leklund](https://github.com/leklund))
10
+
11
+ ## [v1.13.1](https://github.com/fastly/fastly_nsq/tree/v1.13.1) (2018-07-27)
5
12
  [Full Changelog](https://github.com/fastly/fastly_nsq/compare/v1.13.0...v1.13.1)
6
13
 
7
14
  **Merged pull requests:**
@@ -30,9 +30,6 @@ module FastlyNsq
30
30
  # @return [Integer]
31
31
  attr_writer :max_req_timeout
32
32
 
33
- # @return [Logger]
34
- attr_writer :logger
35
-
36
33
  ##
37
34
  # Map of lifecycle events
38
35
  # @return [Hash]
@@ -51,8 +48,20 @@ module FastlyNsq
51
48
  FastlyNsq::Listener.new(topic: topic, processor: processor, **options)
52
49
  end
53
50
 
51
+ ##
52
+ # Return logger or set logger to default.
53
+ # @return [Logger]
54
54
  def logger
55
- @logger ||= Logger.new(nil)
55
+ return @logger if @logger
56
+
57
+ self.logger = Logger.new(STDERR)
58
+ end
59
+
60
+ ##
61
+ # Set the logger and also set Nsq.logger
62
+ # @params logger [Logger]
63
+ def logger=(new_logger)
64
+ @logger = Nsq.logger = new_logger
56
65
  end
57
66
 
58
67
  ##
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module FastlyNsq
4
- VERSION = '1.13.1'
4
+ VERSION = '1.14.0'
5
5
  end
@@ -35,6 +35,28 @@ RSpec.describe FastlyNsq do
35
35
  end
36
36
  end
37
37
 
38
+ describe '#logger' do
39
+ let!(:default_logger) { subject.logger }
40
+ after { subject.logger = default_logger }
41
+
42
+ it 'returns the set logger' do
43
+ logger = Logger.new(nil)
44
+ subject.logger = logger
45
+
46
+ expect(subject.logger).to eq logger
47
+ end
48
+
49
+ it 'sets the default logger if none is set' do
50
+ subject.instance_variable_set(:@logger, nil)
51
+ expect(subject.instance_variable_get(:@logger)).to be nil
52
+ logger = subject.logger
53
+
54
+ expect(logger).to be_instance_of(Logger)
55
+ expect(logger.instance_variable_get(:@logdev).dev).to eq(STDERR)
56
+ expect(logger).to eq(Nsq.logger)
57
+ end
58
+ end
59
+
38
60
  describe '#logger=' do
39
61
  let!(:default_logger) { subject.logger }
40
62
  after { subject.logger = default_logger }
@@ -45,6 +67,13 @@ RSpec.describe FastlyNsq do
45
67
 
46
68
  expect(subject.logger).to eq logger
47
69
  end
70
+
71
+ it 'sets Nsq.logger' do
72
+ logger = Logger.new(STDOUT)
73
+ subject.logger = logger
74
+
75
+ expect(Nsq.logger).to eq logger
76
+ end
48
77
  end
49
78
 
50
79
  describe '#manager' do
@@ -77,7 +106,8 @@ RSpec.describe FastlyNsq do
77
106
  it 'registers callbacks for events' do
78
107
  %i[startup shutdown heartbeat].each do |event|
79
108
  block = -> {}
80
- expect { FastlyNsq.on(event, &block) }.to change { FastlyNsq.events[event] }.by([block])
109
+ FastlyNsq.on(event, &block)
110
+ expect(FastlyNsq.events[event]).to eq([block])
81
111
  end
82
112
  end
83
113
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fastly_nsq
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.13.1
4
+ version: 1.14.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tommy O'Neil
@@ -13,7 +13,7 @@ authors:
13
13
  autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
- date: 2018-07-27 00:00:00.000000000 Z
16
+ date: 2018-08-13 00:00:00.000000000 Z
17
17
  dependencies:
18
18
  - !ruby/object:Gem::Dependency
19
19
  name: awesome_print
@@ -270,7 +270,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
270
270
  version: '0'
271
271
  requirements: []
272
272
  rubyforge_project:
273
- rubygems_version: 2.6.14
273
+ rubygems_version: 2.7.3
274
274
  signing_key:
275
275
  specification_version: 4
276
276
  summary: Fastly NSQ Adapter