active_event 0.4.2 → 0.4.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,15 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 800beee079252d2d5751bf77b1df29de07f24e26
4
- data.tar.gz: 7c7be2d47bfa2c43e30987e77af541c1f605730e
5
- SHA512:
6
- metadata.gz: 10a8ac532100a3c3e554371382b5b60e43d064eeeb0fc3e3e9025e170a1791a5ab030886ffc49f86e33dbdea33138a6e0e089b8e67c4b9e6a5f0eb74ce56cdbe
7
- data.tar.gz: b3e132072d7d3e77450317fe3230ba081996d3dc2906eb380173e1ad59eefb7875a683086939fe130755dd0ab89ceee2641e13bbc9edb010e9b9353af1d88952
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ MTE4NTJmNTQxNDI0NDg1NzlkNzRiNDhiYjBhZmU3OTZkOTA4NDYzNQ==
5
+ data.tar.gz: !binary |-
6
+ MWZlM2UzMTM4NDM0OTdkZmJjOTNlZWNjMWU5NTRlMTk5MTMyNmE1OA==
7
+ !binary "U0hBNTEy":
8
+ metadata.gz: !binary |-
9
+ Y2QyMDIwOTZjOTUzZTVmYjkyMTYzYzIyZGNkOWE4MWM2NjU4ZmYzZjZjZTcx
10
+ OTBiOWFlN2Q4ZWQ1NzZiM2M2MjNkM2JjYTY5ZjA3YmYyOGViYjFmMGE3YzQx
11
+ YTlhNzc0NzFkMzAyMDVkMDM1Mzk4N2FlYWYzMzRkZmY2ZGYwOGM=
12
+ data.tar.gz: !binary |-
13
+ NGJjZDIyM2FmNDA3M2RiOTgyZTk5ZDJmOGQ1ODJlNWRmMWMwODY4MTc2ODg5
14
+ ZWE1ZDIyNTc0NTcyOTM4OGZiMGM1ZGU0NDBmOWZhM2I5NjM0ZDdjZjMwN2Rj
15
+ YzIzOTA5ZmEwOGM2MTFhYTU2YjIwYTk5NTM5ZjQ4ODhiODY4MDg=
@@ -25,7 +25,10 @@ module ActiveEvent
25
25
  else
26
26
  false
27
27
  end
28
- rescue
28
+ rescue Exception => e
29
+ LOGGER.error "Validation failed for #{self.class.name}"
30
+ LOGGER.error e.message
31
+ LOGGER.error e.backtrace.join("\n")
29
32
  false
30
33
  end
31
34
  end
@@ -8,7 +8,7 @@ module ActiveEvent
8
8
  type = event.class.name
9
9
  body = event.to_json
10
10
  instance.event_exchange.publish body, type: type, headers: event.store_infos
11
- puts "Published #{type} with #{body}"
11
+ LOGGER.debug "Published #{type} with #{body}"
12
12
  end
13
13
 
14
14
  def self.start(options)
@@ -19,6 +19,10 @@ module ActiveEvent
19
19
  def start
20
20
  event_connection.start
21
21
  listen_for_resend_requests
22
+ rescue Exception => e
23
+ LOGGER.error e.message
24
+ LOGGER.error e.backtrace.join("\n")
25
+ raise e
22
26
  end
23
27
 
24
28
  def resend_events_after(id)
@@ -39,7 +43,7 @@ module ActiveEvent
39
43
  end
40
44
 
41
45
  def resend_request_received (id)
42
- puts "received resend request with id #{id}"
46
+ LOGGER.debug "received resend request with id #{id}"
43
47
  resend_events_after id.to_i
44
48
  end
45
49
 
@@ -19,6 +19,10 @@ module ActiveEvent
19
19
  @last_id = id
20
20
  start_republishing
21
21
  send_done_message
22
+ rescue Exception => e
23
+ LOGGER.error e.message
24
+ LOGGER.error e.backtrace.join("\n")
25
+ raise e
22
26
  end
23
27
 
24
28
  def queue
@@ -60,7 +64,7 @@ module ActiveEvent
60
64
  type = event.event
61
65
  body = event.data.to_json
62
66
  resend_exchange.publish body, {type: type, headers: {id: event.id, created_at: event.created_at, replayed: true}}
63
- puts "Republished #{type} with #{body}"
67
+ LOGGER.debug "Republished #{type} with #{body}"
64
68
  end
65
69
 
66
70
  def next_event
@@ -0,0 +1,28 @@
1
+ require 'logger'
2
+ module ActiveEvent::Support
3
+ class MultiLogger
4
+ [:info, :debug, :error, :fatal, :warn, :unknown, ].each do |action|
5
+ define_method action do |msg|
6
+ @loggers.each do |logger|
7
+ logger.send(action, msg)
8
+ end
9
+ end
10
+ end
11
+
12
+ def initialize(progname = nil, formatter = nil)
13
+ @loggers = []
14
+ @loggers << Logger.new(STDOUT)
15
+ @loggers << Logger.new("log/disco.log")
16
+ @loggers.each do |logger|
17
+ logger.progname = progname if progname.present?
18
+ logger.formatter = if formatter.present?
19
+ formatter
20
+ else
21
+ proc do |severity, datetime, progname, msg|
22
+ "#{datetime}: [#{progname}][#{severity}]: #{msg}\n"
23
+ end
24
+ end
25
+ end
26
+ end
27
+ end
28
+ end
@@ -1,7 +1,7 @@
1
1
  module ActiveEvent
2
2
  # Returns the version of the currently loaded ActiveEvent as a Gem::Version
3
3
  def self.version
4
- Gem::Version.new '0.4.2'
4
+ Gem::Version.new '0.4.3'
5
5
  end
6
6
 
7
7
  module VERSION #:nodoc:
data/lib/active_event.rb CHANGED
@@ -23,6 +23,7 @@ module ActiveEvent
23
23
  autoload :AttrSetter
24
24
  autoload :Autoload
25
25
  autoload :Autoloader
26
+ autoload :MultiLogger
26
27
  end
27
28
 
28
29
  autoload :Event, (File.expand_path '../../app/models/active_event/event', __FILE__)
metadata CHANGED
@@ -1,20 +1,20 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: active_event
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.2
4
+ version: 0.4.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andreas Reischuck
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-12-18 00:00:00.000000000 Z
11
+ date: 2014-01-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - '>'
17
+ - - ! '>'
18
18
  - !ruby/object:Gem::Version
19
19
  version: 3.2.0
20
20
  - - <
@@ -24,7 +24,7 @@ dependencies:
24
24
  prerelease: false
25
25
  version_requirements: !ruby/object:Gem::Requirement
26
26
  requirements:
27
- - - '>'
27
+ - - ! '>'
28
28
  - !ruby/object:Gem::Version
29
29
  version: 3.2.0
30
30
  - - <
@@ -34,7 +34,7 @@ dependencies:
34
34
  name: activemodel
35
35
  requirement: !ruby/object:Gem::Requirement
36
36
  requirements:
37
- - - '>'
37
+ - - ! '>'
38
38
  - !ruby/object:Gem::Version
39
39
  version: 3.2.0
40
40
  - - <
@@ -44,7 +44,7 @@ dependencies:
44
44
  prerelease: false
45
45
  version_requirements: !ruby/object:Gem::Requirement
46
46
  requirements:
47
- - - '>'
47
+ - - ! '>'
48
48
  - !ruby/object:Gem::Version
49
49
  version: 3.2.0
50
50
  - - <
@@ -54,14 +54,14 @@ dependencies:
54
54
  name: bunny
55
55
  requirement: !ruby/object:Gem::Requirement
56
56
  requirements:
57
- - - '>='
57
+ - - ! '>='
58
58
  - !ruby/object:Gem::Version
59
59
  version: '0'
60
60
  type: :runtime
61
61
  prerelease: false
62
62
  version_requirements: !ruby/object:Gem::Requirement
63
63
  requirements:
64
- - - '>='
64
+ - - ! '>='
65
65
  - !ruby/object:Gem::Version
66
66
  version: '0'
67
67
  - !ruby/object:Gem::Dependency
@@ -82,56 +82,56 @@ dependencies:
82
82
  name: rake
83
83
  requirement: !ruby/object:Gem::Requirement
84
84
  requirements:
85
- - - '>='
85
+ - - ! '>='
86
86
  - !ruby/object:Gem::Version
87
87
  version: '0'
88
88
  type: :development
89
89
  prerelease: false
90
90
  version_requirements: !ruby/object:Gem::Requirement
91
91
  requirements:
92
- - - '>='
92
+ - - ! '>='
93
93
  - !ruby/object:Gem::Version
94
94
  version: '0'
95
95
  - !ruby/object:Gem::Dependency
96
96
  name: rspec
97
97
  requirement: !ruby/object:Gem::Requirement
98
98
  requirements:
99
- - - '>='
99
+ - - ! '>='
100
100
  - !ruby/object:Gem::Version
101
101
  version: '0'
102
102
  type: :development
103
103
  prerelease: false
104
104
  version_requirements: !ruby/object:Gem::Requirement
105
105
  requirements:
106
- - - '>='
106
+ - - ! '>='
107
107
  - !ruby/object:Gem::Version
108
108
  version: '0'
109
109
  - !ruby/object:Gem::Dependency
110
110
  name: factory_girl
111
111
  requirement: !ruby/object:Gem::Requirement
112
112
  requirements:
113
- - - '>='
113
+ - - ! '>='
114
114
  - !ruby/object:Gem::Version
115
115
  version: '0'
116
116
  type: :development
117
117
  prerelease: false
118
118
  version_requirements: !ruby/object:Gem::Requirement
119
119
  requirements:
120
- - - '>='
120
+ - - ! '>='
121
121
  - !ruby/object:Gem::Version
122
122
  version: '0'
123
123
  - !ruby/object:Gem::Dependency
124
124
  name: coveralls
125
125
  requirement: !ruby/object:Gem::Requirement
126
126
  requirements:
127
- - - '>='
127
+ - - ! '>='
128
128
  - !ruby/object:Gem::Version
129
129
  version: '0'
130
130
  type: :development
131
131
  prerelease: false
132
132
  version_requirements: !ruby/object:Gem::Requirement
133
133
  requirements:
134
- - - '>='
134
+ - - ! '>='
135
135
  - !ruby/object:Gem::Version
136
136
  version: '0'
137
137
  description: Event server, validations, commands and events for rails-disco
@@ -155,6 +155,7 @@ files:
155
155
  - lib/active_event/support/attr_setter.rb
156
156
  - lib/active_event/support/autoload.rb
157
157
  - lib/active_event/support/autoloader.rb
158
+ - lib/active_event/support/multi_logger.rb
158
159
  - lib/active_event/validations.rb
159
160
  - lib/active_event/validations_registry.rb
160
161
  - lib/active_event/version.rb
@@ -182,17 +183,17 @@ require_paths:
182
183
  - lib
183
184
  required_ruby_version: !ruby/object:Gem::Requirement
184
185
  requirements:
185
- - - '>='
186
+ - - ! '>='
186
187
  - !ruby/object:Gem::Version
187
188
  version: '0'
188
189
  required_rubygems_version: !ruby/object:Gem::Requirement
189
190
  requirements:
190
- - - '>='
191
+ - - ! '>='
191
192
  - !ruby/object:Gem::Version
192
193
  version: '0'
193
194
  requirements: []
194
195
  rubyforge_project:
195
- rubygems_version: 2.1.11
196
+ rubygems_version: 2.0.3
196
197
  signing_key:
197
198
  specification_version: 4
198
199
  summary: Simple event sourcing stuff (part of rails-disco)
@@ -208,3 +209,4 @@ test_files:
208
209
  - spec/models/event_spec.rb
209
210
  - spec/spec_helper.rb
210
211
  - spec/support/active_record.rb
212
+ has_rdoc: