cruft_tracker 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +8 -2
- data/app/services/cruft_tracker/record_arguments.rb +4 -2
- data/app/services/cruft_tracker/record_backtrace.rb +4 -2
- data/app/services/cruft_tracker/record_invocation.rb +1 -1
- data/app/services/cruft_tracker/track_method.rb +8 -4
- data/lib/cruft_tracker/log_suppressor.rb +13 -0
- data/lib/cruft_tracker/version.rb +1 -1
- data/lib/cruft_tracker.rb +1 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8a4f4e86cc2ed9ea76486127249b9ada54cd1c1499a15e7683bbdc1d996e10c7
|
4
|
+
data.tar.gz: f9306506d77f24352cf2046a428d15062e3de15028f3fc00b8d0c40dd444b5e7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2486fbd72ff1efc6621e3197e7c77e8a28f326daddae376a1a6b68eaf144757dcda46bc0b6bd9da6b783844e327b98fec6ca8e4aff491ead2ab83a9519a51560
|
7
|
+
data.tar.gz: ae3bc92c247015e2b896c206bdec8aa1fc508a520c8059659e9ba82703aed0bbad1d31a5fa1f88609b25da45ff44b51aa25a83239b067e0f2c87f45e57772025
|
data/README.md
CHANGED
@@ -8,7 +8,7 @@ software is _complex_ and sometimes it's unclear what's really going on. This ad
|
|
8
8
|
|
9
9
|
This gem aims to give you a couple tools to make it easier to know what (and how) your code is being used (or not).
|
10
10
|
|
11
|
-
CruftTracker supports Rails versions 5.2 to 6.1 at this time. As of now the gem only supports MySQL, but contributions for Postgres other DBMS would be welcome.
|
11
|
+
CruftTracker supports Rails versions 5.2 to 6.1 at this time. As of now the gem only supports MySQL, but contributions for Postgres or other DBMS would be welcome.
|
12
12
|
|
13
13
|
## Installation
|
14
14
|
Add this line to your application's Gemfile:
|
@@ -447,7 +447,13 @@ Be sure the bump the version in `CruftTracker::VERSION` before building the gem
|
|
447
447
|
gem build cruft_tracker.gemspec
|
448
448
|
```
|
449
449
|
|
450
|
-
This will create a new gem file
|
450
|
+
This will create a new gem file with a name like `cruft_tracker-x.y.z.gem` where `x.y.z` is the version number of the gem.
|
451
|
+
|
452
|
+
To publish the new version (specify the correct version number):
|
453
|
+
|
454
|
+
```bash
|
455
|
+
gem push cruft_tracker-x.y.z.gem
|
456
|
+
```
|
451
457
|
|
452
458
|
## Contributing
|
453
459
|
|
@@ -10,8 +10,10 @@ module CruftTracker
|
|
10
10
|
|
11
11
|
def execute
|
12
12
|
arguments_record.with_lock do
|
13
|
-
|
14
|
-
|
13
|
+
CruftTracker::LogSuppressor.suppress_logging do
|
14
|
+
arguments_record.reload
|
15
|
+
arguments_record.update(occurrences: arguments_record.occurrences + 1)
|
16
|
+
end
|
15
17
|
end
|
16
18
|
|
17
19
|
arguments_record
|
@@ -8,8 +8,10 @@ module CruftTracker
|
|
8
8
|
|
9
9
|
def execute
|
10
10
|
backtrace_record.with_lock do
|
11
|
-
|
12
|
-
|
11
|
+
CruftTracker::LogSuppressor.suppress_logging do
|
12
|
+
backtrace_record.reload
|
13
|
+
backtrace_record.update(occurrences: backtrace_record.occurrences + 1)
|
14
|
+
end
|
13
15
|
end
|
14
16
|
|
15
17
|
backtrace_record
|
@@ -13,10 +13,14 @@ module CruftTracker
|
|
13
13
|
object :arguments_transformer, class: Proc, default: nil
|
14
14
|
|
15
15
|
def execute
|
16
|
-
method_record =
|
17
|
-
|
18
|
-
|
19
|
-
|
16
|
+
method_record =
|
17
|
+
CruftTracker::LogSuppressor.suppress_logging do
|
18
|
+
method_record = create_or_find_method_record
|
19
|
+
method_record.deleted_at = nil
|
20
|
+
method_record.comment = comment if comment != method_record.comment
|
21
|
+
method_record.save
|
22
|
+
method_record
|
23
|
+
end
|
20
24
|
|
21
25
|
wrap_target_method(
|
22
26
|
method_type,
|
@@ -0,0 +1,13 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module CruftTracker
|
4
|
+
class LogSuppressor
|
5
|
+
def self.suppress_logging
|
6
|
+
initial_log_level = ActiveRecord::Base.logger.level
|
7
|
+
ActiveRecord::Base.logger.level = :error
|
8
|
+
yield
|
9
|
+
ensure
|
10
|
+
ActiveRecord::Base.logger.level = initial_log_level
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
data/lib/cruft_tracker.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cruft_tracker
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Adwerx Inc.
|
@@ -242,7 +242,7 @@ description: |
|
|
242
242
|
|
243
243
|
This gem aims to give you a couple tools to make it easier to know what (and how) your code is being used (or not).
|
244
244
|
|
245
|
-
CruftTracker supports Rails versions 5.2 to 6.1 at this time. As of now the gem only supports MySQL, but contributions for Postgres other DBMS would be welcome.
|
245
|
+
CruftTracker supports Rails versions 5.2 to 6.1 at this time. As of now the gem only supports MySQL, but contributions for Postgres or other DBMS would be welcome.
|
246
246
|
email:
|
247
247
|
- dev@adwerx.com
|
248
248
|
- dhughes@adwerx.com
|
@@ -278,6 +278,7 @@ files:
|
|
278
278
|
- db/migrate/20220419174055_create_cruft_tracker_arguments.rb
|
279
279
|
- lib/cruft_tracker.rb
|
280
280
|
- lib/cruft_tracker/engine.rb
|
281
|
+
- lib/cruft_tracker/log_suppressor.rb
|
281
282
|
- lib/cruft_tracker/registry.rb
|
282
283
|
- lib/cruft_tracker/version.rb
|
283
284
|
- lib/tasks/cruft_tracker_tasks.rake
|