dry-rails 0.4.0 → 0.6.0

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: 315efa0b4975c1afe8c02e36ad325eda687c505cbeec76329eaf330f229d21f2
4
- data.tar.gz: 0ee2ec74bafce16a2cee710fb90c10bb483b672f1178fbd76a4518c7d12d98ea
3
+ metadata.gz: ff456104e9451dc6e15a13351762d90a41a1e295910dadb7cca4fb231fbab7b1
4
+ data.tar.gz: 819517fa2d3847bbe70af131583ebf0363117f7c4c86bc6f350c4583442f4184
5
5
  SHA512:
6
- metadata.gz: acd9f6bda792c65ee94b92d6e62ba286f33c2f3b4d7c01fa7f2b7818954fa61c52705686fa919091174ef6de8172d2dfb9b68077bf6f8a866a8fd19e10129290
7
- data.tar.gz: 8001793ca368b1dc0388cacd2610441082a22163ec209169194be1d84aaa1ad5b83b8b6d3d45ea395eac29b5e1bb532296a425dac1664de91675f74a47794a7b
6
+ metadata.gz: a9a73cbde77855ff662285c17d9edd57e5a31b1c93ba38fbde092d6b65a883d51badcd18978d8e54e8fd45893c457ecef1fbd31ff1816a3c7e3285b7c6ebc692
7
+ data.tar.gz: 2b6eac3c402435b0fa9ed3395b739186b8d57056ac13416864e8ce09594d6220dad66471bac2813d9e6d64eacab96cfa93a2e964bc38bc2252c8b3e549576b18
data/CHANGELOG.md CHANGED
@@ -1,5 +1,23 @@
1
1
  <!--- DO NOT EDIT THIS FILE - IT'S AUTOMATICALLY GENERATED VIA DEVTOOLS --->
2
2
 
3
+ ## 0.6.0 2022-10-20
4
+
5
+
6
+ ### Changed
7
+
8
+ - Upgrade to zeitwerkified dry-rb deps (issue #55 fixed via #56) (@solnic)
9
+
10
+ [Compare v0.5.0...v0.6.0](https://github.com/dry-rb/dry-rails/compare/v0.5.0...v0.6.0)
11
+
12
+ ## 0.5.0 2022-02-11
13
+
14
+
15
+ ### Changed
16
+
17
+ - dry-system dependency was bumped to >= 0.23 (via #52) (@solnic)
18
+
19
+ [Compare v0.4.0...v0.5.0](https://github.com/dry-rb/dry-rails/compare/v0.4.0...v0.5.0)
20
+
3
21
  ## 0.4.0 2021-12-23
4
22
 
5
23
  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,6 +33,7 @@ This is a big update - please also read dry-system [CHANGELOG](https://github.co
15
33
  ### Changed
16
34
 
17
35
  - Updated to work with dry-system 0.21 (via #48 and #50) (@zlw + @solnic)
36
+ - dry-system dependency was bumped to >= 0.23 (via #52) (@solnic)
18
37
 
19
38
  [Compare v0.3.0...v0.4.0](https://github.com/dry-rb/dry-rails/compare/v0.3.0...v0.4.0)
20
39
 
data/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  The MIT License (MIT)
2
2
 
3
- Copyright (c) 2015-2021 dry-rb team
3
+ Copyright (c) 2015-2022 dry-rb team
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy of
6
6
  this software and associated documentation files (the "Software"), to deal in
data/README.md CHANGED
@@ -8,10 +8,10 @@
8
8
  # dry-rails [![Join the chat at https://dry-rb.zulipchat.com](https://img.shields.io/badge/dry--rb-join%20chat-%23346b7a.svg)][chat]
9
9
 
10
10
  [![Gem Version](https://badge.fury.io/rb/dry-rails.svg)][gem]
11
- [![CI Status](https://github.com/dry-rb/dry-rails/workflows/CI/badge.svg)][actions]
11
+ [![CI Status](https://github.com/dry-rb/dry-rails/workflows/ci/badge.svg)][actions]
12
12
  [![Codacy Badge](https://api.codacy.com/project/badge/Grade/d4677ea0c4c2497bb1af1b3ac31552f4)][codacy]
13
13
  [![Codacy Badge](https://api.codacy.com/project/badge/Coverage/d4677ea0c4c2497bb1af1b3ac31552f4)][codacy]
14
- [![Inline docs](http://inch-ci.org/github/dry-rb/dry-rails.svg?branch=master)][inchpages]
14
+ [![Inline docs](http://inch-ci.org/github/dry-rb/dry-rails.svg?branch=main)][inchpages]
15
15
 
16
16
  ## Links
17
17
 
@@ -22,8 +22,8 @@
22
22
 
23
23
  This library officially supports the following Ruby versions:
24
24
 
25
- * MRI `>= 2.6.0`
26
- * jruby `>= 9.3`
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
@@ -22,16 +22,16 @@ Gem::Specification.new do |spec|
22
22
  spec.require_paths = ["lib"]
23
23
 
24
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"
25
+ spec.metadata["changelog_uri"] = "https://github.com/dry-rb/dry-rails/blob/main/CHANGELOG.md"
26
26
  spec.metadata["source_code_uri"] = "https://github.com/dry-rb/dry-rails"
27
27
  spec.metadata["bug_tracker_uri"] = "https://github.com/dry-rb/dry-rails/issues"
28
28
 
29
- spec.required_ruby_version = ">= 2.6.0"
29
+ spec.required_ruby_version = ">= 2.7.0"
30
30
 
31
31
  # to update dependencies edit project.yml
32
- spec.add_runtime_dependency "dry-schema", "~> 1.7"
33
- spec.add_runtime_dependency "dry-system", "~> 0.21"
34
- spec.add_runtime_dependency "dry-validation", "~> 1.5"
32
+ spec.add_runtime_dependency "dry-schema", "~> 1.11", ">= 1.11.2"
33
+ spec.add_runtime_dependency "dry-system", "~> 0.27", ">= 0.27.2"
34
+ spec.add_runtime_dependency "dry-validation", "~> 1.9", ">= 1.9.0"
35
35
 
36
36
  spec.add_development_dependency "bundler"
37
37
  spec.add_development_dependency "rake"
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "dry/system/auto_registrar"
3
+ require "dry/system"
4
4
 
5
5
  module Dry
6
6
  module Rails
@@ -1,18 +1,19 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- Dry::System.register_component(:application_contract, provider: :rails) do
4
- init do
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,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- Dry::System.register_component(:controller_helpers, provider: :rails) do
4
- init do
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
 
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- Dry::System.register_component(:safe_params, provider: :rails) do
4
- init do
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
 
@@ -2,9 +2,7 @@
2
2
 
3
3
  require "rails/version"
4
4
 
5
- require "dry/system/container"
6
- require "dry/system/components"
7
-
5
+ require "dry/system"
8
6
  require "dry/rails/auto_registrars/app"
9
7
 
10
8
  module Dry
@@ -59,15 +57,13 @@ module Dry
59
57
  config.auto_registrar = Rails::AutoRegistrars::App
60
58
 
61
59
  class << self
62
- # Return if a given component was booted
60
+ # Return if a given component was started
63
61
  #
64
62
  # @return [Boolean]
65
63
  #
66
64
  # @api private
67
- #
68
- # TODO: this should be moved to dry-system
69
- def booted?(name)
70
- booter.booted.map(&:name).include?(name)
65
+ def started?(name)
66
+ providers[name].started?
71
67
  end
72
68
 
73
69
  # TODO: confirm that this is really needed
@@ -83,9 +79,9 @@ module Dry
83
79
  # @return [self]
84
80
  #
85
81
  # @api private
86
- def refresh_boot_files
87
- booter.boot_files.each do |boot_file|
88
- load(boot_file)
82
+ def refresh_provider_files
83
+ providers.provider_files.each do |boot_file|
84
+ ::Kernel.load(boot_file)
89
85
  end
90
86
  self
91
87
  end
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "dry/validation/contract"
3
+ require "dry/validation"
4
4
 
5
5
  module Dry
6
6
  module Rails
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "dry/schema/params"
3
+ require "dry/schema"
4
4
 
5
5
  module Dry
6
6
  module Rails
@@ -34,8 +34,7 @@ module Dry
34
34
  container = Dry::Rails.create_container(
35
35
  root: root_path,
36
36
  inflector: default_inflector,
37
- system_dir: root_path.join("config/system"),
38
- bootable_dirs: [root_path.join("config/system/boot")]
37
+ provider_dirs: [root_path.join("config/system/boot")]
39
38
  )
40
39
 
41
40
  # Enable :env plugin by default because it is a very common requirement
@@ -57,10 +56,10 @@ module Dry
57
56
  set_or_reload(container.auto_inject_constant, container.injector)
58
57
 
59
58
  container.features.each do |feature|
60
- container.boot(feature, from: :rails)
59
+ container.register_provider(feature, from: :rails)
61
60
  end
62
61
 
63
- container.refresh_boot_files if reloading?
62
+ container.refresh_provider_files if reloading?
64
63
 
65
64
  container.finalize!(freeze: !::Rails.env.test?)
66
65
  end
@@ -76,7 +75,7 @@ module Dry
76
75
  # @api public
77
76
  def stop_features
78
77
  container.features.each do |feature|
79
- container.stop(feature) if container.booted?(feature)
78
+ container.stop(feature) if container.started?(feature)
80
79
  end
81
80
  end
82
81
 
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Dry
4
4
  module Rails
5
- VERSION = "0.4.0"
5
+ VERSION = "0.6.0"
6
6
  end
7
7
  end
data/lib/dry/rails.rb CHANGED
@@ -1,10 +1,12 @@
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
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.0
4
+ version: 0.6.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: 2021-12-23 00:00:00.000000000 Z
11
+ date: 2022-10-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: dry-schema
@@ -16,42 +16,60 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '1.7'
19
+ version: '1.11'
20
+ - - ">="
21
+ - !ruby/object:Gem::Version
22
+ version: 1.11.2
20
23
  type: :runtime
21
24
  prerelease: false
22
25
  version_requirements: !ruby/object:Gem::Requirement
23
26
  requirements:
24
27
  - - "~>"
25
28
  - !ruby/object:Gem::Version
26
- version: '1.7'
29
+ version: '1.11'
30
+ - - ">="
31
+ - !ruby/object:Gem::Version
32
+ version: 1.11.2
27
33
  - !ruby/object:Gem::Dependency
28
34
  name: dry-system
29
35
  requirement: !ruby/object:Gem::Requirement
30
36
  requirements:
31
37
  - - "~>"
32
38
  - !ruby/object:Gem::Version
33
- version: '0.21'
39
+ version: '0.27'
40
+ - - ">="
41
+ - !ruby/object:Gem::Version
42
+ version: 0.27.2
34
43
  type: :runtime
35
44
  prerelease: false
36
45
  version_requirements: !ruby/object:Gem::Requirement
37
46
  requirements:
38
47
  - - "~>"
39
48
  - !ruby/object:Gem::Version
40
- version: '0.21'
49
+ version: '0.27'
50
+ - - ">="
51
+ - !ruby/object:Gem::Version
52
+ version: 0.27.2
41
53
  - !ruby/object:Gem::Dependency
42
54
  name: dry-validation
43
55
  requirement: !ruby/object:Gem::Requirement
44
56
  requirements:
45
57
  - - "~>"
46
58
  - !ruby/object:Gem::Version
47
- version: '1.5'
59
+ version: '1.9'
60
+ - - ">="
61
+ - !ruby/object:Gem::Version
62
+ version: 1.9.0
48
63
  type: :runtime
49
64
  prerelease: false
50
65
  version_requirements: !ruby/object:Gem::Requirement
51
66
  requirements:
52
67
  - - "~>"
53
68
  - !ruby/object:Gem::Version
54
- version: '1.5'
69
+ version: '1.9'
70
+ - - ">="
71
+ - !ruby/object:Gem::Version
72
+ version: 1.9.0
55
73
  - !ruby/object:Gem::Dependency
56
74
  name: bundler
57
75
  requirement: !ruby/object:Gem::Requirement
@@ -112,7 +130,6 @@ files:
112
130
  - lib/dry/rails/boot/application_contract.rb
113
131
  - lib/dry/rails/boot/controller_helpers.rb
114
132
  - lib/dry/rails/boot/safe_params.rb
115
- - lib/dry/rails/components.rb
116
133
  - lib/dry/rails/container.rb
117
134
  - lib/dry/rails/features/application_contract.rb
118
135
  - lib/dry/rails/features/controller_helpers.rb
@@ -124,7 +141,7 @@ licenses:
124
141
  - MIT
125
142
  metadata:
126
143
  allowed_push_host: https://rubygems.org
127
- changelog_uri: https://github.com/dry-rb/dry-rails/blob/master/CHANGELOG.md
144
+ changelog_uri: https://github.com/dry-rb/dry-rails/blob/main/CHANGELOG.md
128
145
  source_code_uri: https://github.com/dry-rb/dry-rails
129
146
  bug_tracker_uri: https://github.com/dry-rb/dry-rails/issues
130
147
  post_install_message:
@@ -135,7 +152,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
135
152
  requirements:
136
153
  - - ">="
137
154
  - !ruby/object:Gem::Version
138
- version: 2.6.0
155
+ version: 2.7.0
139
156
  required_rubygems_version: !ruby/object:Gem::Requirement
140
157
  requirements:
141
158
  - - ">="
@@ -1,8 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "dry/system"
4
-
5
- Dry::System.register_provider(
6
- :rails,
7
- boot_path: Pathname(__dir__).join("boot").realpath
8
- )