Skip to content

Commit 9060dd0

Browse files
authored
Merge pull request #2617 from ruby-grape/migrate-to-dry-configurable
Migrate from ActiveSupport::Configurable to Dry::Configurable
2 parents c80b016 + 9a8a4c6 commit 9060dd0

File tree

4 files changed

+15
-10
lines changed

4 files changed

+15
-10
lines changed

CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,9 @@
2121
* [#2605](https://github.com/ruby-grape/grape/pull/2605): Add Rack 3.2 support with new gemfile and CI integration - [@ericproulx](https://github.com/ericproulx).
2222
* [#2607](https://github.com/ruby-grape/grape/pull/2607): Remove namespace_stackable and namespace_inheritable from public API - [@ericproulx](https://github.com/ericproulx).
2323
* [#2615](https://github.com/ruby-grape/grape/pull/2615): Remove manual toc and tod danger check - [@alexanderadam](https://github.com/alexanderadam).
24-
* Your contribution here.
2524
* [#2612](https://github.com/ruby-grape/grape/pull/2612): Avoid multiple mount pollution - [@alexanderadam](https://github.com/alexanderadam).
25+
* [#2617](https://github.com/ruby-grape/grape/pull/2617): Migrate from `ActiveSupport::Configurable` to `Dry::Configurable` - [@ericproulx](https://github.com/ericproulx).
26+
* Your contribution here.
2627

2728
#### Fixes
2829

UPGRADING.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,13 @@ Upgrading Grape
33

44
### Upgrading to >= 3.0.0
55

6-
### Endpoint execution simplified and `return` deprecated
6+
#### Configuration API Migration from ActiveSupport::Configurable to Dry::Configurable
7+
8+
Grape has migrated from `ActiveSupport::Configurable` to `Dry::Configurable` for its configuration system since its [deprecated](https://github.com/rails/rails/blob/1cdd190a25e483b65f1f25bbd0f13a25d696b461/activesupport/lib/active_support/configurable.rb#L3-L7).
9+
10+
See [#2617](https://github.com/ruby-grape/grape/pull/2617) for more information.
11+
12+
#### Endpoint execution simplified and `return` deprecated
713

814
Executing a endpoint's block has been simplified and calling `return` in it has been deprecated.
915

grape.gemspec

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ Gem::Specification.new do |s|
2222
}
2323

2424
s.add_dependency 'activesupport', '>= 7.0'
25+
s.add_dependency 'dry-configurable'
2526
s.add_dependency 'dry-types', '>= 1.1'
2627
s.add_dependency 'mustermann-grape', '~> 1.1.0'
2728
s.add_dependency 'rack', '>= 2'

lib/grape.rb

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
require 'logger'
44
require 'active_support'
55
require 'active_support/concern'
6-
require 'active_support/configurable'
76
require 'active_support/version'
87
require 'active_support/isolated_execution_state'
98
require 'active_support/core_ext/array/conversions'
@@ -28,6 +27,7 @@
2827
require 'active_support/inflector'
2928
require 'active_support/ordered_options'
3029
require 'active_support/notifications'
30+
require 'dry-configurable'
3131

3232
require 'English'
3333
require 'bigdecimal'
@@ -57,7 +57,10 @@
5757
I18n.load_path << File.expand_path('grape/locale/en.yml', __dir__)
5858

5959
module Grape
60-
include ActiveSupport::Configurable
60+
extend Dry::Configurable
61+
62+
setting :param_builder, default: :hash_with_indifferent_access
63+
setting :lint, default: false
6164

6265
HTTP_SUPPORTED_METHODS = [
6366
Rack::GET,
@@ -72,12 +75,6 @@ module Grape
7275
def self.deprecator
7376
@deprecator ||= ActiveSupport::Deprecation.new('2.0', 'Grape')
7477
end
75-
76-
configure do |config|
77-
config.param_builder = :hash_with_indifferent_access
78-
config.lint = false
79-
config.compile_methods!
80-
end
8178
end
8279

8380
# https://api.rubyonrails.org/classes/ActiveSupport/Deprecation.html

0 commit comments

Comments
 (0)