cron_format 0.1.16 → 0.2.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.tar.gz.sig +0 -0
- data/lib/cron_format.rb +28 -3
- metadata +1 -1
- 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: c876978dc3f4b5ceacd3d314d1a8184c123a184c
|
4
|
+
data.tar.gz: 00c674f845160a27ee3696ccda6c11c7557e3cdf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 98586dbd16b8644edd4c24fbb5297c19e0bf9141bb768d4ffc7ff48af5a23829b710f0565db7b6511521a7b9f0ea627d88bdcb7df1bb62416687b5012c5ead9d
|
7
|
+
data.tar.gz: d3187eaff6b8a6e01d3efc044eb005bba7d50c9cb09ae9ab9ca2991f278ce567f5f4927787e8561c163db17fd61aa5174f470fdc290a743fdc8cb0550b4ee2d0
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
data/lib/cron_format.rb
CHANGED
@@ -61,6 +61,7 @@ class CronFormat
|
|
61
61
|
]
|
62
62
|
|
63
63
|
r = units[index].call @to_time, n
|
64
|
+
|
64
65
|
@to_time = r
|
65
66
|
|
66
67
|
end
|
@@ -69,7 +70,31 @@ class CronFormat
|
|
69
70
|
|
70
71
|
raw_a = @cron_string.split
|
71
72
|
raw_a << '*' if raw_a.length <= 5 # add the year?
|
72
|
-
|
73
|
+
mins, hours, day, month, wday, year = raw_a[0..5]
|
74
|
+
|
75
|
+
if day[/\d+/] and month[/\d+/] and year == '*' then
|
76
|
+
@to_time += DAY until @to_time.day == day.to_i and \
|
77
|
+
@to_time.month == month.to_i
|
78
|
+
end
|
79
|
+
|
80
|
+
if mins[/^\d+$/] and hours[/^\d+$/] then
|
81
|
+
@to_time += MINUTE until @to_time.min == mins.to_i and \
|
82
|
+
@to_time.hour == hours.to_i
|
83
|
+
@to_time -= MINUTE
|
84
|
+
else
|
85
|
+
|
86
|
+
if mins[/^\d+$/] then
|
87
|
+
@to_time += MINUTE until @to_time.min == mins.to_i
|
88
|
+
@to_time -= MINUTE
|
89
|
+
end
|
90
|
+
|
91
|
+
@to_time += HOUR until @to_time.hour == hours.to_i if hours[/^\d+$/]
|
92
|
+
end
|
93
|
+
|
94
|
+
if wday[/^[0-6]$/] and @to_time.wday != wday.to_i then
|
95
|
+
@to_time += DAY until @to_time.wday == wday.to_i
|
96
|
+
end
|
97
|
+
|
73
98
|
dayceiling = raw_a[2][/-(\d+)$/,1]
|
74
99
|
|
75
100
|
if dayceiling and dayceiling.to_i <= @to_time.day then
|
@@ -80,7 +105,7 @@ class CronFormat
|
|
80
105
|
|
81
106
|
@to_time = dt2.to_time
|
82
107
|
end
|
83
|
-
|
108
|
+
|
84
109
|
units = @to_time.to_a.values_at(1..4) + [nil, @to_time.year]
|
85
110
|
|
86
111
|
procs = {
|
@@ -122,7 +147,6 @@ class CronFormat
|
|
122
147
|
end
|
123
148
|
|
124
149
|
|
125
|
-
|
126
150
|
if raw_a[4] != '*' then
|
127
151
|
r = /(sun|mon|tues|wed|thurs|fri|satur|sun)(day)?|tue|thu|sat/i
|
128
152
|
|
@@ -240,6 +264,7 @@ class CronFormat
|
|
240
264
|
else
|
241
265
|
t += DAY until t.wday == wday.to_i
|
242
266
|
end
|
267
|
+
|
243
268
|
end
|
244
269
|
|
245
270
|
# finally, if the date is still less than the current time we can
|
metadata
CHANGED
metadata.gz.sig
CHANGED
Binary file
|