dry-rails 0.2.0 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +55 -2
- data/LICENSE +1 -1
- data/README.md +4 -4
- data/dry-rails.gemspec +16 -15
- data/lib/dry/rails/boot/application_contract.rb +6 -5
- data/lib/dry/rails/boot/controller_helpers.rb +6 -2
- data/lib/dry/rails/boot/safe_params.rb +6 -2
- data/lib/dry/rails/container.rb +22 -97
- data/lib/dry/rails/railtie.rb +21 -14
- data/lib/dry/rails/version.rb +1 -1
- data/lib/dry/rails.rb +8 -4
- metadata +14 -9
- data/lib/dry/rails/components.rb +0 -8
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: b88e2e95f728750240e49d73821d025555aed6cc31d5d39174f6c57aebf6ce27
|
|
4
|
+
data.tar.gz: cabcb4d3fd5d5cf9501fe7949c7c909f40da0ca6a5603673785ae9b40ba04e00
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 175953e3194700744fb405d10684492e7986bbf163fd14cf95d9763ba03155ad97f5dba1998a192430b1b348e7a663ee5a46bc9e4b75a689feda72984be9b555
|
|
7
|
+
data.tar.gz: a6751d7aca04c9c6e4806e0f6cdaf2e0881c2ef88b7a9796650da2ee0408ba05d955324af704a96d17b5318e294e2de0e34c56d9727523ab2d90945502af533d
|
data/CHANGELOG.md
CHANGED
|
@@ -1,4 +1,57 @@
|
|
|
1
|
-
|
|
1
|
+
<!--- DO NOT EDIT THIS FILE - IT'S AUTOMATICALLY GENERATED VIA DEVTOOLS --->
|
|
2
|
+
|
|
3
|
+
## 0.5.0 2022-02-11
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Changed
|
|
7
|
+
|
|
8
|
+
- dry-system dependency was bumped to >= 0.23 (via #52) (@solnic)
|
|
9
|
+
|
|
10
|
+
[Compare v0.4.0...v0.5.0](https://github.com/dry-rb/dry-rails/compare/v0.4.0...v0.5.0)
|
|
11
|
+
|
|
12
|
+
## 0.4.0 2021-12-23
|
|
13
|
+
|
|
14
|
+
This is a big update - please also read dry-system [CHANGELOG](https://github.com/dry-rb/dry-system/blob/master/CHANGELOG.md) versions 0.20 and 0.21.
|
|
15
|
+
|
|
16
|
+
### Added
|
|
17
|
+
|
|
18
|
+
- It's now possible to configure container constant name via `config.constainer_const_name` (issue #21 closed via #41) (@diegotoral)
|
|
19
|
+
|
|
20
|
+
### Fixed
|
|
21
|
+
|
|
22
|
+
- `config.auto_inject_constant` is now cleared during code reloading (see #40 for more info) (@diegotoral)
|
|
23
|
+
|
|
24
|
+
### Changed
|
|
25
|
+
|
|
26
|
+
- Updated to work with dry-system 0.21 (via #48 and #50) (@zlw + @solnic)
|
|
27
|
+
- dry-system dependency was bumped to >= 0.23 (via #52) (@solnic)
|
|
28
|
+
|
|
29
|
+
[Compare v0.3.0...v0.4.0](https://github.com/dry-rb/dry-rails/compare/v0.3.0...v0.4.0)
|
|
30
|
+
|
|
31
|
+
## 0.3.0 2020-08-26
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
### Changed
|
|
35
|
+
|
|
36
|
+
- Use dry-system 0.18.0 and configure new `bootable_dirs` setting appropriately (@timriley in #38)
|
|
37
|
+
|
|
38
|
+
[Compare v0.2.1...v0.3.0](https://github.com/dry-rb/dry-rails/compare/v0.2.1...v0.3.0)
|
|
39
|
+
|
|
40
|
+
## 0.2.1 2020-08-26
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
### Added
|
|
44
|
+
|
|
45
|
+
- Controller features now support `ActionControll::API` too (issue #35 closed via #36) (@rinaldifonseca)
|
|
46
|
+
|
|
47
|
+
### Fixed
|
|
48
|
+
|
|
49
|
+
- Fix dry-system dependency to 0.17.0, to avoid incompatibilities with 0.18.0 (@timriley)
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
[Compare v0.2.0...v0.2.1](https://github.com/dry-rb/dry-rails/compare/v0.2.0...v0.2.1)
|
|
53
|
+
|
|
54
|
+
## 0.2.0 2020-07-21
|
|
2
55
|
|
|
3
56
|
|
|
4
57
|
### Added
|
|
@@ -14,7 +67,7 @@
|
|
|
14
67
|
|
|
15
68
|
- The `:env` dry-system plugin is now enabled by default (fixes #28 via #30) (@solnic)
|
|
16
69
|
|
|
17
|
-
[Compare v0.1.0...
|
|
70
|
+
[Compare v0.1.0...v0.2.0](https://github.com/dry-rb/dry-rails/compare/v0.1.0...v0.2.0)
|
|
18
71
|
|
|
19
72
|
## 0.1.0 2020-03-30
|
|
20
73
|
|
data/LICENSE
CHANGED
data/README.md
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
<!--- this file is synced from dry-rb/template-gem project -->
|
|
1
2
|
[gem]: https://rubygems.org/gems/dry-rails
|
|
2
3
|
[actions]: https://github.com/dry-rb/dry-rails/actions
|
|
3
4
|
[codacy]: https://www.codacy.com/gh/dry-rb/dry-rails
|
|
@@ -12,18 +13,17 @@
|
|
|
12
13
|
[][codacy]
|
|
13
14
|
[][inchpages]
|
|
14
15
|
|
|
15
|
-
dry-rails provides the official integration of dry-rb gems with Ruby on Rails framework.
|
|
16
16
|
## Links
|
|
17
17
|
|
|
18
|
-
* [User documentation](
|
|
18
|
+
* [User documentation](https://dry-rb.org/gems/dry-rails)
|
|
19
19
|
* [API documentation](http://rubydoc.info/gems/dry-rails)
|
|
20
20
|
|
|
21
21
|
## Supported Ruby versions
|
|
22
22
|
|
|
23
23
|
This library officially supports the following Ruby versions:
|
|
24
24
|
|
|
25
|
-
* MRI
|
|
26
|
-
* jruby
|
|
25
|
+
* MRI `>= 2.7.0`
|
|
26
|
+
* jruby `>= 9.3` (postponed until 2.7 is supported)
|
|
27
27
|
|
|
28
28
|
## License
|
|
29
29
|
|
data/dry-rails.gemspec
CHANGED
|
@@ -1,35 +1,36 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
|
-
# this file is managed by dry-rb/devtools project
|
|
3
2
|
|
|
4
|
-
|
|
3
|
+
# this file is synced from dry-rb/template-gem project
|
|
4
|
+
|
|
5
|
+
lib = File.expand_path("lib", __dir__)
|
|
5
6
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
6
|
-
require
|
|
7
|
+
require "dry/rails/version"
|
|
7
8
|
|
|
8
9
|
Gem::Specification.new do |spec|
|
|
9
|
-
spec.name =
|
|
10
|
+
spec.name = "dry-rails"
|
|
10
11
|
spec.authors = ["Piotr Solnica"]
|
|
11
12
|
spec.email = ["piotr.solnica@gmail.com"]
|
|
12
|
-
spec.license =
|
|
13
|
+
spec.license = "MIT"
|
|
13
14
|
spec.version = Dry::Rails::VERSION.dup
|
|
14
15
|
|
|
15
16
|
spec.summary = "The official dry-rb railtie for Ruby on Rails"
|
|
16
17
|
spec.description = "dry-rails provides the official integration of dry-rb gems with Ruby on Rails framework."
|
|
17
|
-
spec.homepage =
|
|
18
|
+
spec.homepage = "https://dry-rb.org/gems/dry-rails"
|
|
18
19
|
spec.files = Dir["CHANGELOG.md", "LICENSE", "README.md", "dry-rails.gemspec", "lib/**/*"]
|
|
19
|
-
spec.bindir =
|
|
20
|
+
spec.bindir = "bin"
|
|
20
21
|
spec.executables = []
|
|
21
|
-
spec.require_paths = [
|
|
22
|
+
spec.require_paths = ["lib"]
|
|
22
23
|
|
|
23
|
-
spec.metadata[
|
|
24
|
-
spec.metadata[
|
|
25
|
-
spec.metadata[
|
|
26
|
-
spec.metadata[
|
|
24
|
+
spec.metadata["allowed_push_host"] = "https://rubygems.org"
|
|
25
|
+
spec.metadata["changelog_uri"] = "https://github.com/dry-rb/dry-rails/blob/master/CHANGELOG.md"
|
|
26
|
+
spec.metadata["source_code_uri"] = "https://github.com/dry-rb/dry-rails"
|
|
27
|
+
spec.metadata["bug_tracker_uri"] = "https://github.com/dry-rb/dry-rails/issues"
|
|
27
28
|
|
|
28
|
-
spec.required_ruby_version = ">= 2.
|
|
29
|
+
spec.required_ruby_version = ">= 2.7.0"
|
|
29
30
|
|
|
30
31
|
# to update dependencies edit project.yml
|
|
31
|
-
spec.add_runtime_dependency "dry-schema", "~> 1.
|
|
32
|
-
spec.add_runtime_dependency "dry-system", "~> 0.
|
|
32
|
+
spec.add_runtime_dependency "dry-schema", "~> 1.7"
|
|
33
|
+
spec.add_runtime_dependency "dry-system", "~> 0.23", ">= 0.23"
|
|
33
34
|
spec.add_runtime_dependency "dry-validation", "~> 1.5"
|
|
34
35
|
|
|
35
36
|
spec.add_development_dependency "bundler"
|
|
@@ -1,18 +1,19 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
Dry::System.
|
|
4
|
-
|
|
3
|
+
Dry::System.register_provider_source(:application_contract, group: :rails) do
|
|
4
|
+
prepare do
|
|
5
5
|
require "dry/rails/features/application_contract"
|
|
6
|
+
@railtie = target_container[:railtie]
|
|
6
7
|
end
|
|
7
8
|
|
|
8
9
|
start do
|
|
9
|
-
railtie.set_or_reload(
|
|
10
|
+
@railtie.set_or_reload(
|
|
10
11
|
:ApplicationContract,
|
|
11
|
-
Class.new(Dry::Rails::Features::ApplicationContract).finalize!(railtie)
|
|
12
|
+
Class.new(Dry::Rails::Features::ApplicationContract).finalize!(@railtie)
|
|
12
13
|
)
|
|
13
14
|
end
|
|
14
15
|
|
|
15
16
|
stop do
|
|
16
|
-
railtie.remove_constant(:ApplicationContract)
|
|
17
|
+
@railtie.remove_constant(:ApplicationContract)
|
|
17
18
|
end
|
|
18
19
|
end
|
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
Dry::System.
|
|
4
|
-
|
|
3
|
+
Dry::System.register_provider_source(:controller_helpers, group: :rails) do
|
|
4
|
+
prepare do
|
|
5
5
|
require "dry/rails/features/controller_helpers"
|
|
6
6
|
end
|
|
7
7
|
|
|
8
8
|
start do
|
|
9
9
|
ApplicationController.include(Dry::Rails::Features::ControllerHelpers)
|
|
10
|
+
|
|
11
|
+
if defined?(ActionController::API)
|
|
12
|
+
ActionController::API.include(Dry::Rails::Features::ControllerHelpers)
|
|
13
|
+
end
|
|
10
14
|
end
|
|
11
15
|
end
|
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
Dry::System.
|
|
4
|
-
|
|
3
|
+
Dry::System.register_provider_source(:safe_params, group: :rails) do
|
|
4
|
+
prepare do
|
|
5
5
|
require "dry/rails/features/safe_params"
|
|
6
6
|
end
|
|
7
7
|
|
|
8
8
|
start do
|
|
9
9
|
ApplicationController.include(Dry::Rails::Features::SafeParams)
|
|
10
|
+
|
|
11
|
+
if defined?(ActionController::API)
|
|
12
|
+
ActionController::API.include(Dry::Rails::Features::SafeParams)
|
|
13
|
+
end
|
|
10
14
|
end
|
|
11
15
|
end
|
data/lib/dry/rails/container.rb
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
require "rails/version"
|
|
4
4
|
|
|
5
5
|
require "dry/system/container"
|
|
6
|
-
require "dry/system/
|
|
6
|
+
require "dry/system/provider_sources"
|
|
7
7
|
|
|
8
8
|
require "dry/rails/auto_registrars/app"
|
|
9
9
|
|
|
@@ -27,28 +27,31 @@ module Dry
|
|
|
27
27
|
#
|
|
28
28
|
# @api public
|
|
29
29
|
# @!scope class
|
|
30
|
-
setting :features,
|
|
30
|
+
setting :features,
|
|
31
|
+
default: %i[application_contract safe_params controller_helpers],
|
|
32
|
+
reader: true
|
|
31
33
|
|
|
32
|
-
# @overload config.
|
|
33
|
-
# Set
|
|
34
|
-
#
|
|
35
|
-
# This is a low-level setting that typically should not be set explicitly,
|
|
36
|
-
# use `auto_register!` instead.
|
|
34
|
+
# @overload config.auto_inject_constant=(auto_inject_constant)
|
|
35
|
+
# Set a custom import constant name
|
|
37
36
|
#
|
|
38
|
-
# @param
|
|
37
|
+
# @param auto_inject_constant [String]
|
|
39
38
|
#
|
|
40
39
|
# @api public
|
|
41
40
|
# @!scope class
|
|
42
|
-
setting :
|
|
41
|
+
setting :auto_inject_constant,
|
|
42
|
+
default: "Deps",
|
|
43
|
+
reader: true
|
|
43
44
|
|
|
44
|
-
# @overload config.
|
|
45
|
-
# Set a custom
|
|
45
|
+
# @overload config.container_constant=(container_constant)
|
|
46
|
+
# Set a custom container constant
|
|
46
47
|
#
|
|
47
|
-
# @param
|
|
48
|
+
# @param container_constant [String]
|
|
48
49
|
#
|
|
49
50
|
# @api public
|
|
50
51
|
# @!scope class
|
|
51
|
-
setting :
|
|
52
|
+
setting :container_constant,
|
|
53
|
+
default: "Container",
|
|
54
|
+
reader: true
|
|
52
55
|
|
|
53
56
|
# @!endgroup
|
|
54
57
|
|
|
@@ -56,91 +59,13 @@ module Dry
|
|
|
56
59
|
config.auto_registrar = Rails::AutoRegistrars::App
|
|
57
60
|
|
|
58
61
|
class << self
|
|
59
|
-
#
|
|
60
|
-
#
|
|
61
|
-
# @example set up a single path
|
|
62
|
-
# Dry::Rails.container do
|
|
63
|
-
# auto_register!("app/operations")
|
|
64
|
-
# end
|
|
65
|
-
#
|
|
66
|
-
# @example set up a single path with a configuration block
|
|
67
|
-
# Dry::Rails.container do
|
|
68
|
-
# auto_register!("app/operations") do |config|
|
|
69
|
-
# config.exclude do |component|
|
|
70
|
-
# component.path.start_with?("concerns")
|
|
71
|
-
# end
|
|
72
|
-
# end
|
|
73
|
-
# end
|
|
74
|
-
#
|
|
75
|
-
# @example set up multiple paths
|
|
76
|
-
# Dry::Rails.container do
|
|
77
|
-
# auto_register!("lib", "app/operations")
|
|
78
|
-
# end
|
|
79
|
-
#
|
|
80
|
-
# @example set up multiple paths with a configuration block
|
|
81
|
-
# Dry::Rails.container do
|
|
82
|
-
# # in this case the config block will be applied to all paths
|
|
83
|
-
# auto_register!("lib", "app/operations") do |config|
|
|
84
|
-
# config.exclude do |component|
|
|
85
|
-
# component.path.start_with?("concerns")
|
|
86
|
-
# end
|
|
87
|
-
# end
|
|
88
|
-
# end
|
|
89
|
-
#
|
|
90
|
-
# @param paths [Array<String>] One or more paths relative to the root
|
|
91
|
-
# @param set_load_paths [Boolean] Whether the paths should be added to $LOAD_PATH
|
|
92
|
-
# @param load_files [Boolean] Whether files should be `required`-ed already
|
|
93
|
-
#
|
|
94
|
-
# @return [self]
|
|
95
|
-
#
|
|
96
|
-
# @api public
|
|
97
|
-
#
|
|
98
|
-
# TODO: this should be moved to dry-system
|
|
99
|
-
def auto_register!(*paths, set_load_paths: true, load_files: false, &block)
|
|
100
|
-
load_paths!(*paths) if set_load_paths
|
|
101
|
-
|
|
102
|
-
if load_files
|
|
103
|
-
paths.each { |path| super(path, &block) }
|
|
104
|
-
else
|
|
105
|
-
config.auto_register_paths.concat(paths.product([block]))
|
|
106
|
-
end
|
|
107
|
-
|
|
108
|
-
self
|
|
109
|
-
end
|
|
110
|
-
|
|
111
|
-
# Finalize the container
|
|
112
|
-
#
|
|
113
|
-
# This is called automatically via the railtie, so typically you won't be using this method
|
|
114
|
-
# directly
|
|
115
|
-
#
|
|
116
|
-
# @param freeze [Boolean] Whether the container should be frozen upon finalization
|
|
117
|
-
#
|
|
118
|
-
# @return [self]
|
|
119
|
-
#
|
|
120
|
-
# @api public
|
|
121
|
-
#
|
|
122
|
-
# TODO: just like auto_register!, this should be moved to dry-system
|
|
123
|
-
def finalize!(freeze: false, &block)
|
|
124
|
-
features.each do |feature|
|
|
125
|
-
start(feature)
|
|
126
|
-
end
|
|
127
|
-
|
|
128
|
-
auto_register_paths.each do |(path, path_block)|
|
|
129
|
-
auto_register!(path, set_load_paths: false, load_files: true, &path_block)
|
|
130
|
-
end
|
|
131
|
-
|
|
132
|
-
super
|
|
133
|
-
end
|
|
134
|
-
|
|
135
|
-
# Return if a given component was booted
|
|
62
|
+
# Return if a given component was started
|
|
136
63
|
#
|
|
137
64
|
# @return [Boolean]
|
|
138
65
|
#
|
|
139
66
|
# @api private
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
def booted?(name)
|
|
143
|
-
booter.booted.map(&:identifier).include?(name)
|
|
67
|
+
def started?(name)
|
|
68
|
+
providers[name].started?
|
|
144
69
|
end
|
|
145
70
|
|
|
146
71
|
# TODO: confirm that this is really needed
|
|
@@ -156,9 +81,9 @@ module Dry
|
|
|
156
81
|
# @return [self]
|
|
157
82
|
#
|
|
158
83
|
# @api private
|
|
159
|
-
def
|
|
160
|
-
|
|
161
|
-
load(boot_file)
|
|
84
|
+
def refresh_provider_files
|
|
85
|
+
providers.provider_files.each do |boot_file|
|
|
86
|
+
::Kernel.load(boot_file)
|
|
162
87
|
end
|
|
163
88
|
self
|
|
164
89
|
end
|
data/lib/dry/rails/railtie.rb
CHANGED
|
@@ -8,6 +8,8 @@ module Dry
|
|
|
8
8
|
#
|
|
9
9
|
# @api public
|
|
10
10
|
class Railtie < ::Rails::Railtie
|
|
11
|
+
attr_reader :container_const_name
|
|
12
|
+
|
|
11
13
|
# This is needed because `finalize!` can reload code and this hook is called every-time
|
|
12
14
|
# in development env upon a request (in production it's called just once during booting)
|
|
13
15
|
config.to_prepare do
|
|
@@ -23,16 +25,16 @@ module Dry
|
|
|
23
25
|
#
|
|
24
26
|
# rubocop:disable Metrics/AbcSize
|
|
25
27
|
def finalize!
|
|
28
|
+
@container_const_name ||= Dry::Rails::Container.container_constant
|
|
29
|
+
|
|
26
30
|
stop_features if reloading?
|
|
27
31
|
|
|
28
32
|
root_path = ::Rails.root
|
|
29
33
|
|
|
30
34
|
container = Dry::Rails.create_container(
|
|
31
35
|
root: root_path,
|
|
32
|
-
name: name,
|
|
33
|
-
default_namespace: name.to_s,
|
|
34
36
|
inflector: default_inflector,
|
|
35
|
-
|
|
37
|
+
provider_dirs: [root_path.join("config/system/boot")]
|
|
36
38
|
)
|
|
37
39
|
|
|
38
40
|
# Enable :env plugin by default because it is a very common requirement
|
|
@@ -41,17 +43,23 @@ module Dry
|
|
|
41
43
|
container.register(:railtie, self)
|
|
42
44
|
container.register(:inflector, default_inflector)
|
|
43
45
|
|
|
44
|
-
|
|
46
|
+
# Remove previously defined constants, if any, so we don't end up with
|
|
47
|
+
# unsused constants in app's namespace when a name change happens.
|
|
48
|
+
remove_constant(container.auto_inject_constant)
|
|
49
|
+
remove_constant(container.container_constant)
|
|
45
50
|
|
|
46
51
|
Dry::Rails.evaluate_initializer(container)
|
|
47
52
|
|
|
53
|
+
@container_const_name = container.container_constant
|
|
54
|
+
|
|
55
|
+
set_or_reload(container.container_constant, container)
|
|
48
56
|
set_or_reload(container.auto_inject_constant, container.injector)
|
|
49
57
|
|
|
50
58
|
container.features.each do |feature|
|
|
51
|
-
container.
|
|
59
|
+
container.register_provider(feature, from: :rails)
|
|
52
60
|
end
|
|
53
61
|
|
|
54
|
-
container.
|
|
62
|
+
container.refresh_provider_files if reloading?
|
|
55
63
|
|
|
56
64
|
container.finalize!(freeze: !::Rails.env.test?)
|
|
57
65
|
end
|
|
@@ -67,7 +75,7 @@ module Dry
|
|
|
67
75
|
# @api public
|
|
68
76
|
def stop_features
|
|
69
77
|
container.features.each do |feature|
|
|
70
|
-
container.stop(feature) if container.
|
|
78
|
+
container.stop(feature) if container.started?(feature)
|
|
71
79
|
end
|
|
72
80
|
end
|
|
73
81
|
|
|
@@ -77,14 +85,14 @@ module Dry
|
|
|
77
85
|
#
|
|
78
86
|
# @api public
|
|
79
87
|
def container
|
|
80
|
-
app_namespace.const_get(
|
|
88
|
+
app_namespace.const_get(container_const_name, false)
|
|
81
89
|
end
|
|
82
90
|
|
|
83
91
|
# Return true if we're in code-reloading mode
|
|
84
92
|
#
|
|
85
93
|
# @api private
|
|
86
94
|
def reloading?
|
|
87
|
-
app_namespace.const_defined?(
|
|
95
|
+
app_namespace.const_defined?(container_const_name, false)
|
|
88
96
|
end
|
|
89
97
|
|
|
90
98
|
# Return the default system name
|
|
@@ -125,16 +133,15 @@ module Dry
|
|
|
125
133
|
|
|
126
134
|
# @api private
|
|
127
135
|
def set_or_reload(const_name, const)
|
|
128
|
-
|
|
129
|
-
app_namespace.__send__(:remove_const, const_name)
|
|
130
|
-
end
|
|
131
|
-
|
|
136
|
+
remove_constant(const_name)
|
|
132
137
|
app_namespace.const_set(const_name, const)
|
|
133
138
|
end
|
|
134
139
|
|
|
135
140
|
# @api private
|
|
136
141
|
def remove_constant(const_name)
|
|
137
|
-
app_namespace.
|
|
142
|
+
if app_namespace.const_defined?(const_name, false)
|
|
143
|
+
app_namespace.__send__(:remove_const, const_name)
|
|
144
|
+
end
|
|
138
145
|
end
|
|
139
146
|
end
|
|
140
147
|
end
|
data/lib/dry/rails/version.rb
CHANGED
data/lib/dry/rails.rb
CHANGED
|
@@ -1,20 +1,24 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
+
require "dry/system"
|
|
3
4
|
require "dry/rails/railtie"
|
|
4
5
|
require "dry/rails/container"
|
|
5
|
-
require "dry/rails/components"
|
|
6
6
|
|
|
7
7
|
module Dry
|
|
8
|
+
Dry::System.register_provider_sources(Pathname(__dir__).join("rails/boot").realpath)
|
|
9
|
+
|
|
8
10
|
# Initializer interface
|
|
9
11
|
#
|
|
10
12
|
# @example set up a container with auto-registration paths
|
|
11
13
|
# # config/initializer/system.rb
|
|
12
14
|
#
|
|
13
15
|
# Dry::Rails.container do
|
|
14
|
-
#
|
|
15
|
-
#
|
|
16
|
+
# config.component_dirs.add "lib" do |dir|
|
|
17
|
+
# dir.namespaces.add "my_super_cool_app", key: nil
|
|
18
|
+
# end
|
|
16
19
|
#
|
|
17
|
-
#
|
|
20
|
+
# config.component_dirs.add "app/operations"
|
|
21
|
+
# end
|
|
18
22
|
#
|
|
19
23
|
# @api public
|
|
20
24
|
module Rails
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: dry-rails
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.5.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Piotr Solnica
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2022-02-11 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: dry-schema
|
|
@@ -16,28 +16,34 @@ dependencies:
|
|
|
16
16
|
requirements:
|
|
17
17
|
- - "~>"
|
|
18
18
|
- !ruby/object:Gem::Version
|
|
19
|
-
version: '1.
|
|
19
|
+
version: '1.7'
|
|
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: '1.
|
|
26
|
+
version: '1.7'
|
|
27
27
|
- !ruby/object:Gem::Dependency
|
|
28
28
|
name: dry-system
|
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
|
30
30
|
requirements:
|
|
31
31
|
- - "~>"
|
|
32
32
|
- !ruby/object:Gem::Version
|
|
33
|
-
version: '0.
|
|
33
|
+
version: '0.23'
|
|
34
|
+
- - ">="
|
|
35
|
+
- !ruby/object:Gem::Version
|
|
36
|
+
version: '0.23'
|
|
34
37
|
type: :runtime
|
|
35
38
|
prerelease: false
|
|
36
39
|
version_requirements: !ruby/object:Gem::Requirement
|
|
37
40
|
requirements:
|
|
38
41
|
- - "~>"
|
|
39
42
|
- !ruby/object:Gem::Version
|
|
40
|
-
version: '0.
|
|
43
|
+
version: '0.23'
|
|
44
|
+
- - ">="
|
|
45
|
+
- !ruby/object:Gem::Version
|
|
46
|
+
version: '0.23'
|
|
41
47
|
- !ruby/object:Gem::Dependency
|
|
42
48
|
name: dry-validation
|
|
43
49
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -112,7 +118,6 @@ files:
|
|
|
112
118
|
- lib/dry/rails/boot/application_contract.rb
|
|
113
119
|
- lib/dry/rails/boot/controller_helpers.rb
|
|
114
120
|
- lib/dry/rails/boot/safe_params.rb
|
|
115
|
-
- lib/dry/rails/components.rb
|
|
116
121
|
- lib/dry/rails/container.rb
|
|
117
122
|
- lib/dry/rails/features/application_contract.rb
|
|
118
123
|
- lib/dry/rails/features/controller_helpers.rb
|
|
@@ -135,14 +140,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
135
140
|
requirements:
|
|
136
141
|
- - ">="
|
|
137
142
|
- !ruby/object:Gem::Version
|
|
138
|
-
version: 2.
|
|
143
|
+
version: 2.7.0
|
|
139
144
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
140
145
|
requirements:
|
|
141
146
|
- - ">="
|
|
142
147
|
- !ruby/object:Gem::Version
|
|
143
148
|
version: '0'
|
|
144
149
|
requirements: []
|
|
145
|
-
rubygems_version: 3.
|
|
150
|
+
rubygems_version: 3.1.6
|
|
146
151
|
signing_key:
|
|
147
152
|
specification_version: 4
|
|
148
153
|
summary: The official dry-rb railtie for Ruby on Rails
|