cron_format 0.3.5 → 0.4.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/lib/cron_format.rb +24 -6
- data.tar.gz.sig +2 -1
- metadata +21 -20
- 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: 16b339c6d41735353e8cf1268fd8faf1bef76e8c
|
4
|
+
data.tar.gz: bdf4d4506b8234269bc979096a8cb58545758255
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8fd195d79177cdf7295dd15c35179b458914e0f6785999ce554bfc169dfb98dce90b155b5acce4a669662f56a10b026fba31ba31c0af6fdbcbbce30ea7b77365
|
7
|
+
data.tar.gz: 51e59d602b155bafa33692277762010bf21f563591a9d6fec6dc0fa4b3ef7e286f24e1a3ee8e1ba63a138d63f5fd92845b36612d9b5a8c1db6b4a724b82bd186
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data/lib/cron_format.rb
CHANGED
@@ -17,8 +17,8 @@ class CronFormat
|
|
17
17
|
|
18
18
|
attr_reader :to_time, :to_expression
|
19
19
|
|
20
|
-
def initialize(cron_string, now=Time.now)
|
21
|
-
@cron_string, @to_time = cron_string, now
|
20
|
+
def initialize(cron_string, now=Time.now, debug: false)
|
21
|
+
@cron_string, @to_time, @debug = cron_string, now, debug
|
22
22
|
parse()
|
23
23
|
end
|
24
24
|
|
@@ -51,6 +51,7 @@ class CronFormat
|
|
51
51
|
def nudge()
|
52
52
|
|
53
53
|
t1 = @to_time
|
54
|
+
puts 't1: ' + t1.inspect if @debug
|
54
55
|
a = @cron_string.split
|
55
56
|
|
56
57
|
val = if @cron_string =~ %r{[/,-]} then
|
@@ -60,6 +61,8 @@ class CronFormat
|
|
60
61
|
end
|
61
62
|
|
62
63
|
index, n = 0, 1
|
64
|
+
|
65
|
+
puts 'val: ' + val.inspect if @debug
|
63
66
|
|
64
67
|
if val then
|
65
68
|
index = a.index(val)
|
@@ -80,7 +83,8 @@ class CronFormat
|
|
80
83
|
end
|
81
84
|
end
|
82
85
|
|
83
|
-
|
86
|
+
puts 'index: ' + index.inspect if @debug
|
87
|
+
|
84
88
|
month_proc = lambda {|t1,n|
|
85
89
|
a = t1.to_a
|
86
90
|
a[4] = a[4] + n <= 12 ? a[4] + n : a[4] + n - 12
|
@@ -98,12 +102,26 @@ class CronFormat
|
|
98
102
|
month_proc,
|
99
103
|
day_proc
|
100
104
|
]
|
101
|
-
|
105
|
+
|
106
|
+
if @debug then
|
107
|
+
puts '@to_time: ' + @to_time.inspect
|
108
|
+
puts 'n: ' + n.inspect
|
109
|
+
end
|
110
|
+
|
102
111
|
r = units[index].call @to_time, n
|
112
|
+
|
113
|
+
puts 'r: ' + r.inspect if @debug
|
114
|
+
|
115
|
+
@to_time = if n > 1 then
|
116
|
+
|
117
|
+
# given day light savings, ensure the time fragment is preserved
|
118
|
+
Time.new(r.year, r.month, r.day, t1.hour, t1.min)
|
119
|
+
|
120
|
+
else
|
121
|
+
r
|
122
|
+
end
|
103
123
|
#r += MINUTE if r == t1
|
104
124
|
|
105
|
-
@to_time = r
|
106
|
-
|
107
125
|
end
|
108
126
|
|
109
127
|
def parse()
|
data.tar.gz.sig
CHANGED
@@ -1 +1,2 @@
|
|
1
|
-
|
1
|
+
ૄ��Q�0->��߈����L�h!����(,���*�8���w�:���6k7�O����%�ׂ}J��Wh�sXΖ$}�� ��h�q k�9Nj�%�o�)o��y�g�'��u&����xϫ��Qu`��yY7d,��
|
2
|
+
35����/�����_?��.���o��l�dk��W�c1ts!/�����1[S�P@�,& A��ny�C�FB�dn�;1_�T{^.�QN8[䓱�
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cron_format
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Robertson
|
@@ -11,26 +11,26 @@ cert_chain:
|
|
11
11
|
- |
|
12
12
|
-----BEGIN CERTIFICATE-----
|
13
13
|
MIIDXjCCAkagAwIBAgIBATANBgkqhkiG9w0BAQUFADAsMSowKAYDVQQDDCFnZW1t
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
14
|
+
YXN0ZXIvREM9amFtZXNyb2JlcnRzb24vREM9ZXUwHhcNMTgwNDA5MjI1MzA3WhcN
|
15
|
+
MTkwNDA5MjI1MzA3WjAsMSowKAYDVQQDDCFnZW1tYXN0ZXIvREM9amFtZXNyb2Jl
|
16
|
+
cnRzb24vREM9ZXUwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDqyw5Y
|
17
|
+
GTvVJJWLpkQqhlUx6RNmZLFRgqTQmle7sIyEtiB7qAtxSZxt2SEKEP+NgQUimlgH
|
18
|
+
HwXx40mQ9crGr1d3+6bwkbi306MTZ6bdRsFfPwthMaevxvK86GGx2MbIpUQ/M0Qx
|
19
|
+
RUuV1mwXFweHHARXwK7bHcGxOwpcPs1ehM7dDAv39OJU6YjJeHq69akXUMGqEPqV
|
20
|
+
y9oK4CtgFHNrB+ytDwUh7mQpAdkNCKA3SwiWnrUpPbQeK0V7sjRlCkTXTs5E7o9e
|
21
|
+
hyL8XQDmCTxYK2fhDU3l1iX+gI9RPWGozWOGOLJNFeRm9eGLbmBjbMkeLLVvX8R4
|
22
|
+
gK4ilPzRXmgGzq17AgMBAAGjgYowgYcwCQYDVR0TBAIwADALBgNVHQ8EBAMCBLAw
|
23
|
+
HQYDVR0OBBYEFKYNYBOjGqMFEfPgNRRYtEzq+4pEMCYGA1UdEQQfMB2BG2dlbW1h
|
24
24
|
c3RlckBqYW1lc3JvYmVydHNvbi5ldTAmBgNVHRIEHzAdgRtnZW1tYXN0ZXJAamFt
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
25
|
+
ZXNyb2JlcnRzb24uZXUwDQYJKoZIhvcNAQEFBQADggEBABMssk3Im1Vin+rHeBKp
|
26
|
+
y3dTWfi4t4oYBkytTb9n68lZtJ16LZgNX42o89w/8WoV9rqoo5rW4A1b1NE1srdZ
|
27
|
+
7Yrs6mVVu1xUfAodPRGdy+P2F+yqzz0hqYBqcBFLdR5oqkP3kvx05w2txGJLZMvv
|
28
|
+
N/ETFF5O4SD1tsPaLS5/kjAk+epirsb/UR8gLq37tyosM79P10HeikBdOMqXmN7U
|
29
|
+
8Wj31raYqIS2rUA0lp+u+e4gKg4r0EBcIqH3pHahMd5le9D3yIwfPLuURhHwBw6R
|
30
|
+
Jde8bC6zoA/f/DUUzBf2TtjXPuoAdtsV3CT3nIo880mXyihT9CL9ulTHMJCBR73I
|
31
|
+
fsk=
|
32
32
|
-----END CERTIFICATE-----
|
33
|
-
date: 2018-
|
33
|
+
date: 2018-04-09 00:00:00.000000000 Z
|
34
34
|
dependencies: []
|
35
35
|
description:
|
36
36
|
email: james@jamesrobertson.eu
|
@@ -62,5 +62,6 @@ rubyforge_project:
|
|
62
62
|
rubygems_version: 2.6.13
|
63
63
|
signing_key:
|
64
64
|
specification_version: 4
|
65
|
-
summary:
|
65
|
+
summary: Accepts a cron expression and outputs the relative time (e.g. 0 7 1 1 * *
|
66
|
+
=> 2019-01-01 07:00:00 +0000
|
66
67
|
test_files: []
|
metadata.gz.sig
CHANGED
Binary file
|