deprecation_toolkit 2.0.0 → 2.0.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: 50f90bbfa1a09a7e1f2cbd9dad67e90d50a3d43e71e57d713f4ed37824bf288f
4
- data.tar.gz: a8e704fd3454e2f0b7753cc6ed677ebfc7f07298362cd06166f53d5d8a01b67b
3
+ metadata.gz: c2d0b00fe8e8b87b77af20209fac4531b7d2faebdecc55a8cdbd1b490cd65089
4
+ data.tar.gz: 4ed23c378e87023b0303839edaaa99265929c2b4eb5e7c1b56156992c24ba8e7
5
5
  SHA512:
6
- metadata.gz: aa06c177df6e63bf8a2ba11d734b837481bc1d5ada8d1fbbf8187e5d6424797aa605b70be127c48642ff3a0e66188fff8cbded056167ef045811a74e8a73eb41
7
- data.tar.gz: 52a7bccd13c97db713aa708e226e817cd0fac52550ded6ef0890ca1b8d6da4a18291787f552f1c11358c5a52d25a8d54a2dfbb1c1efc05bcc99cc559ed8ee7c4
6
+ metadata.gz: 947cd740128e855612cc94917760cf00160adeda014fb4727153a811ea3e2b4cec4e563c61c02729c4eabdebdbf28307787f727feefa4a76e273c4b534c0fc40
7
+ data.tar.gz: e46958cb158e2ede1139cabb445462349ceb8bc4de06b4084d6af1f086aacba390e86c9cba7c07a23d074d899cd669ef775c790263632be66b88990164404cd2
@@ -3,7 +3,7 @@ name: CI
3
3
  on: [push, pull_request]
4
4
 
5
5
  jobs:
6
- build:
6
+ functionality:
7
7
  runs-on: ubuntu-latest
8
8
  name: Ruby ${{ matrix.ruby }} / ${{ matrix.gemfile }}
9
9
  strategy:
@@ -29,11 +29,22 @@ jobs:
29
29
  ruby-version: ${{ matrix.ruby }}
30
30
  bundler-cache: true
31
31
 
32
- - name: RuboCop
33
- run: bundle exec rubocop
34
-
35
32
  - name: Tests
36
33
  run: bundle exec rake test
37
34
 
38
35
  - name: Specs
39
36
  run: bundle exec rspec
37
+ style:
38
+ runs-on: ubuntu-latest
39
+ name: Rubocop
40
+ steps:
41
+ - name: Check out code
42
+ uses: actions/checkout@v3
43
+
44
+ - uses: ruby/setup-ruby@v1
45
+ with:
46
+ ruby-version: "3.1"
47
+ bundler-cache: true
48
+
49
+ - name: RuboCop
50
+ run: bundle exec rubocop
@@ -0,0 +1,26 @@
1
+ name: Contributor License Agreement (CLA)
2
+
3
+ on:
4
+ pull_request_target:
5
+ types: [opened, synchronize]
6
+ issue_comment:
7
+ types: [created]
8
+
9
+ permissions:
10
+ pull-requests: write # to set the label
11
+ actions: write # to re-run the workflow when a comment is received
12
+
13
+ jobs:
14
+ cla:
15
+ runs-on: ubuntu-latest
16
+ if: |
17
+ (github.event.issue.pull_request
18
+ && !github.event.issue.pull_request.merged_at
19
+ && contains(github.event.comment.body, 'signed')
20
+ )
21
+ || (github.event.pull_request && !github.event.pull_request.merged)
22
+ steps:
23
+ - uses: Shopify/shopify-cla-action@v1
24
+ with:
25
+ github-token: ${{ secrets.GITHUB_TOKEN }}
26
+ cla-token: ${{ secrets.CLA_TOKEN }}
data/CHANGELOG.md CHANGED
@@ -2,6 +2,10 @@
2
2
 
3
3
  ## main (unreleased)
4
4
 
5
+ ## 2.0.1 (2022-11-18)
6
+
7
+ * [#74](https://github.com/Shopify/deprecation_toolkit/pull/74): Add support for `Rails.application.deprecators`. (@gmcgibbon)
8
+
5
9
  ## 2.0.0 (2022-03-16)
6
10
 
7
11
  * [#58](https://github.com/Shopify/deprecation_toolkit/pull/58): Drop support for Ruby < 2.6 & Active Support < 5.2. (@sambostock)
data/Gemfile.lock CHANGED
@@ -1,21 +1,21 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- deprecation_toolkit (2.0.0)
4
+ deprecation_toolkit (2.0.1)
5
5
  activesupport (>= 5.2)
6
6
 
7
7
  GEM
8
8
  remote: https://rubygems.org/
9
9
  specs:
10
- activesupport (7.0.2.3)
10
+ activesupport (7.0.4)
11
11
  concurrent-ruby (~> 1.0, >= 1.0.2)
12
12
  i18n (>= 1.6, < 2)
13
13
  minitest (>= 5.1)
14
14
  tzinfo (~> 2.0)
15
15
  ast (2.4.2)
16
- concurrent-ruby (1.1.9)
16
+ concurrent-ruby (1.1.10)
17
17
  diff-lcs (1.5.0)
18
- i18n (1.10.0)
18
+ i18n (1.12.0)
19
19
  concurrent-ruby (~> 1.0)
20
20
  minitest (5.15.0)
21
21
  parallel (1.21.0)
@@ -52,7 +52,7 @@ GEM
52
52
  rubocop-shopify (2.5.0)
53
53
  rubocop (~> 1.25)
54
54
  ruby-progressbar (1.11.0)
55
- tzinfo (2.0.4)
55
+ tzinfo (2.0.5)
56
56
  concurrent-ruby (~> 1.0)
57
57
  unicode-display_width (2.1.0)
58
58
 
data/README.md CHANGED
@@ -6,10 +6,9 @@ Deprecation Toolkit is a gem that helps you get rid of deprecations in your code
6
6
  Having deprecations in your application usually means that something will break whenever you upgrade third-party dependencies. The sooner the better to fix them!
7
7
  Fixing all deprecations at once might be tough depending on the size of your app and the number of deprecations. You might have to progressively resolve them while making sure your team doesn't add new ones. This is where this gem comes handy!
8
8
 
9
-
10
9
  ## How it works
11
10
 
12
- The Deprecation Toolkit gem works by using a [shitlist approach](https://confreaks.tv/videos/reddotrubyconf2017-shitlist-driven-development-and-other-tricks-for-working-on-large-codebases).
11
+ The Deprecation Toolkit gem works by using a [shitlist approach](https://www.youtube.com/watch?v=20pj_ajDBOg).
13
12
  First, the gem records all existing deprecations into `.yml` files. When running a test that have non-recorded deprecations after the initial recording, Deprecation Toolkit triggers a behavior of your choice (by default it raises an error).
14
13
 
15
14
  ## Recording Deprecations
@@ -44,15 +43,13 @@ end
44
43
 
45
44
  Behaviors define what happens when non-recorded deprecations are encountered.
46
45
 
47
- Behaviors are classes that have a `.trigger` class method.
48
-
49
- This gem provides 3 behaviors, the default one being `DeprecationToolkit::Behaviors::Raise`.
46
+ This gem provides 4 behaviors, the default one being `DeprecationToolkit::Behaviors::Raise`.
50
47
 
51
48
  * `DeprecationToolkit::Behaviors::Raise` will raise either:
52
- - `DeprecationToolkit::DeprecationIntroduced` error if a new deprecation is introduced.
53
- - `DeprecationToolkit::DeprecationRemoved` error if a deprecation was removed (compare to the one recorded in the shitlist).
49
+ - `DeprecationToolkit::Behaviors::DeprecationIntroduced` error if a new deprecation is introduced.
50
+ - `DeprecationToolkit::Behaviors::DeprecationRemoved` error if a deprecation was removed (compare to the one recorded in the shitlist).
54
51
  * `DeprecationToolkit::Behaviors::Record` will record deprecations.
55
- * `DeprecationToolkit::Behaviors::CIRecordHelper` See separated explanation below.
52
+ * `DeprecationToolkit::Behaviors::CIRecordHelper` See separate explanation below.
56
53
  * `DeprecationToolkit::Behaviors::Disabled` will do nothing.
57
54
  - This is useful if you want to disable this gem for a moment without removing the gem from your Gemfile.
58
55
 
@@ -72,7 +69,7 @@ end
72
69
  DeprecationToolkit::Configuration.behavior = StatsdBehavior
73
70
  ```
74
71
 
75
- ##### DeprecationToolkit::Behaviors::CIRecordHelper
72
+ #### DeprecationToolkit::Behaviors::CIRecordHelper
76
73
 
77
74
  This is a special type of behaviour meant to help you record deprecations if you have a lof of them.
78
75
  Imagine if you have thousands of tests and need to record deprecations for each on your machine, this is going to take ages.
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module DeprecationToolkit
4
- VERSION = "2.0.0"
4
+ VERSION = "2.0.1"
5
5
  end
@@ -18,20 +18,35 @@ module DeprecationToolkit
18
18
  autoload :CIRecordHelper, "deprecation_toolkit/behaviors/ci_record_helper"
19
19
  end
20
20
 
21
- def self.add_notify_behavior
22
- notify = ActiveSupport::Deprecation::DEFAULT_BEHAVIORS[:notify]
23
- behaviors = ActiveSupport::Deprecation.behavior
21
+ class << self
22
+ def add_notify_behavior
23
+ notify = ActiveSupport::Deprecation::DEFAULT_BEHAVIORS[:notify]
24
24
 
25
- unless behaviors.find { |behavior| behavior == notify }
26
- ActiveSupport::Deprecation.behavior = behaviors << notify
25
+ each_deprecator do |deprecator|
26
+ behaviors = deprecator.behavior
27
+
28
+ unless behaviors.find { |behavior| behavior == notify }
29
+ deprecator.behavior = (behaviors << notify)
30
+ end
31
+ end
32
+ end
33
+
34
+ def attach_subscriber
35
+ return if DeprecationSubscriber.already_attached?
36
+
37
+ Configuration.attach_to.each do |gem_name|
38
+ DeprecationSubscriber.attach_to(gem_name)
39
+ end
27
40
  end
28
- end
29
41
 
30
- def self.attach_subscriber
31
- return if DeprecationSubscriber.already_attached?
42
+ private
32
43
 
33
- Configuration.attach_to.each do |gem_name|
34
- DeprecationSubscriber.attach_to(gem_name)
44
+ def each_deprecator(&block)
45
+ if defined?(Rails.application) && Rails.application.respond_to?(:deprecators)
46
+ Rails.application.deprecators.each(&block)
47
+ else
48
+ block.call(ActiveSupport::Deprecation)
49
+ end
35
50
  end
36
51
  end
37
52
  end
@@ -13,6 +13,7 @@ module Minitest
13
13
  return unless using_bundler?
14
14
 
15
15
  require "deprecation_toolkit"
16
+
16
17
  if options[:record_deprecations]
17
18
  DeprecationToolkit::Configuration.behavior = DeprecationToolkit::Behaviors::Record
18
19
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: deprecation_toolkit
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0
4
+ version: 2.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Shopify
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-03-16 00:00:00.000000000 Z
11
+ date: 2022-11-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -32,6 +32,7 @@ extensions: []
32
32
  extra_rdoc_files: []
33
33
  files:
34
34
  - ".github/workflows/ci.yml"
35
+ - ".github/workflows/cla.yml"
35
36
  - ".gitignore"
36
37
  - ".rspec"
37
38
  - ".rubocop.yml"
@@ -98,7 +99,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
98
99
  - !ruby/object:Gem::Version
99
100
  version: '0'
100
101
  requirements: []
101
- rubygems_version: 3.2.20
102
+ rubygems_version: 3.3.3
102
103
  signing_key:
103
104
  specification_version: 4
104
105
  summary: Deprecation Toolkit around ActiveSupport::Deprecation