fugit 1.1.2 → 1.1.3
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 +5 -0
- data/CREDITS.md +2 -0
- data/Makefile +4 -1
- data/lib/fugit.rb +1 -1
- data/lib/fugit/cron.rb +17 -17
- data/lib/fugit/duration.rb +9 -9
- data/lib/fugit/nat.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cf9112604503de8154a134544a4a30a8a5faee5f
|
4
|
+
data.tar.gz: 648f1f1215a0609b22afeed98849e9f2741f98d3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0e0d0983c4bf016caf168a02a666f3de7ba516073e6610133bcf5324f6ddf37f3e48e410d439a8834c65af098c642e0e9ed45e11268ab00ac880abc789c35341
|
7
|
+
data.tar.gz: b960fddc42f5ef1eabffac55a6f54b316e9eecc878d703a1a4b4248f2d3b381c18877b2896015f793dd4177a082ea6283835aa4bbf020029fc1682eb5f75da2f
|
data/CHANGELOG.md
CHANGED
data/CREDITS.md
CHANGED
@@ -1,8 +1,10 @@
|
|
1
1
|
|
2
2
|
# fugit credits
|
3
3
|
|
4
|
+
* Utilum https://github.com/utilum silenced Ruby warnings
|
4
5
|
* Tero Marttila https://github.com/SpComb added missing Cron#seconds
|
5
6
|
* Harry Lascelles https://github.com/hlascelles timezone reminder
|
7
|
+
* John Mettraux https://github.com/jmettraux author and maintainer
|
6
8
|
|
7
9
|
|
8
10
|
## rufus-scheduler credits
|
data/Makefile
CHANGED
@@ -19,6 +19,9 @@ gemspec_validate:
|
|
19
19
|
name: gemspec_validate
|
20
20
|
@echo "$(NAME) $(VERSION)"
|
21
21
|
|
22
|
+
cw:
|
23
|
+
find lib -name "*.rb" -exec ruby -cw {} \;
|
24
|
+
|
22
25
|
build: gemspec_validate
|
23
26
|
gem build $(NAME).gemspec
|
24
27
|
mkdir -p pkg
|
@@ -28,5 +31,5 @@ push: build
|
|
28
31
|
gem push pkg/$(NAME)-$(VERSION).gem
|
29
32
|
|
30
33
|
|
31
|
-
.PHONY: build push
|
34
|
+
.PHONY: build push cw
|
32
35
|
|
data/lib/fugit.rb
CHANGED
data/lib/fugit/cron.rb
CHANGED
@@ -28,7 +28,6 @@ module Fugit
|
|
28
28
|
|
29
29
|
return s if s.is_a?(self)
|
30
30
|
|
31
|
-
original = s
|
32
31
|
s = SPECIALS[s] || s
|
33
32
|
|
34
33
|
return nil unless s.is_a?(String)
|
@@ -94,8 +93,8 @@ module Fugit
|
|
94
93
|
def inc_min; inc(60 - @t.sec); end
|
95
94
|
|
96
95
|
def inc_sec(seconds)
|
97
|
-
if
|
98
|
-
inc(
|
96
|
+
if sec = seconds.find { |s| s > @t.sec }
|
97
|
+
inc(sec - @t.sec)
|
99
98
|
else
|
100
99
|
inc(60 - @t.sec + seconds.first)
|
101
100
|
end
|
@@ -123,7 +122,7 @@ module Fugit
|
|
123
122
|
|
124
123
|
return true if @weekdays.nil?
|
125
124
|
|
126
|
-
wd, hsh = @weekdays.find { |
|
125
|
+
wd, hsh = @weekdays.find { |d, _| d == nt.wday }
|
127
126
|
|
128
127
|
return false unless wd
|
129
128
|
return true if hsh.nil?
|
@@ -328,37 +327,38 @@ module Fugit
|
|
328
327
|
arr.sort!
|
329
328
|
end
|
330
329
|
|
331
|
-
def determine_seconds(
|
332
|
-
@seconds = (
|
330
|
+
def determine_seconds(arr)
|
331
|
+
@seconds = (arr || [ 0 ]).inject([]) { |a, s| a.concat(expand(0, 59, s)) }
|
333
332
|
compact(:@seconds)
|
334
333
|
end
|
335
334
|
|
336
|
-
def determine_minutes(
|
337
|
-
@minutes =
|
335
|
+
def determine_minutes(arr)
|
336
|
+
@minutes = arr.inject([]) { |a, m| a.concat(expand(0, 59, m)) }
|
338
337
|
compact(:@minutes)
|
339
338
|
end
|
340
339
|
|
341
|
-
def determine_hours(
|
342
|
-
@hours =
|
343
|
-
|
340
|
+
def determine_hours(arr)
|
341
|
+
@hours = arr
|
342
|
+
.inject([]) { |a, h| a.concat(expand(0, 23, h)) }
|
343
|
+
.collect { |h| h == 24 ? 0 : h }
|
344
344
|
compact(:@hours)
|
345
345
|
end
|
346
346
|
|
347
|
-
def determine_monthdays(
|
348
|
-
@monthdays =
|
347
|
+
def determine_monthdays(arr)
|
348
|
+
@monthdays = arr.inject([]) { |a, d| a.concat(expand(1, 31, d)) }
|
349
349
|
compact(:@monthdays)
|
350
350
|
end
|
351
351
|
|
352
|
-
def determine_months(
|
353
|
-
@months =
|
352
|
+
def determine_months(arr)
|
353
|
+
@months = arr.inject([]) { |a, m| a.concat(expand(1, 12, m)) }
|
354
354
|
compact(:@months)
|
355
355
|
end
|
356
356
|
|
357
|
-
def determine_weekdays(
|
357
|
+
def determine_weekdays(arr)
|
358
358
|
|
359
359
|
@weekdays = []
|
360
360
|
|
361
|
-
|
361
|
+
arr.each do |a, z, s, h| # a to z, slash and hash
|
362
362
|
if h
|
363
363
|
@weekdays << [ a, h ]
|
364
364
|
elsif s
|
data/lib/fugit/duration.rb
CHANGED
@@ -128,7 +128,7 @@ module Fugit
|
|
128
128
|
|
129
129
|
def inflate
|
130
130
|
|
131
|
-
|
131
|
+
params =
|
132
132
|
@h.inject({ sec: 0 }) { |h, (k, v)|
|
133
133
|
a = KEYS[k]
|
134
134
|
if a[:I]
|
@@ -139,7 +139,7 @@ module Fugit
|
|
139
139
|
h
|
140
140
|
}
|
141
141
|
|
142
|
-
self.class.allocate.init(@original, {},
|
142
|
+
self.class.allocate.init(@original, {}, params)
|
143
143
|
end
|
144
144
|
|
145
145
|
# Round float seconds to 9 decimals when deflating
|
@@ -184,9 +184,9 @@ module Fugit
|
|
184
184
|
|
185
185
|
def opposite
|
186
186
|
|
187
|
-
|
187
|
+
params = @h.inject({}) { |h, (k, v)| h[k] = -v; h }
|
188
188
|
|
189
|
-
self.class.allocate.init(nil, {},
|
189
|
+
self.class.allocate.init(nil, {}, params)
|
190
190
|
end
|
191
191
|
|
192
192
|
alias -@ opposite
|
@@ -201,9 +201,9 @@ module Fugit
|
|
201
201
|
|
202
202
|
def add_duration(d)
|
203
203
|
|
204
|
-
|
204
|
+
params = d.h.inject(@h.dup) { |h, (k, v)| h[k] = (h[k] || 0) + v; h }
|
205
205
|
|
206
|
-
self.class.allocate.init(nil, {},
|
206
|
+
self.class.allocate.init(nil, {}, params)
|
207
207
|
end
|
208
208
|
|
209
209
|
def add_to_time(t)
|
@@ -312,10 +312,10 @@ module Fugit
|
|
312
312
|
|
313
313
|
t
|
314
314
|
.subgather(nil)
|
315
|
-
.inject({}) { |h,
|
316
|
-
v =
|
315
|
+
.inject({}) { |h, tt|
|
316
|
+
v = tt.string; v = v.index('.') ? v.to_f : v.to_i
|
317
317
|
# drops ending ("y", "m", ...) by itself
|
318
|
-
h[
|
318
|
+
h[tt.name] = (h[tt.name] || 0) + v
|
319
319
|
h
|
320
320
|
}
|
321
321
|
end
|
data/lib/fugit/nat.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.1.
|
4
|
+
version: 1.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- John Mettraux
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-06-
|
11
|
+
date: 2018-06-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: raabro
|