fugit 1.5.0 → 1.5.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ae056967c15463b2aed7a2839f383b9965968ae19414d214f37841ccabdeb7e5
4
- data.tar.gz: 33ddf5842af78f3bba3a477800dfde053bee82cde318575f7c78d3e25df8e910
3
+ metadata.gz: fd6f6af6264734f4eb10d5aa8e88cbcfbca029fb697f20b7a0ae37d220c55653
4
+ data.tar.gz: 25606c4f975d71350a360f4feb092a54f88bbb022fef31e4eb13c22d98b36b8f
5
5
  SHA512:
6
- metadata.gz: 13c7b00c76df998cac5c3ab8e754e7519b34c91c4653afa2da3d036d874c020ad10b34d596e20147f0d3c73e8b3904197896d0dd914b093e571d2e699df44632
7
- data.tar.gz: 59422402187e49a0ffe1b53f4798f3cab4427aa734bad7cfac8eafdb001e08728a7577f7c5f83ad197a3eaa06007c3a871714ccc8036fca1cf6361a3ed9f7a23
6
+ metadata.gz: 253c2fc474a22ff93caa8b1f465af16565ab8b69037f7e83dc1e42719085d95342ee9d7a43200bdb05bcc9815dc29f590c5d86df51b7f526e25bb6d96dd4ef02
7
+ data.tar.gz: '0951e692d8026d3a66c374e99f872bd03270f77e93232bbbecefac44c8b9b17253b46218dbb36f9f009441bb6d602c04f40dad7782df31674e26244c1ce59055'
data/CHANGELOG.md CHANGED
@@ -2,6 +2,21 @@
2
2
  # CHANGELOG.md
3
3
 
4
4
 
5
+ ## fugit 1.5.3 released 2022-04-02
6
+
7
+ * Fix Fugit::Cron.to_s vs "0 13 * * wed%2", gh-68
8
+
9
+
10
+ ## fugit 1.5.2 released 2021-09-18
11
+
12
+ * Simplify inc_day, gh-62
13
+
14
+
15
+ ## fugit 1.5.1 released 2021-08-18
16
+
17
+ * Fix #next_time break issue for America/Santiago into DST, gh-60
18
+
19
+
5
20
  ## fugit 1.5.0 released 2021-06-08
6
21
 
7
22
  * Accept "at 12 noon" and "at 12 midday" as "* 12 * * *", gh-57
data/CREDITS.md CHANGED
@@ -1,6 +1,9 @@
1
1
 
2
2
  # fugit credits
3
3
 
4
+ * Peter Goldstein, https://github.com/petergoldstein GHA 3.3 j9.3, gh-65
5
+ * Pascal Zumkehr https://github.com/codez gh-62, Santiago into DST vs Time.zone
6
+ * Ggallardoh https://github.com/Ggallardoh gh-60, America/Santiago into DST
4
7
  * Khaled AbuShqear https://github.com/shqear93 gh-57, "12pm"
5
8
  * John W Higgins https://github.com/wishdev gh-56, 15/30 cron decision
6
9
  * Karen Sawrey https://github.com/karensawrey gh-47, Mon%2+1 rework idea
data/LICENSE.txt CHANGED
@@ -1,5 +1,5 @@
1
1
 
2
- Copyright (c) 2017-2021, John Mettraux, jmettraux+flor@gmail.com
2
+ Copyright (c) 2017-2022, 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/README.md CHANGED
@@ -37,6 +37,7 @@ The intersection of those two projects is where fugit is born:
37
37
  * [flor](https://github.com/floraison/flor) - used in the [cron](https://github.com/floraison/flor/blob/master/doc/procedures/cron.md) procedure
38
38
  * [que-scheduler](https://github.com/hlascelles/que-scheduler) - a reliable job scheduler for [que](https://github.com/chanks/que)
39
39
  * [serial_scheduler](https://github.com/grosser/serial_scheduler) - ruby task scheduler without threading
40
+ * [delayed_cron_job](https://github.com/codez/delayed_cron_job) - an extension to Delayed::Job that allows you to set cron expressions for your jobs
40
41
  * ...
41
42
 
42
43
  ## `Fugit.parse(s)`
data/fugit.gemspec CHANGED
@@ -41,7 +41,7 @@ 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.4'
44
- s.add_runtime_dependency 'et-orbi', '~> 1.1', '>= 1.1.8'
44
+ s.add_runtime_dependency 'et-orbi', '~> 1', '>= 1.2.7'
45
45
 
46
46
  s.add_development_dependency 'rspec', '~> 3.8'
47
47
  s.add_development_dependency 'chronic', '~> 0.10'
data/lib/fugit/cron.rb CHANGED
@@ -60,7 +60,7 @@ module Fugit
60
60
  (@hours || [ '*' ]).join(','),
61
61
  (@monthdays || [ '*' ]).join(','),
62
62
  (@months || [ '*' ]).join(','),
63
- (@weekdays || [ [ '*' ] ]).map { |d| d.compact.join('#') }.join(','),
63
+ weekdays_to_cron_s,
64
64
  @timezone ? @timezone.name : nil
65
65
  ].compact.join(' ')
66
66
  end
@@ -74,6 +74,8 @@ module Fugit
74
74
  end
75
75
 
76
76
  def time; @t; end
77
+ def to_t; @t; end
78
+ #
77
79
  def to_i; @t.to_i; end
78
80
 
79
81
  %w[ year month day wday hour min sec wday_in_month rweek rday ]
@@ -83,18 +85,33 @@ module Fugit
83
85
  def dec(i); inc(-i); end
84
86
 
85
87
  def inc_month
88
+
86
89
  y = @t.year
87
90
  m = @t.month + 1
88
91
  if m == 13; m = 1; y += 1; end
92
+
89
93
  @t = ::EtOrbi.make(y, m, @t.zone)
94
+
90
95
  self
91
96
  end
92
97
 
93
98
  def inc_day
99
+
94
100
  inc((24 - @t.hour) * 3600 - @t.min * 60 - @t.sec)
95
- #inc( - @t.hour * 3600) if @t.hour != 0 # compensate for entering DST
96
- inc( - @t.hour * 3600) if @t.hour > 0 && @t.hour < 7
101
+
102
+ return if @t.hour == 0
103
+
104
+ if @t.hour < 12
105
+ begin
106
+ @t = ::EtOrbi.make(@t.year, @t.month, @t.day, @t.zone)
107
+ rescue ::TZInfo::PeriodNotFound
108
+ inc((24 - @t.hour) * 3600)
109
+ end
110
+ else
111
+ inc((24 - @t.hour) * 3600)
112
+ end
97
113
  end
114
+
98
115
  def inc_hour
99
116
  inc((60 - @t.min) * 60 - @t.sec)
100
117
  end
@@ -605,6 +622,24 @@ module Fugit
605
622
  @zone, @timezone = z
606
623
  end
607
624
 
625
+ def weekdays_to_cron_s
626
+
627
+ return '*' unless @weekdays
628
+
629
+ @weekdays
630
+ .collect { |a|
631
+ if a.length == 1
632
+ a[0].to_s
633
+ elsif a[1].is_a?(Array)
634
+ a11 = a[1][1]
635
+ off = (a11 < 0) ? a11.to_s : (a11 > 0) ? "+#{a11}" : ''
636
+ "#{a[0]}%#{a[1][0]}" + off
637
+ else
638
+ a.collect(&:to_s).join('#')
639
+ end }
640
+ .join(',')
641
+ end
642
+
608
643
  module Parser include Raabro
609
644
 
610
645
  WEEKDAYS =
data/lib/fugit.rb CHANGED
@@ -1,8 +1,9 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+
3
4
  module Fugit
4
5
 
5
- VERSION = '1.5.0'
6
+ VERSION = '1.5.3'
6
7
  end
7
8
 
8
9
  require 'time'
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.5.0
4
+ version: 1.5.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: 2021-06-08 00:00:00.000000000 Z
11
+ date: 2022-04-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: raabro
@@ -30,20 +30,20 @@ dependencies:
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '1.1'
33
+ version: '1'
34
34
  - - ">="
35
35
  - !ruby/object:Gem::Version
36
- version: 1.1.8
36
+ version: 1.2.7
37
37
  type: :runtime
38
38
  prerelease: false
39
39
  version_requirements: !ruby/object:Gem::Requirement
40
40
  requirements:
41
41
  - - "~>"
42
42
  - !ruby/object:Gem::Version
43
- version: '1.1'
43
+ version: '1'
44
44
  - - ">="
45
45
  - !ruby/object:Gem::Version
46
- version: 1.1.8
46
+ version: 1.2.7
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: rspec
49
49
  requirement: !ruby/object:Gem::Requirement
@@ -117,7 +117,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
117
117
  - !ruby/object:Gem::Version
118
118
  version: '0'
119
119
  requirements: []
120
- rubygems_version: 3.0.3
120
+ rubygems_version: 3.1.2
121
121
  signing_key:
122
122
  specification_version: 4
123
123
  summary: time tools for flor