cron_format 0.1.14 → 0.1.15

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 876cd6851afd8b26d63589020148f933f934bc02
4
- data.tar.gz: fda9fd1375861ff28b0804341c1ab3d47b170201
3
+ metadata.gz: 414d4064981ad653741b80fce46e863167607379
4
+ data.tar.gz: 67023e8ba3f5ee0790307bcc1794cada00e85542
5
5
  SHA512:
6
- metadata.gz: c803f715557f653037ba920479566400b0bd1c3f852ef7e529b18f4c7e988f0e5cc1f1536d1e3f9b826008d7878ad889dcfb04ca2aa459c4bddec203daa98997
7
- data.tar.gz: 4c8fb0d49d01936771e95f4b37abb54a15bc7e639ef49506c99f31e74fa006dea64a45d6545ff0cf27c9022522d960ab3c4ff091bed0fe67dfb751c487ec7374
6
+ metadata.gz: 41b84a6ab78e19bf48da04158fef9f1b1d12a8a699944757d8f64085a7552160cbeeb6e5479f7720dd9a6b73683a15a598c36ec8e62b66005569f5b888149993
7
+ data.tar.gz: 4b5d0578b5a212952b0267961a24a483e4b32c56ce9a1ed64e1b89fe72e2b7ba0eae347899179ad93910344730f623de9a650495eddd081c3bcc4234373f1461
checksums.yaml.gz.sig CHANGED
Binary file
data.tar.gz.sig CHANGED
Binary file
data/lib/cron_format.rb CHANGED
@@ -22,7 +22,7 @@ class CronFormat
22
22
  parse()
23
23
  end
24
24
 
25
- def next()
25
+ def next_date()
26
26
 
27
27
  nudge() unless @cron_string =~ %r{/}
28
28
  parse()
@@ -69,7 +69,18 @@ class CronFormat
69
69
 
70
70
  raw_a = @cron_string.split
71
71
  raw_a << '*' if raw_a.length <= 5 # add the year?
72
+
73
+ dayceiling = raw_a[2][/-(\d+)$/,1]
74
+
75
+ if dayceiling and dayceiling.to_i <= @to_time.day then
72
76
 
77
+ dt2 = @to_time.to_datetime
78
+ next_month = dt2.next_month.month
79
+ dt2 += 1 until dt2.month == next_month
80
+
81
+ @to_time = dt2.to_time
82
+ end
83
+
73
84
  units = @to_time.to_a.values_at(1..4) + [nil, @to_time.year]
74
85
 
75
86
  procs = {
@@ -109,6 +120,8 @@ class CronFormat
109
120
  raw_units << v1
110
121
  repeaters << v2
111
122
  end
123
+
124
+
112
125
 
113
126
  if raw_a[4] != '*' then
114
127
  r = /(sun|mon|tues|wed|thurs|fri|satur|sun)(day)?|tue|thu|sat/i
@@ -121,7 +134,8 @@ class CronFormat
121
134
  raw_units[4].gsub!(r,&to_i)
122
135
  end
123
136
 
124
- @to_expression = raw_a[0..4].join ' '
137
+ @to_expression = raw_a[0..4].join ' '
138
+
125
139
  raw_date = raw_units.map.with_index {|x,i| dt[i].call(x) }
126
140
 
127
141
  # expand the repeater
@@ -153,7 +167,6 @@ class CronFormat
153
167
 
154
168
  next unless day_valid? d.reverse.take 3
155
169
  t = Time.parse(TF % d.reverse)
156
-
157
170
  # if there is a defined weekday, increment a day at
158
171
  # a time to match that weekday
159
172
  if wday and wday != t.wday then
@@ -182,6 +195,7 @@ class CronFormat
182
195
 
183
196
  # starting from the biggest unit, attempt to increment that
184
197
  # unit where it is equal to '*'
198
+
185
199
  if t < @to_time then
186
200
 
187
201
  if t.month < @to_time.month and raw_a[4] == '*' then
@@ -275,4 +289,4 @@ class CronFormat
275
289
  end
276
290
  end
277
291
 
278
- end
292
+ end
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.1.14
4
+ version: 0.1.15
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Robertson
@@ -10,28 +10,28 @@ bindir: bin
10
10
  cert_chain:
11
11
  - |
12
12
  -----BEGIN CERTIFICATE-----
13
- MIIDljCCAn6gAwIBAgIBATANBgkqhkiG9w0BAQUFADBIMRIwEAYDVQQDDAlnZW1t
14
- YXN0ZXIxHjAcBgoJkiaJk/IsZAEZFg5qYW1lc3JvYmVydHNvbjESMBAGCgmSJomT
15
- 8ixkARk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AQAAvEHq
27
+ yXYlDk/eBMY5TEYYqJ1yC2ojqhPWte6XHiB2HM81FIWeVdttdn6okb30AEbR6q2f
28
+ 5i4eAIJW7xGG3GNnDTvkd3/GzdrjgBhVkAuJwQyn9yow/uoxUOv8oQF/8xurum6V
29
+ PDf269Dp/SOaLlKW5CwJUPuEXJ5wTYM/HacwyxhrxTT4Lo9h4+sewKsJKZwmLdyJ
30
+ 2qaxwo1jIFkqEkmoAO+0DdHSxt0oOaa69+O0RsBlDbbCXeK8jCApP8OEsTLnzove
31
+ MmJuAQVfTk9wZd03YN619a64hLGIvud4ASW7UVAW0B4U0PcmbhHvne07e11jt7j5
32
+ WwVcDIvT38Bo3hAt
33
33
  -----END CERTIFICATE-----
34
- date: 2014-05-03 00:00:00.000000000 Z
34
+ date: 2015-01-14 00:00:00.000000000 Z
35
35
  dependencies: []
36
36
  description:
37
37
  email: james@r0bertson.co.uk
@@ -52,7 +52,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
52
52
  requirements:
53
53
  - - ">="
54
54
  - !ruby/object:Gem::Version
55
- version: '0'
55
+ version: 2.1.2
56
56
  required_rubygems_version: !ruby/object:Gem::Requirement
57
57
  requirements:
58
58
  - - ">="
@@ -60,7 +60,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
60
60
  version: '0'
61
61
  requirements: []
62
62
  rubyforge_project:
63
- rubygems_version: 2.1.11
63
+ rubygems_version: 2.2.2
64
64
  signing_key:
65
65
  specification_version: 4
66
66
  summary: cron_format
metadata.gz.sig CHANGED
Binary file