dep_shield 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/docs/README.md +23 -1
- data/lib/dep_shield/todos.rb +3 -1
- data/lib/dep_shield/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d34f09cc5662781f4ac4e0c8cc133c5450ebddfb11dea43e3c1960a6ef004a5b
|
4
|
+
data.tar.gz: fc0ea1a708e700bab073a51b7efbe34eae7390800e1a83031028cd451d307c07
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 89081dbd1e13a1cf0594a12816661da7c741bc68e3e025494bb6a9357225147211fa2917c6d34cb0ebb76330bd6734496ed5b20a1b3a02025358f8e30babc2e6
|
7
|
+
data.tar.gz: 7db0507ed633afa7e009ffeec4ab8b2db6f26987c6b2aae5043f2539cfba6ce9561a8207a0f05a0950cc7f4d47584d7a973dd3c45e7aefe062f3689319fd05e7
|
data/docs/README.md
CHANGED
@@ -6,4 +6,26 @@ With DepShield, developers can stay ahead of the curve by receiving real-time al
|
|
6
6
|
|
7
7
|
## Usage
|
8
8
|
|
9
|
-
|
9
|
+
`DepShield#raise_or_capture!` is used to mark methods as deprecated. When called, it will intelligently warn or raise exceptions to alert developers to the deprecated activity. The method expects two arguments, a `name` (ie, the name of the deprecation you're introducing), and a `message` (usually information about what is deprecated and how to fix it). Marking something as deprecated is pretty simple:
|
10
|
+
|
11
|
+
```ruby
|
12
|
+
# components/books/lib/books.rb
|
13
|
+
|
14
|
+
def self.category
|
15
|
+
NitroErrors.deprecate!(name: "books_default_category", message: "please use '.default_category' instead")
|
16
|
+
"Science Fiction"
|
17
|
+
end
|
18
|
+
```
|
19
|
+
|
20
|
+
This is used in conjuction with NitroConfig to define how different environment should react:
|
21
|
+
|
22
|
+
Option A: the result of this is a logged warning every time the method is called.
|
23
|
+
Option B: this will raise and notify our error catcher (Sentry).
|
24
|
+
|
25
|
+
If a developer needs to bypass this/defer fixing the deprecation to a future date, the call can be "grandfathered" by adding this information to the allowlist in `.deprecation_todo.yml` in the application/component that hosts the deprecated reference. For example, if you have a method in the `authors` component that references `Books.category`:
|
26
|
+
|
27
|
+
```ruby
|
28
|
+
# components/authors/lib/book_information.rb
|
29
|
+
|
30
|
+
book_category = Books.category
|
31
|
+
```
|
data/lib/dep_shield/todos.rb
CHANGED
@@ -7,7 +7,9 @@ module DepShield
|
|
7
7
|
paths = Rails.root.glob("**/.deprecation_todo.yml")
|
8
8
|
|
9
9
|
paths.each_with_object({}) do |path, list|
|
10
|
-
YAML.load_file(path)
|
10
|
+
todos = YAML.load_file(path) || {}
|
11
|
+
|
12
|
+
todos.each do |feature_name, dep_todos|
|
11
13
|
list[feature_name] ||= []
|
12
14
|
list[feature_name] += dep_todos
|
13
15
|
end
|
data/lib/dep_shield/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dep_shield
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jill Klang
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-01-
|
11
|
+
date: 2024-01-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: appraisal
|