hron 0.5.1 → 0.6.0
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
- data/hron.gemspec +3 -3
- data/lib/hron/ast.rb +9 -1
- data/lib/hron/cron.rb +579 -82
- data/lib/hron/display.rb +26 -8
- data/lib/hron/evaluator.rb +496 -71
- data/lib/hron/lexer.rb +6 -0
- data/lib/hron/parser.rb +100 -36
- data/lib/hron/schedule.rb +15 -0
- data/lib/hron/version.rb +1 -1
- metadata +5 -5
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 83e68eccedae56c786fee25ac787926f1ba648cf98cf6e1574faadbaf8624817
|
|
4
|
+
data.tar.gz: 25fa66640c1a1b132008fe52e96164a6501997dae76a1db470f51bde72bfbdec
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 7a7be1616230531d0d60285c84c1cddfa9435ccce5fe38253a6a1c3f994baededacd97acbaff727e37d56f3774b2f21ea2a9db6c664820689efa2d5b0f389744
|
|
7
|
+
data.tar.gz: c30d7e497650a4a122f4f0c8c6fb463bea3bc36177b69126da2f250b14cbdbacd5676abb45e97cc44b52cb63aa6d01ba4d6771b4b9c3452d27b7b1e10e5e118b
|
data/hron.gemspec
CHANGED
|
@@ -9,16 +9,16 @@ Gem::Specification.new do |spec|
|
|
|
9
9
|
spec.email = ["prasrvenkat@gmail.com"]
|
|
10
10
|
|
|
11
11
|
spec.summary = "Human-readable cron — a scheduling expression language that is a superset of cron"
|
|
12
|
-
spec.description = "
|
|
12
|
+
spec.description = "hron (human-readable cron) is a scheduling expression language " \
|
|
13
13
|
"that is designed to be easy to read, write, and understand. It is a superset of cron, " \
|
|
14
|
-
"meaning any valid cron expression can be converted to and from
|
|
14
|
+
"meaning any valid cron expression can be converted to and from hron."
|
|
15
15
|
spec.homepage = "https://github.com/prasrvenkat/hron"
|
|
16
16
|
spec.license = "MIT"
|
|
17
17
|
spec.required_ruby_version = ">= 4.0.0"
|
|
18
18
|
|
|
19
19
|
spec.metadata["homepage_uri"] = spec.homepage
|
|
20
20
|
spec.metadata["source_code_uri"] = "https://github.com/prasrvenkat/hron"
|
|
21
|
-
spec.metadata["changelog_uri"] = "https://github.com/prasrvenkat/hron/
|
|
21
|
+
spec.metadata["changelog_uri"] = "https://github.com/prasrvenkat/hron/releases"
|
|
22
22
|
spec.metadata["rubygems_mfa_required"] = "true"
|
|
23
23
|
|
|
24
24
|
spec.files = Dir.chdir(__dir__) do
|
data/lib/hron/ast.rb
CHANGED
|
@@ -165,11 +165,20 @@ module Hron
|
|
|
165
165
|
SingleDay = Data.define(:day)
|
|
166
166
|
DayRange = Data.define(:start, :end_day) # end_day to avoid Ruby keyword
|
|
167
167
|
|
|
168
|
+
# --- Direction for nearest weekday ---
|
|
169
|
+
|
|
170
|
+
module NearestDirection
|
|
171
|
+
NEXT = :next
|
|
172
|
+
PREVIOUS = :previous
|
|
173
|
+
end
|
|
174
|
+
|
|
168
175
|
# --- Month target variants ---
|
|
169
176
|
|
|
170
177
|
DaysTarget = Data.define(:specs) # specs: Array<DayOfMonthSpec>
|
|
171
178
|
LastDayTarget = Data.define
|
|
172
179
|
LastWeekdayTarget = Data.define
|
|
180
|
+
NearestWeekdayTarget = Data.define(:day, :direction) # day: 1-31, direction: nil or NearestDirection
|
|
181
|
+
OrdinalWeekdayTarget = Data.define(:ordinal, :weekday)
|
|
173
182
|
|
|
174
183
|
# --- Year target variants ---
|
|
175
184
|
|
|
@@ -199,7 +208,6 @@ module Hron
|
|
|
199
208
|
DayRepeat = Data.define(:interval, :days, :times)
|
|
200
209
|
WeekRepeat = Data.define(:interval, :days, :times)
|
|
201
210
|
MonthRepeat = Data.define(:interval, :target, :times)
|
|
202
|
-
OrdinalRepeat = Data.define(:interval, :ordinal, :day, :times)
|
|
203
211
|
SingleDateExpr = Data.define(:date, :times)
|
|
204
212
|
YearRepeat = Data.define(:interval, :target, :times)
|
|
205
213
|
|