ndr_support 5.5.0 → 5.5.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -0
- data/code_safety.yml +15 -23
- data/gemfiles/Gemfile.rails60 +6 -0
- data/lib/ndr_support.rb +2 -0
- data/lib/ndr_support/concerns/working_days.rb +16 -0
- data/lib/ndr_support/string/conversions.rb +2 -2
- data/lib/ndr_support/version.rb +1 -1
- data/ndr_support.gemspec +4 -4
- data/test/string/conversions_test.rb +10 -0
- metadata +17 -20
- data/gemfiles/Gemfile.rails42 +0 -6
- data/gemfiles/Gemfile.rails50 +0 -6
- data/gemfiles/Gemfile.rails51 +0 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3f5d3aeeaaa13e7221012d0c20948ce96257b4ebb2824e765d0570bc10cec75c
|
4
|
+
data.tar.gz: 57dc19084dc7ebe85fce29dcd5db48372febf8ee58c9cdd8a2ae275c81d1037c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e9b013478c6a967e6dc2293de8c7bae820382fdb6dc0c8b0bb5aae82da064969620fb8143a6ee9013166f0d652c7ce64a7187279ca5b571c718cd74de5d075b5
|
7
|
+
data.tar.gz: c4a0b7c8c41c93aacbf53351d7ef517593e7f0612c6b6cb750ab218223e2d494dc9c746c9005c1bf003d2ed9c9e6ed4887813688f79f7eb22cb25e0bec6cff5b
|
data/CHANGELOG.md
CHANGED
@@ -1,6 +1,12 @@
|
|
1
1
|
## [Unreleased]
|
2
2
|
*no unreleased changes*
|
3
3
|
|
4
|
+
## 5.5.1 / 2019-05-15
|
5
|
+
### Fixed
|
6
|
+
* Support Ruby 2.6, Rails 6.0. Minimum Ruby/Rails versions are now 2.5/5.2
|
7
|
+
* Warn when WorkingDays lookup is getting stale
|
8
|
+
* Improved date parsing in String#to_date
|
9
|
+
|
4
10
|
## 5.5.0 / 2018-11-16
|
5
11
|
### Added
|
6
12
|
* Add `ThreatScanner` to wrap ClamAV for virus detection (#10)
|
data/code_safety.yml
CHANGED
@@ -12,12 +12,12 @@ file safety:
|
|
12
12
|
comments: 'diff failed; reviewed whole file. Revision c88f5ac8c12fd657bb142144e0d3afaa7f9bc361:
|
13
13
|
Slack notification secret is public/private key encrypted, so not a disclosure
|
14
14
|
risk. As a secondary protection, it''s excluded from the .gem file by ndr_support.gemspec'
|
15
|
-
reviewed_by:
|
16
|
-
safe_revision:
|
15
|
+
reviewed_by: josh.pencheon
|
16
|
+
safe_revision: 0cfcfac5ddcd721a67dcd23f04cbf6bc2278b922
|
17
17
|
CHANGELOG.md:
|
18
18
|
comments:
|
19
19
|
reviewed_by: josh.pencheon
|
20
|
-
safe_revision:
|
20
|
+
safe_revision: 1a3b9f3403a81404b0165c0d4ff7dd9a728eb0b5
|
21
21
|
CODE_OF_CONDUCT.md:
|
22
22
|
comments:
|
23
23
|
reviewed_by: timgentry
|
@@ -42,34 +42,26 @@ file safety:
|
|
42
42
|
comments:
|
43
43
|
reviewed_by: timgentry
|
44
44
|
safe_revision: e33e9dae7f38bc449ce9276515a539836dbbbd53
|
45
|
-
gemfiles/Gemfile.rails42:
|
46
|
-
comments:
|
47
|
-
reviewed_by: pauleves
|
48
|
-
safe_revision: f76ad0fe72d42b1ff37553c8194935a8b93a6848
|
49
|
-
gemfiles/Gemfile.rails50:
|
50
|
-
comments:
|
51
|
-
reviewed_by: josh.pencheon
|
52
|
-
safe_revision: 55ed1c2a18b9cc4d1d996ee69419f5ee38f87746
|
53
|
-
gemfiles/Gemfile.rails51:
|
54
|
-
comments:
|
55
|
-
reviewed_by: brian.shand
|
56
|
-
safe_revision: 4e87fd9d64fc0f15b359ba60fc48cda54453c647
|
57
45
|
gemfiles/Gemfile.rails52:
|
58
46
|
comments:
|
59
47
|
reviewed_by: josh.pencheon
|
60
48
|
safe_revision: 8a6bedae77d33d0db1b67eaed7972870b6afc993
|
61
|
-
|
49
|
+
gemfiles/Gemfile.rails60:
|
62
50
|
comments:
|
63
51
|
reviewed_by: josh.pencheon
|
64
|
-
safe_revision:
|
52
|
+
safe_revision: 0cfcfac5ddcd721a67dcd23f04cbf6bc2278b922
|
53
|
+
lib/ndr_support.rb:
|
54
|
+
comments:
|
55
|
+
reviewed_by: brian.shand
|
56
|
+
safe_revision: 44fbdf72f47f4022c7dc9148150ebc18589dac8f
|
65
57
|
lib/ndr_support/array.rb:
|
66
58
|
comments:
|
67
59
|
reviewed_by: pauleves
|
68
60
|
safe_revision: 4a4ed24d2cfe7e1736baadf4cf6e0fece6823be1
|
69
61
|
lib/ndr_support/concerns/working_days.rb:
|
70
62
|
comments:
|
71
|
-
reviewed_by:
|
72
|
-
safe_revision:
|
63
|
+
reviewed_by: brian.shand
|
64
|
+
safe_revision: a64c2c4616317240faec2db7a84761947ae844a3
|
73
65
|
lib/ndr_support/date_and_time_extensions.rb:
|
74
66
|
comments:
|
75
67
|
reviewed_by: josh.pencheon
|
@@ -137,7 +129,7 @@ file safety:
|
|
137
129
|
lib/ndr_support/string/conversions.rb:
|
138
130
|
comments:
|
139
131
|
reviewed_by: brian.shand
|
140
|
-
safe_revision:
|
132
|
+
safe_revision: 1692170e1d07e3b6ba95e88d6c15510a7b3c2fe6
|
141
133
|
lib/ndr_support/tasks.rb:
|
142
134
|
comments:
|
143
135
|
reviewed_by: timgentry
|
@@ -165,7 +157,7 @@ file safety:
|
|
165
157
|
lib/ndr_support/version.rb:
|
166
158
|
comments:
|
167
159
|
reviewed_by: josh.pencheon
|
168
|
-
safe_revision:
|
160
|
+
safe_revision: 1a3b9f3403a81404b0165c0d4ff7dd9a728eb0b5
|
169
161
|
lib/ndr_support/yaml/serialization_migration.rb:
|
170
162
|
comments:
|
171
163
|
reviewed_by: timgentry
|
@@ -173,7 +165,7 @@ file safety:
|
|
173
165
|
ndr_support.gemspec:
|
174
166
|
comments:
|
175
167
|
reviewed_by: josh.pencheon
|
176
|
-
safe_revision:
|
168
|
+
safe_revision: 0cfcfac5ddcd721a67dcd23f04cbf6bc2278b922
|
177
169
|
test/array_test.rb:
|
178
170
|
comments:
|
179
171
|
reviewed_by: timgentry
|
@@ -241,7 +233,7 @@ file safety:
|
|
241
233
|
test/string/conversions_test.rb:
|
242
234
|
comments:
|
243
235
|
reviewed_by: brian.shand
|
244
|
-
safe_revision:
|
236
|
+
safe_revision: 1692170e1d07e3b6ba95e88d6c15510a7b3c2fe6
|
245
237
|
test/test_helper.rb:
|
246
238
|
comments:
|
247
239
|
reviewed_by: josh.pencheon
|
data/lib/ndr_support.rb
CHANGED
@@ -77,8 +77,24 @@ module WorkingDays
|
|
77
77
|
'2019-08-26', # Monday - Summer bank holiday
|
78
78
|
'2019-12-25', # Wednesday - Christmas Day
|
79
79
|
'2019-12-26', # Thursday - Boxing Day
|
80
|
+
# 2020
|
81
|
+
'2020-01-01', # Wednesday - New Year's Day
|
82
|
+
'2020-04-10', # Friday - Good Friday
|
83
|
+
'2020-04-13', # Monday - Easter Monday
|
84
|
+
'2020-05-04', # Monday - Early May bank holiday
|
85
|
+
'2020-05-25', # Monday - Spring bank holiday
|
86
|
+
'2020-08-31', # Monday - Summer bank holiday
|
87
|
+
'2020-12-25', # Friday - Christmas Day
|
88
|
+
'2020-12-26', # Monday - Boxing Day
|
80
89
|
].map { |str| Date.parse(str) }
|
81
90
|
|
91
|
+
def self.check_lookup
|
92
|
+
return true if HOLIDAYS.max >= 1.year.from_now
|
93
|
+
|
94
|
+
warn "NdrSupport's WorkingDays extension has under a year of future data. Check for updates?"
|
95
|
+
false
|
96
|
+
end
|
97
|
+
|
82
98
|
# How many complete working days there are until the given
|
83
99
|
# `other`. Returns negative number if `other` is earlier.
|
84
100
|
def working_days_until(other)
|
@@ -112,12 +112,12 @@ class String
|
|
112
112
|
|
113
113
|
if ['yyyy/dd/mm', 'mm/dd/yyyy'].include?(pattern)
|
114
114
|
month, day = day, month
|
115
|
-
elsif 8 == length && self
|
115
|
+
elsif 8 == length && self =~ /\A\d{2}[^A-Z0-9]\d{2}[^A-Z0-9]\d{2}\z/i
|
116
116
|
# dd/mm/yy, rather than yyyymmdd
|
117
117
|
year, day = day, year
|
118
118
|
year += 100 if year <= Ourdate.today.year % 100
|
119
119
|
year += 1900
|
120
|
-
elsif 9 == length
|
120
|
+
elsif 9 == length && self =~ /\A\d{2}[^A-Z0-9][A-Z]{3}[^A-Z0-9]\d{2}\z/i
|
121
121
|
# dd/mmm/yy, rare case.
|
122
122
|
year += 100 if year <= Ourdate.today.year % 100
|
123
123
|
year += 1900
|
data/lib/ndr_support/version.rb
CHANGED
data/ndr_support.gemspec
CHANGED
@@ -20,13 +20,13 @@ Gem::Specification.new do |spec|
|
|
20
20
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
21
21
|
spec.require_paths = ['lib']
|
22
22
|
|
23
|
-
spec.add_dependency 'activerecord', '>=
|
24
|
-
spec.add_dependency 'activesupport', '>=
|
23
|
+
spec.add_dependency 'activerecord', '>= 5.2.0', '< 7'
|
24
|
+
spec.add_dependency 'activesupport', '>= 5.2.0', '< 7'
|
25
25
|
|
26
|
-
spec.add_development_dependency 'bundler'
|
26
|
+
spec.add_development_dependency 'bundler'
|
27
27
|
spec.add_development_dependency 'rake', '~> 10.0'
|
28
28
|
|
29
|
-
spec.required_ruby_version = '>= 2.
|
29
|
+
spec.required_ruby_version = '>= 2.5.0'
|
30
30
|
|
31
31
|
# Avoid std-lib minitest (which has different namespace)
|
32
32
|
spec.add_development_dependency 'minitest', '>= 5.0.0'
|
@@ -58,6 +58,10 @@ class String::ConversionsTest < Minitest::Test
|
|
58
58
|
assert_ymd [2001, 3, 2], '02/03/2001'.to_date
|
59
59
|
assert_ymd [2010, 7, 11], '2010-07-11'.to_date
|
60
60
|
|
61
|
+
assert_ymd [2001, 3, 2], '2.3.2001'.to_date
|
62
|
+
assert_ymd [2001, 3, 2], '2/3/2001'.to_date
|
63
|
+
assert_ymd [2010, 7, 11], '2010-7-11'.to_date
|
64
|
+
|
61
65
|
assert_ymd [2001, 2, 3], '2001/02/03'.to_date('yyyy/mm/dd')
|
62
66
|
assert_ymd [2001, 2, 3], '2001/03/02'.to_date('yyyy/dd/mm')
|
63
67
|
assert_ymd [2001, 2, 3], '2001-02-03'.to_date('yyyy-mm-dd')
|
@@ -334,6 +338,12 @@ class String::ConversionsTest < Minitest::Test
|
|
334
338
|
assert_equal Ourdate.build_datetime(2008, 05, 03), '03/05/2008 13:38'.to_date
|
335
339
|
end
|
336
340
|
|
341
|
+
test 'incorrectly formatted string to_date' do
|
342
|
+
assert_nil '10-1975'.to_date
|
343
|
+
assert_nil '10.1975A'.to_date
|
344
|
+
assert_nil '10.1975AA'.to_date
|
345
|
+
end
|
346
|
+
|
337
347
|
test 'to_boolean' do
|
338
348
|
assert_equal true, 'true'.to_boolean
|
339
349
|
assert_equal true, 'yes'.to_boolean
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ndr_support
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 5.5.
|
4
|
+
version: 5.5.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- NCRS Development Team
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2019-05-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|
@@ -16,54 +16,54 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
19
|
+
version: 5.2.0
|
20
20
|
- - "<"
|
21
21
|
- !ruby/object:Gem::Version
|
22
|
-
version: '
|
22
|
+
version: '7'
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
25
|
version_requirements: !ruby/object:Gem::Requirement
|
26
26
|
requirements:
|
27
27
|
- - ">="
|
28
28
|
- !ruby/object:Gem::Version
|
29
|
-
version:
|
29
|
+
version: 5.2.0
|
30
30
|
- - "<"
|
31
31
|
- !ruby/object:Gem::Version
|
32
|
-
version: '
|
32
|
+
version: '7'
|
33
33
|
- !ruby/object:Gem::Dependency
|
34
34
|
name: activesupport
|
35
35
|
requirement: !ruby/object:Gem::Requirement
|
36
36
|
requirements:
|
37
37
|
- - ">="
|
38
38
|
- !ruby/object:Gem::Version
|
39
|
-
version:
|
39
|
+
version: 5.2.0
|
40
40
|
- - "<"
|
41
41
|
- !ruby/object:Gem::Version
|
42
|
-
version: '
|
42
|
+
version: '7'
|
43
43
|
type: :runtime
|
44
44
|
prerelease: false
|
45
45
|
version_requirements: !ruby/object:Gem::Requirement
|
46
46
|
requirements:
|
47
47
|
- - ">="
|
48
48
|
- !ruby/object:Gem::Version
|
49
|
-
version:
|
49
|
+
version: 5.2.0
|
50
50
|
- - "<"
|
51
51
|
- !ruby/object:Gem::Version
|
52
|
-
version: '
|
52
|
+
version: '7'
|
53
53
|
- !ruby/object:Gem::Dependency
|
54
54
|
name: bundler
|
55
55
|
requirement: !ruby/object:Gem::Requirement
|
56
56
|
requirements:
|
57
|
-
- - "
|
57
|
+
- - ">="
|
58
58
|
- !ruby/object:Gem::Version
|
59
|
-
version: '
|
59
|
+
version: '0'
|
60
60
|
type: :development
|
61
61
|
prerelease: false
|
62
62
|
version_requirements: !ruby/object:Gem::Requirement
|
63
63
|
requirements:
|
64
|
-
- - "
|
64
|
+
- - ">="
|
65
65
|
- !ruby/object:Gem::Version
|
66
|
-
version: '
|
66
|
+
version: '0'
|
67
67
|
- !ruby/object:Gem::Dependency
|
68
68
|
name: rake
|
69
69
|
requirement: !ruby/object:Gem::Requirement
|
@@ -240,10 +240,8 @@ files:
|
|
240
240
|
- README.md
|
241
241
|
- Rakefile
|
242
242
|
- code_safety.yml
|
243
|
-
- gemfiles/Gemfile.rails42
|
244
|
-
- gemfiles/Gemfile.rails50
|
245
|
-
- gemfiles/Gemfile.rails51
|
246
243
|
- gemfiles/Gemfile.rails52
|
244
|
+
- gemfiles/Gemfile.rails60
|
247
245
|
- lib/ndr_support.rb
|
248
246
|
- lib/ndr_support/array.rb
|
249
247
|
- lib/ndr_support/concerns/working_days.rb
|
@@ -308,15 +306,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
308
306
|
requirements:
|
309
307
|
- - ">="
|
310
308
|
- !ruby/object:Gem::Version
|
311
|
-
version: 2.
|
309
|
+
version: 2.5.0
|
312
310
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
313
311
|
requirements:
|
314
312
|
- - ">="
|
315
313
|
- !ruby/object:Gem::Version
|
316
314
|
version: '0'
|
317
315
|
requirements: []
|
318
|
-
|
319
|
-
rubygems_version: 2.7.6
|
316
|
+
rubygems_version: 3.0.3
|
320
317
|
signing_key:
|
321
318
|
specification_version: 4
|
322
319
|
summary: NDR Support library
|
data/gemfiles/Gemfile.rails42
DELETED
data/gemfiles/Gemfile.rails50
DELETED