deprecation_collector 0.5.0 → 0.5.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/gemfiles/rails_6.gemfile.lock +1 -1
- data/gemfiles/rails_7.gemfile.lock +1 -1
- data/gemfiles/rails_none.gemfile.lock +1 -1
- data/lib/deprecation_collector/storage.rb +9 -2
- data/lib/deprecation_collector/version.rb +1 -1
- data/lib/deprecation_collector/web/helpers.rb +7 -1
- data/lib/deprecation_collector/web/views/index.html.template.rb +3 -2
- data/lib/deprecation_collector.rb +16 -9
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 12a18a7dcdd264edfd2e2350b648a5f7ba9ade6c6623ee500ffff557277bc02e
|
4
|
+
data.tar.gz: 4c39ea72577e7eca7092aa040a9b0095134f833c155b8a417b80be5e6b9a25bf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0e5acf3561f2b2f106362e3738050197188bd9d51b32c8534feb30ba2bcba67b51ca514a20e529818ac28388b1823371131735adb61ae5e095150908e4542b5e
|
7
|
+
data.tar.gz: e35978336a7642085f9daca1eff1922d80abd9e769bffef46f6ba6d4c36d066fe99b39f0dba262710c0d8469c7e5f7b9567dc702268d9d4712247ef22dc8f9a1
|
data/Gemfile.lock
CHANGED
@@ -7,6 +7,8 @@ class DeprecationCollector
|
|
7
7
|
# :nodoc:
|
8
8
|
class Base
|
9
9
|
# rubocop:disable Style/SingleLineMethods
|
10
|
+
def initialize(**); end
|
11
|
+
def support_disabling?; false; end
|
10
12
|
def enabled?; true; end
|
11
13
|
def enable; end
|
12
14
|
def disable; end
|
@@ -16,6 +18,7 @@ class DeprecationCollector
|
|
16
18
|
|
17
19
|
def delete(digests); end
|
18
20
|
def clear(enable: false); end
|
21
|
+
def flush(**); end
|
19
22
|
|
20
23
|
def store(_deprecation); raise("Not implemented"); end
|
21
24
|
# rubocop:enable Style/SingleLineMethods
|
@@ -32,9 +35,9 @@ class DeprecationCollector
|
|
32
35
|
class Redis < Base
|
33
36
|
attr_accessor :write_interval, :write_interval_jitter, :redis, :count
|
34
37
|
|
35
|
-
def initialize(redis, mutex: nil, count: false, write_interval: 900, write_interval_jitter: 60,
|
38
|
+
def initialize(redis: nil, mutex: nil, count: false, write_interval: 900, write_interval_jitter: 60,
|
36
39
|
key_prefix: nil)
|
37
|
-
super
|
40
|
+
super
|
38
41
|
@key_prefix = key_prefix || "deprecations"
|
39
42
|
@redis = redis
|
40
43
|
@last_write_time = current_time
|
@@ -47,6 +50,10 @@ class DeprecationCollector
|
|
47
50
|
@known_digests = Set.new
|
48
51
|
end
|
49
52
|
|
53
|
+
def support_disabling?
|
54
|
+
true
|
55
|
+
end
|
56
|
+
|
50
57
|
def unsent_deprecations
|
51
58
|
@deprecations
|
52
59
|
end
|
@@ -65,7 +65,12 @@ class DeprecationCollector
|
|
65
65
|
msg = deprecation[:message]
|
66
66
|
return :kwargs if msg.include?("Using the last argument as keyword parameters is deprecated") ||
|
67
67
|
msg.include?("Passing the keyword argument as the last hash parameter is deprecated")
|
68
|
-
|
68
|
+
end
|
69
|
+
|
70
|
+
def test_deprecation?(deprecation)
|
71
|
+
%w[trigger_kwargs_error_warning trigger_rails_deprecation].any? do
|
72
|
+
|method| deprecation[:message].include?(method)
|
73
|
+
end
|
69
74
|
end
|
70
75
|
|
71
76
|
def deprecation_tags(deprecation)
|
@@ -73,6 +78,7 @@ class DeprecationCollector
|
|
73
78
|
if (detected_tag = detect_tag(deprecation))
|
74
79
|
tags << detected_tag
|
75
80
|
end
|
81
|
+
tags << :test if test_deprecation?(deprecation)
|
76
82
|
tags << deprecation[:realm] if deprecation[:realm] && deprecation[:realm] != "rails"
|
77
83
|
tags.merge(deprecation.dig(:notes, :tags) || [])
|
78
84
|
|
@@ -6,7 +6,8 @@ _buf = ''; _buf << ("<header class=\"mb-3\"><h1>Deprecations</h1><a class=\"btn
|
|
6
6
|
;
|
7
7
|
;
|
8
8
|
;
|
9
|
-
; if DeprecationCollector.instance.
|
9
|
+
; if DeprecationCollector.instance.storage.support_disabling?;
|
10
|
+
; if DeprecationCollector.instance.storage.enabled?;
|
10
11
|
;
|
11
12
|
;
|
12
13
|
;
|
@@ -16,7 +17,7 @@ _buf = ''; _buf << ("<header class=\"mb-3\"><h1>Deprecations</h1><a class=\"btn
|
|
16
17
|
;
|
17
18
|
; _buf << ("<a class=\"btn btn-secondary\" data-method=\"post\"".freeze); _slim_codeattributes4 = enable_deprecations_path; if _slim_codeattributes4; if _slim_codeattributes4 == true; _buf << (" href=\"\"".freeze); else; _buf << (" href=\"".freeze); _buf << ((::Temple::Utils.escape_html((_slim_codeattributes4))).to_s); _buf << ("\"".freeze); end; end; _buf << (" rel=\"nofollow\">Turn on (after workers restart)</a> ".freeze);
|
18
19
|
;
|
19
|
-
; end; _buf << ("</header><main><table class=\"table table-striped\"><tr><th>Count</th><th>Message</th><th>Location</th><th>Ruby/Rails</th></tr>".freeze);
|
20
|
+
; end; end; _buf << ("</header><main><table class=\"table table-striped\"><tr><th>Count</th><th>Message</th><th>Location</th><th>Ruby/Rails</th></tr>".freeze);
|
20
21
|
;
|
21
22
|
;
|
22
23
|
;
|
@@ -78,35 +78,33 @@ class DeprecationCollector
|
|
78
78
|
self.count = false
|
79
79
|
self.write_interval = 900 # 15.minutes
|
80
80
|
self.write_interval_jitter = 60
|
81
|
+
self.key_prefix = "deprecations"
|
81
82
|
@context_saver = nil
|
82
83
|
end
|
83
84
|
|
84
85
|
def redis=(val)
|
85
86
|
raise ArgumentError, "redis should not be nil" unless val
|
86
|
-
|
87
|
-
|
88
|
-
write_interval: write_interval,
|
89
|
-
write_interval_jitter: write_interval_jitter,
|
90
|
-
key_prefix: key_prefix)
|
87
|
+
self.storage = DeprecationCollector::Storage::Redis unless storage.respond_to?(:redis=)
|
88
|
+
storage.redis = val
|
91
89
|
end
|
92
90
|
|
93
91
|
def count=(val)
|
94
|
-
storage.count = val if storage.respond_to?(:count)
|
92
|
+
storage.count = val if storage.respond_to?(:count=)
|
95
93
|
@count = val
|
96
94
|
end
|
97
95
|
|
98
96
|
def write_interval=(val)
|
99
|
-
storage.write_interval = val if storage.respond_to?(:write_interval)
|
97
|
+
storage.write_interval = val if storage.respond_to?(:write_interval=)
|
100
98
|
@write_interval = val
|
101
99
|
end
|
102
100
|
|
103
101
|
def write_interval_jitter=(val)
|
104
|
-
storage.write_interval_jitter = val if storage.respond_to?(:write_interval_jitter)
|
102
|
+
storage.write_interval_jitter = val if storage.respond_to?(:write_interval_jitter=)
|
105
103
|
@write_interval_jitter = val
|
106
104
|
end
|
107
105
|
|
108
106
|
def key_prefix=(val)
|
109
|
-
storage.key_prefix = val
|
107
|
+
storage.key_prefix = val if storage.respond_to?(:key_prefix=)
|
110
108
|
@key_prefix = val
|
111
109
|
end
|
112
110
|
|
@@ -114,6 +112,14 @@ class DeprecationCollector
|
|
114
112
|
@storage ||= DeprecationCollector::Storage::StdErr.new
|
115
113
|
end
|
116
114
|
|
115
|
+
def storage=(val)
|
116
|
+
return @storage = val unless val.is_a?(Class)
|
117
|
+
|
118
|
+
@storage = val.new(mutex: @instance_mutex, count: count,
|
119
|
+
write_interval: write_interval, write_interval_jitter: write_interval_jitter,
|
120
|
+
key_prefix: key_prefix)
|
121
|
+
end
|
122
|
+
|
117
123
|
def ignored_messages=(val)
|
118
124
|
@ignore_message_regexp = (val && Regexp.union(val)) || nil
|
119
125
|
end
|
@@ -173,6 +179,7 @@ class DeprecationCollector
|
|
173
179
|
storage.clear(enable: enable)
|
174
180
|
end
|
175
181
|
|
182
|
+
# deprecated, use storage.enabled?
|
176
183
|
def enabled_in_redis?
|
177
184
|
storage.enabled?
|
178
185
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: deprecation_collector
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Vasily Fedoseyev
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-09-
|
11
|
+
date: 2023-09-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: redis
|