dynarex_cron 0.4.0 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data/lib/dynarex_cron.rb +20 -28
- data.tar.gz.sig +0 -0
- metadata +42 -22
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 650e5dd599bcb72a630285bf8e86bd39ad116570
|
4
|
+
data.tar.gz: 2f3fae25c68d9c102bf8edb6b405b17d3854b49c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 27802c0a22d2491bb9e9c32dc74f8177e1d05aeff9c51d608cca8ecf14860c7f42dd2344de344d0c6f94662aba8ff4cd8207677a3e746b3d3c305a8e715fcade
|
7
|
+
data.tar.gz: 6f3845abf104006af8d3afdce6095ebde61176ace4b9919c01c3ed5ed5103ab4c2ff43cafb52cab16781fc6d359a34df182a5ce23360bcf39c8ef6b563e20cdf
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data/lib/dynarex_cron.rb
CHANGED
@@ -4,10 +4,12 @@
|
|
4
4
|
|
5
5
|
require 'dynarex'
|
6
6
|
require 'chronic_cron'
|
7
|
-
require 'websocket-eventmachine-client'
|
8
7
|
require 'rscript'
|
9
8
|
require 'chronic_duration'
|
10
9
|
require 'logger'
|
10
|
+
require 'run_every'
|
11
|
+
require 'sps-pub'
|
12
|
+
|
11
13
|
|
12
14
|
DF = "%Y-%m-%d %H:%M"
|
13
15
|
|
@@ -48,32 +50,24 @@ class DynarexCron
|
|
48
50
|
puts '[' + (Time.now + @time_offset).strftime(DF) + '] DynarexCron started'
|
49
51
|
params = {uri: "ws://%s:%s" % [@sps_address, @sps_port]}
|
50
52
|
|
51
|
-
|
52
|
-
|
53
|
-
EventMachine.run do
|
54
|
-
|
55
|
-
@ws = c.connect(params)
|
56
|
-
|
57
|
-
EM.add_periodic_timer(60) do
|
53
|
+
RunEvery.new(seconds: 60) do
|
58
54
|
|
59
|
-
|
60
|
-
|
55
|
+
iterate @cron_entries
|
56
|
+
iterate @cron_events
|
61
57
|
|
62
|
-
|
58
|
+
if @dynarex_file.is_a? String then
|
63
59
|
|
64
|
-
|
65
|
-
|
60
|
+
buffer, _ = RXFHelper.read(@dynarex_file)
|
61
|
+
reload_entries buffer if @buffer != buffer
|
66
62
|
|
67
|
-
end
|
68
63
|
end
|
64
|
+
|
69
65
|
end
|
70
66
|
|
71
67
|
end
|
72
68
|
|
73
69
|
def stop()
|
74
70
|
@running = false
|
75
|
-
@ws.close
|
76
|
-
EM.stop_event_loop
|
77
71
|
end
|
78
72
|
|
79
73
|
private
|
@@ -92,6 +86,12 @@ class DynarexCron
|
|
92
86
|
def load_entries(dynarex)
|
93
87
|
|
94
88
|
@include_url = dynarex.summary[:include]
|
89
|
+
|
90
|
+
if dynarex.summary[:sps_address] then
|
91
|
+
@sps_address, @sps_port = dynarex.summary[:sps_address]\
|
92
|
+
.split(':',2) << '59000'
|
93
|
+
end
|
94
|
+
|
95
95
|
@cron_entries = dynarex.to_h
|
96
96
|
@cron_entries.each do |h|
|
97
97
|
h[:cron] = ChronicCron.new(h[:expression], Time.now + @time_offset)
|
@@ -126,7 +126,8 @@ class DynarexCron
|
|
126
126
|
begin
|
127
127
|
|
128
128
|
topic, msg = r.captures
|
129
|
-
|
129
|
+
#@ws.send "%s: %s" % [topic, msg]
|
130
|
+
SPSPub.notice "%s: %s" % [topic, msg], address: @sps_address, port: @sps_port
|
130
131
|
h[:cron].next # advances the time
|
131
132
|
|
132
133
|
rescue
|
@@ -179,17 +180,8 @@ class DynarexEvents < DynarexCron
|
|
179
180
|
puts '[' + Time.now.strftime(DF) + '] DynarexEvents started'
|
180
181
|
params = {uri: "ws://%s:%s" % [@sps_address, @sps_port]}
|
181
182
|
|
182
|
-
|
183
|
-
|
184
|
-
EventMachine.run do
|
185
|
-
|
186
|
-
@ws = c.connect(params)
|
187
|
-
|
188
|
-
EM.add_periodic_timer(60) do
|
189
|
-
iterate @cron_events
|
190
|
-
end
|
191
|
-
|
192
|
-
end
|
183
|
+
RunEvery.new(seconds: 60) { iterate @cron_events }
|
184
|
+
|
193
185
|
end
|
194
186
|
|
195
187
|
def to_a()
|
data.tar.gz.sig
CHANGED
Binary file
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dynarex_cron
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Robertson
|
@@ -31,68 +31,88 @@ cert_chain:
|
|
31
31
|
AYk47T0/8hx1QaR5nU5Db9LztjboHVugHlqfEKWwY2mURuQWP9iCCwiG3T1cC04z
|
32
32
|
WnpuryTBFz7cvg==
|
33
33
|
-----END CERTIFICATE-----
|
34
|
-
date: 2014-
|
34
|
+
date: 2014-12-20 00:00:00.000000000 Z
|
35
35
|
dependencies:
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
|
-
name:
|
37
|
+
name: chronic_cron
|
38
38
|
requirement: !ruby/object:Gem::Requirement
|
39
39
|
requirements:
|
40
40
|
- - "~>"
|
41
41
|
- !ruby/object:Gem::Version
|
42
|
-
version: '
|
42
|
+
version: '0.2'
|
43
43
|
- - ">="
|
44
44
|
- !ruby/object:Gem::Version
|
45
|
-
version:
|
45
|
+
version: 0.2.33
|
46
46
|
type: :runtime
|
47
47
|
prerelease: false
|
48
48
|
version_requirements: !ruby/object:Gem::Requirement
|
49
49
|
requirements:
|
50
50
|
- - "~>"
|
51
51
|
- !ruby/object:Gem::Version
|
52
|
-
version: '
|
52
|
+
version: '0.2'
|
53
53
|
- - ">="
|
54
54
|
- !ruby/object:Gem::Version
|
55
|
-
version:
|
55
|
+
version: 0.2.33
|
56
56
|
- !ruby/object:Gem::Dependency
|
57
|
-
name:
|
57
|
+
name: chronic_duration
|
58
58
|
requirement: !ruby/object:Gem::Requirement
|
59
59
|
requirements:
|
60
60
|
- - "~>"
|
61
61
|
- !ruby/object:Gem::Version
|
62
|
-
version: '0.
|
62
|
+
version: '0.10'
|
63
63
|
- - ">="
|
64
64
|
- !ruby/object:Gem::Version
|
65
|
-
version: 0.
|
65
|
+
version: 0.10.4
|
66
66
|
type: :runtime
|
67
67
|
prerelease: false
|
68
68
|
version_requirements: !ruby/object:Gem::Requirement
|
69
69
|
requirements:
|
70
70
|
- - "~>"
|
71
71
|
- !ruby/object:Gem::Version
|
72
|
-
version: '0.
|
72
|
+
version: '0.10'
|
73
73
|
- - ">="
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version: 0.
|
75
|
+
version: 0.10.4
|
76
76
|
- !ruby/object:Gem::Dependency
|
77
|
-
name:
|
77
|
+
name: dynarex
|
78
78
|
requirement: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
80
|
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version: '1.
|
82
|
+
version: '1.2'
|
83
83
|
- - ">="
|
84
84
|
- !ruby/object:Gem::Version
|
85
|
-
version: 1.
|
85
|
+
version: 1.2.90
|
86
86
|
type: :runtime
|
87
87
|
prerelease: false
|
88
88
|
version_requirements: !ruby/object:Gem::Requirement
|
89
89
|
requirements:
|
90
90
|
- - "~>"
|
91
91
|
- !ruby/object:Gem::Version
|
92
|
-
version: '1.
|
92
|
+
version: '1.2'
|
93
93
|
- - ">="
|
94
94
|
- !ruby/object:Gem::Version
|
95
|
-
version: 1.
|
95
|
+
version: 1.2.90
|
96
|
+
- !ruby/object:Gem::Dependency
|
97
|
+
name: sps-pub
|
98
|
+
requirement: !ruby/object:Gem::Requirement
|
99
|
+
requirements:
|
100
|
+
- - "~>"
|
101
|
+
- !ruby/object:Gem::Version
|
102
|
+
version: '0.4'
|
103
|
+
- - ">="
|
104
|
+
- !ruby/object:Gem::Version
|
105
|
+
version: 0.4.0
|
106
|
+
type: :runtime
|
107
|
+
prerelease: false
|
108
|
+
version_requirements: !ruby/object:Gem::Requirement
|
109
|
+
requirements:
|
110
|
+
- - "~>"
|
111
|
+
- !ruby/object:Gem::Version
|
112
|
+
version: '0.4'
|
113
|
+
- - ">="
|
114
|
+
- !ruby/object:Gem::Version
|
115
|
+
version: 0.4.0
|
96
116
|
- !ruby/object:Gem::Dependency
|
97
117
|
name: rscript
|
98
118
|
requirement: !ruby/object:Gem::Requirement
|
@@ -114,25 +134,25 @@ dependencies:
|
|
114
134
|
- !ruby/object:Gem::Version
|
115
135
|
version: 0.1.25
|
116
136
|
- !ruby/object:Gem::Dependency
|
117
|
-
name:
|
137
|
+
name: run_every
|
118
138
|
requirement: !ruby/object:Gem::Requirement
|
119
139
|
requirements:
|
120
140
|
- - "~>"
|
121
141
|
- !ruby/object:Gem::Version
|
122
|
-
version: '0.
|
142
|
+
version: '0.1'
|
123
143
|
- - ">="
|
124
144
|
- !ruby/object:Gem::Version
|
125
|
-
version: 0.
|
145
|
+
version: 0.1.9
|
126
146
|
type: :runtime
|
127
147
|
prerelease: false
|
128
148
|
version_requirements: !ruby/object:Gem::Requirement
|
129
149
|
requirements:
|
130
150
|
- - "~>"
|
131
151
|
- !ruby/object:Gem::Version
|
132
|
-
version: '0.
|
152
|
+
version: '0.1'
|
133
153
|
- - ">="
|
134
154
|
- !ruby/object:Gem::Version
|
135
|
-
version: 0.
|
155
|
+
version: 0.1.9
|
136
156
|
description:
|
137
157
|
email: james@r0bertson.co.uk
|
138
158
|
executables: []
|
metadata.gz.sig
CHANGED
Binary file
|