fugit 1.1.6 → 1.1.7
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.
Potentially problematic release.
This version of fugit might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/CHANGELOG.md +7 -0
- data/CREDITS.md +6 -4
- data/LICENSE.txt +1 -1
- data/Makefile +14 -1
- data/fugit.gemspec +2 -1
- data/lib/fugit.rb +1 -1
- data/lib/fugit/cron.rb +45 -7
- metadata +18 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 06b510a4263280ff9bccbc45da080d66aaceeedc
|
4
|
+
data.tar.gz: db42c613d90cb57152159bab92a0c6175df06872
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a430e9a966158192af7d58658a96841e838f9c1a5c36c640552d4a3681c3126a33589be6591863d093af444727a8a53a49cdead95e71648bbf875451f6355d85
|
7
|
+
data.tar.gz: ddfb07e67ed544e8bbe2c4d4f18c44f4f681399f1ab8726b86eed1a23b73947895437bc5d200b11f14fa57bfc7beeb127e61e91ec9855dcb2b8e7a23a6b4f084
|
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,13 @@
|
|
2
2
|
# CHANGELOG.md
|
3
3
|
|
4
4
|
|
5
|
+
## fugit 1.1.7 released 2019-01-15
|
6
|
+
|
7
|
+
* Add breaker to Cron #next_time / #previous_time, gh-13
|
8
|
+
* Prevent 0 as a month in crons, gh-10
|
9
|
+
* Prevent 0 as a day of month in crons, gh-10
|
10
|
+
|
11
|
+
|
5
12
|
## fugit 1.1.6 released 2018-09-05
|
6
13
|
|
7
14
|
* Ensure `Etc/GMT-11` and all Olson timezone names are recognized
|
data/CREDITS.md
CHANGED
@@ -1,12 +1,14 @@
|
|
1
1
|
|
2
2
|
# fugit credits
|
3
3
|
|
4
|
-
*
|
5
|
-
*
|
6
|
-
*
|
4
|
+
* Wenhui Wang https://github.com/w11th #next_time vs Chronic+ActiveSupport #11
|
5
|
+
* Lin-Jen Shin https://github.com/godfat #next_time untamed loop, #13
|
6
|
+
* Nils Mueller https://github.com/Tolsto missing Olson timezone names, #9
|
7
|
+
* jakemack https://github.com/jakemack issue when going out of DST, #6
|
8
|
+
* Cristian Bica https://github.com/cristianbica Nat improvements, #7
|
7
9
|
* Utilum https://github.com/utilum silenced Ruby warnings
|
8
10
|
* Tero Marttila https://github.com/SpComb added missing Cron#seconds
|
9
|
-
* Harry Lascelles https://github.com/hlascelles timezone reminder
|
11
|
+
* Harry Lascelles https://github.com/hlascelles timezone reminder and more
|
10
12
|
* John Mettraux https://github.com/jmettraux author and maintainer
|
11
13
|
|
12
14
|
|
data/LICENSE.txt
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
|
2
|
-
Copyright (c) 2017-
|
2
|
+
Copyright (c) 2017-2019, John Mettraux, jmettraux+flor@gmail.com
|
3
3
|
|
4
4
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
5
5
|
of this software and associated documentation files (the "Software"), to deal
|
data/Makefile
CHANGED
@@ -35,5 +35,18 @@ spec:
|
|
35
35
|
test: spec
|
36
36
|
|
37
37
|
|
38
|
-
|
38
|
+
## specific to project ##
|
39
|
+
|
40
|
+
info:
|
41
|
+
uname -a
|
42
|
+
bundle exec ruby -v
|
43
|
+
bundle exec ruby -Ilib -r et-orbi -e "EtOrbi._make_info"
|
44
|
+
|
45
|
+
tzones:
|
46
|
+
bundle exec ruby -r tzinfo -e "TZInfo::Timezone.all.each { |tz| p tz.name }"
|
47
|
+
#tzonesd:
|
48
|
+
# bundle exec ruby -r tzinfo -r tzinfo-data -e "::TZInfo::Timezone.all.each { |tz| p tz.name }"
|
49
|
+
|
50
|
+
|
51
|
+
.PHONY: count_lines gemspec_validate name cw build push spec info tzones
|
39
52
|
|
data/fugit.gemspec
CHANGED
@@ -41,9 +41,10 @@ Time tools for flor and the floraison project. Cron parsing and occurrence compu
|
|
41
41
|
# this dependency appears in 'et-orbi'
|
42
42
|
|
43
43
|
s.add_runtime_dependency 'raabro', '~> 1.1'
|
44
|
-
s.add_runtime_dependency 'et-orbi', '~> 1.1', '>= 1.1.
|
44
|
+
s.add_runtime_dependency 'et-orbi', '~> 1.1', '>= 1.1.7'
|
45
45
|
|
46
46
|
s.add_development_dependency 'rspec', '~> 3.7'
|
47
|
+
s.add_development_dependency 'chronic', '~> 0.10'
|
47
48
|
|
48
49
|
s.require_path = 'lib'
|
49
50
|
end
|
data/lib/fugit.rb
CHANGED
data/lib/fugit/cron.rb
CHANGED
@@ -43,7 +43,7 @@ module Fugit
|
|
43
43
|
def do_parse(s)
|
44
44
|
|
45
45
|
parse(s) ||
|
46
|
-
fail(ArgumentError.new("
|
46
|
+
fail(ArgumentError.new("invalid cron string #{s.inspect}"))
|
47
47
|
end
|
48
48
|
end
|
49
49
|
|
@@ -166,19 +166,39 @@ module Fugit
|
|
166
166
|
hour_match?(t) && min_match?(t) && sec_match?(t)
|
167
167
|
end
|
168
168
|
|
169
|
+
BREAKER_S = 41 * (365 + 1) * 24 * 3600
|
170
|
+
# 41 years and a few days... there wont'be a next or a previous time
|
171
|
+
|
169
172
|
def next_time(from=::EtOrbi::EoTime.now)
|
170
173
|
|
171
174
|
from = ::EtOrbi.make_time(from)
|
172
175
|
sfrom = from.strftime('%F/%T')
|
176
|
+
ifrom = from.to_i
|
173
177
|
|
174
178
|
t = TimeCursor.new(from.translate(@timezone))
|
175
179
|
#
|
176
180
|
# the translation occurs in the timezone of
|
177
181
|
# this Fugit::Cron instance
|
178
182
|
|
183
|
+
ti = 0
|
184
|
+
stalling = false
|
185
|
+
|
179
186
|
loop do
|
180
187
|
|
181
|
-
|
188
|
+
ti1 = t.to_i
|
189
|
+
|
190
|
+
fail RuntimeError.new(
|
191
|
+
"loop stalled for #{@original.inspect} #next_time, breaking"
|
192
|
+
) if stalling && ti == ti1
|
193
|
+
|
194
|
+
stalling = (ti == ti1)
|
195
|
+
ti = ti1
|
196
|
+
|
197
|
+
fail RuntimeError.new(
|
198
|
+
"too many loops for #{@original.inspect} #next_time, breaking"
|
199
|
+
) if (ti - ifrom).abs > BREAKER_S
|
200
|
+
|
201
|
+
(ifrom == ti) && (t.inc(1); next)
|
182
202
|
month_match?(t) || (t.inc_month; next)
|
183
203
|
day_match?(t) || (t.inc_day; next)
|
184
204
|
hour_match?(t) || (t.inc_hour; next)
|
@@ -186,7 +206,7 @@ module Fugit
|
|
186
206
|
sec_match?(t) || (t.inc_sec(@seconds); next)
|
187
207
|
|
188
208
|
st = t.time.strftime('%F/%T')
|
189
|
-
(from, sfrom = t.time, st; next) if st == sfrom
|
209
|
+
(from, sfrom, ifrom = t.time, st, t.time.to_i; next) if st == sfrom
|
190
210
|
#
|
191
211
|
# when transitioning out of DST, this prevents #next_time from
|
192
212
|
# yielding the same literal time twice in a row, see gh-6
|
@@ -203,11 +223,28 @@ module Fugit
|
|
203
223
|
def previous_time(from=::EtOrbi::EoTime.now)
|
204
224
|
|
205
225
|
from = ::EtOrbi.make_time(from)
|
226
|
+
ti = 0
|
227
|
+
ifrom = from.to_i
|
228
|
+
|
206
229
|
t = TimeCursor.new(from.translate(@timezone))
|
230
|
+
stalling = false
|
207
231
|
|
208
232
|
loop do
|
209
|
-
|
210
|
-
|
233
|
+
|
234
|
+
ti1 = t.to_i
|
235
|
+
|
236
|
+
fail RuntimeError.new(
|
237
|
+
"loop stalled for #{@original.inspect} #previous_time, breaking"
|
238
|
+
) if stalling && ti == ti1
|
239
|
+
|
240
|
+
stalling = (ti == ti1)
|
241
|
+
ti = ti1
|
242
|
+
|
243
|
+
fail RuntimeError.new(
|
244
|
+
"too many loops for #{@original.inspect} #previous_time, breaking"
|
245
|
+
) if (ifrom - ti).abs > BREAKER_S
|
246
|
+
|
247
|
+
(ifrom == ti) && (t.inc(-1); next)
|
211
248
|
month_match?(t) || (t.dec_month; next)
|
212
249
|
day_match?(t) || (t.dec_day; next)
|
213
250
|
hour_match?(t) || (t.dec_hour; next)
|
@@ -237,6 +274,7 @@ module Fugit
|
|
237
274
|
t = EtOrbi.make_time("#{year}-01-01") - 1
|
238
275
|
t0 = nil
|
239
276
|
t1 = nil
|
277
|
+
|
240
278
|
loop do
|
241
279
|
t1 = next_time(t)
|
242
280
|
deltas << (t1 - t).to_i if t0
|
@@ -484,8 +522,8 @@ module Fugit
|
|
484
522
|
|
485
523
|
def core_mos(i); rex(:mos, i, /[0-5]?\d/); end # min or sec
|
486
524
|
def core_hou(i); rex(:hou, i, /(2[0-4]|[01]?[0-9])/); end
|
487
|
-
def core_dom(i); rex(:dom, i, /(-?(3[01]|[
|
488
|
-
def core_mon(i); rex(:mon, i, /(1[0-2]|0?[
|
525
|
+
def core_dom(i); rex(:dom, i, /(-?(3[01]|[12][0-9]|0?[1-9])|last|l)/i); end
|
526
|
+
def core_mon(i); rex(:mon, i, /(1[0-2]|0?[1-9]|#{MONTHS[1..-1].join('|')})/i); end
|
489
527
|
def core_dow(i); rex(:dow, i, /([0-7]|#{WEEKDS.join('|')})/i); end
|
490
528
|
|
491
529
|
def dow_hash(i); rex(:hash, i, /#(-?[1-5]|last|l)/i); end
|
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.1.
|
4
|
+
version: 1.1.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- John Mettraux
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2019-01-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: raabro
|
@@ -33,7 +33,7 @@ dependencies:
|
|
33
33
|
version: '1.1'
|
34
34
|
- - ">="
|
35
35
|
- !ruby/object:Gem::Version
|
36
|
-
version: 1.1.
|
36
|
+
version: 1.1.7
|
37
37
|
type: :runtime
|
38
38
|
prerelease: false
|
39
39
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -43,7 +43,7 @@ dependencies:
|
|
43
43
|
version: '1.1'
|
44
44
|
- - ">="
|
45
45
|
- !ruby/object:Gem::Version
|
46
|
-
version: 1.1.
|
46
|
+
version: 1.1.7
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: rspec
|
49
49
|
requirement: !ruby/object:Gem::Requirement
|
@@ -58,6 +58,20 @@ dependencies:
|
|
58
58
|
- - "~>"
|
59
59
|
- !ruby/object:Gem::Version
|
60
60
|
version: '3.7'
|
61
|
+
- !ruby/object:Gem::Dependency
|
62
|
+
name: chronic
|
63
|
+
requirement: !ruby/object:Gem::Requirement
|
64
|
+
requirements:
|
65
|
+
- - "~>"
|
66
|
+
- !ruby/object:Gem::Version
|
67
|
+
version: '0.10'
|
68
|
+
type: :development
|
69
|
+
prerelease: false
|
70
|
+
version_requirements: !ruby/object:Gem::Requirement
|
71
|
+
requirements:
|
72
|
+
- - "~>"
|
73
|
+
- !ruby/object:Gem::Version
|
74
|
+
version: '0.10'
|
61
75
|
description: Time tools for flor and the floraison project. Cron parsing and occurrence
|
62
76
|
computing. Timestamps and more.
|
63
77
|
email:
|