fugit 1.3.3 → 1.3.4

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
- SHA1:
3
- metadata.gz: 0e67fe1fbf7a5e0213b828cc78c59d6cf5b36a6e
4
- data.tar.gz: 920ea06ef202094e9b1c9c719fb06c55e0926b51
2
+ SHA256:
3
+ metadata.gz: a10a8afb99cf16856e53766a86b1f0d13ddb0d2784c756cb525ceea8fbae7bd1
4
+ data.tar.gz: dcd1d01a8f5f8fc819854f430e12fc6bf69850e64060cffbe93c595be78785a2
5
5
  SHA512:
6
- metadata.gz: d6f4c28d4e280b73a0b5a3c6bae84e328e06fa33cb573bc8fc1a3660e1c921dd666c793fd17a18f10bc4d630d5db2473c2d75659def60bb6fd7342c9e3dfbb51
7
- data.tar.gz: 40ae39ba32717fcc2d0148d2e4a63a2cd179fa61ef5de13670057021b77a95c9bec1ae7f299a3117602e63a1b02c5b1de683748ef793fa74ec394a4a7861992c
6
+ metadata.gz: 4b29f59bffe4f786b90c0f0a42c26c682e78b523183863f7cfc8c486ecca9056bb96f5eae92b2ee9446ece5c84a10aeddd9a52077eece5357af8985853da99ee
7
+ data.tar.gz: a32ac9539496ff7f4bc1949f97eeefcf836a8f1607569080acafd2d338befd7cb97e10179ffee06d2da3ebead95830147f5f418a883a4bd2a77f549455761788
@@ -2,6 +2,11 @@
2
2
  # CHANGELOG.md
3
3
 
4
4
 
5
+ ## fugit 1.3.4 released 2020-04-06
6
+
7
+ * Prevent #rough_frequency returning 0, gh-36
8
+
9
+
5
10
  ## fugit 1.3.3 released 2019-08-29
6
11
 
7
12
  * Fix Cron#match?(t) with respect to the cron's timezone, gh-31
data/CREDITS.md CHANGED
@@ -1,6 +1,7 @@
1
1
 
2
2
  # fugit credits
3
3
 
4
+ * Dominik Sander https://github.com/dsander #rough_frequency 0, gh-36
4
5
  * Milovan Zogovic https://github.com/assembler Cron#match? vs TZ, gh-31
5
6
  * Jessica Stokes https://github.com/ticky 0-24 issue with cron, gh-30
6
7
  * Shai Coleman https://github.com/shaicoleman parse_nat enhancements, gh-24, gh-25, and gh-28
@@ -1,5 +1,5 @@
1
1
 
2
- Copyright (c) 2017-2019, John Mettraux, jmettraux+flor@gmail.com
2
+ Copyright (c) 2017-2020, 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
@@ -31,7 +31,7 @@ build: gemspec_validate
31
31
  mv $(NAME)-$(VERSION).gem pkg/
32
32
 
33
33
  push: build
34
- gem push pkg/$(NAME)-$(VERSION).gem
34
+ gem push --otp "$(OTP)" pkg/$(NAME)-$(VERSION).gem
35
35
 
36
36
  spec:
37
37
  bundle exec rspec
data/README.md CHANGED
@@ -36,6 +36,7 @@ The intersection of those two projects is where fugit is born:
36
36
  * [rufus-scheduler](https://github.com/jmettraux/rufus-scheduler) -
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
+ * [serial_scheduler](https://github.com/grosser/serial_scheduler) - ruby task scheduler without threading
39
40
  * ...
40
41
 
41
42
  ## `Fugit.parse(s)`
@@ -137,6 +138,49 @@ Example of cron strings understood by fugit:
137
138
  # and more...
138
139
  ```
139
140
 
141
+ ### the first Monday of the month
142
+
143
+ Fugit tries to follow the `man 5 crontab` documentation.
144
+
145
+ There is a surprising thing about this canon, all the columns are joined by ANDs, except for monthday and weekday which are joined together by OR if they are both set (they are not `*`).
146
+
147
+ Many people (me included) [are suprised](https://superuser.com/questions/428807/run-a-cron-job-on-the-first-monday-of-every-month) when they try to specify "at 05:00 on the first Monday of the month" as `0 5 1-7 * 1` or `0 5 1-7 * mon` and the results are off.
148
+
149
+ The man page says:
150
+
151
+ > Note: The day of a command's execution can be specified by
152
+ > two fields -- day of month, and day of week. If both fields
153
+ > are restricted (ie, are not *), the command will be run when
154
+ > either field matches the current time.
155
+ > For example, ``30 4 1,15 * 5'' would cause a command to be run
156
+ > at 4:30 am on the 1st and 15th of each month, plus every Friday.
157
+
158
+ Fugit follows this specification.
159
+
160
+ There is a solution though, please read on.
161
+
162
+ ### the hash extension
163
+
164
+ Fugit understands `0 5 * * 1#1` or `0 5 * * mon#1` as "each first Monday of the month, at 05:00".
165
+
166
+ ```ruby
167
+ '0 5 * * 1#1' #
168
+ '0 5 * * mon#1' # the first Monday of the month at 05:00
169
+
170
+ '0 6 * * 5#4,5#5' #
171
+ '0 6 * * fri#4,fri#5' # the 4th and 5th Fridays of the month at 06:00
172
+
173
+ '0 7 * * 5#-1' #
174
+ '0 7 * * fri#-1' # the last Friday of the month at 07:00
175
+
176
+ '0 7 * * 5#L' #
177
+ '0 7 * * fri#L' #
178
+ '0 7 * * 5#last' #
179
+ '0 7 * * fri#last' # the last Friday of the month at 07:00
180
+
181
+ '0 23 * * mon#2,tue' # the 2nd Monday of the month and every Tuesday, at 23:00
182
+ ```
183
+
140
184
  ### the modulo extension
141
185
 
142
186
  Fugit, since 1.1.10, also understands cron strings like "`9 0 * * sun%2`" which can be read as "every other Sunday at 9am".
@@ -145,7 +189,7 @@ For odd Sundays, one can write `9 0 * * sun%2+1`.
145
189
 
146
190
  It can be combined, as in `9 0 * * sun%2,tue%3+2`
147
191
 
148
- But what does it references to? It starts at 1 on 2019-01-01.
192
+ But what does it reference to? It starts at 1 on 2019-01-01.
149
193
 
150
194
  ```ruby
151
195
  require 'et-orbi' # >= 1.1.8
@@ -1,7 +1,7 @@
1
1
 
2
2
  module Fugit
3
3
 
4
- VERSION = '1.3.3'
4
+ VERSION = '1.3.4'
5
5
  end
6
6
 
7
7
  require 'time'
@@ -188,6 +188,17 @@ module Fugit
188
188
 
189
189
  return weekday_match?(nt) || monthday_match?(nt) \
190
190
  if @weekdays && @monthdays
191
+ #
192
+ # From `man 5 crontab`
193
+ #
194
+ # Note: The day of a command's execution can be specified
195
+ # by two fields -- day of month, and day of week.
196
+ # If both fields are restricted (ie, are not *), the command will be
197
+ # run when either field matches the current time.
198
+ # For example, ``30 4 1,15 * 5'' would cause a command to be run
199
+ # at 4:30 am on the 1st and 15th of each month, plus every Friday.
200
+ #
201
+ # as seen in gh-5 and gh-35
191
202
 
192
203
  return false unless weekday_match?(nt)
193
204
  return false unless monthday_match?(nt)
@@ -336,6 +347,7 @@ module Fugit
336
347
  return (a + [ a.first + v1 ])
337
348
  .each_cons(2)
338
349
  .collect { |a0, a1| a1 - a0 }
350
+ .select { |d| d > 0 } # weed out zero deltas
339
351
  .min * v0
340
352
  end
341
353
 
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.3.3
4
+ version: 1.3.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - John Mettraux
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-08-29 00:00:00.000000000 Z
11
+ date: 2020-04-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: raabro
@@ -117,8 +117,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
117
117
  - !ruby/object:Gem::Version
118
118
  version: '0'
119
119
  requirements: []
120
- rubyforge_project:
121
- rubygems_version: 2.5.2.3
120
+ rubygems_version: 3.0.3
122
121
  signing_key:
123
122
  specification_version: 4
124
123
  summary: time tools for flor