-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Subscribe to rails deprecations (#242)
Subscribe to rails deprecations so DepShield is informed whenever the notification behavior is set to `:notify`.
- Loading branch information
Showing
11 changed files
with
74 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,17 @@ | ||
## [Unreleased] | ||
|
||
## [0.3.0] | ||
|
||
- Subscribe to deprecation.rails notifications from railtie | ||
|
||
## [0.2.0] | ||
|
||
- Dynamically load todo lists | ||
|
||
## [0.1.1] | ||
|
||
- Fixes / navigates around different returns for YAML.load_file | ||
|
||
## [0.1.0] - 2024-01-17 | ||
|
||
- Initial release |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# frozen_string_literal: true | ||
|
||
require "dep_shield" | ||
|
||
module DepShield | ||
# Ties DepShield to rails deprecations system | ||
class Railtie < Rails::Railtie | ||
initializer "dep_shield.subscribe" do | ||
ActiveSupport::Notifications.subscribe("deprecation.rails") do |name, _start, _finish, _id, payload| | ||
message = payload[:message] || "this is deprecated in rails" | ||
callstack = payload[:callstack] || caller | ||
|
||
DepShield.raise_or_capture!(name: name, message: message, callstack: callstack) | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
# frozen_string_literal: true | ||
|
||
module DepShield | ||
VERSION = "0.2.1" | ||
VERSION = "0.3.0" | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# frozen_string_literal: true | ||
|
||
require "spec_helper" | ||
|
||
RSpec.describe DepShield::Deprecation do | ||
it "subscribes to deprecation.rails" do | ||
expect(DepShield).to( | ||
receive(:raise_or_capture!) | ||
.with(name: "deprecation.rails", message: "This has been so deprecated", callstack: ["file1.rb", "file2.rb"]) | ||
) | ||
|
||
ActiveSupport::Notifications.instrument( | ||
"deprecation.rails", | ||
message: "This has been so deprecated", | ||
callstack: ["file1.rb", "file2.rb"] | ||
) | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters