roqua-support 0.4.1 → 0.4.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +13 -0
- data/Gemfile.lock +5 -5
- data/lib/roqua/core_ext/enumerable/sort_by_alphanum.rb +36 -18
- data/lib/roqua/support/errors.rb +1 -1
- data/lib/roqua-support/version.rb +1 -1
- data/spec/roqua/core_ext/enumerable/sort_by_alphanum_spec.rb +15 -0
- data/spec/roqua/support/errors_spec.rb +0 -1
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 26f053a4b379494d15a9b24e9b8bc81911f3315c803f087dc0798bf668b762c3
|
4
|
+
data.tar.gz: 564d0a8c6a2faf7dee1074d4f6f18798371febfeaacb0e76df40ff85109440e8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 90c413010ca39e84809c85fd7a659900293055d0db111adafcd70f7cba88c24aee6c8953bd6ef066c9861fc6406e6612ea34a318780302a6dc5488ceda29e7f1
|
7
|
+
data.tar.gz: 4c977d93716db251acd831231904271d8ec216bc1abc1a7ca1620da75767bada7b4ab737b0917359b975c64172fcaebad8a1ffc305833daf80d00157329c5b97
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,16 @@
|
|
1
|
+
## 0.4.4
|
2
|
+
|
3
|
+
* Fix incompatibility with Appsignal v3 which removed long-deprecated is_ignored_exception? with no alternative
|
4
|
+
|
5
|
+
|
6
|
+
## 0.4.3
|
7
|
+
|
8
|
+
* Make sort_by_alphanum sort shorter string first.
|
9
|
+
|
10
|
+
## 0.4.2
|
11
|
+
|
12
|
+
* Make sort_by_alphanum stable for chunks that parse to the same int like 04 and 4.
|
13
|
+
|
1
14
|
## 0.4.1
|
2
15
|
|
3
16
|
* Add timezone to logging timestamps. Use milliseconds instead of microseconds precision.
|
data/Gemfile.lock
CHANGED
@@ -10,7 +10,7 @@ GIT
|
|
10
10
|
PATH
|
11
11
|
remote: .
|
12
12
|
specs:
|
13
|
-
roqua-support (0.4.
|
13
|
+
roqua-support (0.4.4)
|
14
14
|
active_interaction (>= 3.0, < 5.0)
|
15
15
|
activesupport (>= 5.2, < 6.2)
|
16
16
|
appsignal (>= 2.9, < 3.1)
|
@@ -33,9 +33,9 @@ GEM
|
|
33
33
|
erubi (~> 1.4)
|
34
34
|
rails-dom-testing (~> 2.0)
|
35
35
|
rails-html-sanitizer (~> 1.1, >= 1.2.0)
|
36
|
-
active_interaction (4.0
|
37
|
-
activemodel (>= 5, <
|
38
|
-
activesupport (>= 5, <
|
36
|
+
active_interaction (4.1.0)
|
37
|
+
activemodel (>= 5, < 8)
|
38
|
+
activesupport (>= 5, < 8)
|
39
39
|
activemodel (6.0.2.2)
|
40
40
|
activesupport (= 6.0.2.2)
|
41
41
|
activerecord (6.0.2.2)
|
@@ -51,7 +51,7 @@ GEM
|
|
51
51
|
bundler
|
52
52
|
rake
|
53
53
|
thor (>= 0.14.0)
|
54
|
-
appsignal (3.0.
|
54
|
+
appsignal (3.0.26)
|
55
55
|
rack
|
56
56
|
ast (2.4.2)
|
57
57
|
builder (3.2.4)
|
@@ -21,29 +21,47 @@ module Enumerable
|
|
21
21
|
|
22
22
|
private
|
23
23
|
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
b_chunk, b = extract_alpha_or_number_group(b)
|
24
|
+
ALL_NUM = /\d+/
|
25
|
+
ALL_ALPHA = /[A-Za-z]+/
|
26
|
+
NON_ALPHANUM = /[^A-Za-z0-9]+/
|
28
27
|
|
29
|
-
|
28
|
+
def grouped_compare(a, b)
|
29
|
+
a_scanner = StringScanner.new(a)
|
30
|
+
b_scanner = StringScanner.new(b)
|
31
|
+
# each loop has to do exactly 1 non-nil-scan on both scanners or return a non-zero value.
|
32
|
+
loop do
|
33
|
+
ret = \
|
34
|
+
if a_scanner.eos?
|
35
|
+
-1
|
36
|
+
elsif b_scanner.eos?
|
37
|
+
1
|
38
|
+
elsif (a_chunk = a_scanner.scan(ALL_NUM))
|
39
|
+
if (b_chunk = b_scanner.scan(ALL_NUM))
|
40
|
+
if a_chunk.to_i != b_chunk.to_i
|
30
41
|
a_chunk.to_i <=> b_chunk.to_i
|
31
|
-
else
|
42
|
+
else # 03 vs 3
|
32
43
|
a_chunk <=> b_chunk
|
33
44
|
end
|
34
|
-
|
35
|
-
|
45
|
+
elsif b_scanner.scan(ALL_ALPHA)
|
46
|
+
-1
|
47
|
+
else # NON_ALPHANUM
|
48
|
+
1
|
49
|
+
end
|
50
|
+
elsif (a_chunk = a_scanner.scan(ALL_ALPHA))
|
51
|
+
if (b_chunk = b_scanner.scan(ALL_ALPHA))
|
52
|
+
a_chunk <=> b_chunk
|
53
|
+
else # ALL_NUM or NON_ALPHANUM
|
54
|
+
1
|
55
|
+
end
|
56
|
+
else # NON_ALPHANUM
|
57
|
+
a_chunk = a_scanner.scan(NON_ALPHANUM)
|
58
|
+
if (b_chunk = b_scanner.scan(NON_ALPHANUM))
|
59
|
+
a_chunk <=> b_chunk
|
60
|
+
else
|
61
|
+
-1
|
62
|
+
end
|
63
|
+
end
|
36
64
|
return ret if ret != 0
|
37
|
-
}
|
38
|
-
end
|
39
|
-
|
40
|
-
def extract_alpha_or_number_group(item)
|
41
|
-
matchdata = /([A-Za-z]+|[\d]+)/.match(item)
|
42
|
-
|
43
|
-
if matchdata.nil?
|
44
|
-
["", ""]
|
45
|
-
else
|
46
|
-
[matchdata[0], item = item[matchdata.offset(0)[1] .. -1]]
|
47
65
|
end
|
48
66
|
end
|
49
67
|
end
|
data/lib/roqua/support/errors.rb
CHANGED
@@ -69,7 +69,7 @@ module Roqua
|
|
69
69
|
end
|
70
70
|
|
71
71
|
def notify_appsignal?(exception)
|
72
|
-
const_defined?(:Appsignal) && Appsignal.active?
|
72
|
+
const_defined?(:Appsignal) && Appsignal.active?
|
73
73
|
end
|
74
74
|
|
75
75
|
def notify_appsignal(exception, labels, namespace)
|
@@ -11,8 +11,23 @@ describe Enumerable do
|
|
11
11
|
expect(input.sort_by_alphanum(&:reverse)).to eq ["004some10thing", "004some11thing", "3another"]
|
12
12
|
end
|
13
13
|
|
14
|
+
it 'sorts shorter strings first' do
|
15
|
+
input = %w[a_2_ a_2 a a_1] # curlies are above alpha in utf-8, Ԙ is multi-byte
|
16
|
+
expect(input.sort_by_alphanum).to eq %w[a a_1 a_2 a_2_]
|
17
|
+
end
|
18
|
+
|
19
|
+
it 'treats non-alphanum as lower than alpha and num' do
|
20
|
+
input = %w[b3a b{c bԘb] # curlies are above alpha in utf-8, Ԙ is multi-byte
|
21
|
+
expect(input.sort_by_alphanum).to eq %w[b{c bԘb b3a]
|
22
|
+
end
|
23
|
+
|
14
24
|
it 'compares number chunks as integers' do
|
15
25
|
expect(%w(004 3).sort_by_alphanum).to eq %w(3 004)
|
16
26
|
end
|
27
|
+
|
28
|
+
it 'sorts identical integers by asci' do
|
29
|
+
input = %w[b4e b0004e b04e b004e]
|
30
|
+
expect(input.sort_by_alphanum).to eq %w[b0004e b004e b04e b4e]
|
31
|
+
end
|
17
32
|
end
|
18
33
|
end
|
@@ -96,7 +96,6 @@ describe 'Error reporting' do
|
|
96
96
|
before do
|
97
97
|
Appsignal.config = Appsignal::Config.new(Dir.pwd, "test")
|
98
98
|
allow(Appsignal).to receive(:active?).and_return(true)
|
99
|
-
allow(Appsignal).to receive(:is_ignored_exception?).and_return(false)
|
100
99
|
allow(Appsignal).to receive(:agent).and_return(agent)
|
101
100
|
end
|
102
101
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: roqua-support
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Marten Veldthuis
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-05-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: active_interaction
|
@@ -266,7 +266,7 @@ homepage: https://github.com/roqua/roqua-support
|
|
266
266
|
licenses:
|
267
267
|
- MIT
|
268
268
|
metadata: {}
|
269
|
-
post_install_message:
|
269
|
+
post_install_message:
|
270
270
|
rdoc_options: []
|
271
271
|
require_paths:
|
272
272
|
- lib
|
@@ -282,7 +282,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
282
282
|
version: '0'
|
283
283
|
requirements: []
|
284
284
|
rubygems_version: 3.1.4
|
285
|
-
signing_key:
|
285
|
+
signing_key:
|
286
286
|
specification_version: 4
|
287
287
|
summary: Helper objects and proxies used by a lot of RoQua applications
|
288
288
|
test_files:
|