dry-rails 0.1.0 → 0.4.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 +57 -12
- data/LICENSE +1 -1
- data/README.md +5 -5
- data/dry-rails.gemspec +16 -15
- data/lib/dry/rails/boot/controller_helpers.rb +4 -0
- data/lib/dry/rails/boot/safe_params.rb +4 -0
- data/lib/dry/rails/container.rb +20 -84
- data/lib/dry/rails/features/safe_params.rb +9 -3
- data/lib/dry/rails/railtie.rb +28 -13
- data/lib/dry/rails/version.rb +1 -1
- data/lib/dry/rails.rb +5 -3
- metadata +8 -8
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 315efa0b4975c1afe8c02e36ad325eda687c505cbeec76329eaf330f229d21f2
|
|
4
|
+
data.tar.gz: 0ee2ec74bafce16a2cee710fb90c10bb483b672f1178fbd76a4518c7d12d98ea
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: acd9f6bda792c65ee94b92d6e62ba286f33c2f3b4d7c01fa7f2b7818954fa61c52705686fa919091174ef6de8172d2dfb9b68077bf6f8a866a8fd19e10129290
|
|
7
|
+
data.tar.gz: 8001793ca368b1dc0388cacd2610441082a22163ec209169194be1d84aaa1ad5b83b8b6d3d45ea395eac29b5e1bb532296a425dac1664de91675f74a47794a7b
|
data/CHANGELOG.md
CHANGED
|
@@ -1,26 +1,71 @@
|
|
|
1
|
-
|
|
1
|
+
<!--- DO NOT EDIT THIS FILE - IT'S AUTOMATICALLY GENERATED VIA DEVTOOLS --->
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
## 0.4.0 2021-12-23
|
|
4
|
+
|
|
5
|
+
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.
|
|
4
6
|
|
|
5
7
|
### Added
|
|
6
8
|
|
|
7
|
-
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
-
|
|
9
|
+
- It's now possible to configure container constant name via `config.constainer_const_name` (issue #21 closed via #41) (@diegotoral)
|
|
10
|
+
|
|
11
|
+
### Fixed
|
|
12
|
+
|
|
13
|
+
- `config.auto_inject_constant` is now cleared during code reloading (see #40 for more info) (@diegotoral)
|
|
14
|
+
|
|
15
|
+
### Changed
|
|
16
|
+
|
|
17
|
+
- Updated to work with dry-system 0.21 (via #48 and #50) (@zlw + @solnic)
|
|
18
|
+
|
|
19
|
+
[Compare v0.3.0...v0.4.0](https://github.com/dry-rb/dry-rails/compare/v0.3.0...v0.4.0)
|
|
20
|
+
|
|
21
|
+
## 0.3.0 2020-08-26
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
### Changed
|
|
25
|
+
|
|
26
|
+
- Use dry-system 0.18.0 and configure new `bootable_dirs` setting appropriately (@timriley in #38)
|
|
27
|
+
|
|
28
|
+
[Compare v0.2.1...v0.3.0](https://github.com/dry-rb/dry-rails/compare/v0.2.1...v0.3.0)
|
|
29
|
+
|
|
30
|
+
## 0.2.1 2020-08-26
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
### Added
|
|
34
|
+
|
|
35
|
+
- Controller features now support `ActionControll::API` too (issue #35 closed via #36) (@rinaldifonseca)
|
|
36
|
+
|
|
37
|
+
### Fixed
|
|
38
|
+
|
|
39
|
+
- Fix dry-system dependency to 0.17.0, to avoid incompatibilities with 0.18.0 (@timriley)
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
[Compare v0.2.0...v0.2.1](https://github.com/dry-rb/dry-rails/compare/v0.2.0...v0.2.1)
|
|
43
|
+
|
|
44
|
+
## 0.2.0 2020-07-21
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
### Added
|
|
48
|
+
|
|
49
|
+
- You can now configure auto_inject constant name via `config.auto_inject_constant` - previously it was hardcoded as `"Import"`, now it's configured as `"Deps"` by default (issue #18 closed via #29) (@diegotoral)
|
|
50
|
+
|
|
51
|
+
### Fixed
|
|
52
|
+
|
|
53
|
+
- Resolving `Container` constant looks it up only within the application namespace (see #22 for more information) (@jandudulski)
|
|
54
|
+
- [safe_params] defining multiple schemas works as expected (issue #23 fixed via 24) (@gotar)
|
|
55
|
+
|
|
56
|
+
### Changed
|
|
12
57
|
|
|
58
|
+
- The `:env` dry-system plugin is now enabled by default (fixes #28 via #30) (@solnic)
|
|
13
59
|
|
|
14
|
-
[Compare
|
|
60
|
+
[Compare v0.1.0...v0.2.0](https://github.com/dry-rb/dry-rails/compare/v0.1.0...v0.2.0)
|
|
15
61
|
|
|
16
|
-
##
|
|
62
|
+
## 0.1.0 2020-03-30
|
|
17
63
|
|
|
18
|
-
|
|
64
|
+
This is based on dry-system-rails that dry-rails replaces.
|
|
19
65
|
|
|
20
66
|
### Added
|
|
21
67
|
|
|
22
|
-
- `:rails` system component provider, which uses standard bootable components, aka "features", to manage application state (@solnic)
|
|
23
68
|
- `config.features` setting which is an array with feature identifiers that you want the railtie to boot (@solnic)
|
|
24
69
|
- `:application_contract` feature which defines `ApplicationContract` within the application namespace and configured to work with `I18n` (@solnic)
|
|
25
70
|
- `:safe_params` feature which extends `ApplicationController` with `schema` DSL and exposes `safe_params` controller helper (@solnic)
|
|
26
|
-
- `:
|
|
71
|
+
- `:controller_helpers` feature which adds `ApplicationController#{resolve,container}` shortcuts (@solnic)
|
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
|
|
@@ -7,23 +8,22 @@
|
|
|
7
8
|
# dry-rails [][chat]
|
|
8
9
|
|
|
9
10
|
[][gem]
|
|
10
|
-
[][actions]
|
|
11
12
|
[][codacy]
|
|
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.6.0`
|
|
26
|
+
* jruby `>= 9.3`
|
|
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.6.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.21"
|
|
33
34
|
spec.add_runtime_dependency "dry-validation", "~> 1.5"
|
|
34
35
|
|
|
35
36
|
spec.add_development_dependency "bundler"
|
|
@@ -7,5 +7,9 @@ Dry::System.register_component(:controller_helpers, provider: :rails) do
|
|
|
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
|
|
@@ -7,5 +7,9 @@ Dry::System.register_component(:safe_params, provider: :rails) do
|
|
|
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
|
@@ -27,19 +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
|
+
# @overload config.auto_inject_constant=(auto_inject_constant)
|
|
35
|
+
# Set a custom import constant name
|
|
34
36
|
#
|
|
35
|
-
#
|
|
36
|
-
# use `auto_register!` instead.
|
|
37
|
+
# @param auto_inject_constant [String]
|
|
37
38
|
#
|
|
38
|
-
# @
|
|
39
|
+
# @api public
|
|
40
|
+
# @!scope class
|
|
41
|
+
setting :auto_inject_constant,
|
|
42
|
+
default: "Deps",
|
|
43
|
+
reader: true
|
|
44
|
+
|
|
45
|
+
# @overload config.container_constant=(container_constant)
|
|
46
|
+
# Set a custom container constant
|
|
47
|
+
#
|
|
48
|
+
# @param container_constant [String]
|
|
39
49
|
#
|
|
40
50
|
# @api public
|
|
41
51
|
# @!scope class
|
|
42
|
-
setting :
|
|
52
|
+
setting :container_constant,
|
|
53
|
+
default: "Container",
|
|
54
|
+
reader: true
|
|
43
55
|
|
|
44
56
|
# @!endgroup
|
|
45
57
|
|
|
@@ -47,82 +59,6 @@ module Dry
|
|
|
47
59
|
config.auto_registrar = Rails::AutoRegistrars::App
|
|
48
60
|
|
|
49
61
|
class << self
|
|
50
|
-
# Set up auto-registration paths and optional a configuration block
|
|
51
|
-
#
|
|
52
|
-
# @example set up a single path
|
|
53
|
-
# Dry::Rails.container do
|
|
54
|
-
# auto_register!("app/operations")
|
|
55
|
-
# end
|
|
56
|
-
#
|
|
57
|
-
# @example set up a single path with a configuration block
|
|
58
|
-
# Dry::Rails.container do
|
|
59
|
-
# auto_register!("app/operations") do |config|
|
|
60
|
-
# config.exclude do |component|
|
|
61
|
-
# component.path.start_with?("concerns")
|
|
62
|
-
# end
|
|
63
|
-
# end
|
|
64
|
-
# end
|
|
65
|
-
#
|
|
66
|
-
# @example set up multiple paths
|
|
67
|
-
# Dry::Rails.container do
|
|
68
|
-
# auto_register!("lib", "app/operations")
|
|
69
|
-
# end
|
|
70
|
-
#
|
|
71
|
-
# @example set up multiple paths with a configuration block
|
|
72
|
-
# Dry::Rails.container do
|
|
73
|
-
# # in this case the config block will be applied to all paths
|
|
74
|
-
# auto_register!("lib", "app/operations") do |config|
|
|
75
|
-
# config.exclude do |component|
|
|
76
|
-
# component.path.start_with?("concerns")
|
|
77
|
-
# end
|
|
78
|
-
# end
|
|
79
|
-
# end
|
|
80
|
-
#
|
|
81
|
-
# @param paths [Array<String>] One or more paths relative to the root
|
|
82
|
-
# @param set_load_paths [Boolean] Whether the paths should be added to $LOAD_PATH
|
|
83
|
-
# @param load_files [Boolean] Whether files should be `required`-ed already
|
|
84
|
-
#
|
|
85
|
-
# @return [self]
|
|
86
|
-
#
|
|
87
|
-
# @api public
|
|
88
|
-
#
|
|
89
|
-
# TODO: this should be moved to dry-system
|
|
90
|
-
def auto_register!(*paths, set_load_paths: true, load_files: false, &block)
|
|
91
|
-
load_paths!(*paths) if set_load_paths
|
|
92
|
-
|
|
93
|
-
if load_files
|
|
94
|
-
paths.each { |path| super(path, &block) }
|
|
95
|
-
else
|
|
96
|
-
config.auto_register_paths.concat(paths.product([block]))
|
|
97
|
-
end
|
|
98
|
-
|
|
99
|
-
self
|
|
100
|
-
end
|
|
101
|
-
|
|
102
|
-
# Finalize the container
|
|
103
|
-
#
|
|
104
|
-
# This is called automatically via the railtie, so typically you won't be using this method
|
|
105
|
-
# directly
|
|
106
|
-
#
|
|
107
|
-
# @param freeze [Boolean] Whether the container should be frozen upon finalization
|
|
108
|
-
#
|
|
109
|
-
# @return [self]
|
|
110
|
-
#
|
|
111
|
-
# @api public
|
|
112
|
-
#
|
|
113
|
-
# TODO: just like auto_register!, this should be moved to dry-system
|
|
114
|
-
def finalize!(freeze: false, &block)
|
|
115
|
-
features.each do |feature|
|
|
116
|
-
start(feature)
|
|
117
|
-
end
|
|
118
|
-
|
|
119
|
-
auto_register_paths.each do |(path, path_block)|
|
|
120
|
-
auto_register!(path, set_load_paths: false, load_files: true, &path_block)
|
|
121
|
-
end
|
|
122
|
-
|
|
123
|
-
super
|
|
124
|
-
end
|
|
125
|
-
|
|
126
62
|
# Return if a given component was booted
|
|
127
63
|
#
|
|
128
64
|
# @return [Boolean]
|
|
@@ -131,7 +67,7 @@ module Dry
|
|
|
131
67
|
#
|
|
132
68
|
# TODO: this should be moved to dry-system
|
|
133
69
|
def booted?(name)
|
|
134
|
-
booter.booted.map(&:
|
|
70
|
+
booter.booted.map(&:name).include?(name)
|
|
135
71
|
end
|
|
136
72
|
|
|
137
73
|
# TODO: confirm that this is really needed
|
|
@@ -13,6 +13,10 @@ module Dry
|
|
|
13
13
|
def self.included(klass)
|
|
14
14
|
super
|
|
15
15
|
klass.extend(ClassMethods)
|
|
16
|
+
|
|
17
|
+
klass.class_eval do
|
|
18
|
+
before_action(:set_safe_params, prepend: true)
|
|
19
|
+
end
|
|
16
20
|
end
|
|
17
21
|
|
|
18
22
|
# ApplicationController methods
|
|
@@ -33,8 +37,6 @@ module Dry
|
|
|
33
37
|
schemas[name] = schema
|
|
34
38
|
end
|
|
35
39
|
|
|
36
|
-
before_action(:set_safe_params, only: actions)
|
|
37
|
-
|
|
38
40
|
self
|
|
39
41
|
end
|
|
40
42
|
|
|
@@ -68,7 +70,11 @@ module Dry
|
|
|
68
70
|
|
|
69
71
|
# @api private
|
|
70
72
|
def set_safe_params
|
|
71
|
-
|
|
73
|
+
schema = schemas[action_name.to_sym]
|
|
74
|
+
|
|
75
|
+
return unless schema
|
|
76
|
+
|
|
77
|
+
@safe_params = schema.(request.params)
|
|
72
78
|
end
|
|
73
79
|
end
|
|
74
80
|
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
|
|
@@ -16,31 +18,44 @@ module Dry
|
|
|
16
18
|
|
|
17
19
|
# Code-reloading-aware finalization process
|
|
18
20
|
#
|
|
19
|
-
# This sets up `Container` and `
|
|
21
|
+
# This sets up `Container` and `Deps` constants, reloads them if this is in reloading mode,
|
|
20
22
|
# and registers default components like the railtie itself or the inflector
|
|
21
23
|
#
|
|
22
24
|
# @api public
|
|
25
|
+
#
|
|
26
|
+
# rubocop:disable Metrics/AbcSize
|
|
23
27
|
def finalize!
|
|
28
|
+
@container_const_name ||= Dry::Rails::Container.container_constant
|
|
29
|
+
|
|
24
30
|
stop_features if reloading?
|
|
25
31
|
|
|
26
32
|
root_path = ::Rails.root
|
|
27
33
|
|
|
28
34
|
container = Dry::Rails.create_container(
|
|
29
35
|
root: root_path,
|
|
30
|
-
name: name,
|
|
31
|
-
default_namespace: name.to_s,
|
|
32
36
|
inflector: default_inflector,
|
|
33
|
-
system_dir: root_path.join("config/system")
|
|
37
|
+
system_dir: root_path.join("config/system"),
|
|
38
|
+
bootable_dirs: [root_path.join("config/system/boot")]
|
|
34
39
|
)
|
|
35
40
|
|
|
41
|
+
# Enable :env plugin by default because it is a very common requirement
|
|
42
|
+
container.use :env, inferrer: -> { ::Rails.env }
|
|
43
|
+
|
|
36
44
|
container.register(:railtie, self)
|
|
37
45
|
container.register(:inflector, default_inflector)
|
|
38
46
|
|
|
39
|
-
|
|
40
|
-
|
|
47
|
+
# Remove previously defined constants, if any, so we don't end up with
|
|
48
|
+
# unsused constants in app's namespace when a name change happens.
|
|
49
|
+
remove_constant(container.auto_inject_constant)
|
|
50
|
+
remove_constant(container.container_constant)
|
|
41
51
|
|
|
42
52
|
Dry::Rails.evaluate_initializer(container)
|
|
43
53
|
|
|
54
|
+
@container_const_name = container.container_constant
|
|
55
|
+
|
|
56
|
+
set_or_reload(container.container_constant, container)
|
|
57
|
+
set_or_reload(container.auto_inject_constant, container.injector)
|
|
58
|
+
|
|
44
59
|
container.features.each do |feature|
|
|
45
60
|
container.boot(feature, from: :rails)
|
|
46
61
|
end
|
|
@@ -49,6 +64,7 @@ module Dry
|
|
|
49
64
|
|
|
50
65
|
container.finalize!(freeze: !::Rails.env.test?)
|
|
51
66
|
end
|
|
67
|
+
# rubocop:enable Metrics/AbcSize
|
|
52
68
|
alias_method :reload, :finalize!
|
|
53
69
|
|
|
54
70
|
# Stops all configured features (bootable components)
|
|
@@ -70,14 +86,14 @@ module Dry
|
|
|
70
86
|
#
|
|
71
87
|
# @api public
|
|
72
88
|
def container
|
|
73
|
-
app_namespace.const_get(
|
|
89
|
+
app_namespace.const_get(container_const_name, false)
|
|
74
90
|
end
|
|
75
91
|
|
|
76
92
|
# Return true if we're in code-reloading mode
|
|
77
93
|
#
|
|
78
94
|
# @api private
|
|
79
95
|
def reloading?
|
|
80
|
-
app_namespace.const_defined?(
|
|
96
|
+
app_namespace.const_defined?(container_const_name, false)
|
|
81
97
|
end
|
|
82
98
|
|
|
83
99
|
# Return the default system name
|
|
@@ -118,16 +134,15 @@ module Dry
|
|
|
118
134
|
|
|
119
135
|
# @api private
|
|
120
136
|
def set_or_reload(const_name, const)
|
|
121
|
-
|
|
122
|
-
app_namespace.__send__(:remove_const, const_name)
|
|
123
|
-
end
|
|
124
|
-
|
|
137
|
+
remove_constant(const_name)
|
|
125
138
|
app_namespace.const_set(const_name, const)
|
|
126
139
|
end
|
|
127
140
|
|
|
128
141
|
# @api private
|
|
129
142
|
def remove_constant(const_name)
|
|
130
|
-
app_namespace.
|
|
143
|
+
if app_namespace.const_defined?(const_name, false)
|
|
144
|
+
app_namespace.__send__(:remove_const, const_name)
|
|
145
|
+
end
|
|
131
146
|
end
|
|
132
147
|
end
|
|
133
148
|
end
|
data/lib/dry/rails/version.rb
CHANGED
data/lib/dry/rails.rb
CHANGED
|
@@ -11,10 +11,12 @@ module Dry
|
|
|
11
11
|
# # config/initializer/system.rb
|
|
12
12
|
#
|
|
13
13
|
# Dry::Rails.container do
|
|
14
|
-
#
|
|
15
|
-
#
|
|
14
|
+
# config.component_dirs.add "lib" do |dir|
|
|
15
|
+
# dir.namespaces.add "my_super_cool_app", key: nil
|
|
16
|
+
# end
|
|
16
17
|
#
|
|
17
|
-
#
|
|
18
|
+
# config.component_dirs.add "app/operations"
|
|
19
|
+
# end
|
|
18
20
|
#
|
|
19
21
|
# @api public
|
|
20
22
|
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.4.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: 2021-12-23 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: dry-schema
|
|
@@ -16,28 +16,28 @@ 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.21'
|
|
34
34
|
type: :runtime
|
|
35
35
|
prerelease: false
|
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
|
37
37
|
requirements:
|
|
38
38
|
- - "~>"
|
|
39
39
|
- !ruby/object:Gem::Version
|
|
40
|
-
version: '0.
|
|
40
|
+
version: '0.21'
|
|
41
41
|
- !ruby/object:Gem::Dependency
|
|
42
42
|
name: dry-validation
|
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -135,14 +135,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
135
135
|
requirements:
|
|
136
136
|
- - ">="
|
|
137
137
|
- !ruby/object:Gem::Version
|
|
138
|
-
version: 2.
|
|
138
|
+
version: 2.6.0
|
|
139
139
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
140
140
|
requirements:
|
|
141
141
|
- - ">="
|
|
142
142
|
- !ruby/object:Gem::Version
|
|
143
143
|
version: '0'
|
|
144
144
|
requirements: []
|
|
145
|
-
rubygems_version: 3.
|
|
145
|
+
rubygems_version: 3.1.6
|
|
146
146
|
signing_key:
|
|
147
147
|
specification_version: 4
|
|
148
148
|
summary: The official dry-rb railtie for Ruby on Rails
|