deprecation_collector 0.5.1 → 0.6.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,81 @@
1
+ header.mb-3
2
+ h1 Deprecation
3
+
4
+ a.btn.btn-secondary> href=deprecations_path Back
5
+ a.btn.btn-danger> href=deprecation_path(@deprecation[:digest]) data-method="delete" data-confirm="Delete?" rel="nofollow" title="Delete"
6
+ span.glyphicon.glyphicon-trash.insalesicon-trash
7
+ | Delete
8
+
9
+ main
10
+ dl.row
11
+ dt Message
12
+ dd
13
+ code= @deprecation[:message]
14
+ / dt.col-sm-3 First time
15
+ / dd.col-sm-9= @deprecation[:first_timestamp]&.yield_self { |time| Time.at(time) }
16
+ dt First time
17
+ dd= @deprecation[:first_timestamp]&.yield_self { |time| Time.at(time) }
18
+
19
+ - if @deprecation[:count]&.>(1)
20
+ dt Count
21
+ dd= @deprecation[:count]
22
+
23
+ dt Realm
24
+ dd= @deprecation[:realm]
25
+
26
+ - if @deprecation[:ruby_version]
27
+ dt Ruby
28
+ dd= @deprecation[:ruby_version]
29
+ - if @deprecation[:rails_version]
30
+ dt Rails
31
+ dd= @deprecation[:rails_version]
32
+
33
+ - if @deprecation[:revision]
34
+ dt Revision
35
+ dd= @deprecation[:revision]
36
+ - if @deprecation[:hostname]
37
+ dt Hostname
38
+ dd= @deprecation[:hostname]
39
+
40
+ - if @deprecation[:context]
41
+ dt Context
42
+ dd
43
+ .card.p-3
44
+ pre
45
+ code = JSON.pretty_generate(@deprecation[:context])
46
+
47
+ - if @deprecation[:app_traceline]
48
+ dt App traceline
49
+ dd
50
+ - location, function = @deprecation[:app_traceline].split(':in `', 2)
51
+ code.code_location>= location
52
+ i= function.delete_suffix("'")
53
+
54
+ - if @deprecation[:gem_traceline]
55
+ dt Gem traceline
56
+ dd
57
+ - location, function = @deprecation[:gem_traceline].split(':in `', 2)
58
+ - full_gemname = location.delete_prefix('/gems/').gsub(%r{/.*}, '')
59
+ - location_in_gem = location.delete_prefix("/gems/#{full_gemname}/")
60
+ i>= full_gemname
61
+ code.code_location> data-copy-value=location_in_gem = location_in_gem.delete_prefix('lib/')
62
+ i= function.delete_suffix("'")
63
+
64
+ - if @deprecation[:full_backtrace]
65
+ dt Backtrace
66
+ dd
67
+ - @deprecation[:full_backtrace].each do |trace_line|
68
+ .trace-line
69
+ - location, function = trace_line.split(':in `', 2)
70
+ code.code_location>= location
71
+ i= function.delete_suffix("'")
72
+
73
+ - fields_to_reject = %i[message first_timestamp count realm app_traceline gem_traceline full_backtrace ruby_version rails_version context revision hostname digest_base digest].to_set
74
+ - additional_data = @deprecation.reject { |key,_val| fields_to_reject.include?(key) }
75
+ - if additional_data.size > 0
76
+ dt
77
+ ' Additional data
78
+ .card.p-3
79
+ pre
80
+ code = JSON.pretty_generate additional_data
81
+ a href=deprecation_path(params[:id], format: 'json') Raw json
@@ -1,4 +1,4 @@
1
- _buf = ''; _buf << ("<header class=\"mb-3\"><h1>Deprecation</h1><a class=\"btn btn-secondary\"".freeze);
1
+ _buf = ''.dup; _buf << ("<header class=\"mb-3\"><h1>Deprecation</h1><a class=\"btn btn-secondary\"".freeze);
2
2
  ;
3
3
  ;
4
4
  ; _slim_codeattributes1 = deprecations_path; if _slim_codeattributes1; if _slim_codeattributes1 == true; _buf << (" href=\"\"".freeze); else; _buf << (" href=\"".freeze); _buf << ((::Temple::Utils.escape_html((_slim_codeattributes1))).to_s); _buf << ("\"".freeze); end; end; _buf << (">Back</a> <a class=\"btn btn-danger\" data-confirm=\"Delete?\" data-method=\"delete\"".freeze);
@@ -16,7 +16,7 @@ _buf = ''; _buf << ("<header class=\"mb-3\"><h1>Deprecation</h1><a class=\"btn b
16
16
  ;
17
17
  ; _buf << ((::Temple::Utils.escape_html((@deprecation[:first_timestamp]&.yield_self { |time| Time.at(time) }))).to_s);
18
18
  ;
19
- ; _buf << ("</dd>".freeze); if @deprecation[:count] > 1;
19
+ ; _buf << ("</dd>".freeze); if @deprecation[:count]&.>(1);
20
20
  ; _buf << ("<dt>Count</dt><dd>".freeze);
21
21
  ; _buf << ((::Temple::Utils.escape_html((@deprecation[:count]))).to_s);
22
22
  ;
@@ -84,10 +84,17 @@ class DeprecationCollector
84
84
 
85
85
  def redis=(val)
86
86
  raise ArgumentError, "redis should not be nil" unless val
87
+
87
88
  self.storage = DeprecationCollector::Storage::Redis unless storage.respond_to?(:redis=)
88
89
  storage.redis = val
89
90
  end
90
91
 
92
+ def model=(val)
93
+ require "deprecation_collector/storage/active_record" unless defined?(DeprecationCollector::Storage::ActiveRecord)
94
+ self.storage = DeprecationCollector::Storage::ActiveRecord
95
+ storage.model = val
96
+ end
97
+
91
98
  def count=(val)
92
99
  storage.count = val if storage.respond_to?(:count=)
93
100
  @count = val
@@ -113,7 +120,10 @@ class DeprecationCollector
113
120
  end
114
121
 
115
122
  def storage=(val)
116
- return @storage = val unless val.is_a?(Class)
123
+ unless val.is_a?(Class)
124
+ @storage = val
125
+ return
126
+ end
117
127
 
118
128
  @storage = val.new(mutex: @instance_mutex, count: count,
119
129
  write_interval: write_interval, write_interval_jitter: write_interval_jitter,
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.1
4
+ version: 0.6.0
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-14 00:00:00.000000000 Z
11
+ date: 2023-09-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: redis
@@ -60,36 +60,28 @@ executables: []
60
60
  extensions: []
61
61
  extra_rdoc_files: []
62
62
  files:
63
- - ".rspec"
64
- - ".rubocop.yml"
65
- - Appraisals
66
63
  - CHANGELOG.md
67
- - Gemfile
68
- - Gemfile.lock
69
- - LICENSE
70
64
  - LICENSE.txt
71
65
  - README.md
72
- - Rakefile
73
66
  - deprecation_collector.gemspec
74
- - gemfiles/rails_6.gemfile
75
- - gemfiles/rails_6.gemfile.lock
76
- - gemfiles/rails_7.gemfile
77
- - gemfiles/rails_7.gemfile.lock
78
- - gemfiles/rails_none.gemfile
79
- - gemfiles/rails_none.gemfile.lock
80
67
  - lib/deprecation_collector.rb
81
68
  - lib/deprecation_collector/collectors.rb
82
69
  - lib/deprecation_collector/deprecation.rb
83
70
  - lib/deprecation_collector/storage.rb
71
+ - lib/deprecation_collector/storage/active_record.rb
84
72
  - lib/deprecation_collector/version.rb
85
73
  - lib/deprecation_collector/web.rb
86
74
  - lib/deprecation_collector/web/application.rb
87
75
  - lib/deprecation_collector/web/helpers.rb
88
76
  - lib/deprecation_collector/web/router.rb
89
77
  - lib/deprecation_collector/web/utils.rb
78
+ - lib/deprecation_collector/web/views/import.html.slim
90
79
  - lib/deprecation_collector/web/views/import.html.template.rb
80
+ - lib/deprecation_collector/web/views/index.html.slim
91
81
  - lib/deprecation_collector/web/views/index.html.template.rb
82
+ - lib/deprecation_collector/web/views/layout.html.slim
92
83
  - lib/deprecation_collector/web/views/layout.html.template.rb
84
+ - lib/deprecation_collector/web/views/show.html.slim
93
85
  - lib/deprecation_collector/web/views/show.html.template.rb
94
86
  - sig/deprecation_collector.rbs
95
87
  homepage: https://github.com/Vasfed/deprecation_collector
data/.rspec DELETED
@@ -1,3 +0,0 @@
1
- --format documentation
2
- --color
3
- --require spec_helper
data/.rubocop.yml DELETED
@@ -1,34 +0,0 @@
1
- require:
2
- - rubocop-rspec
3
- - rubocop-rake
4
- - rubocop-performance
5
-
6
- AllCops:
7
- # note additional conf in spec/
8
- TargetRubyVersion: 2.5
9
- NewCops: enable
10
- SuggestExtensions: false
11
- Exclude:
12
- - gemfiles/*
13
- - lib/deprecation_collector/web/views/*.template.rb
14
-
15
- Style/StringLiterals:
16
- Enabled: true
17
- EnforcedStyle: double_quotes
18
-
19
- Style/StringLiteralsInInterpolation:
20
- Enabled: true
21
- EnforcedStyle: double_quotes
22
-
23
- Layout/LineLength:
24
- Max: 120
25
-
26
- Metrics/ClassLength: { Max: 230 }
27
- Metrics/MethodLength: { Max: 15 }
28
- Metrics/AbcSize: { Max: 23 }
29
- Metrics/CyclomaticComplexity: { Max: 9 }
30
- Metrics/PerceivedComplexity: { Max: 9 }
31
-
32
- RSpec/ExampleLength: { Enabled: false }
33
- RSpec/MultipleExpectations: { Enabled: false }
34
- RSpec/MessageSpies: { Enabled: false }
data/Appraisals DELETED
@@ -1,13 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- appraise "rails_none" do
4
- # none here
5
- end
6
-
7
- appraise "rails_6" do
8
- gem "rails", "~>6.0"
9
- end
10
-
11
- appraise "rails_7" do
12
- gem "rails", "~>7.0"
13
- end
data/Gemfile DELETED
@@ -1,33 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- source "https://rubygems.org"
4
-
5
- # Specify your gem's dependencies in deprecation_collector.gemspec
6
- gemspec
7
-
8
- gem "rake", "~> 13.0"
9
-
10
- gem "rspec", "~> 3.0"
11
- gem "timecop"
12
-
13
- unless defined?(Appraisal)
14
- group :lint do
15
- gem "rubocop", "~> 1.21"
16
- gem "rubocop-performance"
17
- gem "rubocop-rails"
18
- gem "rubocop-rake"
19
- gem "rubocop-rspec"
20
- end
21
-
22
- gem "rails", "~>6.0.0"
23
- gem "simplecov"
24
- end
25
-
26
- gem "fakeredis"
27
- gem "redis", "~>4.8"
28
-
29
- # for web tests
30
- gem "rack"
31
- gem "webrick"
32
-
33
- gem "slim" # not used in production, for compiling templates
data/Gemfile.lock DELETED
@@ -1,249 +0,0 @@
1
- PATH
2
- remote: .
3
- specs:
4
- deprecation_collector (0.5.1)
5
- redis (>= 3.0)
6
-
7
- GEM
8
- remote: https://rubygems.org/
9
- specs:
10
- actioncable (6.0.6)
11
- actionpack (= 6.0.6)
12
- nio4r (~> 2.0)
13
- websocket-driver (>= 0.6.1)
14
- actionmailbox (6.0.6)
15
- actionpack (= 6.0.6)
16
- activejob (= 6.0.6)
17
- activerecord (= 6.0.6)
18
- activestorage (= 6.0.6)
19
- activesupport (= 6.0.6)
20
- mail (>= 2.7.1)
21
- actionmailer (6.0.6)
22
- actionpack (= 6.0.6)
23
- actionview (= 6.0.6)
24
- activejob (= 6.0.6)
25
- mail (~> 2.5, >= 2.5.4)
26
- rails-dom-testing (~> 2.0)
27
- actionpack (6.0.6)
28
- actionview (= 6.0.6)
29
- activesupport (= 6.0.6)
30
- rack (~> 2.0, >= 2.0.8)
31
- rack-test (>= 0.6.3)
32
- rails-dom-testing (~> 2.0)
33
- rails-html-sanitizer (~> 1.0, >= 1.2.0)
34
- actiontext (6.0.6)
35
- actionpack (= 6.0.6)
36
- activerecord (= 6.0.6)
37
- activestorage (= 6.0.6)
38
- activesupport (= 6.0.6)
39
- nokogiri (>= 1.8.5)
40
- actionview (6.0.6)
41
- activesupport (= 6.0.6)
42
- builder (~> 3.1)
43
- erubi (~> 1.4)
44
- rails-dom-testing (~> 2.0)
45
- rails-html-sanitizer (~> 1.1, >= 1.2.0)
46
- activejob (6.0.6)
47
- activesupport (= 6.0.6)
48
- globalid (>= 0.3.6)
49
- activemodel (6.0.6)
50
- activesupport (= 6.0.6)
51
- activerecord (6.0.6)
52
- activemodel (= 6.0.6)
53
- activesupport (= 6.0.6)
54
- activestorage (6.0.6)
55
- actionpack (= 6.0.6)
56
- activejob (= 6.0.6)
57
- activerecord (= 6.0.6)
58
- marcel (~> 1.0)
59
- activesupport (6.0.6)
60
- concurrent-ruby (~> 1.0, >= 1.0.2)
61
- i18n (>= 0.7, < 2)
62
- minitest (~> 5.1)
63
- tzinfo (~> 1.1)
64
- zeitwerk (~> 2.2, >= 2.2.2)
65
- appraisal (2.4.1)
66
- bundler
67
- rake
68
- thor (>= 0.14.0)
69
- ast (2.4.2)
70
- builder (3.2.4)
71
- concurrent-ruby (1.1.10)
72
- crass (1.0.6)
73
- date (3.3.1)
74
- diff-lcs (1.5.0)
75
- docile (1.4.0)
76
- erubi (1.11.0)
77
- fakeredis (0.8.0)
78
- redis (~> 4.1)
79
- globalid (1.0.0)
80
- activesupport (>= 5.0)
81
- i18n (1.12.0)
82
- concurrent-ruby (~> 1.0)
83
- json (2.6.3)
84
- loofah (2.19.1)
85
- crass (~> 1.0.2)
86
- nokogiri (>= 1.5.9)
87
- mail (2.8.0)
88
- mini_mime (>= 0.1.1)
89
- net-imap
90
- net-pop
91
- net-smtp
92
- marcel (1.0.2)
93
- method_source (1.0.0)
94
- mini_mime (1.1.2)
95
- mini_portile2 (2.8.1)
96
- minitest (5.16.3)
97
- net-imap (0.3.2)
98
- date
99
- net-protocol
100
- net-pop (0.1.2)
101
- net-protocol
102
- net-protocol (0.2.1)
103
- timeout
104
- net-smtp (0.3.3)
105
- net-protocol
106
- nio4r (2.5.8)
107
- nokogiri (1.14.0)
108
- mini_portile2 (~> 2.8.0)
109
- racc (~> 1.4)
110
- nokogiri (1.14.0-arm64-darwin)
111
- racc (~> 1.4)
112
- nokogiri (1.14.0-x86_64-darwin)
113
- racc (~> 1.4)
114
- nokogiri (1.14.0-x86_64-linux)
115
- racc (~> 1.4)
116
- parallel (1.22.1)
117
- parser (3.1.3.0)
118
- ast (~> 2.4.1)
119
- racc (1.6.2)
120
- rack (2.2.7)
121
- rack-test (2.0.2)
122
- rack (>= 1.3)
123
- rails (6.0.6)
124
- actioncable (= 6.0.6)
125
- actionmailbox (= 6.0.6)
126
- actionmailer (= 6.0.6)
127
- actionpack (= 6.0.6)
128
- actiontext (= 6.0.6)
129
- actionview (= 6.0.6)
130
- activejob (= 6.0.6)
131
- activemodel (= 6.0.6)
132
- activerecord (= 6.0.6)
133
- activestorage (= 6.0.6)
134
- activesupport (= 6.0.6)
135
- bundler (>= 1.3.0)
136
- railties (= 6.0.6)
137
- sprockets-rails (>= 2.0.0)
138
- rails-dom-testing (2.0.3)
139
- activesupport (>= 4.2.0)
140
- nokogiri (>= 1.6)
141
- rails-html-sanitizer (1.4.4)
142
- loofah (~> 2.19, >= 2.19.1)
143
- railties (6.0.6)
144
- actionpack (= 6.0.6)
145
- activesupport (= 6.0.6)
146
- method_source
147
- rake (>= 0.8.7)
148
- thor (>= 0.20.3, < 2.0)
149
- rainbow (3.1.1)
150
- rake (13.0.6)
151
- redis (4.8.0)
152
- regexp_parser (2.6.1)
153
- rexml (3.2.5)
154
- rspec (3.12.0)
155
- rspec-core (~> 3.12.0)
156
- rspec-expectations (~> 3.12.0)
157
- rspec-mocks (~> 3.12.0)
158
- rspec-core (3.12.0)
159
- rspec-support (~> 3.12.0)
160
- rspec-expectations (3.12.0)
161
- diff-lcs (>= 1.2.0, < 2.0)
162
- rspec-support (~> 3.12.0)
163
- rspec-mocks (3.12.1)
164
- diff-lcs (>= 1.2.0, < 2.0)
165
- rspec-support (~> 3.12.0)
166
- rspec-support (3.12.0)
167
- rubocop (1.40.0)
168
- json (~> 2.3)
169
- parallel (~> 1.10)
170
- parser (>= 3.1.2.1)
171
- rainbow (>= 2.2.2, < 4.0)
172
- regexp_parser (>= 1.8, < 3.0)
173
- rexml (>= 3.2.5, < 4.0)
174
- rubocop-ast (>= 1.23.0, < 2.0)
175
- ruby-progressbar (~> 1.7)
176
- unicode-display_width (>= 1.4.0, < 3.0)
177
- rubocop-ast (1.24.0)
178
- parser (>= 3.1.1.0)
179
- rubocop-performance (1.15.1)
180
- rubocop (>= 1.7.0, < 2.0)
181
- rubocop-ast (>= 0.4.0)
182
- rubocop-rails (2.17.3)
183
- activesupport (>= 4.2.0)
184
- rack (>= 1.1)
185
- rubocop (>= 1.33.0, < 2.0)
186
- rubocop-rake (0.6.0)
187
- rubocop (~> 1.0)
188
- rubocop-rspec (2.16.0)
189
- rubocop (~> 1.33)
190
- ruby-progressbar (1.11.0)
191
- simplecov (0.22.0)
192
- docile (~> 1.1)
193
- simplecov-html (~> 0.11)
194
- simplecov_json_formatter (~> 0.1)
195
- simplecov-html (0.12.3)
196
- simplecov_json_formatter (0.1.4)
197
- slim (5.1.0)
198
- temple (~> 0.10.0)
199
- tilt (>= 2.0.6, < 2.2)
200
- sprockets (4.1.1)
201
- concurrent-ruby (~> 1.0)
202
- rack (> 1, < 3)
203
- sprockets-rails (3.4.2)
204
- actionpack (>= 5.2)
205
- activesupport (>= 5.2)
206
- sprockets (>= 3.0.0)
207
- temple (0.10.0)
208
- thor (1.2.1)
209
- thread_safe (0.3.6)
210
- tilt (2.1.0)
211
- timecop (0.9.6)
212
- timeout (0.3.1)
213
- tzinfo (1.2.10)
214
- thread_safe (~> 0.1)
215
- unicode-display_width (2.3.0)
216
- webrick (1.8.1)
217
- websocket-driver (0.7.5)
218
- websocket-extensions (>= 0.1.0)
219
- websocket-extensions (0.1.5)
220
- zeitwerk (2.6.6)
221
-
222
- PLATFORMS
223
- arm64-darwin
224
- ruby
225
- x86_64-darwin
226
- x86_64-linux
227
-
228
- DEPENDENCIES
229
- appraisal
230
- deprecation_collector!
231
- fakeredis
232
- rack
233
- rack-test
234
- rails (~> 6.0.0)
235
- rake (~> 13.0)
236
- redis (~> 4.8)
237
- rspec (~> 3.0)
238
- rubocop (~> 1.21)
239
- rubocop-performance
240
- rubocop-rails
241
- rubocop-rake
242
- rubocop-rspec
243
- simplecov
244
- slim
245
- timecop
246
- webrick
247
-
248
- BUNDLED WITH
249
- 2.4.12
data/LICENSE DELETED
@@ -1,21 +0,0 @@
1
- MIT License
2
-
3
- Copyright (c) 2022 Vasily Fedoseyev
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
data/Rakefile DELETED
@@ -1,30 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "bundler/gem_tasks"
4
- require "rspec/core/rake_task"
5
-
6
- RSpec::Core::RakeTask.new(:spec)
7
-
8
- begin
9
- require "rubocop/rake_task"
10
- RuboCop::RakeTask.new
11
- rescue LoadError # rubocop:disable Lint/SuppressedException
12
- end
13
-
14
- task default: %i[spec rubocop]
15
-
16
- desc "Compile slim templates (so that slim is not needed as dependency)"
17
- task :precompile_templates do
18
- require "slim"
19
- # Slim::Template.new { '.lala' }.precompiled_template
20
- Dir["lib/deprecation_collector/web/views/*.slim"].each do |file|
21
- target = file.sub(/\.slim\z/, ".template.rb")
22
- puts "Compiling #{file} -> #{target}"
23
- content = Slim::Template.new(file).precompiled_template # maybe send(:precompiled, []) is more correct
24
-
25
- File.write(target, content)
26
- end
27
- end
28
-
29
- Rake::Task[:spec].enhance [:precompile_templates]
30
- Rake::Task[:build].enhance [:precompile_templates]
@@ -1,15 +0,0 @@
1
- # This file was generated by Appraisal
2
-
3
- source "https://rubygems.org"
4
-
5
- gem "rake", "~> 13.0"
6
- gem "rspec", "~> 3.0"
7
- gem "timecop"
8
- gem "fakeredis"
9
- gem "redis", "~>4.8"
10
- gem "rack"
11
- gem "webrick"
12
- gem "slim"
13
- gem "rails", "~>6.0"
14
-
15
- gemspec path: "../"