chronic_cron 0.5.0 → 0.6.0
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.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/lib/chronic_cron.rb +36 -1
- metadata +41 -38
- metadata.gz.sig +1 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d2aa1ee213393540b1f82770bdd33cfa00443a7d0c1d23571f46450cb51c51eb
|
4
|
+
data.tar.gz: ab48a734ac469da60395a23e6c4587ff1af4026801e8dbe46e0b20c4ff88884e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f5f34e35492918a0709184ba47b5a6dfb113bbd6f3e4f9b03bc7258c1805c261a45cc6f67f0af57e8d69743cdb574b0a4ff2047d3a3903b232d29768ea5cd06c
|
7
|
+
data.tar.gz: bf88b16ff4fa13c1fa5efaa367821b1afabe194be4927cdda20c98daf8fbd23f5111f38f6d86164a406331a53958d1b6564e5f8b948ecf9a793450a676160f9b
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
data/lib/chronic_cron.rb
CHANGED
@@ -10,6 +10,7 @@ require 'timetoday'
|
|
10
10
|
|
11
11
|
class ChronicCron
|
12
12
|
include AppRoutes
|
13
|
+
using ColouredText
|
13
14
|
|
14
15
|
attr_reader :to_expression
|
15
16
|
|
@@ -17,6 +18,8 @@ class ChronicCron
|
|
17
18
|
|
18
19
|
@now, @log, @debug = now, log, debug
|
19
20
|
|
21
|
+
puts ('@now: ' + @now.inspect).debug if @debug
|
22
|
+
|
20
23
|
super()
|
21
24
|
@params = {input: s}
|
22
25
|
expressions(@params)
|
@@ -269,8 +272,10 @@ class ChronicCron
|
|
269
272
|
([ap]m)/i do |day, month, raw_hrs, mins, meridiem|
|
270
273
|
|
271
274
|
now = Chronic.parse(month, now: @now)
|
275
|
+
puts ('now: ' + now.inspect).debug if @debug
|
272
276
|
|
273
277
|
d = last_wdayofmonth(day, now)
|
278
|
+
puts ('d: ' + d.inspect).debug if @debug
|
274
279
|
|
275
280
|
hrs = in24hrs(raw_hrs, meridiem)
|
276
281
|
|
@@ -335,16 +340,46 @@ class ChronicCron
|
|
335
340
|
"* * * * %s/2" % [wday]
|
336
341
|
|
337
342
|
end
|
343
|
+
|
344
|
+
|
345
|
+
# e.g. every 2 weeks (starting 7th Jan 2020)
|
346
|
+
get /^every (\w+) weeks \(starting ([^\)]+)/ do |interval, raw_date|
|
347
|
+
|
348
|
+
if @debug then
|
349
|
+
puts ('raw_date: ' + raw_date.inspect).debug
|
350
|
+
puts ('now: ' + @now.inspect).debug
|
351
|
+
end
|
352
|
+
|
353
|
+
t = raw_date ? Chronic.parse(raw_date, :now => @now) : @now
|
354
|
+
t += WEEK * interval.to_i until t > @now
|
355
|
+
mins, hrs = t.to_a.values_at(1,2)
|
356
|
+
|
357
|
+
log.info 'ChronicCron/expressions/get: r260' if log
|
358
|
+
if @debug then
|
359
|
+
puts 'ChronicCron#expressions 260'
|
360
|
+
puts ('t: ' + t.inspect).debug
|
361
|
+
end
|
362
|
+
|
363
|
+
"%s %s * * %s/%s" % [mins, hrs, t.wday, interval]
|
364
|
+
end
|
338
365
|
|
339
366
|
# e.g. every 2 weeks at 6am starting from 7th Jan
|
340
367
|
get /^every (\w+) weeks(?:\s+at\s+([^\s]+))?/ do |interval, raw_time|
|
341
368
|
|
369
|
+
if @debug then
|
370
|
+
puts ('raw_time: ' + raw_time.inspect).debug
|
371
|
+
puts ('now: ' + @now.inspect).debug
|
372
|
+
end
|
373
|
+
|
342
374
|
t = raw_time ? Chronic.parse(raw_time, :now => @now) : @now
|
343
375
|
t += WEEK * interval.to_i until t > @now
|
344
376
|
mins, hrs = t.to_a.values_at(1,2)
|
345
377
|
|
346
378
|
log.info 'ChronicCron/expressions/get: r270' if log
|
347
|
-
|
379
|
+
if @debug then
|
380
|
+
puts 'ChronicCron#expressions 270'
|
381
|
+
puts ('t: ' + t.inspect).debug
|
382
|
+
end
|
348
383
|
|
349
384
|
"%s %s * * %s/%s" % [mins, hrs, t.wday, interval]
|
350
385
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: chronic_cron
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Robertson
|
@@ -10,28 +10,32 @@ bindir: bin
|
|
10
10
|
cert_chain:
|
11
11
|
- |
|
12
12
|
-----BEGIN CERTIFICATE-----
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
13
|
+
MIIEXjCCAsagAwIBAgIBATANBgkqhkiG9w0BAQsFADAsMSowKAYDVQQDDCFnZW1t
|
14
|
+
YXN0ZXIvREM9amFtZXNyb2JlcnRzb24vREM9ZXUwHhcNMTkwOTEwMTczMDU2WhcN
|
15
|
+
MjAwOTA5MTczMDU2WjAsMSowKAYDVQQDDCFnZW1tYXN0ZXIvREM9amFtZXNyb2Jl
|
16
|
+
cnRzb24vREM9ZXUwggGiMA0GCSqGSIb3DQEBAQUAA4IBjwAwggGKAoIBgQD+oxz1
|
17
|
+
IhGNszjzVKXOIivImj03s3bNue3UNjX7PPAXpDo5zP8uAGMGcdqjcNzgUziuSnuP
|
18
|
+
603LcDLmVqjAxaGoCq9nLMXij095YbDN4MZDBzXJw5tsb3jJXC43GWNCnFrO8xKP
|
19
|
+
PS2JtF8ou4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j6hVlZFCeNqwy7KLfohyuTIrgkfvHGlMEMA
|
34
|
+
/IOiCQ02XiDAWeE1CekdGItDmcotFwoCSuWai+Y4rg+JX1JaJQApPEM0tabWX83n
|
35
|
+
djri2zyv3s3ucIBaOlC4bOZZiydDSAXx/S/SRGyvA1/ZKgR5h+zu6T2GKcusq7QA
|
36
|
+
2O89BwLoEmEP437kjQ6HjyqC
|
33
37
|
-----END CERTIFICATE-----
|
34
|
-
date:
|
38
|
+
date: 2019-09-10 00:00:00.000000000 Z
|
35
39
|
dependencies:
|
36
40
|
- !ruby/object:Gem::Dependency
|
37
41
|
name: app-routes
|
@@ -57,22 +61,22 @@ dependencies:
|
|
57
61
|
name: cron_format
|
58
62
|
requirement: !ruby/object:Gem::Requirement
|
59
63
|
requirements:
|
60
|
-
- - "~>"
|
61
|
-
- !ruby/object:Gem::Version
|
62
|
-
version: '0.4'
|
63
64
|
- - ">="
|
64
65
|
- !ruby/object:Gem::Version
|
65
|
-
version: 0.
|
66
|
+
version: 0.6.0
|
67
|
+
- - "~>"
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: '0.6'
|
66
70
|
type: :runtime
|
67
71
|
prerelease: false
|
68
72
|
version_requirements: !ruby/object:Gem::Requirement
|
69
73
|
requirements:
|
70
|
-
- - "~>"
|
71
|
-
- !ruby/object:Gem::Version
|
72
|
-
version: '0.4'
|
73
74
|
- - ">="
|
74
75
|
- !ruby/object:Gem::Version
|
75
|
-
version: 0.
|
76
|
+
version: 0.6.0
|
77
|
+
- - "~>"
|
78
|
+
- !ruby/object:Gem::Version
|
79
|
+
version: '0.6'
|
76
80
|
- !ruby/object:Gem::Dependency
|
77
81
|
name: chronic
|
78
82
|
requirement: !ruby/object:Gem::Requirement
|
@@ -97,22 +101,22 @@ dependencies:
|
|
97
101
|
name: timetoday
|
98
102
|
requirement: !ruby/object:Gem::Requirement
|
99
103
|
requirements:
|
100
|
-
- - "~>"
|
101
|
-
- !ruby/object:Gem::Version
|
102
|
-
version: '0.2'
|
103
104
|
- - ">="
|
104
105
|
- !ruby/object:Gem::Version
|
105
106
|
version: 0.2.0
|
107
|
+
- - "~>"
|
108
|
+
- !ruby/object:Gem::Version
|
109
|
+
version: '0.2'
|
106
110
|
type: :runtime
|
107
111
|
prerelease: false
|
108
112
|
version_requirements: !ruby/object:Gem::Requirement
|
109
113
|
requirements:
|
110
|
-
- - "~>"
|
111
|
-
- !ruby/object:Gem::Version
|
112
|
-
version: '0.2'
|
113
114
|
- - ">="
|
114
115
|
- !ruby/object:Gem::Version
|
115
116
|
version: 0.2.0
|
117
|
+
- - "~>"
|
118
|
+
- !ruby/object:Gem::Version
|
119
|
+
version: '0.2'
|
116
120
|
description:
|
117
121
|
email: james@jamesrobertson.eu
|
118
122
|
executables: []
|
@@ -139,8 +143,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
139
143
|
- !ruby/object:Gem::Version
|
140
144
|
version: '0'
|
141
145
|
requirements: []
|
142
|
-
|
143
|
-
rubygems_version: 2.7.6
|
146
|
+
rubygems_version: 3.0.1
|
144
147
|
signing_key:
|
145
148
|
specification_version: 4
|
146
149
|
summary: Converts a human-readable time (e.g. 10:15 daily) into a cron format (e,g,
|
metadata.gz.sig
CHANGED