fugit 1.6.0 → 1.7.1
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of fugit might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/CHANGELOG.md +13 -0
- data/CREDITS.md +2 -0
- data/README.md +28 -1
- data/fugit.gemspec +1 -1
- data/lib/fugit/cron.rb +28 -14
- data/lib/fugit.rb +1 -1
- metadata +2 -3
- data/Makefile +0 -55
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 318e360c503855580a65262f188ae07d02a17c1e833aeb5d8d21e25a67a9805c
|
4
|
+
data.tar.gz: 54b9eaeba60e6c1a64db0ca2b5e86ed09e74d8c4afeb32677314946f8b1d5211
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c2813ab3974e9dcc7b3b6552bc8a5855617ac40b26190f84a3cbd413108d4b2ebc6a8c9418389a873844161289f60d48bece8fc10ca25295414e2e04c1da1474
|
7
|
+
data.tar.gz: 6e8587a3894c801bc220f967e3f5b0fed6e1bdea0bc606841fe188f890c8a0f6756f4b5357fd4cd887ff7d9bfd0a6bde68a1405ff369f7b4d41b8ec3e14c1c4b
|
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,19 @@
|
|
2
2
|
# CHANGELOG.md
|
3
3
|
|
4
4
|
|
5
|
+
## fugit 1.7.1 released 2022-09-21
|
6
|
+
|
7
|
+
* Change behaviour for "0 0/5 * * *", gh-79
|
8
|
+
go "every 5h start hour 0", previous behaviour only triggered at hour 0
|
9
|
+
|
10
|
+
|
11
|
+
## fugit 1.7.0 released 2022-09-15
|
12
|
+
|
13
|
+
* Introduce the & cron syntax (day-of-month AND day-of-week), gh-78
|
14
|
+
* Change how cron deals with modulo and offset, gh-76
|
15
|
+
* Be liberal with extra commas, gh-77
|
16
|
+
|
17
|
+
|
5
18
|
## fugit 1.6.0 release 2022-08-25
|
6
19
|
|
7
20
|
* Ensure input strings are stripped before parsing, gh-74
|
data/CREDITS.md
CHANGED
@@ -1,6 +1,8 @@
|
|
1
1
|
|
2
2
|
# fugit credits
|
3
3
|
|
4
|
+
* Joseph Halter, https://github.com/JosephHalter, gh-79
|
5
|
+
* James Healy, https://github.com/yob, gh-76
|
4
6
|
* John Bachir, https://github.com/jjb, gh-74
|
5
7
|
* Vivek Miyani, https://github.com/vivekmiyani, gh-71
|
6
8
|
* Peter Goldstein, https://github.com/petergoldstein infra, gh-65, -72
|
data/README.md
CHANGED
@@ -160,7 +160,34 @@ The man page says:
|
|
160
160
|
|
161
161
|
Fugit follows this specification.
|
162
162
|
|
163
|
-
|
163
|
+
Since fugit 1.7.0, by adding `&` right after a day specifier, the `day-of-month OR day-of-week` becomes `day-of-month AND day-of-week`.
|
164
|
+
|
165
|
+
```ruby
|
166
|
+
# standard cron
|
167
|
+
|
168
|
+
p Fugit.parse_cron('0 0 */2 * 1-5').next_time('2022-08-09').to_s
|
169
|
+
# ==> "2022-08-10 00:00:00 +0900"
|
170
|
+
|
171
|
+
# with an &
|
172
|
+
|
173
|
+
p Fugit.parse_cron('0 0 */2 * 1-5&').next_time('2022-08-09').to_s # or
|
174
|
+
p Fugit.parse_cron('0 0 */2& * 1-5').next_time('2022-08-09').to_s
|
175
|
+
p Fugit.parse_cron('0 0 */2& * 1-5&').next_time('2022-08-09').to_s
|
176
|
+
# ==> "2022-08-11 00:00:00 +0900"
|
177
|
+
|
178
|
+
|
179
|
+
# standard cron
|
180
|
+
|
181
|
+
p Fugit.parse_cron('59 6 1-7 * 2').next_time('2020-03-15').to_s
|
182
|
+
# ==> "2020-03-17 06:59:00 +0900"
|
183
|
+
|
184
|
+
# with an &
|
185
|
+
|
186
|
+
p Fugit.parse_cron('59 6 1-7 * 2&').next_time('2020-03-15').to_s
|
187
|
+
p Fugit.parse_cron('59 6 1-7& * 2').next_time('2020-03-15').to_s
|
188
|
+
p Fugit.parse_cron('59 6 1-7& * 2&').next_time('2020-03-15').to_s
|
189
|
+
# ==> "2020-04-07 06:59:00 +0900"
|
190
|
+
```
|
164
191
|
|
165
192
|
### the hash extension
|
166
193
|
|
data/fugit.gemspec
CHANGED
@@ -32,7 +32,7 @@ Time tools for flor and the floraison project. Cron parsing and occurrence compu
|
|
32
32
|
s.files = Dir[
|
33
33
|
'README.{md,txt}',
|
34
34
|
'CHANGELOG.{md,txt}', 'CREDITS.{md,txt}', 'LICENSE.{md,txt}',
|
35
|
-
'Makefile',
|
35
|
+
#'Makefile',
|
36
36
|
'lib/**/*.rb', #'spec/**/*.rb', 'test/**/*.rb',
|
37
37
|
"#{s.name}.gemspec",
|
38
38
|
]
|
data/lib/fugit/cron.rb
CHANGED
@@ -167,7 +167,7 @@ module Fugit
|
|
167
167
|
|
168
168
|
def weekday_modulo_match?(nt, mod)
|
169
169
|
|
170
|
-
(nt.rweek
|
170
|
+
(nt.rweek % mod[0]) == (mod[1] % mod[0])
|
171
171
|
end
|
172
172
|
|
173
173
|
def weekday_match?(nt)
|
@@ -199,8 +199,14 @@ module Fugit
|
|
199
199
|
|
200
200
|
def day_match?(nt)
|
201
201
|
|
202
|
-
|
203
|
-
|
202
|
+
if @weekdays && @monthdays
|
203
|
+
|
204
|
+
return weekday_match?(nt) && monthday_match?(nt) \
|
205
|
+
if @day_and
|
206
|
+
#
|
207
|
+
# extension for fugit, gh-78
|
208
|
+
|
209
|
+
return weekday_match?(nt) || monthday_match?(nt)
|
204
210
|
#
|
205
211
|
# From `man 5 crontab`
|
206
212
|
#
|
@@ -212,6 +218,8 @@ module Fugit
|
|
212
218
|
# at 4:30 am on the 1st and 15th of each month, plus every Friday.
|
213
219
|
#
|
214
220
|
# as seen in gh-5 and gh-35
|
221
|
+
end
|
222
|
+
|
215
223
|
|
216
224
|
return false unless weekday_match?(nt)
|
217
225
|
return false unless monthday_match?(nt)
|
@@ -482,6 +490,7 @@ module Fugit
|
|
482
490
|
|
483
491
|
@original = original
|
484
492
|
@cron_s = nil # just to be sure
|
493
|
+
@day_and = h[:&]
|
485
494
|
|
486
495
|
determine_seconds(h[:sec])
|
487
496
|
determine_minutes(h[:min])
|
@@ -500,8 +509,6 @@ module Fugit
|
|
500
509
|
|
501
510
|
sta, edn, sla = r
|
502
511
|
|
503
|
-
sla = nil if sla == 1 # don't get fooled by /1
|
504
|
-
|
505
512
|
edn = max if sla && edn.nil?
|
506
513
|
|
507
514
|
return [ nil ] if sta.nil? && edn.nil? && sla.nil?
|
@@ -516,6 +523,8 @@ module Fugit
|
|
516
523
|
|
517
524
|
def range(min, max, sta, edn, sla)
|
518
525
|
|
526
|
+
return [ nil ] if sta == min && edn == max && sla == 1
|
527
|
+
|
519
528
|
fail ArgumentError.new(
|
520
529
|
'both start and end must be negative in ' +
|
521
530
|
{ min: min, max: max, sta: sta, edn: edn, sla: sla }.inspect
|
@@ -660,7 +669,9 @@ module Fugit
|
|
660
669
|
def s(i); rex(nil, i, /[ \t]+/); end
|
661
670
|
def star(i); str(nil, i, '*'); end
|
662
671
|
def hyphen(i); str(nil, i, '-'); end
|
663
|
-
def comma(i);
|
672
|
+
def comma(i); rex(nil, i, /,([ \t]*,)*/); end
|
673
|
+
def comma?(i); rex(nil, i, /([ \t]*,)*/); end
|
674
|
+
def and?(i); rex(nil, i, /&?/); end
|
664
675
|
|
665
676
|
def slash(i); rex(:slash, i, /\/\d\d?/); end
|
666
677
|
|
@@ -720,12 +731,12 @@ module Fugit
|
|
720
731
|
def list_mon(i); jseq(:mon, i, :mon_elt, :comma); end
|
721
732
|
def list_dow(i); jseq(:dow, i, :dow_elt_, :comma); end
|
722
733
|
|
723
|
-
def lsec_(i); seq(nil, i, :list_sec, :s); end
|
724
|
-
def lmin_(i); seq(nil, i, :list_min, :s); end
|
725
|
-
def lhou_(i); seq(nil, i, :list_hou, :s); end
|
726
|
-
def ldom_(i); seq(nil, i, :list_dom, :s); end
|
727
|
-
def lmon_(i); seq(nil, i, :list_mon, :s); end
|
728
|
-
|
734
|
+
def lsec_(i); seq(nil, i, :comma?, :list_sec, :comma?, :s); end
|
735
|
+
def lmin_(i); seq(nil, i, :comma?, :list_min, :comma?, :s); end
|
736
|
+
def lhou_(i); seq(nil, i, :comma?, :list_hou, :comma?, :s); end
|
737
|
+
def ldom_(i); seq(nil, i, :comma?, :list_dom, :comma?, :and?, :s); end
|
738
|
+
def lmon_(i); seq(nil, i, :comma?, :list_mon, :comma?, :s); end
|
739
|
+
def ldow(i); seq(nil, i, :comma?, :list_dow, :comma?, :and?); end
|
729
740
|
|
730
741
|
def _tz_name(i)
|
731
742
|
rex(nil, i, / +[A-Z][a-zA-Z0-9+\-]+(\/[A-Z][a-zA-Z0-9+\-_]+){0,2}/)
|
@@ -736,10 +747,12 @@ module Fugit
|
|
736
747
|
def _tz(i); alt(:tz, i, :_tz_delta, :_tz_name); end
|
737
748
|
|
738
749
|
def classic_cron(i)
|
739
|
-
seq(:ccron, i,
|
750
|
+
seq(:ccron, i,
|
751
|
+
:lmin_, :lhou_, :ldom_, :lmon_, :ldow, :_tz, '?')
|
740
752
|
end
|
741
753
|
def second_cron(i)
|
742
|
-
seq(:scron, i,
|
754
|
+
seq(:scron, i,
|
755
|
+
:lsec_, :lmin_, :lhou_, :ldom_, :lmon_, :ldow, :_tz, '?')
|
743
756
|
end
|
744
757
|
|
745
758
|
def cron(i)
|
@@ -821,6 +834,7 @@ module Fugit
|
|
821
834
|
.inject({}) { |h, tt|
|
822
835
|
h[tt.name] = tt.name == :tz ? rewrite_tz(tt) : rewrite_entry(tt)
|
823
836
|
h }
|
837
|
+
hcron[:&] = true if t.string.index('&')
|
824
838
|
|
825
839
|
z, tz = hcron[:tz]; return nil if z && ! tz
|
826
840
|
|
data/lib/fugit.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fugit
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.7.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- John Mettraux
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-09-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: raabro
|
@@ -83,7 +83,6 @@ files:
|
|
83
83
|
- CHANGELOG.md
|
84
84
|
- CREDITS.md
|
85
85
|
- LICENSE.txt
|
86
|
-
- Makefile
|
87
86
|
- README.md
|
88
87
|
- fugit.gemspec
|
89
88
|
- lib/fugit.rb
|
data/Makefile
DELETED
@@ -1,55 +0,0 @@
|
|
1
|
-
|
2
|
-
## gem tasks ##
|
3
|
-
|
4
|
-
NAME = \
|
5
|
-
$(shell ruby -e "s = eval(File.read(Dir['*.gemspec'][0])); puts s.name")
|
6
|
-
VERSION = \
|
7
|
-
$(shell ruby -e "s = eval(File.read(Dir['*.gemspec'][0])); puts s.version")
|
8
|
-
|
9
|
-
count_lines:
|
10
|
-
find lib -name "*.rb" | xargs cat | ruby -e "p STDIN.readlines.count { |l| l = l.strip; l[0, 1] != '#' && l != '' }"
|
11
|
-
find spec -name "*_spec.rb" | xargs cat | ruby -e "p STDIN.readlines.count { |l| l = l.strip; l[0, 1] != '#' && l != '' }"
|
12
|
-
cl: count_lines
|
13
|
-
|
14
|
-
scan:
|
15
|
-
scan lib/**/*.rb
|
16
|
-
|
17
|
-
gemspec_validate:
|
18
|
-
@echo "---"
|
19
|
-
ruby -e "s = eval(File.read(Dir['*.gemspec'].first)); p s.validate"
|
20
|
-
@echo "---"
|
21
|
-
|
22
|
-
name: gemspec_validate
|
23
|
-
@echo "$(NAME) $(VERSION)"
|
24
|
-
|
25
|
-
cw:
|
26
|
-
find lib -name "*.rb" -exec ruby -cw {} \;
|
27
|
-
|
28
|
-
build: gemspec_validate
|
29
|
-
gem build $(NAME).gemspec
|
30
|
-
mkdir -p pkg
|
31
|
-
mv $(NAME)-$(VERSION).gem pkg/
|
32
|
-
|
33
|
-
push: build
|
34
|
-
gem push --otp "$(OTP)" pkg/$(NAME)-$(VERSION).gem
|
35
|
-
|
36
|
-
spec:
|
37
|
-
bundle exec rspec
|
38
|
-
test: spec
|
39
|
-
|
40
|
-
|
41
|
-
## specific to project ##
|
42
|
-
|
43
|
-
info:
|
44
|
-
uname -a
|
45
|
-
bundle exec ruby -v
|
46
|
-
bundle exec ruby -Ilib -r et-orbi -e "EtOrbi._make_info"
|
47
|
-
|
48
|
-
tzones:
|
49
|
-
bundle exec ruby -r tzinfo -e "TZInfo::Timezone.all.each { |tz| p tz.name }"
|
50
|
-
#tzonesd:
|
51
|
-
# bundle exec ruby -r tzinfo -r tzinfo-data -e "::TZInfo::Timezone.all.each { |tz| p tz.name }"
|
52
|
-
|
53
|
-
|
54
|
-
.PHONY: count_lines scan gemspec_validate name cw build push spec info tzones
|
55
|
-
|