dry-system-rails 0.2.0 → 0.3.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: 90d51a08b5024e86dc3bf7af90b18b6f39a5d8f5bcc7cd219b57c0fac0a9670a
4
- data.tar.gz: 81e0a1be3b3b7bcfe394bf21bf4931b11250c8612af936766622eb98a1a88d1b
3
+ metadata.gz: 8e94b8a96ce984b5582bc41385cf819bf608a5001cc410e87cfe9fcf91699379
4
+ data.tar.gz: 6ef6f4145d23e5d4b66f00fb51e40eae586c43a0aa6020c2e4c329959fe63dca
5
5
  SHA512:
6
- metadata.gz: cfd84104666878865808a1df1b13bd331475a2422fd92b8a6fb05acbb214e5fcbbce6427661037facf186f2cadacf42b2879816408f56030f2aef557d22affe9
7
- data.tar.gz: 974009073ebe8cddc8ac6f61395e055257dedc90311fdcdf386ba0631b23d08abc2d09e569c193c795b90e48d455c07a6bd0d5a50e0b05579b454c008414996d
6
+ metadata.gz: 2a9dd12714f79ad6ebbbd180f7022c6a4758cc14ebd2415b73b676e7e99e185dc743f0c5ad21da285a77cb64822ccc71a95af93466f8b1b5a444a8ecbadfa59e
7
+ data.tar.gz: d32adcc4fb9d57a84884abeb25649068bfddbf763b198f270a486b04258e02f93102b3562bedadb4c667cf03fafeecfa3ba160295d0980f156e49d67b114f1a8
data/.travis.yml CHANGED
@@ -11,10 +11,9 @@ script:
11
11
  - bundle exec rake spec
12
12
  - RAILS_ENV=production bundle exec rspec --tag production_env
13
13
  rvm:
14
- - 2.6.2
14
+ - 2.6.3
15
15
  - 2.5.5
16
16
  - 2.4.6
17
- - 2.3.8
18
17
  - truffleruby
19
18
  matrix:
20
19
  allow_failures:
data/CHANGELOG.md CHANGED
@@ -1,3 +1,13 @@
1
+ # v0.3.0 2019-09-29
2
+
3
+ ### Changed
4
+
5
+ - Depend on dry-system 0.12.x (arielvalentin)
6
+ - Drop support for Ruby versions earlier than 2.4 (arielvalentin)
7
+ - Evaluate user-supplied `Dry::System::Rails.container { ... }` block before applying any standard behaviour (which includes accessing the container's config). This change makes it possible for the user to adjust the container's dry-configurable-provided settings, e.g. through using dry-system plugins that add their own settings (timriley)
8
+
9
+ [Compare v0.2.0...v0.3.0](https://github.com/dry-rb/dry-system/compare/v0.2.0...v0.3.0)
10
+
1
11
  # v0.2.0 2019-04-16
2
12
 
3
13
  ### Added
data/README.md CHANGED
@@ -24,7 +24,7 @@ gem 'dry-system-rails'
24
24
 
25
25
  ## Usage
26
26
 
27
- To configure auto-registration create `config/initializer/system.rb` with the following content:
27
+ To configure auto-registration create `config/initializers/system.rb` with the following content:
28
28
 
29
29
  ``` ruby
30
30
  Dry::System::Rails.container do
@@ -65,8 +65,9 @@ The Rails API is designed around the usage of class methods. If you choose to wr
65
65
  E.g. You have an object `CreateWidget` that needs to process widgets asynchronously with an `Widgets:NotificationJob` but you want to leverage dependency injection to decouple the components:
66
66
 
67
67
  ```ruby
68
- # config/initializer/system.rb
69
- Dry::System::Rails.configure do |config|
68
+ # config/initializers/system.rb
69
+ Dry::System::Rails.container do
70
+ # changes `self` to the container
70
71
  config.auto_register << 'lib'
71
72
  end
72
73
 
@@ -16,8 +16,9 @@ Gem::Specification.new do |spec|
16
16
  spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
17
17
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
18
18
  spec.require_paths = ['lib']
19
+ spec.required_ruby_version = '~> 2.4'
19
20
 
20
- spec.add_runtime_dependency 'dry-system', '~> 0.10'
21
+ spec.add_runtime_dependency 'dry-system', '~> 0.12'
21
22
 
22
23
  spec.add_development_dependency 'bundler'
23
24
  spec.add_development_dependency 'rake'
@@ -32,16 +32,18 @@ module Dry
32
32
  #
33
33
  # @api private
34
34
  def self.create_container(options = {})
35
- container = Class.new(Container).configure { |config|
36
- config.root = ::Rails.root
37
- config.system_dir = config.root.join('config/system')
38
- config.update(options)
35
+ container = Class.new(Container)
36
+
37
+ container.class_eval(&@container_block) if container_block
38
+
39
+ default_options = {
40
+ root: ::Rails.root,
41
+ system_dir: ::Rails.root.join('config/system'),
39
42
  }
43
+ container.config.update(default_options.merge(options))
40
44
 
41
45
  container.load_paths!('lib', 'app', 'app/models')
42
46
 
43
- container.class_eval(&@container_block) if container_block
44
-
45
47
  container
46
48
  end
47
49
 
@@ -3,7 +3,7 @@
3
3
  module Dry
4
4
  module System
5
5
  module Rails
6
- VERSION = '0.2.0'
6
+ VERSION = '0.3.0'
7
7
  end
8
8
  end
9
9
  end
@@ -3,6 +3,8 @@
3
3
  require 'dry/system/rails'
4
4
 
5
5
  Dry::System::Rails.container do
6
+ use :env, inferrer: -> { Rails.env.to_sym }
7
+
6
8
  config.auto_register << 'lib' << 'app/operations'
7
9
 
8
10
  auto_register!('app/workers') do |config|
@@ -0,0 +1,5 @@
1
+ RSpec.describe 'Using dry-system plugins' do
2
+ specify 'Using dry-system plugins (which add extra settings) inside the initializer container block' do
3
+ expect(Dummy::Container.env).to eq Rails.env.to_sym
4
+ end
5
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dry-system-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.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: 2019-04-16 00:00:00.000000000 Z
11
+ date: 2019-09-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: dry-system
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '0.10'
19
+ version: '0.12'
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: '0.10'
26
+ version: '0.12'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: bundler
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -119,6 +119,7 @@ files:
119
119
  - spec/dummy/config/system/boot/persistence.rb
120
120
  - spec/dummy/lib/mailer.rb
121
121
  - spec/dummy/log/.keep
122
+ - spec/integration/container/using_plugins_spec.rb
122
123
  - spec/integration/container_spec.rb
123
124
  - spec/integration/environments_spec.rb
124
125
  - spec/integration/models/user_repo_spec.rb
@@ -134,9 +135,9 @@ require_paths:
134
135
  - lib
135
136
  required_ruby_version: !ruby/object:Gem::Requirement
136
137
  requirements:
137
- - - ">="
138
+ - - "~>"
138
139
  - !ruby/object:Gem::Version
139
- version: '0'
140
+ version: '2.4'
140
141
  required_rubygems_version: !ruby/object:Gem::Requirement
141
142
  requirements:
142
143
  - - ">="
@@ -177,6 +178,7 @@ test_files:
177
178
  - spec/dummy/config/system/boot/persistence.rb
178
179
  - spec/dummy/lib/mailer.rb
179
180
  - spec/dummy/log/.keep
181
+ - spec/integration/container/using_plugins_spec.rb
180
182
  - spec/integration/container_spec.rb
181
183
  - spec/integration/environments_spec.rb
182
184
  - spec/integration/models/user_repo_spec.rb