dry-rails 0.4.0 → 0.5.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: b88e2e95f728750240e49d73821d025555aed6cc31d5d39174f6c57aebf6ce27
4
+ data.tar.gz: cabcb4d3fd5d5cf9501fe7949c7c909f40da0ca6a5603673785ae9b40ba04e00
5
5
  SHA512:
6
- metadata.gz: acd9f6bda792c65ee94b92d6e62ba286f33c2f3b4d7c01fa7f2b7818954fa61c52705686fa919091174ef6de8172d2dfb9b68077bf6f8a866a8fd19e10129290
7
- data.tar.gz: 8001793ca368b1dc0388cacd2610441082a22163ec209169194be1d84aaa1ad5b83b8b6d3d45ea395eac29b5e1bb532296a425dac1664de91675f74a47794a7b
6
+ metadata.gz: 175953e3194700744fb405d10684492e7986bbf163fd14cf95d9763ba03155ad97f5dba1998a192430b1b348e7a663ee5a46bc9e4b75a689feda72984be9b555
7
+ data.tar.gz: a6751d7aca04c9c6e4806e0f6cdaf2e0881c2ef88b7a9796650da2ee0408ba05d955324af704a96d17b5318e294e2de0e34c56d9727523ab2d90945502af533d
data/CHANGELOG.md CHANGED
@@ -1,5 +1,14 @@
1
1
  <!--- DO NOT EDIT THIS FILE - IT'S AUTOMATICALLY GENERATED VIA DEVTOOLS --->
2
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
+
3
12
  ## 0.4.0 2021-12-23
4
13
 
5
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,6 +24,7 @@ This is a big update - please also read dry-system [CHANGELOG](https://github.co
15
24
  ### Changed
16
25
 
17
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)
18
28
 
19
29
  [Compare v0.3.0...v0.4.0](https://github.com/dry-rb/dry-rails/compare/v0.3.0...v0.4.0)
20
30
 
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,7 +8,7 @@
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
14
  [![Inline docs](http://inch-ci.org/github/dry-rb/dry-rails.svg?branch=master)][inchpages]
@@ -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
@@ -26,11 +26,11 @@ Gem::Specification.new do |spec|
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
32
  spec.add_runtime_dependency "dry-schema", "~> 1.7"
33
- spec.add_runtime_dependency "dry-system", "~> 0.21"
33
+ spec.add_runtime_dependency "dry-system", "~> 0.23", ">= 0.23"
34
34
  spec.add_runtime_dependency "dry-validation", "~> 1.5"
35
35
 
36
36
  spec.add_development_dependency "bundler"
@@ -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
 
@@ -3,7 +3,7 @@
3
3
  require "rails/version"
4
4
 
5
5
  require "dry/system/container"
6
- require "dry/system/components"
6
+ require "dry/system/provider_sources"
7
7
 
8
8
  require "dry/rails/auto_registrars/app"
9
9
 
@@ -59,15 +59,13 @@ module Dry
59
59
  config.auto_registrar = Rails::AutoRegistrars::App
60
60
 
61
61
  class << self
62
- # Return if a given component was booted
62
+ # Return if a given component was started
63
63
  #
64
64
  # @return [Boolean]
65
65
  #
66
66
  # @api private
67
- #
68
- # TODO: this should be moved to dry-system
69
- def booted?(name)
70
- booter.booted.map(&:name).include?(name)
67
+ def started?(name)
68
+ providers[name].started?
71
69
  end
72
70
 
73
71
  # TODO: confirm that this is really needed
@@ -83,9 +81,9 @@ module Dry
83
81
  # @return [self]
84
82
  #
85
83
  # @api private
86
- def refresh_boot_files
87
- booter.boot_files.each do |boot_file|
88
- load(boot_file)
84
+ def refresh_provider_files
85
+ providers.provider_files.each do |boot_file|
86
+ ::Kernel.load(boot_file)
89
87
  end
90
88
  self
91
89
  end
@@ -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.5.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.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: 2021-12-23 00:00:00.000000000 Z
11
+ date: 2022-02-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: dry-schema
@@ -30,14 +30,20 @@ dependencies:
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '0.21'
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.21'
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,7 +140,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
135
140
  requirements:
136
141
  - - ">="
137
142
  - !ruby/object:Gem::Version
138
- version: 2.6.0
143
+ version: 2.7.0
139
144
  required_rubygems_version: !ruby/object:Gem::Requirement
140
145
  requirements:
141
146
  - - ">="
@@ -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
- )