rabbit_feed 2.3.1 → 2.3.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.
Files changed (36) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +1 -1
  3. data/.rspec +1 -0
  4. data/Gemfile.lock +1 -1
  5. data/README.md +1 -1
  6. data/example/non_rails_app/.rspec +2 -0
  7. data/example/non_rails_app/Gemfile.lock +1 -1
  8. data/example/non_rails_app/bin/benchmark +1 -4
  9. data/example/non_rails_app/lib/non_rails_app.rb +0 -3
  10. data/example/non_rails_app/spec/lib/non_rails_app/event_handler_spec.rb +0 -2
  11. data/example/non_rails_app/spec/lib/non_rails_app/event_routing_spec.rb +0 -2
  12. data/example/non_rails_app/spec/spec_helper.rb +0 -19
  13. data/example/rails_app/.rspec +2 -0
  14. data/example/rails_app/Gemfile.lock +1 -1
  15. data/example/rails_app/config/initializers/rabbit_feed.rb +0 -3
  16. data/example/rails_app/spec/controllers/beavers_controller_spec.rb +0 -2
  17. data/example/rails_app/spec/event_routing_spec.rb +0 -2
  18. data/example/rails_app/spec/rails_helper.rb +2 -3
  19. data/lib/rabbit_feed.rb +21 -4
  20. data/lib/rabbit_feed/client.rb +1 -1
  21. data/lib/rabbit_feed/testing_support.rb +1 -0
  22. data/lib/rabbit_feed/version.rb +1 -1
  23. data/log/.keep +0 -0
  24. data/spec/lib/rabbit_feed/client_spec.rb +0 -2
  25. data/spec/lib/rabbit_feed/configuration_spec.rb +0 -2
  26. data/spec/lib/rabbit_feed/consumer_connection_spec.rb +0 -2
  27. data/spec/lib/rabbit_feed/event_definitions_spec.rb +0 -2
  28. data/spec/lib/rabbit_feed/event_routing_spec.rb +0 -2
  29. data/spec/lib/rabbit_feed/event_spec.rb +0 -2
  30. data/spec/lib/rabbit_feed/producer_connection_spec.rb +0 -2
  31. data/spec/lib/rabbit_feed/producer_spec.rb +0 -2
  32. data/spec/lib/rabbit_feed/testing_support/rspec_matchers/publish_event_spec.rb +0 -2
  33. data/spec/lib/rabbit_feed/testing_support/testing_helper_spec.rb +0 -2
  34. data/spec/spec_helper.rb +1 -2
  35. metadata +3 -3
  36. data/example/rails_app/spec/spec_helper.rb +0 -14
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3ab62ca0a881a02a77ffb047578b18ee0171fe1b
4
- data.tar.gz: 0c5026737dbb42a8ff35e8c411a58e96c2df7675
3
+ metadata.gz: bb3568ac0fb22611b9d73b0b1ffd3078d7a2f378
4
+ data.tar.gz: 34f7bf50b5d0c47e8aa40603cdea8a1b43cf4c42
5
5
  SHA512:
6
- metadata.gz: 0e2025010bd1cdde1be560dc32a66374148c651cee165212310a54918ea5e16c4b5e5e73fbe3a8989b0635f08927633223e6de799b251583a6a95a922c657951
7
- data.tar.gz: abe806532b976fb2c05770e5b1453e0ef671f4957544e6af447bb0fefa1c6690289547066dbe05299c022168fc1b44b4e6828a9450c82c433bf1eda17fdf40ba
6
+ metadata.gz: 997d107c3db5834ad0f8d75042af9f80aeb3070ec53a455cbfda8bf7004c658c96acc81dd33a540d10a39efa9d38ebca78e0c3f9539de35357a80ed1789550c3
7
+ data.tar.gz: 6844f471ea911177451f98d4a45750406dae32de59d44d18af54301a8576f3ac77cde9d555f515f75486390ad9320666e7f8eeab65f4522ed33a4f1bcf2ac494
data/.gitignore CHANGED
@@ -5,7 +5,7 @@ pkg
5
5
  # OSX dotfile
6
6
  .DS_Store
7
7
  # Log files
8
- *.log
8
+ *.log*
9
9
  *.iml
10
10
  .idea/
11
11
  *.gem
data/.rspec CHANGED
@@ -2,3 +2,4 @@
2
2
  --order rand
3
3
  --color
4
4
  --format doc
5
+ --require spec_helper
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- rabbit_feed (2.3.1)
4
+ rabbit_feed (2.3.2)
5
5
  activemodel (>= 3.2.0, < 5.0.0)
6
6
  activesupport (>= 3.2.0, < 5.0.0)
7
7
  avro (>= 1.5.4, < 1.8.0)
data/README.md CHANGED
@@ -80,7 +80,7 @@ EventRouting do
80
80
  end
81
81
  ```
82
82
 
83
- You may also override the log location (defaults to `STDOUT`), the environment (defaults to the `RAILS_ENV`), and the path to the RabbitFeed config file (defaults to `config/rabbit_feed.yml`) in the initializer, like this:
83
+ You may also override the log location (defaults to `log/rabbit_feed.log` if a `log` directory exists, else `STDOUT`), the environment (defaults to the `RAILS_ENV` or `RACK_ENV`), and the path to the RabbitFeed config file (defaults to `config/rabbit_feed.yml`) in the initializer, like this:
84
84
 
85
85
  ```ruby
86
86
  RabbitFeed.instance_eval do
@@ -1 +1,3 @@
1
1
  --color
2
+ --order rand
3
+ --require spec_helper
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ../../
3
3
  specs:
4
- rabbit_feed (2.3.1)
4
+ rabbit_feed (2.3.2)
5
5
  activemodel (>= 3.2.0, < 5.0.0)
6
6
  activesupport (>= 3.2.0, < 5.0.0)
7
7
  avro (>= 1.5.4, < 1.8.0)
@@ -7,10 +7,7 @@ require 'rabbit_feed'
7
7
  # Prevent deprecation warnings
8
8
  I18n.enforce_available_locales = true
9
9
 
10
- RabbitFeed.instance_eval do
11
- self.log = Logger.new 'log/rabbit_feed.log'
12
- self.environment = 'development'
13
- end
10
+ RabbitFeed.environment = 'development'
14
11
 
15
12
  payload = 'abc'*5000
16
13
  number_of_events = 5000
@@ -1,9 +1,6 @@
1
1
  require 'rabbit_feed'
2
2
  require_relative 'non_rails_app/event_handler'
3
3
 
4
- RabbitFeed.log = Logger.new('log/rabbit_feed.log')
5
- RabbitFeed.log.formatter = RabbitFeed::JsonLogFormatter
6
-
7
4
  EventRouting do
8
5
  accept_from('rails_app') do
9
6
  event('user_creates_beaver') do |event|
@@ -1,5 +1,3 @@
1
- require 'spec_helper'
2
-
3
1
  module NonRailsApp
4
2
  describe EventHandler do
5
3
 
@@ -1,5 +1,3 @@
1
- require_relative '../../spec_helper'
2
-
3
1
  module NonRailsApp
4
2
  describe 'Event Routing' do
5
3
  let(:payload) { {'field' => 'value'} }
@@ -1,24 +1,5 @@
1
1
  require 'non_rails_app'
2
2
 
3
3
  RSpec.configure do |config|
4
- # ## Mock Framework
5
- #
6
- # If you prefer to use mocha, flexmock or RR, uncomment the appropriate line:
7
- #
8
- # config.mock_with :mocha
9
- # config.mock_with :flexmock
10
- # config.mock_with :rr
11
-
12
- # Run specs in random order to surface order dependencies. If you find an
13
- # order dependency and want to debug it, you can fix the order by providing
14
- # the seed, which is printed after each run.
15
- # --seed 1234
16
- config.order = 'random'
17
-
18
4
  RabbitFeed::TestingSupport.setup(config)
19
5
  end
20
-
21
- RabbitFeed.log = Logger.new('log/rabbit_feed.log')
22
- RabbitFeed.log.formatter = RabbitFeed::JsonLogFormatter
23
- RabbitFeed.environment = 'test'
24
- RabbitFeed.configuration_file_path = 'config/rabbit_feed.yml'
@@ -1 +1,3 @@
1
1
  --color
2
+ --order rand
3
+ --require rails_helper
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ../../
3
3
  specs:
4
- rabbit_feed (2.3.1)
4
+ rabbit_feed (2.3.2)
5
5
  activemodel (>= 3.2.0, < 5.0.0)
6
6
  activesupport (>= 3.2.0, < 5.0.0)
7
7
  avro (>= 1.5.4, < 1.8.0)
@@ -1,6 +1,3 @@
1
- RabbitFeed.log = Logger.new('log/rabbit_feed.log')
2
- RabbitFeed.log.formatter = RabbitFeed::JsonLogFormatter
3
-
4
1
  EventDefinitions do
5
2
  define_event('user_creates_beaver', version: '1.0.0') do
6
3
  defined_as do
@@ -1,5 +1,3 @@
1
- require 'rails_helper'
2
-
3
1
  describe BeaversController do
4
2
 
5
3
  describe 'POST create' do
@@ -1,5 +1,3 @@
1
- require_relative 'rails_helper'
2
-
3
1
  module RailsApp
4
2
  describe 'Event Routing' do
5
3
 
@@ -1,7 +1,6 @@
1
1
  # This file is copied to spec/ when you run 'rails generate rspec:install'
2
- ENV["RAILS_ENV"] ||= 'test'
3
- require 'spec_helper'
4
- require File.expand_path("../../config/environment", __FILE__)
2
+ ENV['RAILS_ENV'] ||= 'test'
3
+ require File.expand_path('../../config/environment', __FILE__)
5
4
  require 'rspec/rails'
6
5
  # Add additional requires below this line. Rails is not loaded until this point!
7
6
 
data/lib/rabbit_feed.rb CHANGED
@@ -29,10 +29,7 @@ module RabbitFeed
29
29
  attr_accessor :log, :environment, :configuration_file_path, :application
30
30
 
31
31
  def configuration
32
- RabbitFeed.log ||= (Logger.new STDOUT)
33
- RabbitFeed.configuration_file_path ||= 'config/rabbit_feed.yml'
34
- RabbitFeed.environment ||= ENV['RAILS_ENV'] || ENV['RACK_ENV']
35
- @configuration ||= (Configuration.load RabbitFeed.configuration_file_path, RabbitFeed.environment, application)
32
+ @configuration ||= (Configuration.load configuration_file_path, environment, application)
36
33
  end
37
34
 
38
35
  def exception_notify exception
@@ -40,4 +37,24 @@ module RabbitFeed
40
37
  (Airbrake.notify_or_ignore exception) if Airbrake.configuration.public?
41
38
  end
42
39
  end
40
+
41
+ def default_logger
42
+ if File.directory? 'log'
43
+ Logger.new 'log/rabbit_feed.log', 10, 100.megabytes
44
+ else
45
+ Logger.new STDOUT
46
+ end.tap do |log|
47
+ log.formatter = RabbitFeed::JsonLogFormatter
48
+ log.level = Logger::INFO
49
+ end
50
+ end
51
+
52
+ def set_defaults
53
+ self.log = default_logger
54
+ self.configuration_file_path = 'config/rabbit_feed.yml'
55
+ self.environment = ENV['RAILS_ENV'] || ENV['RACK_ENV']
56
+ end
57
+ private :set_defaults
58
+
59
+ set_defaults
43
60
  end
@@ -86,7 +86,7 @@ module RabbitFeed
86
86
  end
87
87
 
88
88
  def set_logging
89
- RabbitFeed.log = Logger.new options[:logfile]
89
+ RabbitFeed.log = Logger.new(options[:logfile], 10, 100.megabytes)
90
90
  RabbitFeed.log.level = verbose? ? Logger::DEBUG : Logger::INFO
91
91
  RabbitFeed.log.formatter = RabbitFeed::JsonLogFormatter
92
92
  end
@@ -9,6 +9,7 @@ module RabbitFeed
9
9
  attr_accessor :published_events
10
10
 
11
11
  def setup rspec_config
12
+ RabbitFeed.environment ||= 'test'
12
13
  capture_published_events rspec_config
13
14
  include_support rspec_config
14
15
  end
@@ -1,3 +1,3 @@
1
1
  module RabbitFeed
2
- VERSION = '2.3.1'
2
+ VERSION = '2.3.2'
3
3
  end
data/log/.keep ADDED
File without changes
@@ -1,5 +1,3 @@
1
- require 'spec_helper'
2
-
3
1
  module RabbitFeed
4
2
  describe Client do
5
3
  let(:command) { 'consume' }
@@ -1,5 +1,3 @@
1
- require 'spec_helper'
2
-
3
1
  module RabbitFeed
4
2
  describe Configuration do
5
3
 
@@ -1,5 +1,3 @@
1
- require 'spec_helper'
2
-
3
1
  module RabbitFeed
4
2
  describe ConsumerConnection do
5
3
  let(:bunny_queue) { double(:bunny_queue, bind: nil, subscribe: nil)}
@@ -1,5 +1,3 @@
1
- require 'spec_helper'
2
-
3
1
  module RabbitFeed
4
2
  describe EventDefinitions do
5
3
  before do
@@ -1,5 +1,3 @@
1
- require 'spec_helper'
2
-
3
1
  module RabbitFeed
4
2
  describe EventRouting do
5
3
  before do
@@ -1,5 +1,3 @@
1
- require 'spec_helper'
2
-
3
1
  module RabbitFeed
4
2
  describe Event do
5
3
  let(:schema) { double(:schema) }
@@ -1,5 +1,3 @@
1
- require 'spec_helper'
2
-
3
1
  module RabbitFeed
4
2
  describe ProducerConnection do
5
3
  let(:bunny_exchange) { double(:bunny_exchange, on_return: nil, publish: nil) }
@@ -1,5 +1,3 @@
1
- require 'spec_helper'
2
-
3
1
  module RabbitFeed
4
2
  describe Producer do
5
3
  describe '.publish' do
@@ -1,5 +1,3 @@
1
- require 'spec_helper'
2
-
3
1
  module RabbitFeed
4
2
  module TestingSupport
5
3
  module RSpecMatchers
@@ -1,5 +1,3 @@
1
- require 'spec_helper'
2
-
3
1
  module RabbitFeed
4
2
  module TestingSupport
5
3
  describe TestingHelpers do
data/spec/spec_helper.rb CHANGED
@@ -38,8 +38,7 @@ RSpec.configure do |config|
38
38
  end
39
39
 
40
40
  def reset_environment
41
- RabbitFeed.log = Logger.new('test.log')
42
- RabbitFeed.log.formatter = RabbitFeed::JsonLogFormatter
41
+ RabbitFeed.log = RabbitFeed.default_logger
43
42
  RabbitFeed.environment = 'test'
44
43
  RabbitFeed.configuration_file_path = 'spec/fixtures/configuration.yml'
45
44
  RabbitFeed::Consumer.event_routing = nil
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rabbit_feed
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.3.1
4
+ version: 2.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Simply Business
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-07-28 00:00:00.000000000 Z
11
+ date: 2015-07-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bunny
@@ -225,7 +225,6 @@ files:
225
225
  - example/rails_app/spec/controllers/beavers_controller_spec.rb
226
226
  - example/rails_app/spec/event_routing_spec.rb
227
227
  - example/rails_app/spec/rails_helper.rb
228
- - example/rails_app/spec/spec_helper.rb
229
228
  - example/rails_app/test/controllers/.keep
230
229
  - example/rails_app/test/controllers/beavers_controller_test.rb
231
230
  - example/rails_app/test/fixtures/.keep
@@ -258,6 +257,7 @@ files:
258
257
  - lib/rabbit_feed/testing_support/test_rabbit_feed_consumer.rb
259
258
  - lib/rabbit_feed/testing_support/testing_helpers.rb
260
259
  - lib/rabbit_feed/version.rb
260
+ - log/.keep
261
261
  - logo.png
262
262
  - rabbit_feed.gemspec
263
263
  - run_benchmark
@@ -1,14 +0,0 @@
1
- require 'rabbit_feed'
2
- require 'logger'
3
-
4
- RSpec.configure do |config|
5
-
6
- # Run specs in random order to surface order dependencies. If you find an
7
- # order dependency and want to debug it, you can fix the order by providing
8
- # the seed, which is printed after each run.
9
- # --seed 1234
10
- config.order = 'random'
11
- end
12
-
13
- RabbitFeed.log = Logger.new('log/rabbit_feed.log')
14
- RabbitFeed.log.formatter = RabbitFeed::JsonLogFormatter