chronic_cron 0.2.25 → 0.2.26
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 +16 -7
- metadata +2 -2
- 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: 66daab1a72dc3f45d8d1df42be0c6b78d874b662
|
4
|
+
data.tar.gz: e2a927a2a7a829653c26681d1b5521d3c2076be0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6ff659dd0c467a203da283097413e54c55ba595e71e768b52b24af92fccfab6edca0a20f03444095c77f39cae3ac923171dc5e7ecd0d3b40f6d1d290962e41dc
|
7
|
+
data.tar.gz: 64c9cf0cbbc65948522004745f32b54ba465f818c65284e8845f09291e8b669a0acca4153c8200adcd4f05a4b85c133f0f9b92cdd070de41d7752b5c1d149dd6
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
data/lib/chronic_cron.rb
CHANGED
@@ -82,14 +82,14 @@ class ChronicCron
|
|
82
82
|
|
83
83
|
# e.g. 10:15am every day
|
84
84
|
get /(\d{1,2}):(\d{1,2})([ap]m)?\s+#{daily}/ do |raw_hrs, mins, meridiem|
|
85
|
-
hrs =
|
85
|
+
hrs = in24hrs(raw_hrs, meridiem)
|
86
86
|
"%s %s * * *" % [mins.to_i, hrs]
|
87
87
|
end
|
88
88
|
|
89
89
|
# e.g. at 7:30am Monday to Friday
|
90
90
|
get /(\d{1,2}):(\d{1,2})([ap]m)?\s+(\w+) to (\w+)/ do
|
91
91
|
|raw_hrs, mins, meridiem, wday1, wday2|
|
92
|
-
hrs =
|
92
|
+
hrs = in24hrs(raw_hrs, meridiem)
|
93
93
|
"%s %s * * %s-%s" % [mins.to_i, hrs , wday1, wday2]
|
94
94
|
end
|
95
95
|
|
@@ -112,14 +112,14 @@ class ChronicCron
|
|
112
112
|
# e.g. at 10:30pm on every Monday
|
113
113
|
get /(\d{1,2}):(\d{1,2})([ap]m)?\s+(?:on )?every #{weekday}/i do
|
114
114
|
|raw_hrs, mins, meridiem, wday|
|
115
|
-
hrs =
|
115
|
+
hrs = in24hrs(raw_hrs, meridiem)
|
116
116
|
"%s %s * * %s" % [mins, hrs , wday]
|
117
117
|
end
|
118
118
|
|
119
119
|
# e.g. at 10pm on every Monday
|
120
120
|
get /(\d{1,2})([ap]m)?\s+(?:on )?every #{weekday}/i do
|
121
121
|
|raw_hrs, meridiem, wday|
|
122
|
-
hrs =
|
122
|
+
hrs = in24hrs(raw_hrs, meridiem)
|
123
123
|
"0 %s * * %s" % [hrs , wday]
|
124
124
|
end
|
125
125
|
|
@@ -149,14 +149,14 @@ class ChronicCron
|
|
149
149
|
# e.g. every tuesday at 4pm
|
150
150
|
get /every\s+#{weekday}\s+at\s+(\d{1,2})([ap]m)/i do
|
151
151
|
|wday, raw_hrs, meridiem, |
|
152
|
-
hrs =
|
152
|
+
hrs = in24hrs(raw_hrs, meridiem)
|
153
153
|
"0 %s * * %s" % [hrs , wday]
|
154
154
|
end
|
155
155
|
|
156
156
|
# e.g. every tuesday at 4:40pm
|
157
157
|
get /every\s+#{weekday}\s+at\s+(\d{1,2}):(\d{1,2})([ap]m)/i do
|
158
158
|
|wday, raw_hrs, mins, meridiem, |
|
159
|
-
hrs =
|
159
|
+
hrs = in24hrs(raw_hrs, meridiem)
|
160
160
|
"%s %s * * %s" % [mins, hrs , wday]
|
161
161
|
end
|
162
162
|
|
@@ -186,7 +186,7 @@ class ChronicCron
|
|
186
186
|
|
187
187
|
# e.g. first thursday of each month at 7:30pm
|
188
188
|
nday = '(\w+(?:st|rd|nd))\s+' + weekday + '\s+'
|
189
|
-
get /#{nday}(?:of\s+)?(?:the|each|every)\s+month(?:\s+at\s+([^\s]+))?/ do
|
189
|
+
get /#{nday}(?:of\s+)?(?:the|each|every)\s+month(?:\s+at\s+([^\s]+))?/i do
|
190
190
|
|nth_week, day_of_week, time|
|
191
191
|
|
192
192
|
month = @now.month
|
@@ -221,6 +221,15 @@ class ChronicCron
|
|
221
221
|
|
222
222
|
t = Chronic.parse(params[:input], :now => @now)
|
223
223
|
"%s %s %s %s * %s" % t.to_a.values_at(1,2,3,4,5)
|
224
|
+
end
|
225
|
+
|
226
|
+
def in24hrs(raw_hrs, meridiem)
|
227
|
+
|
228
|
+
hrs = if meridiem == 'pm' then
|
229
|
+
raw_hrs.to_i + 12
|
230
|
+
else
|
231
|
+
raw_hrs.to_i == 12 ? 0 : raw_hrs
|
232
|
+
end
|
224
233
|
end
|
225
234
|
end
|
226
235
|
|
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.2.
|
4
|
+
version: 0.2.26
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Robertson
|
@@ -29,7 +29,7 @@ cert_chain:
|
|
29
29
|
aYYwh4InyS/QZr4LG0nh0TuYVP5vwm1cCSlLlo4dlv7bl7Q4y815j70z8O4oUrT8
|
30
30
|
5oSIzmlVDEDmwAibYqdf+aHqmum1mkYW
|
31
31
|
-----END CERTIFICATE-----
|
32
|
-
date:
|
32
|
+
date: 2014-01-09 00:00:00.000000000 Z
|
33
33
|
dependencies:
|
34
34
|
- !ruby/object:Gem::Dependency
|
35
35
|
name: app-routes
|
metadata.gz.sig
CHANGED
Binary file
|