chronic_cron 0.2.30 → 0.2.31

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3021f9c41bdc280f708a200198ded01bd2fbeec0
4
- data.tar.gz: f958ca9e1e244edb44eba8740414ce93ab5742d0
3
+ metadata.gz: e42e18d5ebcdb9de79765b2d45dc153ac8fb5952
4
+ data.tar.gz: 0e1210be360e47fcc7a4663288efa6fb640280dc
5
5
  SHA512:
6
- metadata.gz: 3426c1d69d7508d85d76013d6416674275a4e29acd4d0c6e9f37b844102bb9949dbfac012a3975507abe8a875083a060e24502a5ce957084b616f318af473c93
7
- data.tar.gz: f6ba01d88b5b042f624afadd449621f44c78c7bd544cddfdfb38009214e18ad5d28d846b2f0b356906374282e09dc051b632a9fa64dc5820560d514846ea49b0
6
+ metadata.gz: e880f3bfe6c25ec58989543a196f0e5aa05985b1ff9a6a14f7f0d4ad4b899bb36787a8278b11b332b9a8a26b84de690819292056610cf8ff50841d2d49c2e28e
7
+ data.tar.gz: debd5511c05ef066d9b4d5379315f8874e2ef600f286980235a93a3ca50c708d8f0d23a1fed90a5da2041ace7252030388684a66141ef2a3854710b728805492
Binary file
data.tar.gz.sig CHANGED
Binary file
@@ -150,6 +150,30 @@ class ChronicCron
150
150
  "0 %s * * %s" % [hrs , wday]
151
151
  end
152
152
 
153
+ # e.g. first thursday of each month at 7:30pm
154
+ nday = '(\w+(?:st|rd|nd))\s+' + weekday + '\s+'
155
+ get /#{nday}(?:of\s+)?(?:the|each|every)\s+month(?:\s+at\s+([^\s]+))?/i do
156
+ |nth_week, day_of_week, raw_time|
157
+
158
+ month = @now.month
159
+
160
+ h = {
161
+ /first|1st/i => '1-7',
162
+ /second|2nd/i => '8-14',
163
+ /third|3rd/i => '15-21',
164
+ /fourth|4th|last/i => '22-28'
165
+ }
166
+
167
+ _, day_range = h.find{|k,_| nth_week[k]}
168
+ a = %w(sunday monday tuesday wednesday thursday friday saturday)
169
+ wday = a.index(a.grep(/#{day_of_week}/i).first)
170
+
171
+ raw_time ||= '6:00am'
172
+ minute, hour = Chronic.parse(raw_time).to_a[1,2]
173
+ "%s %s %s * %s" % [minute, hour, day_range, wday]
174
+
175
+ end
176
+
153
177
  # e.g. every tuesday at 4:40pm
154
178
  get /every\s+#{weekday}\s+at\s+(\d{1,2}):(\d{1,2})([ap]m)/i do
155
179
  |wday, raw_hrs, mins, meridiem, |
@@ -232,30 +256,6 @@ class ChronicCron
232
256
  "%s %s %s %s %s %s" % [mins, hrs, day, month, t.wday, year]
233
257
  end
234
258
 
235
- # e.g. first thursday of each month at 7:30pm
236
- nday = '(\w+(?:st|rd|nd))\s+' + weekday + '\s+'
237
- get /#{nday}(?:of\s+)?(?:the|each|every)\s+month(?:\s+at\s+([^\s]+))?/i do
238
- |nth_week, day_of_week, raw_time|
239
-
240
- month = @now.month
241
-
242
- h = {
243
- /first|1st/i => '1-7',
244
- /second|2nd/i => '8-14',
245
- /third|3rd/i => '15-21',
246
- /fourth|4th|last/i => '22-28'
247
- }
248
-
249
- _, day_range = h.find{|k,_| nth_week[k]}
250
- a = %w(sunday monday tuesday wednesday thursday friday saturday)
251
- wday = a.index(a.grep(/#{day_of_week}/).first)
252
-
253
- raw_time ||= '6:00am'
254
- minute, hour = Chronic.parse(raw_time).to_a[1,2]
255
-
256
- "%s %s %s * %s" % [minute, hour, day_range, wday]
257
- end
258
-
259
259
  # e.g. 04-Aug@12:34
260
260
  get '*' do
261
261
 
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.30
4
+ version: 0.2.31
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: 2014-01-14 00:00:00.000000000 Z
32
+ date: 2014-01-15 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