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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6872c1981b26d42c76dc4193a91b40aa05c931f4ee24762db71b17b2ab37d121
4
- data.tar.gz: 96e8425050bd7f65621bb3b3353dc5faa8f543369c863d1b6ed593c55313263d
3
+ metadata.gz: 8a4f4e86cc2ed9ea76486127249b9ada54cd1c1499a15e7683bbdc1d996e10c7
4
+ data.tar.gz: f9306506d77f24352cf2046a428d15062e3de15028f3fc00b8d0c40dd444b5e7
5
5
  SHA512:
6
- metadata.gz: dbcb404cc15715242373e8cf6ac4f973cfdaede0ca3ec6a8dc4379515a153e79aea612335d1b2ad87c7773e732cb79b816a5d9641dbf2e3ea63bd023323f7632
7
- data.tar.gz: dbefa67a93ebdec9f702ba28bc3b303550c61df3f34dd1bc1d07a8a6bd13e4e5a9ac4c6efe23bd68690153b3ea4a03c028300928368bda246bccfabb9080fb71
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
- arguments_record.reload
14
- arguments_record.update(occurrences: arguments_record.occurrences + 1)
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
- backtrace_record.reload
12
- backtrace_record.update(occurrences: backtrace_record.occurrences + 1)
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
@@ -5,7 +5,7 @@ module CruftTracker
5
5
  record :method, class: CruftTracker::Method
6
6
 
7
7
  def execute
8
- increment_invocations
8
+ CruftTracker::LogSuppressor.suppress_logging { increment_invocations }
9
9
  end
10
10
 
11
11
  def increment_invocations
@@ -13,10 +13,14 @@ module CruftTracker
13
13
  object :arguments_transformer, class: Proc, default: nil
14
14
 
15
15
  def execute
16
- method_record = create_or_find_method_record
17
- method_record.deleted_at = nil
18
- method_record.comment = comment if comment != method_record.comment
19
- method_record.save
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
@@ -1,3 +1,3 @@
1
1
  module CruftTracker
2
- VERSION = '0.1.0'
2
+ VERSION = '0.1.1'
3
3
  end
data/lib/cruft_tracker.rb CHANGED
@@ -1,6 +1,7 @@
1
1
  require 'cruft_tracker/version'
2
2
  require 'cruft_tracker/engine'
3
3
  require 'cruft_tracker/registry'
4
+ require 'cruft_tracker/log_suppressor'
4
5
 
5
6
  module CruftTracker
6
7
  # Your code goes here...
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.0
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