fugit 1.4.5 → 1.5.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e49e2002591b450a853f0a27eb942fd69f69a59d6803c229bcdb51af471b6862
4
- data.tar.gz: f9f6921007e4e0df0908e63f080d0f710ba60401299440347ecc994b6ccf56fc
3
+ metadata.gz: ae056967c15463b2aed7a2839f383b9965968ae19414d214f37841ccabdeb7e5
4
+ data.tar.gz: 33ddf5842af78f3bba3a477800dfde053bee82cde318575f7c78d3e25df8e910
5
5
  SHA512:
6
- metadata.gz: 22dc41bcc969d3505157572bbe899d7f160f8ab06ce42b3f4b494911ae69d96bde4be7422f55fd31c33491899b3af4ec50b4870f419145d103bd230d94affecd
7
- data.tar.gz: 50d62627a4ed4fe54cf31d2901eebdd56f57a69f0464f0ede436184af604d1d18622e3159b487f9a92a35cfbf8a3ed65b58887dc3f43514e86a73e4db5d11692
6
+ metadata.gz: 13c7b00c76df998cac5c3ab8e754e7519b34c91c4653afa2da3d036d874c020ad10b34d596e20147f0d3c73e8b3904197896d0dd914b093e571d2e699df44632
7
+ data.tar.gz: 59422402187e49a0ffe1b53f4798f3cab4427aa734bad7cfac8eafdb001e08728a7577f7c5f83ad197a3eaa06007c3a871714ccc8036fca1cf6361a3ed9f7a23
data/CHANGELOG.md CHANGED
@@ -2,6 +2,13 @@
2
2
  # CHANGELOG.md
3
3
 
4
4
 
5
+ ## fugit 1.5.0 released 2021-06-08
6
+
7
+ * Accept "at 12 noon" and "at 12 midday" as "* 12 * * *", gh-57
8
+ * Accept "at 12pm" as "0 12 * * *", not "0 24 * * *", gh-57
9
+ * Accept "15/30 * * * *" as "15-59/30 * * * *", gh-56
10
+
11
+
5
12
  ## fugit 1.4.5 released 2021-04-22
6
13
 
7
14
  * Accept "* * * Mon%2+2", gh-47
data/CREDITS.md CHANGED
@@ -1,6 +1,8 @@
1
1
 
2
2
  # fugit credits
3
3
 
4
+ * Khaled AbuShqear https://github.com/shqear93 gh-57, "12pm"
5
+ * John W Higgins https://github.com/wishdev gh-56, 15/30 cron decision
4
6
  * Karen Sawrey https://github.com/karensawrey gh-47, Mon%2+1 rework idea
5
7
  * Olle Jonsson https://github.com/olleolleolle gha Ruby 3.0
6
8
  * Andy Pfister https://github.com/andyundso gh-53, entering DST
data/README.md CHANGED
@@ -138,6 +138,8 @@ Example of cron strings understood by fugit:
138
138
  # and more...
139
139
  ```
140
140
 
141
+ Please note that `'15/30 * * * *'` is interpreted as `'15-59/30 * * * *'` since fugit 1.4.6.
142
+
141
143
  ### the first Monday of the month
142
144
 
143
145
  Fugit tries to follow the `man 5 crontab` documentation.
data/lib/fugit.rb CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  module Fugit
4
4
 
5
- VERSION = '1.4.5'
5
+ VERSION = '1.5.0'
6
6
  end
7
7
 
8
8
  require 'time'
data/lib/fugit/cron.rb CHANGED
@@ -485,6 +485,8 @@ module Fugit
485
485
 
486
486
  sla = nil if sla == 1 # don't get fooled by /1
487
487
 
488
+ edn = max if sla && edn.nil?
489
+
488
490
  return [ nil ] if sta.nil? && edn.nil? && sla.nil?
489
491
  return [ sta ] if sta && edn.nil?
490
492
 
data/lib/fugit/nat.rb CHANGED
@@ -201,7 +201,7 @@ module Fugit
201
201
  end
202
202
 
203
203
  def ampm(i)
204
- rex(:ampm, i, /[ \t]*(am|pm)/i)
204
+ rex(:ampm, i, /[ \t]*(am|pm|noon|midday|midnight)/i)
205
205
  end
206
206
  def dark(i)
207
207
  rex(:dark, i, /[ \t]*dark/i)
@@ -473,17 +473,21 @@ module Fugit
473
473
  slot(:monthday, "#{md0}-#{md1}")
474
474
  end
475
475
 
476
+ def adjust_h(h, ap)
477
+ h = h.to_i
478
+ ap = ap || ''
479
+ (h < 12 && ap == 'pm' || ap == 'midnight') ? h + 12 : h
480
+ end
481
+
476
482
  def rewrite_digital_hour(t)
477
483
  h, m, ap = t.strinpd.split(/[: \t]+/)
478
- h, m = h.to_i, m.to_i
479
- h += 12 if ap && ap == 'pm'
480
- slot(:hm, h.to_i, m.to_i)
484
+ h, m = adjust_h(h, ap), m.to_i
485
+ slot(:hm, h, m)
481
486
  end
482
487
 
483
488
  def rewrite_simple_hour(t)
484
489
  h, ap = t.subgather(nil).collect(&:strinpd)
485
- h = h.to_i
486
- h = h + 12 if ap == 'pm'
490
+ h = adjust_h(h, ap)
487
491
  slot(:hm, h, 0)
488
492
  end
489
493
 
@@ -500,7 +504,7 @@ module Fugit
500
504
  m = NMINUTES[m] || m
501
505
  #p [ 1, '-->', h, m ]
502
506
 
503
- h += 12 if h < 13 && apt && apt.strinpd == 'pm'
507
+ h = adjust_h(h, apt && apt.strinpd)
504
508
 
505
509
  slot(:hm, h, m)
506
510
  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.4.5
4
+ version: 1.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - John Mettraux
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-04-22 00:00:00.000000000 Z
11
+ date: 2021-06-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: raabro