deprecation_toolkit 2.0.4 → 2.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -0
- data/Gemfile.lock +2 -2
- data/README.md +25 -0
- data/deprecation_toolkit.gemspec +1 -1
- data/lib/deprecation_toolkit/configuration.rb +9 -0
- data/lib/deprecation_toolkit/read_write_helper.rb +1 -6
- data/lib/deprecation_toolkit/version.rb +1 -1
- data/lib/deprecation_toolkit/warning.rb +2 -1
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4ed492475deec1821f75a8e79aa20ad0415abc84d55a1901e41bc178f8b3e7b5
|
4
|
+
data.tar.gz: 9420f08d816ea5c65331d91aad7cf942dcd3efe06fbf9eb78fd6f74f026528db
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 86fcf411a9243ceb75c551de88194a12606ededb0174ea3a0336fee7093f673702deb76c409e6ad642a02cef169991eb9a0f73a90a84a57448fbfcbb8d4e9583
|
7
|
+
data.tar.gz: bb1b607fd1bf0dba205be60a672ab9c6931c0eb66bc338a5f6b281992f6603e899d954201f04f174e20926b999191eb4663d4cc7a78f7d34ff2499d7e39b3f13
|
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,11 @@
|
|
2
2
|
|
3
3
|
## main (unreleased)
|
4
4
|
|
5
|
+
## 2.1.0 (2024-01-19)
|
6
|
+
|
7
|
+
* [#99](https://github.com/Shopify/deprecation_toolkit/pull/99): Fix `Warning.warn` hook to accept a category.
|
8
|
+
* [#95](https://github.com/Shopify/deprecation_toolkit/pull/95): Allow configuration of deprecation file paths and file names.
|
9
|
+
|
5
10
|
## 2.0.4 (2023-11-20)
|
6
11
|
|
7
12
|
* [#90](https://github.com/Shopify/deprecation_toolkit/pull/90) & [#93](https://github.com/Shopify/deprecation_toolkit/pull/93): Stop using deprecated behavior from Active Support. (@etiennebarrie)
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -117,6 +117,31 @@ This setting accepts an array of regular expressions. To match on all warnings,
|
|
117
117
|
DeprecationToolkit::Configuration.warnings_treated_as_deprecation = [//]
|
118
118
|
```
|
119
119
|
|
120
|
+
### 🔨 `#DeprecationToolkit::Configuration#deprecation_file_path_format`
|
121
|
+
|
122
|
+
DeprecationToolkit allows you to choose the file path format for deprecation files.
|
123
|
+
|
124
|
+
For Minitest, it defaults to using class name so the following code would correspond to `#{deprecation_path}/deprecation_toolkit/behaviors/raise_test.yml`
|
125
|
+
|
126
|
+
```ruby
|
127
|
+
module DeprecationToolkit
|
128
|
+
module Behaviors
|
129
|
+
class RaiseTest < ActiveSupport::TestCase
|
130
|
+
end
|
131
|
+
end
|
132
|
+
end
|
133
|
+
```
|
134
|
+
|
135
|
+
For rspec if defaults to the file location with spec removed. `/spec/models/user_spec.rb` would correspond to `/models/user.yml`.
|
136
|
+
|
137
|
+
If you have a specific use case you can configure this with a custom format using a proc. The proc is called with an instance of the test.
|
138
|
+
|
139
|
+
```ruby
|
140
|
+
Configuration.deprecation_file_path_format = -> (test) do
|
141
|
+
Kernel.const_source_location(test.class.name)[0].sub(%r{^./test/}, "").sub(/_test.rb$/, "")
|
142
|
+
end
|
143
|
+
```
|
144
|
+
|
120
145
|
## RSpec
|
121
146
|
|
122
147
|
By default Deprecation Toolkit uses Minitest as its test runner. To use Deprecation Toolkit with RSpec you'll have to configure it.
|
data/deprecation_toolkit.gemspec
CHANGED
@@ -12,5 +12,14 @@ module DeprecationToolkit
|
|
12
12
|
config_accessor(:deprecation_path) { "test/deprecations" }
|
13
13
|
config_accessor(:test_runner) { :minitest }
|
14
14
|
config_accessor(:warnings_treated_as_deprecation) { [] }
|
15
|
+
config_accessor(:deprecation_file_path_format) do
|
16
|
+
proc do |test|
|
17
|
+
if DeprecationToolkit::Configuration.test_runner == :rspec
|
18
|
+
test.example_group.file_path.sub(%r{^./spec/}, "").sub(/_spec.rb$/, "")
|
19
|
+
else
|
20
|
+
test.class.name.underscore
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
15
24
|
end
|
16
25
|
end
|
@@ -48,12 +48,7 @@ module DeprecationToolkit
|
|
48
48
|
Configuration.deprecation_path
|
49
49
|
end
|
50
50
|
|
51
|
-
path =
|
52
|
-
if DeprecationToolkit::Configuration.test_runner == :rspec
|
53
|
-
test.example_group.file_path.sub(%r{^./spec/}, "").sub(/_spec.rb$/, "")
|
54
|
-
else
|
55
|
-
test.class.name.underscore
|
56
|
-
end
|
51
|
+
path = Configuration.deprecation_file_path_format.call(test)
|
57
52
|
|
58
53
|
Pathname(deprecation_folder).join("#{path}.yml")
|
59
54
|
end
|
@@ -52,7 +52,7 @@ end
|
|
52
52
|
|
53
53
|
module DeprecationToolkit
|
54
54
|
module WarningPatch
|
55
|
-
def warn(str)
|
55
|
+
def warn(str, *)
|
56
56
|
str = DeprecationToolkit::Warning.handle_multipart(str)
|
57
57
|
return unless str
|
58
58
|
|
@@ -62,6 +62,7 @@ module DeprecationToolkit
|
|
62
62
|
super
|
63
63
|
end
|
64
64
|
end
|
65
|
+
ruby2_keywords :warn
|
65
66
|
end
|
66
67
|
end
|
67
68
|
Warning.singleton_class.prepend(DeprecationToolkit::WarningPatch)
|
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
|
4
|
+
version: 2.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Shopify
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-01-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '7.0'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
26
|
+
version: '7.0'
|
27
27
|
description:
|
28
28
|
email:
|
29
29
|
- rails@shopify.com
|
@@ -83,7 +83,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
83
83
|
- !ruby/object:Gem::Version
|
84
84
|
version: '0'
|
85
85
|
requirements: []
|
86
|
-
rubygems_version: 3.4
|
86
|
+
rubygems_version: 3.5.4
|
87
87
|
signing_key:
|
88
88
|
specification_version: 4
|
89
89
|
summary: Deprecation Toolkit around ActiveSupport::Deprecation
|