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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 44d4c2a3a8f3e972cba7b9895821d280f4817fdd8c1d1ff0ce540ea147a07596
4
- data.tar.gz: 59a24ea20b53111e769baac758bac6e55b1c7d322bd6c92515c79a1c96f03c84
3
+ metadata.gz: d34f09cc5662781f4ac4e0c8cc133c5450ebddfb11dea43e3c1960a6ef004a5b
4
+ data.tar.gz: fc0ea1a708e700bab073a51b7efbe34eae7390800e1a83031028cd451d307c07
5
5
  SHA512:
6
- metadata.gz: b5eb9b757f0d55ac8b81f08622e28d066b1766dadb9fc2751160bc6fe5cbb58bb6761aa0cd08bc41b4fbaab6e2ed354ab71a96bdd2db97ef6e4c4a71b56f94d1
7
- data.tar.gz: 2ef7dce440c24ed3d8d9f95c8c3d70ae8ae368c7ee7243c4ddf5a6f5647d7d1a36a3f4ca27ca12cd83090f91b4f02b2fc14100452bafec5935fd3c7c8dd02358
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
- TODO: Write usage instructions here
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
+ ```
@@ -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)&.each do |feature_name, dep_todos|
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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module DepShield
4
- VERSION = "0.1.1"
4
+ VERSION = "0.1.2"
5
5
  end
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.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-25 00:00:00.000000000 Z
11
+ date: 2024-01-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: appraisal