parse-cron 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/cron_parser.rb +2 -1
- data/lib/parse-cron/version.rb +1 -1
- data/spec/cron_parser_spec.rb +2 -0
- metadata +21 -3
data/lib/cron_parser.rb
CHANGED
@@ -159,7 +159,8 @@ class CronParser
|
|
159
159
|
nudge_year(t, dir) if next_value.nil?
|
160
160
|
|
161
161
|
# we changed the month, so its likely that the date is incorrect now
|
162
|
-
|
162
|
+
valid_days = interpolate_weekdays(t.year, t.month)[1]
|
163
|
+
t.day = dir == :next ? valid_days.first : valid_days.last
|
163
164
|
end
|
164
165
|
|
165
166
|
def date_valid?(t, dir = :next)
|
data/lib/parse-cron/version.rb
CHANGED
data/spec/cron_parser_spec.rb
CHANGED
@@ -39,6 +39,8 @@ describe "CronParser#next" do
|
|
39
39
|
["* * 12 * *", "2010-04-15 10:15", "2010-05-12 00:00"],
|
40
40
|
["* * * * 1,3", "2010-04-15 10:15", "2010-04-19 00:00"],
|
41
41
|
["0 0 1 1 *", "2010-04-15 10:15", "2011-01-01 00:00"],
|
42
|
+
["0 0 * * 1", "2011-08-01 00:00", "2011-08-08 00:00"],
|
43
|
+
["0 0 * * 1", "2011-07-25 00:00", "2011-08-01 00:00"],
|
42
44
|
].each do |line, now, expected_next|
|
43
45
|
it "should return #{expected_next} for '#{line}' when now is #{now}" do
|
44
46
|
now = parse_date(now)
|
metadata
CHANGED
@@ -1,8 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: parse-cron
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
+
hash: 25
|
4
5
|
prerelease:
|
5
|
-
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 1
|
9
|
+
- 1
|
10
|
+
version: 0.1.1
|
6
11
|
platform: ruby
|
7
12
|
authors:
|
8
13
|
- Michael Siebert
|
@@ -10,7 +15,8 @@ autorequire:
|
|
10
15
|
bindir: bin
|
11
16
|
cert_chain: []
|
12
17
|
|
13
|
-
date: 2011-08-18 00:00:00
|
18
|
+
date: 2011-08-18 00:00:00 +02:00
|
19
|
+
default_executable:
|
14
20
|
dependencies:
|
15
21
|
- !ruby/object:Gem::Dependency
|
16
22
|
name: rspec
|
@@ -20,6 +26,11 @@ dependencies:
|
|
20
26
|
requirements:
|
21
27
|
- - ~>
|
22
28
|
- !ruby/object:Gem::Version
|
29
|
+
hash: 23
|
30
|
+
segments:
|
31
|
+
- 2
|
32
|
+
- 6
|
33
|
+
- 0
|
23
34
|
version: 2.6.0
|
24
35
|
type: :development
|
25
36
|
version_requirements: *id001
|
@@ -43,6 +54,7 @@ files:
|
|
43
54
|
- parse-cron.gemspec
|
44
55
|
- spec/cron_parser_spec.rb
|
45
56
|
- spec/spec_helper.rb
|
57
|
+
has_rdoc: true
|
46
58
|
homepage: https://github.com/siebertm/parse-cron
|
47
59
|
licenses: []
|
48
60
|
|
@@ -56,17 +68,23 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
56
68
|
requirements:
|
57
69
|
- - ">="
|
58
70
|
- !ruby/object:Gem::Version
|
71
|
+
hash: 3
|
72
|
+
segments:
|
73
|
+
- 0
|
59
74
|
version: "0"
|
60
75
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
61
76
|
none: false
|
62
77
|
requirements:
|
63
78
|
- - ">="
|
64
79
|
- !ruby/object:Gem::Version
|
80
|
+
hash: 3
|
81
|
+
segments:
|
82
|
+
- 0
|
65
83
|
version: "0"
|
66
84
|
requirements: []
|
67
85
|
|
68
86
|
rubyforge_project: parse-cron
|
69
|
-
rubygems_version: 1.
|
87
|
+
rubygems_version: 1.4.2
|
70
88
|
signing_key:
|
71
89
|
specification_version: 3
|
72
90
|
summary: Parses cron expressions and calculates the next occurence
|