ruote 2.1.9 → 2.1.10
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.
- data/CHANGELOG.txt +32 -0
- data/CREDITS.txt +3 -0
- data/Rakefile +4 -4
- data/TODO.txt +55 -11
- data/examples/barley.rb +2 -1
- data/examples/flickr_report.rb +5 -6
- data/examples/web_first_page.rb +11 -0
- data/lib/ruote/context.rb +36 -13
- data/lib/ruote/engine.rb +88 -56
- data/lib/ruote/engine/process_error.rb +13 -0
- data/lib/ruote/engine/process_status.rb +33 -1
- data/lib/ruote/error_handler.rb +122 -0
- data/lib/ruote/evt/tracker.rb +27 -10
- data/lib/ruote/exp/fe_apply.rb +69 -0
- data/lib/ruote/exp/fe_participant.rb +33 -5
- data/lib/ruote/exp/flowexpression.rb +37 -5
- data/lib/ruote/exp/ro_persist.rb +8 -4
- data/lib/ruote/exp/ro_variables.rb +2 -2
- data/lib/ruote/fei.rb +59 -7
- data/lib/ruote/log/storage_history.rb +2 -0
- data/lib/ruote/log/test_logger.rb +28 -19
- data/lib/ruote/log/wait_logger.rb +4 -2
- data/lib/ruote/parser.rb +2 -1
- data/lib/ruote/part/dispatch_pool.rb +10 -10
- data/lib/ruote/part/engine_participant.rb +2 -2
- data/lib/ruote/part/local_participant.rb +99 -7
- data/lib/ruote/part/participant_list.rb +18 -7
- data/lib/ruote/part/storage_participant.rb +9 -6
- data/lib/ruote/receiver/base.rb +109 -10
- data/lib/ruote/storage/base.rb +118 -41
- data/lib/ruote/storage/fs_storage.rb +1 -0
- data/lib/ruote/storage/hash_storage.rb +2 -1
- data/lib/ruote/util/lookup.rb +22 -2
- data/lib/ruote/util/misc.rb +5 -5
- data/lib/ruote/version.rb +1 -1
- data/lib/ruote/worker.rb +50 -63
- data/lib/ruote/workitem.rb +64 -0
- data/ruote.gemspec +17 -12
- data/test/functional/base.rb +3 -1
- data/test/functional/concurrent_base.rb +35 -29
- data/test/functional/crunner.sh +19 -0
- data/test/functional/ct_0_concurrence.rb +17 -30
- data/test/functional/ct_1_iterator.rb +20 -17
- data/test/functional/ct_2_cancel.rb +32 -25
- data/test/functional/eft_12_listen.rb +2 -1
- data/test/functional/eft_23_apply.rb +23 -0
- data/test/functional/eft_3_participant.rb +27 -0
- data/test/functional/ft_11_recursion.rb +1 -1
- data/test/functional/ft_13_variables.rb +22 -0
- data/test/functional/ft_14_re_apply.rb +3 -0
- data/test/functional/ft_15_timeout.rb +1 -0
- data/test/functional/ft_20_storage_participant.rb +20 -2
- data/test/functional/ft_21_forget.rb +30 -0
- data/test/functional/ft_22_process_definitions.rb +2 -1
- data/test/functional/ft_24_block_participants.rb +1 -1
- data/test/functional/ft_25_receiver.rb +83 -1
- data/test/functional/ft_26_participant_timeout.rb +1 -1
- data/test/functional/ft_2_errors.rb +2 -5
- data/test/functional/ft_30_smtp_participant.rb +47 -45
- data/test/functional/ft_36_storage_history.rb +4 -4
- data/test/functional/ft_37_engine_participant.rb +14 -10
- data/test/functional/ft_38_participant_more.rb +178 -0
- data/test/functional/ft_39_wait_for.rb +100 -0
- data/test/functional/ft_40_participant_on_reply.rb +87 -0
- data/test/functional/ft_41_participants.rb +65 -0
- data/test/functional/ft_42_storage_copy.rb +67 -0
- data/test/functional/ft_5_on_error.rb +103 -0
- data/test/functional/ft_9_subprocesses.rb +2 -1
- data/test/functional/storage_helper.rb +5 -1
- data/test/functional/test.rb +4 -1
- data/test/functional/vertical.rb +46 -0
- data/test/unit/storage.rb +17 -1
- data/test/unit/storages.rb +27 -7
- data/test/unit/ut_11_lookup.rb +36 -0
- data/test/unit/ut_16_parser.rb +43 -0
- data/test/unit/ut_1_fei.rb +28 -1
- data/test/unit/ut_7_workitem.rb +23 -0
- metadata +67 -105
- data/lib/ruote/log/fs_history.rb +0 -182
- data/test/functional/ft_32_fs_history.rb +0 -188
- data/test/mpc_test.rb +0 -29
metadata
CHANGED
@@ -1,12 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruote
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
segments:
|
6
|
-
- 2
|
7
|
-
- 1
|
8
|
-
- 9
|
9
|
-
version: 2.1.9
|
4
|
+
version: 2.1.10
|
10
5
|
platform: ruby
|
11
6
|
authors:
|
12
7
|
- John Mettraux
|
@@ -16,175 +11,139 @@ autorequire:
|
|
16
11
|
bindir: bin
|
17
12
|
cert_chain: []
|
18
13
|
|
19
|
-
date: 2010-
|
14
|
+
date: 2010-06-15 00:00:00 +09:00
|
20
15
|
default_executable:
|
21
16
|
dependencies:
|
22
17
|
- !ruby/object:Gem::Dependency
|
23
18
|
name: rufus-json
|
24
|
-
|
25
|
-
|
19
|
+
type: :runtime
|
20
|
+
version_requirement:
|
21
|
+
version_requirements: !ruby/object:Gem::Requirement
|
26
22
|
requirements:
|
27
23
|
- - ">="
|
28
24
|
- !ruby/object:Gem::Version
|
29
|
-
|
30
|
-
|
31
|
-
- 2
|
32
|
-
- 0
|
33
|
-
version: 0.2.0
|
34
|
-
type: :runtime
|
35
|
-
version_requirements: *id001
|
25
|
+
version: 0.2.2
|
26
|
+
version:
|
36
27
|
- !ruby/object:Gem::Dependency
|
37
28
|
name: rufus-cloche
|
38
|
-
|
39
|
-
|
29
|
+
type: :runtime
|
30
|
+
version_requirement:
|
31
|
+
version_requirements: !ruby/object:Gem::Requirement
|
40
32
|
requirements:
|
41
33
|
- - ">="
|
42
34
|
- !ruby/object:Gem::Version
|
43
|
-
|
44
|
-
|
45
|
-
- 1
|
46
|
-
- 16
|
47
|
-
version: 0.1.16
|
48
|
-
type: :runtime
|
49
|
-
version_requirements: *id002
|
35
|
+
version: 0.1.17
|
36
|
+
version:
|
50
37
|
- !ruby/object:Gem::Dependency
|
51
38
|
name: rufus-dollar
|
52
|
-
|
53
|
-
|
39
|
+
type: :runtime
|
40
|
+
version_requirement:
|
41
|
+
version_requirements: !ruby/object:Gem::Requirement
|
54
42
|
requirements:
|
55
43
|
- - ">="
|
56
44
|
- !ruby/object:Gem::Version
|
57
|
-
segments:
|
58
|
-
- 0
|
59
45
|
version: "0"
|
60
|
-
|
61
|
-
version_requirements: *id003
|
46
|
+
version:
|
62
47
|
- !ruby/object:Gem::Dependency
|
63
48
|
name: rufus-lru
|
64
|
-
|
65
|
-
|
49
|
+
type: :runtime
|
50
|
+
version_requirement:
|
51
|
+
version_requirements: !ruby/object:Gem::Requirement
|
66
52
|
requirements:
|
67
53
|
- - ">="
|
68
54
|
- !ruby/object:Gem::Version
|
69
|
-
segments:
|
70
|
-
- 0
|
71
55
|
version: "0"
|
72
|
-
|
73
|
-
version_requirements: *id004
|
56
|
+
version:
|
74
57
|
- !ruby/object:Gem::Dependency
|
75
58
|
name: rufus-mnemo
|
76
|
-
|
77
|
-
|
59
|
+
type: :runtime
|
60
|
+
version_requirement:
|
61
|
+
version_requirements: !ruby/object:Gem::Requirement
|
78
62
|
requirements:
|
79
63
|
- - ">="
|
80
64
|
- !ruby/object:Gem::Version
|
81
|
-
segments:
|
82
|
-
- 1
|
83
|
-
- 1
|
84
|
-
- 0
|
85
65
|
version: 1.1.0
|
86
|
-
|
87
|
-
version_requirements: *id005
|
66
|
+
version:
|
88
67
|
- !ruby/object:Gem::Dependency
|
89
68
|
name: rufus-scheduler
|
90
|
-
|
91
|
-
|
69
|
+
type: :runtime
|
70
|
+
version_requirement:
|
71
|
+
version_requirements: !ruby/object:Gem::Requirement
|
92
72
|
requirements:
|
93
73
|
- - ">="
|
94
74
|
- !ruby/object:Gem::Version
|
95
|
-
segments:
|
96
|
-
- 2
|
97
|
-
- 0
|
98
|
-
- 5
|
99
75
|
version: 2.0.5
|
100
|
-
|
101
|
-
version_requirements: *id006
|
76
|
+
version:
|
102
77
|
- !ruby/object:Gem::Dependency
|
103
78
|
name: rufus-treechecker
|
104
|
-
|
105
|
-
|
79
|
+
type: :runtime
|
80
|
+
version_requirement:
|
81
|
+
version_requirements: !ruby/object:Gem::Requirement
|
106
82
|
requirements:
|
107
83
|
- - ">="
|
108
84
|
- !ruby/object:Gem::Version
|
109
|
-
segments:
|
110
|
-
- 1
|
111
|
-
- 0
|
112
|
-
- 3
|
113
85
|
version: 1.0.3
|
114
|
-
|
115
|
-
version_requirements: *id007
|
86
|
+
version:
|
116
87
|
- !ruby/object:Gem::Dependency
|
117
88
|
name: rake
|
118
|
-
|
119
|
-
|
89
|
+
type: :development
|
90
|
+
version_requirement:
|
91
|
+
version_requirements: !ruby/object:Gem::Requirement
|
120
92
|
requirements:
|
121
93
|
- - ">="
|
122
94
|
- !ruby/object:Gem::Version
|
123
|
-
segments:
|
124
|
-
- 0
|
125
95
|
version: "0"
|
126
|
-
|
127
|
-
version_requirements: *id008
|
96
|
+
version:
|
128
97
|
- !ruby/object:Gem::Dependency
|
129
98
|
name: yard
|
130
|
-
|
131
|
-
|
99
|
+
type: :development
|
100
|
+
version_requirement:
|
101
|
+
version_requirements: !ruby/object:Gem::Requirement
|
132
102
|
requirements:
|
133
103
|
- - ">="
|
134
104
|
- !ruby/object:Gem::Version
|
135
|
-
segments:
|
136
|
-
- 0
|
137
105
|
version: "0"
|
138
|
-
|
139
|
-
version_requirements: *id009
|
106
|
+
version:
|
140
107
|
- !ruby/object:Gem::Dependency
|
141
108
|
name: json
|
142
|
-
|
143
|
-
|
109
|
+
type: :development
|
110
|
+
version_requirement:
|
111
|
+
version_requirements: !ruby/object:Gem::Requirement
|
144
112
|
requirements:
|
145
113
|
- - ">="
|
146
114
|
- !ruby/object:Gem::Version
|
147
|
-
segments:
|
148
|
-
- 0
|
149
115
|
version: "0"
|
150
|
-
|
151
|
-
version_requirements: *id010
|
116
|
+
version:
|
152
117
|
- !ruby/object:Gem::Dependency
|
153
118
|
name: builder
|
154
|
-
|
155
|
-
|
119
|
+
type: :development
|
120
|
+
version_requirement:
|
121
|
+
version_requirements: !ruby/object:Gem::Requirement
|
156
122
|
requirements:
|
157
123
|
- - ">="
|
158
124
|
- !ruby/object:Gem::Version
|
159
|
-
segments:
|
160
|
-
- 0
|
161
125
|
version: "0"
|
162
|
-
|
163
|
-
version_requirements: *id011
|
126
|
+
version:
|
164
127
|
- !ruby/object:Gem::Dependency
|
165
128
|
name: mailtrap
|
166
|
-
|
167
|
-
|
129
|
+
type: :development
|
130
|
+
version_requirement:
|
131
|
+
version_requirements: !ruby/object:Gem::Requirement
|
168
132
|
requirements:
|
169
133
|
- - ">="
|
170
134
|
- !ruby/object:Gem::Version
|
171
|
-
segments:
|
172
|
-
- 0
|
173
135
|
version: "0"
|
174
|
-
|
175
|
-
version_requirements: *id012
|
136
|
+
version:
|
176
137
|
- !ruby/object:Gem::Dependency
|
177
138
|
name: jeweler
|
178
|
-
|
179
|
-
|
139
|
+
type: :development
|
140
|
+
version_requirement:
|
141
|
+
version_requirements: !ruby/object:Gem::Requirement
|
180
142
|
requirements:
|
181
143
|
- - ">="
|
182
144
|
- !ruby/object:Gem::Version
|
183
|
-
segments:
|
184
|
-
- 0
|
185
145
|
version: "0"
|
186
|
-
|
187
|
-
version_requirements: *id013
|
146
|
+
version:
|
188
147
|
description: "\n\
|
189
148
|
ruote is an open source ruby workflow engine.\n "
|
190
149
|
email: jmettraux@gmail.com
|
@@ -212,6 +171,7 @@ files:
|
|
212
171
|
- lib/ruote/engine.rb
|
213
172
|
- lib/ruote/engine/process_error.rb
|
214
173
|
- lib/ruote/engine/process_status.rb
|
174
|
+
- lib/ruote/error_handler.rb
|
215
175
|
- lib/ruote/evt/tracker.rb
|
216
176
|
- lib/ruote/exp/command.rb
|
217
177
|
- lib/ruote/exp/commanded.rb
|
@@ -256,7 +216,6 @@ files:
|
|
256
216
|
- lib/ruote/fei.rb
|
257
217
|
- lib/ruote/id/mnemo_wfid_generator.rb
|
258
218
|
- lib/ruote/id/wfid_generator.rb
|
259
|
-
- lib/ruote/log/fs_history.rb
|
260
219
|
- lib/ruote/log/storage_history.rb
|
261
220
|
- lib/ruote/log/test_logger.rb
|
262
221
|
- lib/ruote/log/wait_logger.rb
|
@@ -308,6 +267,7 @@ files:
|
|
308
267
|
- test/functional/base.rb
|
309
268
|
- test/functional/concurrent_base.rb
|
310
269
|
- test/functional/crunner.rb
|
270
|
+
- test/functional/crunner.sh
|
311
271
|
- test/functional/ct_0_concurrence.rb
|
312
272
|
- test/functional/ct_1_iterator.rb
|
313
273
|
- test/functional/ct_2_cancel.rb
|
@@ -366,13 +326,17 @@ files:
|
|
366
326
|
- test/functional/ft_2_errors.rb
|
367
327
|
- test/functional/ft_30_smtp_participant.rb
|
368
328
|
- test/functional/ft_31_part_blocking.rb
|
369
|
-
- test/functional/ft_32_fs_history.rb
|
370
329
|
- test/functional/ft_33_participant_subprocess_priority.rb
|
371
330
|
- test/functional/ft_34_cursor_rewind.rb
|
372
331
|
- test/functional/ft_35_add_service.rb
|
373
332
|
- test/functional/ft_36_storage_history.rb
|
374
333
|
- test/functional/ft_37_engine_participant.rb
|
334
|
+
- test/functional/ft_38_participant_more.rb
|
335
|
+
- test/functional/ft_39_wait_for.rb
|
375
336
|
- test/functional/ft_3_participant_registration.rb
|
337
|
+
- test/functional/ft_40_participant_on_reply.rb
|
338
|
+
- test/functional/ft_41_participants.rb
|
339
|
+
- test/functional/ft_42_storage_copy.rb
|
376
340
|
- test/functional/ft_4_cancel.rb
|
377
341
|
- test/functional/ft_5_on_error.rb
|
378
342
|
- test/functional/ft_6_on_cancel.rb
|
@@ -389,7 +353,7 @@ files:
|
|
389
353
|
- test/functional/rtest.rb
|
390
354
|
- test/functional/storage_helper.rb
|
391
355
|
- test/functional/test.rb
|
392
|
-
- test/
|
356
|
+
- test/functional/vertical.rb
|
393
357
|
- test/path_helper.rb
|
394
358
|
- test/pdef.xml
|
395
359
|
- test/test.rb
|
@@ -428,20 +392,18 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
428
392
|
requirements:
|
429
393
|
- - ">="
|
430
394
|
- !ruby/object:Gem::Version
|
431
|
-
segments:
|
432
|
-
- 0
|
433
395
|
version: "0"
|
396
|
+
version:
|
434
397
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
435
398
|
requirements:
|
436
399
|
- - ">="
|
437
400
|
- !ruby/object:Gem::Version
|
438
|
-
segments:
|
439
|
-
- 0
|
440
401
|
version: "0"
|
402
|
+
version:
|
441
403
|
requirements: []
|
442
404
|
|
443
405
|
rubyforge_project: ruote
|
444
|
-
rubygems_version: 1.3.
|
406
|
+
rubygems_version: 1.3.5
|
445
407
|
signing_key:
|
446
408
|
specification_version: 3
|
447
409
|
summary: an open source ruby workflow engine
|
data/lib/ruote/log/fs_history.rb
DELETED
@@ -1,182 +0,0 @@
|
|
1
|
-
#--
|
2
|
-
# Copyright (c) 2005-2010, John Mettraux, jmettraux@gmail.com
|
3
|
-
#
|
4
|
-
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
5
|
-
# of this software and associated documentation files (the "Software"), to deal
|
6
|
-
# in the Software without restriction, including without limitation the rights
|
7
|
-
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
8
|
-
# copies of the Software, and to permit persons to whom the Software is
|
9
|
-
# furnished to do so, subject to the following conditions:
|
10
|
-
#
|
11
|
-
# The above copyright notice and this permission notice shall be included in
|
12
|
-
# all copies or substantial portions of the Software.
|
13
|
-
#
|
14
|
-
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
15
|
-
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
16
|
-
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
17
|
-
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
18
|
-
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
19
|
-
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
20
|
-
# THE SOFTWARE.
|
21
|
-
#
|
22
|
-
# Made in Japan.
|
23
|
-
#++
|
24
|
-
|
25
|
-
require 'fileutils'
|
26
|
-
require 'rufus/json'
|
27
|
-
|
28
|
-
|
29
|
-
module Ruote
|
30
|
-
|
31
|
-
#
|
32
|
-
# Logs the ruote engine history to files.
|
33
|
-
#
|
34
|
-
# REMEMBER : this FsHistory only logs 1 worker. StorageHistory is better
|
35
|
-
# to let all the workers output history in the shared storage.
|
36
|
-
#
|
37
|
-
class FsHistory
|
38
|
-
|
39
|
-
def initialize (context, options={})
|
40
|
-
|
41
|
-
@context = context
|
42
|
-
@options = options
|
43
|
-
|
44
|
-
@path =
|
45
|
-
@options['history_path'] ||
|
46
|
-
@context['history_path'] ||
|
47
|
-
File.join('work', 'log')
|
48
|
-
|
49
|
-
FileUtils.mkdir_p(@path)
|
50
|
-
|
51
|
-
@last = nil
|
52
|
-
@file = nil
|
53
|
-
|
54
|
-
if @context.worker
|
55
|
-
|
56
|
-
# only care about logging if there is a worker present
|
57
|
-
|
58
|
-
@context.worker.subscribe(:all, self)
|
59
|
-
rotate_if_necessary
|
60
|
-
end
|
61
|
-
end
|
62
|
-
|
63
|
-
# Makes sure to close the history file.
|
64
|
-
#
|
65
|
-
def shutdown
|
66
|
-
|
67
|
-
@file.close rescue nil
|
68
|
-
end
|
69
|
-
|
70
|
-
# Returns the messages concerning the process given by its wfid,
|
71
|
-
# or an empty array if there were no such process seen.
|
72
|
-
#
|
73
|
-
def by_process (wfid)
|
74
|
-
|
75
|
-
files = Dir[File.join(@path, '*.json')].sort.reverse
|
76
|
-
|
77
|
-
history = []
|
78
|
-
|
79
|
-
files.each do |f|
|
80
|
-
|
81
|
-
lines = File.readlines(f).reverse
|
82
|
-
|
83
|
-
lines.each do |l|
|
84
|
-
|
85
|
-
a = Rufus::Json.decode(l) rescue nil
|
86
|
-
|
87
|
-
next unless a
|
88
|
-
|
89
|
-
at, msg = a
|
90
|
-
|
91
|
-
m_wfid = msg['wfid'] || (msg['fei']['wfid'] rescue nil)
|
92
|
-
|
93
|
-
next if m_wfid != wfid
|
94
|
-
|
95
|
-
history.unshift(a)
|
96
|
-
|
97
|
-
return history if msg['action'] == 'launch'
|
98
|
-
end
|
99
|
-
end
|
100
|
-
|
101
|
-
history # shouldn't occur, unless history [file] got lost
|
102
|
-
end
|
103
|
-
|
104
|
-
RANGE_REGEXP = /_([0-9]{4}-[0-9]{2}-[0-9]{2}).json$/
|
105
|
-
|
106
|
-
# Returns an array [ most recent date, oldest date ] (Time instances).
|
107
|
-
#
|
108
|
-
def range
|
109
|
-
|
110
|
-
files = Dir[File.join(@path, '*.json')].sort
|
111
|
-
|
112
|
-
[ files.last, files.first ].inject([]) do |a, fn|
|
113
|
-
if m = RANGE_REGEXP.match(fn)
|
114
|
-
a << Time.parse(m[1])
|
115
|
-
end
|
116
|
-
a
|
117
|
-
end
|
118
|
-
end
|
119
|
-
|
120
|
-
# Returns an array of messages for a given day or an empty array if nothing
|
121
|
-
# happened at that date.
|
122
|
-
#
|
123
|
-
def by_date (date)
|
124
|
-
|
125
|
-
date = Time.parse(date.to_s).strftime('%Y-%m-%d')
|
126
|
-
|
127
|
-
lines = File.readlines(File.join(@path, "history_#{date}.json")) rescue []
|
128
|
-
|
129
|
-
lines.inject([]) do |a, l|
|
130
|
-
if r = (Rufus::Json.decode(l) rescue nil)
|
131
|
-
a << r
|
132
|
-
end
|
133
|
-
a
|
134
|
-
end
|
135
|
-
end
|
136
|
-
|
137
|
-
#def history_to_tree (wfid)
|
138
|
-
# # (NOTE why not ?)
|
139
|
-
#end
|
140
|
-
|
141
|
-
# The history system doesn't implement purge! so that when purge! is called
|
142
|
-
# on the engine, the history is not cleared.
|
143
|
-
#
|
144
|
-
# Call this *dangerous* clear! method to clean out any history file.
|
145
|
-
#
|
146
|
-
def clear!
|
147
|
-
|
148
|
-
Dir[File.join(@path, "#{engine.engine_id}_*.txt")].each do |f|
|
149
|
-
FileUtils.rm_f(f) rescue nil
|
150
|
-
end
|
151
|
-
end
|
152
|
-
|
153
|
-
# This is the method called by the workqueue. Incoming engine events
|
154
|
-
# are 'processed' here.
|
155
|
-
#
|
156
|
-
def notify (msg)
|
157
|
-
|
158
|
-
rotate_if_necessary
|
159
|
-
|
160
|
-
@file.puts(Rufus::Json.encode(
|
161
|
-
[ "#{@last.strftime('%Y-%m-%d %T')}.#{"%06d" % @last.usec}", msg ]))
|
162
|
-
@file.flush
|
163
|
-
end
|
164
|
-
|
165
|
-
protected
|
166
|
-
|
167
|
-
def rotate_if_necessary
|
168
|
-
|
169
|
-
prev = @last
|
170
|
-
@last = Time.now.utc
|
171
|
-
|
172
|
-
return if prev && prev.day == @last.day
|
173
|
-
|
174
|
-
@file.close rescue nil
|
175
|
-
|
176
|
-
fn = [ 'history', @last.strftime('%Y-%m-%d') ].join('_') + '.json'
|
177
|
-
|
178
|
-
@file = File.open(File.join(@path, fn), 'a')
|
179
|
-
end
|
180
|
-
end
|
181
|
-
end
|
182
|
-
|