tengine_event 0.4.9 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +1 -23
- data/Gemfile.lock +41 -36
- data/lib/tengine/event.rb +18 -1
- data/lib/tengine/event/sender.rb +1 -1
- data/lib/tengine_event.rb +3 -2
- metadata +115 -60
- data/.document +0 -5
- data/.rspec +0 -1
- data/Rakefile +0 -51
- data/VERSION +0 -1
- data/lib/tengine/null_logger.rb +0 -10
- data/spec/.gitignore +0 -1
- data/spec/mq_config.yml.example +0 -13
- data/spec/spec_helper.rb +0 -15
- data/spec/tengine/event/model_notifiable_spec.rb +0 -80
- data/spec/tengine/event/sender_spec.rb +0 -124
- data/spec/tengine/event_spec.rb +0 -397
- data/spec/tengine/mq/connect_actually_spec.rb +0 -38
- data/spec/tengine/mq/suite_spec.rb +0 -981
- data/spec/tengine/null_logger_spec.rb +0 -13
- data/spec/tengine_spec.rb +0 -17
- data/tengine_event.gemspec +0 -96
data/Gemfile
CHANGED
@@ -1,26 +1,4 @@
|
|
1
1
|
# -*- coding: utf-8 -*-
|
2
2
|
source "http://rubygems.org"
|
3
3
|
|
4
|
-
|
5
|
-
# Example:
|
6
|
-
# gem "activesupport", ">= 2.3.5"
|
7
|
-
|
8
|
-
gem "activesupport", ">= 3.0.0"
|
9
|
-
gem "tengine_support", ">= 0.3.27"
|
10
|
-
|
11
|
-
gem "uuid", "~> 2.3.4"
|
12
|
-
|
13
|
-
gem "amqp", "~> 0.8.0"
|
14
|
-
|
15
|
-
# Add dependencies to develop your gem here.
|
16
|
-
# Include everything needed to run rake, tests, features, etc.
|
17
|
-
group :development do
|
18
|
-
gem "rspec", "~> 2.6.0"
|
19
|
-
gem "yard", "~> 0.7.2"
|
20
|
-
gem "bundler", "~> 1.1.3"
|
21
|
-
gem "jeweler", "~> 1.6.4"
|
22
|
-
# gem "rcov", ">= 0"
|
23
|
-
gem "simplecov", "~> 0.5.3"
|
24
|
-
gem "ZenTest", "~> 4.6.2"
|
25
|
-
gem "ci_reporter", "~>1.6.5"
|
26
|
-
end
|
4
|
+
gemspec
|
data/Gemfile.lock
CHANGED
@@ -1,8 +1,17 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
tengine_event (1.1.0)
|
5
|
+
activesupport (>= 3.0.0)
|
6
|
+
amqp (~> 0.8.0)
|
7
|
+
tengine_support (~> 1.1.0)
|
8
|
+
uuid (~> 2.3.4)
|
9
|
+
|
1
10
|
GEM
|
2
11
|
remote: http://rubygems.org/
|
3
12
|
specs:
|
4
|
-
ZenTest (4.
|
5
|
-
activesupport (3.2.
|
13
|
+
ZenTest (4.8.2)
|
14
|
+
activesupport (3.2.9)
|
6
15
|
i18n (~> 0.6)
|
7
16
|
multi_json (~> 1.0)
|
8
17
|
amq-client (0.8.7)
|
@@ -13,52 +22,48 @@ GEM
|
|
13
22
|
amq-client (~> 0.8.7)
|
14
23
|
amq-protocol (~> 0.8.4)
|
15
24
|
eventmachine
|
16
|
-
|
25
|
+
autotest (4.4.6)
|
26
|
+
ZenTest (>= 4.4.1)
|
27
|
+
builder (3.1.3)
|
17
28
|
ci_reporter (1.6.9)
|
18
29
|
builder (>= 2.1.2)
|
19
30
|
diff-lcs (1.1.3)
|
20
|
-
eventmachine (0.
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
git (>= 1.2.5)
|
26
|
-
rake
|
27
|
-
macaddr (1.5.0)
|
28
|
-
systemu (>= 2.4.0)
|
29
|
-
multi_json (1.0.4)
|
31
|
+
eventmachine (1.0.0)
|
32
|
+
i18n (0.6.1)
|
33
|
+
macaddr (1.6.1)
|
34
|
+
systemu (~> 2.5.0)
|
35
|
+
multi_json (1.3.6)
|
30
36
|
rake (0.9.2.2)
|
31
|
-
|
32
|
-
|
33
|
-
rspec-
|
34
|
-
rspec-
|
35
|
-
|
36
|
-
rspec-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
37
|
+
rdiscount (1.6.8)
|
38
|
+
rspec (2.10.0)
|
39
|
+
rspec-core (~> 2.10.0)
|
40
|
+
rspec-expectations (~> 2.10.0)
|
41
|
+
rspec-mocks (~> 2.10.0)
|
42
|
+
rspec-core (2.10.1)
|
43
|
+
rspec-expectations (2.10.0)
|
44
|
+
diff-lcs (~> 1.1.3)
|
45
|
+
rspec-mocks (2.10.1)
|
46
|
+
simplecov (0.6.4)
|
47
|
+
multi_json (~> 1.0)
|
41
48
|
simplecov-html (~> 0.5.3)
|
42
49
|
simplecov-html (0.5.3)
|
43
|
-
systemu (2.5.
|
44
|
-
tengine_support (
|
50
|
+
systemu (2.5.2)
|
51
|
+
tengine_support (1.1.0)
|
45
52
|
activesupport (>= 3.0.0)
|
46
53
|
uuid (2.3.5)
|
47
54
|
macaddr (~> 1.0)
|
48
|
-
yard (0.
|
55
|
+
yard (0.8.2.1)
|
49
56
|
|
50
57
|
PLATFORMS
|
51
58
|
ruby
|
52
59
|
|
53
60
|
DEPENDENCIES
|
54
|
-
|
55
|
-
|
56
|
-
amqp (~> 0.8.0)
|
57
|
-
bundler (~> 1.1.3)
|
61
|
+
autotest
|
62
|
+
bundler
|
58
63
|
ci_reporter (~> 1.6.5)
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
yard (~> 0.
|
64
|
+
rake (~> 0.9.2.2)
|
65
|
+
rdiscount
|
66
|
+
rspec (~> 2.10.0)
|
67
|
+
simplecov (~> 0.6.4)
|
68
|
+
tengine_event!
|
69
|
+
yard (~> 0.8.1)
|
data/lib/tengine/event.rb
CHANGED
@@ -6,6 +6,8 @@ require 'active_support/core_ext/hash/keys'
|
|
6
6
|
require 'active_support/json'
|
7
7
|
require 'uuid'
|
8
8
|
|
9
|
+
ActiveSupport::OrderedHash = Hash unless defined?(ActiveSupport::OrderedHash)
|
10
|
+
|
9
11
|
# Serializable Class of object to send to an MQ or to receive from MQ.
|
10
12
|
class Tengine::Event
|
11
13
|
|
@@ -143,12 +145,27 @@ class Tengine::Event
|
|
143
145
|
# @attribute
|
144
146
|
# イベントの通知レベル
|
145
147
|
attr_accessor :level
|
148
|
+
def level=(val)
|
149
|
+
if val && !LEVELS.keys.include?(val)
|
150
|
+
raise ArgumentError, "Invalid level #{val.inspect}. It must be one of #{LEVELS.keys.inspect}"
|
151
|
+
end
|
152
|
+
@level = val
|
153
|
+
end
|
146
154
|
|
147
155
|
# @attribute
|
148
156
|
# イベントの通知レベルキー
|
149
157
|
# :gr_heartbeat/:debug/:info/:warn/:error/:fatal
|
150
158
|
def level_key; LEVELS[level];end
|
151
|
-
def level_key=(v)
|
159
|
+
def level_key=(v)
|
160
|
+
if v
|
161
|
+
unless val = LEVELS_INV[v.to_sym]
|
162
|
+
raise ArgumentError, "Invalid level_key #{v.inspect}. It must be one of #{LEVELS_INV.keys.inspect}"
|
163
|
+
end
|
164
|
+
self.level = val
|
165
|
+
else
|
166
|
+
self.level = nil
|
167
|
+
end
|
168
|
+
end
|
152
169
|
|
153
170
|
# @attribute
|
154
171
|
# イベントの送信者名。
|
data/lib/tengine/event/sender.rb
CHANGED
@@ -58,7 +58,7 @@ class Tengine::Event::Sender
|
|
58
58
|
Tengine::Mq::Suite.new(options)
|
59
59
|
end
|
60
60
|
@default_keep_connection = @mq_suite.config[:sender][:keep_connection]
|
61
|
-
@logger = options[:logger] || Tengine::NullLogger.new
|
61
|
+
@logger = options[:logger] || Tengine::Support::NullLogger.new
|
62
62
|
end
|
63
63
|
|
64
64
|
def stop(&block)
|
data/lib/tengine_event.rb
CHANGED
@@ -1,11 +1,12 @@
|
|
1
|
+
require 'tengine_support'
|
2
|
+
|
1
3
|
module Tengine
|
2
4
|
autoload :Event , 'tengine/event'
|
3
5
|
autoload :Mq , 'tengine/mq'
|
4
|
-
autoload :NullLogger, 'tengine/null_logger'
|
5
6
|
|
6
7
|
class << self
|
7
8
|
def logger
|
8
|
-
@logger ||= NullLogger.new # ::Logger.new(STDOUT)
|
9
|
+
@logger ||= ::Tengine::Support::NullLogger.new # ::Logger.new(STDOUT)
|
9
10
|
end
|
10
11
|
attr_writer :logger
|
11
12
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tengine_event
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 1.1.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -13,11 +13,11 @@ authors:
|
|
13
13
|
autorequire:
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
|
-
date: 2012-
|
16
|
+
date: 2012-12-19 00:00:00.000000000 Z
|
17
17
|
dependencies:
|
18
18
|
- !ruby/object:Gem::Dependency
|
19
19
|
name: activesupport
|
20
|
-
requirement:
|
20
|
+
requirement: !ruby/object:Gem::Requirement
|
21
21
|
none: false
|
22
22
|
requirements:
|
23
23
|
- - ! '>='
|
@@ -25,21 +25,31 @@ dependencies:
|
|
25
25
|
version: 3.0.0
|
26
26
|
type: :runtime
|
27
27
|
prerelease: false
|
28
|
-
version_requirements:
|
28
|
+
version_requirements: !ruby/object:Gem::Requirement
|
29
|
+
none: false
|
30
|
+
requirements:
|
31
|
+
- - ! '>='
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 3.0.0
|
29
34
|
- !ruby/object:Gem::Dependency
|
30
35
|
name: tengine_support
|
31
|
-
requirement:
|
36
|
+
requirement: !ruby/object:Gem::Requirement
|
32
37
|
none: false
|
33
38
|
requirements:
|
34
|
-
- -
|
39
|
+
- - ~>
|
35
40
|
- !ruby/object:Gem::Version
|
36
|
-
version:
|
41
|
+
version: 1.1.0
|
37
42
|
type: :runtime
|
38
43
|
prerelease: false
|
39
|
-
version_requirements:
|
44
|
+
version_requirements: !ruby/object:Gem::Requirement
|
45
|
+
none: false
|
46
|
+
requirements:
|
47
|
+
- - ~>
|
48
|
+
- !ruby/object:Gem::Version
|
49
|
+
version: 1.1.0
|
40
50
|
- !ruby/object:Gem::Dependency
|
41
51
|
name: uuid
|
42
|
-
requirement:
|
52
|
+
requirement: !ruby/object:Gem::Requirement
|
43
53
|
none: false
|
44
54
|
requirements:
|
45
55
|
- - ~>
|
@@ -47,10 +57,15 @@ dependencies:
|
|
47
57
|
version: 2.3.4
|
48
58
|
type: :runtime
|
49
59
|
prerelease: false
|
50
|
-
version_requirements:
|
60
|
+
version_requirements: !ruby/object:Gem::Requirement
|
61
|
+
none: false
|
62
|
+
requirements:
|
63
|
+
- - ~>
|
64
|
+
- !ruby/object:Gem::Version
|
65
|
+
version: 2.3.4
|
51
66
|
- !ruby/object:Gem::Dependency
|
52
67
|
name: amqp
|
53
|
-
requirement:
|
68
|
+
requirement: !ruby/object:Gem::Requirement
|
54
69
|
none: false
|
55
70
|
requirements:
|
56
71
|
- - ~>
|
@@ -58,76 +73,127 @@ dependencies:
|
|
58
73
|
version: 0.8.0
|
59
74
|
type: :runtime
|
60
75
|
prerelease: false
|
61
|
-
version_requirements:
|
62
|
-
- !ruby/object:Gem::Dependency
|
63
|
-
name: rspec
|
64
|
-
requirement: &2164059060 !ruby/object:Gem::Requirement
|
76
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
77
|
none: false
|
66
78
|
requirements:
|
67
79
|
- - ~>
|
68
80
|
- !ruby/object:Gem::Version
|
69
|
-
version:
|
81
|
+
version: 0.8.0
|
82
|
+
- !ruby/object:Gem::Dependency
|
83
|
+
name: bundler
|
84
|
+
requirement: !ruby/object:Gem::Requirement
|
85
|
+
none: false
|
86
|
+
requirements:
|
87
|
+
- - ! '>='
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
70
90
|
type: :development
|
71
91
|
prerelease: false
|
72
|
-
version_requirements:
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
none: false
|
94
|
+
requirements:
|
95
|
+
- - ! '>='
|
96
|
+
- !ruby/object:Gem::Version
|
97
|
+
version: '0'
|
73
98
|
- !ruby/object:Gem::Dependency
|
74
|
-
name:
|
75
|
-
requirement:
|
99
|
+
name: rake
|
100
|
+
requirement: !ruby/object:Gem::Requirement
|
76
101
|
none: false
|
77
102
|
requirements:
|
78
103
|
- - ~>
|
79
104
|
- !ruby/object:Gem::Version
|
80
|
-
version: 0.
|
105
|
+
version: 0.9.2.2
|
81
106
|
type: :development
|
82
107
|
prerelease: false
|
83
|
-
version_requirements:
|
108
|
+
version_requirements: !ruby/object:Gem::Requirement
|
109
|
+
none: false
|
110
|
+
requirements:
|
111
|
+
- - ~>
|
112
|
+
- !ruby/object:Gem::Version
|
113
|
+
version: 0.9.2.2
|
84
114
|
- !ruby/object:Gem::Dependency
|
85
|
-
name:
|
86
|
-
requirement:
|
115
|
+
name: rspec
|
116
|
+
requirement: !ruby/object:Gem::Requirement
|
87
117
|
none: false
|
88
118
|
requirements:
|
89
119
|
- - ~>
|
90
120
|
- !ruby/object:Gem::Version
|
91
|
-
version:
|
121
|
+
version: 2.10.0
|
92
122
|
type: :development
|
93
123
|
prerelease: false
|
94
|
-
version_requirements:
|
124
|
+
version_requirements: !ruby/object:Gem::Requirement
|
125
|
+
none: false
|
126
|
+
requirements:
|
127
|
+
- - ~>
|
128
|
+
- !ruby/object:Gem::Version
|
129
|
+
version: 2.10.0
|
95
130
|
- !ruby/object:Gem::Dependency
|
96
|
-
name:
|
97
|
-
requirement:
|
131
|
+
name: yard
|
132
|
+
requirement: !ruby/object:Gem::Requirement
|
98
133
|
none: false
|
99
134
|
requirements:
|
100
135
|
- - ~>
|
101
136
|
- !ruby/object:Gem::Version
|
102
|
-
version:
|
137
|
+
version: 0.8.1
|
103
138
|
type: :development
|
104
139
|
prerelease: false
|
105
|
-
version_requirements:
|
140
|
+
version_requirements: !ruby/object:Gem::Requirement
|
141
|
+
none: false
|
142
|
+
requirements:
|
143
|
+
- - ~>
|
144
|
+
- !ruby/object:Gem::Version
|
145
|
+
version: 0.8.1
|
106
146
|
- !ruby/object:Gem::Dependency
|
107
147
|
name: simplecov
|
108
|
-
requirement:
|
148
|
+
requirement: !ruby/object:Gem::Requirement
|
109
149
|
none: false
|
110
150
|
requirements:
|
111
151
|
- - ~>
|
112
152
|
- !ruby/object:Gem::Version
|
113
|
-
version: 0.
|
153
|
+
version: 0.6.4
|
114
154
|
type: :development
|
115
155
|
prerelease: false
|
116
|
-
version_requirements:
|
117
|
-
- !ruby/object:Gem::Dependency
|
118
|
-
name: ZenTest
|
119
|
-
requirement: &2164056240 !ruby/object:Gem::Requirement
|
156
|
+
version_requirements: !ruby/object:Gem::Requirement
|
120
157
|
none: false
|
121
158
|
requirements:
|
122
159
|
- - ~>
|
123
160
|
- !ruby/object:Gem::Version
|
124
|
-
version:
|
161
|
+
version: 0.6.4
|
162
|
+
- !ruby/object:Gem::Dependency
|
163
|
+
name: autotest
|
164
|
+
requirement: !ruby/object:Gem::Requirement
|
165
|
+
none: false
|
166
|
+
requirements:
|
167
|
+
- - ! '>='
|
168
|
+
- !ruby/object:Gem::Version
|
169
|
+
version: '0'
|
125
170
|
type: :development
|
126
171
|
prerelease: false
|
127
|
-
version_requirements:
|
172
|
+
version_requirements: !ruby/object:Gem::Requirement
|
173
|
+
none: false
|
174
|
+
requirements:
|
175
|
+
- - ! '>='
|
176
|
+
- !ruby/object:Gem::Version
|
177
|
+
version: '0'
|
178
|
+
- !ruby/object:Gem::Dependency
|
179
|
+
name: rdiscount
|
180
|
+
requirement: !ruby/object:Gem::Requirement
|
181
|
+
none: false
|
182
|
+
requirements:
|
183
|
+
- - ! '>='
|
184
|
+
- !ruby/object:Gem::Version
|
185
|
+
version: '0'
|
186
|
+
type: :development
|
187
|
+
prerelease: false
|
188
|
+
version_requirements: !ruby/object:Gem::Requirement
|
189
|
+
none: false
|
190
|
+
requirements:
|
191
|
+
- - ! '>='
|
192
|
+
- !ruby/object:Gem::Version
|
193
|
+
version: '0'
|
128
194
|
- !ruby/object:Gem::Dependency
|
129
195
|
name: ci_reporter
|
130
|
-
requirement:
|
196
|
+
requirement: !ruby/object:Gem::Requirement
|
131
197
|
none: false
|
132
198
|
requirements:
|
133
199
|
- - ~>
|
@@ -135,7 +201,12 @@ dependencies:
|
|
135
201
|
version: 1.6.5
|
136
202
|
type: :development
|
137
203
|
prerelease: false
|
138
|
-
version_requirements:
|
204
|
+
version_requirements: !ruby/object:Gem::Requirement
|
205
|
+
none: false
|
206
|
+
requirements:
|
207
|
+
- - ~>
|
208
|
+
- !ruby/object:Gem::Version
|
209
|
+
version: 1.6.5
|
139
210
|
description: Tengine Event API to access the queue
|
140
211
|
email: tengine-info@groovenauts.jp
|
141
212
|
executables:
|
@@ -145,34 +216,18 @@ extensions: []
|
|
145
216
|
extra_rdoc_files:
|
146
217
|
- README.rdoc
|
147
218
|
files:
|
148
|
-
- .document
|
149
|
-
- .rspec
|
150
219
|
- Gemfile
|
151
220
|
- Gemfile.lock
|
152
221
|
- README.rdoc
|
153
|
-
- Rakefile
|
154
|
-
- VERSION
|
155
222
|
- bin/tengine_event_sucks
|
156
223
|
- bin/tengine_fire
|
157
|
-
- lib/tengine/event.rb
|
158
224
|
- lib/tengine/event/model_notifiable.rb
|
159
225
|
- lib/tengine/event/sender.rb
|
160
|
-
- lib/tengine/
|
226
|
+
- lib/tengine/event.rb
|
161
227
|
- lib/tengine/mq/suite.rb
|
162
|
-
- lib/tengine/
|
228
|
+
- lib/tengine/mq.rb
|
163
229
|
- lib/tengine_event.rb
|
164
|
-
|
165
|
-
- spec/mq_config.yml.example
|
166
|
-
- spec/spec_helper.rb
|
167
|
-
- spec/tengine/event/model_notifiable_spec.rb
|
168
|
-
- spec/tengine/event/sender_spec.rb
|
169
|
-
- spec/tengine/event_spec.rb
|
170
|
-
- spec/tengine/mq/connect_actually_spec.rb
|
171
|
-
- spec/tengine/mq/suite_spec.rb
|
172
|
-
- spec/tengine/null_logger_spec.rb
|
173
|
-
- spec/tengine_spec.rb
|
174
|
-
- tengine_event.gemspec
|
175
|
-
homepage: https://github.com/tengine/tengine_event
|
230
|
+
homepage: https://github.com/tengine/tengine/tree/develop/tengine_event
|
176
231
|
licenses:
|
177
232
|
- MPL2.0/LGPLv3
|
178
233
|
post_install_message:
|
@@ -187,7 +242,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
187
242
|
version: '0'
|
188
243
|
segments:
|
189
244
|
- 0
|
190
|
-
hash:
|
245
|
+
hash: -2976382533152683923
|
191
246
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
192
247
|
none: false
|
193
248
|
requirements:
|
@@ -196,7 +251,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
196
251
|
version: '0'
|
197
252
|
requirements: []
|
198
253
|
rubyforge_project:
|
199
|
-
rubygems_version: 1.8.
|
254
|
+
rubygems_version: 1.8.23
|
200
255
|
signing_key:
|
201
256
|
specification_version: 3
|
202
257
|
summary: Tengine Event API to access the queue
|