dynarex_cron 0.5.3 → 0.6.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3139d44b6db16578a36bc08dc006fec8ccf5b287
4
- data.tar.gz: 89b56fe3106d2b88f11e3f60cb9dbb4e8a4ae785
3
+ metadata.gz: 420b00ecdd29552efc3582140a5532b874a51a0f
4
+ data.tar.gz: 28f95e9900e219d0abe42a763c7d4f0b4574f3ff
5
5
  SHA512:
6
- metadata.gz: 81cbd636ca30d77aa8b2754fa989157f3e959411691d37de786e1fabf75380b70ea3872b79e082a66e21221d864dbc58cf0baf9beca7daa5177a5f4bf7b94cbd
7
- data.tar.gz: 44139283cdaff56684a7780c6b312243291635623da242c8879b3419e332221a66d6a718ec1eb292922fed28804666040099f17fde1d36a2bcdd621cd9022d7b
6
+ metadata.gz: b7c3c210391ab3bc54eed2760ce5e224492417716c273e72ab794aa6c76aabd2f81dd14f14fd8e5ba517cafb1d85c61821bb4392aafa2d805a8fddd298627e35
7
+ data.tar.gz: 534c6105d76475f2916f471e0b9273c361674ddf6037b3779a1352e81b09ae84697987c8ef491ed5d2c5c52dd886e28053ca86bf8ab3efe9b51cd45072fc01a7
checksums.yaml.gz.sig CHANGED
Binary file
data.tar.gz.sig CHANGED
Binary file
data/lib/dynarex_cron.rb CHANGED
@@ -4,8 +4,6 @@
4
4
 
5
5
  require 'dynarex'
6
6
  require 'chronic_cron'
7
- require 'rscript'
8
- require 'chronic_duration'
9
7
  require 'logger'
10
8
  require 'run_every'
11
9
  require 'sps-pub'
@@ -27,7 +25,7 @@ class DynarexCron
27
25
  # the time of each entry
28
26
  @time_offset = opt[:time_offset].to_i
29
27
 
30
- @cron_entries, @cron_events = [], []
28
+ @cron_entries = []
31
29
 
32
30
  @dynarex_file = dynarex_file
33
31
 
@@ -37,8 +35,6 @@ class DynarexCron
37
35
  load_entries(dynarex)
38
36
  end
39
37
 
40
- load_events() if @include_url and @include_url.length > 0
41
-
42
38
  @sps_address, @sps_port = opt[:sps_address], opt[:sps_port]
43
39
 
44
40
 
@@ -53,11 +49,10 @@ class DynarexCron
53
49
  RunEvery.new(seconds: 60) do
54
50
 
55
51
  iterate @cron_entries
56
- iterate @cron_events
57
52
 
58
53
  if @dynarex_file.is_a? String then
59
54
 
60
- # What happens is the @dynarex_file is a URL and the web server is
55
+ # What happens if the @dynarex_file is a URL and the web server is
61
56
  # temporarily unavailable? i.e. 503 Service Temporarily Unavailable
62
57
  begin
63
58
  buffer, _ = RXFHelper.read(@dynarex_file)
@@ -91,8 +86,6 @@ class DynarexCron
91
86
  end
92
87
 
93
88
  def load_entries(dynarex)
94
-
95
- @include_url = dynarex.summary[:include]
96
89
 
97
90
  if dynarex.summary[:sps_address] then
98
91
  @sps_address, @sps_port = dynarex.summary[:sps_address]\
@@ -105,12 +98,6 @@ class DynarexCron
105
98
  end
106
99
  end
107
100
 
108
- def load_events()
109
-
110
- de = DynarexEvents.new(@include_url)
111
- @cron_events = de.to_a
112
- end
113
-
114
101
  def log(s, method_name=:debug)
115
102
  return unless @logger
116
103
  @logger.method(method_name).call s
@@ -148,63 +135,4 @@ class DynarexCron
148
135
  @buffer = buffer
149
136
  end
150
137
 
151
- end
152
-
153
- class DynarexEvents < DynarexCron
154
-
155
- attr_reader :to_a
156
-
157
- def initialize(dynarex_file=nil, options={})
158
-
159
- opt = {sps_address: nil, time_offset: 0}.merge options
160
-
161
- @time_offset = opt[:time_offset]
162
- @cron_events = []
163
-
164
- @dynarex_file = dynarex_file
165
- load_events()
166
-
167
- @sps_address = opt[:sps_address]
168
-
169
- end
170
-
171
- def load_events()
172
-
173
- dynarex = Dynarex.new @dynarex_file
174
- @entries = dynarex.to_h
175
- @cron_events = self.to_a
176
- end
177
-
178
- alias refresh load_events
179
-
180
- def start
181
-
182
- @running = true
183
- puts '[' + Time.now.strftime(DF) + '] DynarexEvents started'
184
- params = {uri: "ws://%s:%s" % [@sps_address, @sps_port]}
185
-
186
- RunEvery.new(seconds: 60) { iterate @cron_events }
187
-
188
- end
189
-
190
- def to_a()
191
-
192
- @entries.inject([]) do |r,h|
193
-
194
- time = Time.now + @time_offset
195
- h[:cron] = ChronicCron.new(h[:date], time)
196
- h[:fqm] = 'event: ' + h[:title]
197
-
198
- if h[:reminder].length > 0 then
199
- rmndr = {}
200
- rmndr[:cron] = ChronicCron.new((Chronic.parse(h[:date]) -
201
- ChronicDuration.parse(h[:reminder])).to_s, time)
202
- rmndr[:fqm] = 'event: reminder ' + h[:title]
203
- r << rmndr
204
- end
205
-
206
- r << h
207
- end
208
-
209
- end
210
138
  end
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.5.3
4
+ version: 0.6.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Robertson
@@ -53,26 +53,6 @@ dependencies:
53
53
  - - ">="
54
54
  - !ruby/object:Gem::Version
55
55
  version: 0.2.33
56
- - !ruby/object:Gem::Dependency
57
- name: chronic_duration
58
- requirement: !ruby/object:Gem::Requirement
59
- requirements:
60
- - - "~>"
61
- - !ruby/object:Gem::Version
62
- version: '0.10'
63
- - - ">="
64
- - !ruby/object:Gem::Version
65
- version: 0.10.4
66
- type: :runtime
67
- prerelease: false
68
- version_requirements: !ruby/object:Gem::Requirement
69
- requirements:
70
- - - "~>"
71
- - !ruby/object:Gem::Version
72
- version: '0.10'
73
- - - ">="
74
- - !ruby/object:Gem::Version
75
- version: 0.10.4
76
56
  - !ruby/object:Gem::Dependency
77
57
  name: dynarex
78
58
  requirement: !ruby/object:Gem::Requirement
@@ -113,26 +93,6 @@ dependencies:
113
93
  - - ">="
114
94
  - !ruby/object:Gem::Version
115
95
  version: 0.4.0
116
- - !ruby/object:Gem::Dependency
117
- name: rscript
118
- requirement: !ruby/object:Gem::Requirement
119
- requirements:
120
- - - "~>"
121
- - !ruby/object:Gem::Version
122
- version: '0.1'
123
- - - ">="
124
- - !ruby/object:Gem::Version
125
- version: 0.1.25
126
- type: :runtime
127
- prerelease: false
128
- version_requirements: !ruby/object:Gem::Requirement
129
- requirements:
130
- - - "~>"
131
- - !ruby/object:Gem::Version
132
- version: '0.1'
133
- - - ">="
134
- - !ruby/object:Gem::Version
135
- version: 0.1.25
136
96
  - !ruby/object:Gem::Dependency
137
97
  name: run_every
138
98
  requirement: !ruby/object:Gem::Requirement
metadata.gz.sig CHANGED
Binary file