piko-quick-lib 0.0.1

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.
Files changed (49) hide show
  1. checksums.yaml +7 -0
  2. data/dry-system-1.2.5/CHANGELOG.md +1311 -0
  3. data/dry-system-1.2.5/LICENSE +21 -0
  4. data/dry-system-1.2.5/README.md +17 -0
  5. data/dry-system-1.2.5/dry-system.gemspec +42 -0
  6. data/dry-system-1.2.5/lib/dry/system/auto_registrar.rb +45 -0
  7. data/dry-system-1.2.5/lib/dry/system/component.rb +190 -0
  8. data/dry-system-1.2.5/lib/dry/system/component_dir.rb +171 -0
  9. data/dry-system-1.2.5/lib/dry/system/config/component_dir.rb +228 -0
  10. data/dry-system-1.2.5/lib/dry/system/config/component_dirs.rb +285 -0
  11. data/dry-system-1.2.5/lib/dry/system/config/namespace.rb +75 -0
  12. data/dry-system-1.2.5/lib/dry/system/config/namespaces.rb +192 -0
  13. data/dry-system-1.2.5/lib/dry/system/constants.rb +13 -0
  14. data/dry-system-1.2.5/lib/dry/system/container.rb +685 -0
  15. data/dry-system-1.2.5/lib/dry/system/errors.rb +132 -0
  16. data/dry-system-1.2.5/lib/dry/system/identifier.rb +176 -0
  17. data/dry-system-1.2.5/lib/dry/system/importer.rb +144 -0
  18. data/dry-system-1.2.5/lib/dry/system/indirect_component.rb +63 -0
  19. data/dry-system-1.2.5/lib/dry/system/loader/autoloading.rb +24 -0
  20. data/dry-system-1.2.5/lib/dry/system/loader.rb +84 -0
  21. data/dry-system-1.2.5/lib/dry/system/magic_comments_parser.rb +31 -0
  22. data/dry-system-1.2.5/lib/dry/system/manifest_registrar.rb +57 -0
  23. data/dry-system-1.2.5/lib/dry/system/plugins/bootsnap.rb +47 -0
  24. data/dry-system-1.2.5/lib/dry/system/plugins/dependency_graph/strategies.rb +66 -0
  25. data/dry-system-1.2.5/lib/dry/system/plugins/dependency_graph.rb +53 -0
  26. data/dry-system-1.2.5/lib/dry/system/plugins/env.rb +30 -0
  27. data/dry-system-1.2.5/lib/dry/system/plugins/logging.rb +73 -0
  28. data/dry-system-1.2.5/lib/dry/system/plugins/monitoring/proxy.rb +51 -0
  29. data/dry-system-1.2.5/lib/dry/system/plugins/monitoring.rb +45 -0
  30. data/dry-system-1.2.5/lib/dry/system/plugins/notifications.rb +27 -0
  31. data/dry-system-1.2.5/lib/dry/system/plugins/plugin.rb +61 -0
  32. data/dry-system-1.2.5/lib/dry/system/plugins/zeitwerk/compat_inflector.rb +22 -0
  33. data/dry-system-1.2.5/lib/dry/system/plugins/zeitwerk.rb +109 -0
  34. data/dry-system-1.2.5/lib/dry/system/plugins.rb +70 -0
  35. data/dry-system-1.2.5/lib/dry/system/provider/source.rb +281 -0
  36. data/dry-system-1.2.5/lib/dry/system/provider/source_dsl.rb +55 -0
  37. data/dry-system-1.2.5/lib/dry/system/provider.rb +291 -0
  38. data/dry-system-1.2.5/lib/dry/system/provider_registrar.rb +289 -0
  39. data/dry-system-1.2.5/lib/dry/system/provider_source_registry.rb +67 -0
  40. data/dry-system-1.2.5/lib/dry/system/provider_sources/settings/config.rb +73 -0
  41. data/dry-system-1.2.5/lib/dry/system/provider_sources/settings/loader.rb +44 -0
  42. data/dry-system-1.2.5/lib/dry/system/provider_sources/settings.rb +40 -0
  43. data/dry-system-1.2.5/lib/dry/system/provider_sources.rb +6 -0
  44. data/dry-system-1.2.5/lib/dry/system/stubs.rb +39 -0
  45. data/dry-system-1.2.5/lib/dry/system/version.rb +7 -0
  46. data/dry-system-1.2.5/lib/dry/system.rb +62 -0
  47. data/dry-system-1.2.5/lib/dry-system.rb +3 -0
  48. data/piko-quick-lib.gemspec +11 -0
  49. metadata +87 -0
@@ -0,0 +1,1311 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
+ and this project adheres to [Break Versioning](https://www.taoensso.com/break-versioning).
7
+
8
+ ## [Unreleased]
9
+
10
+ [Unreleased]: https://github.com/dry-rb/dry-system/compare/v1.2.5...main
11
+
12
+ ## [1.2.5] - 2025-12-01
13
+
14
+ ### Fixed
15
+
16
+ - Pass through keyword arguments to monitored objects in `monitoring` plugin. (@yuszuv in #290)
17
+
18
+ [1.2.5]: https://github.com/dry-rb/dry-system/compare/v1.2.4...v1.2.5
19
+
20
+ ## [1.2.4] - 2025-08-14
21
+
22
+
23
+ ### Fixed
24
+
25
+ - Allow imported components to be lazy loaded when both strings and symbols are given as the
26
+ namespace to `Container.import` (@timriley in #287)
27
+
28
+
29
+ [Compare v1.2.3...v1.2.4](https://github.com/dry-rb/dry-system/compare/v1.2.3...v1.2.4)
30
+
31
+ ## [1.2.3] - 2025-07-29
32
+
33
+
34
+ ### Added
35
+
36
+ - Add :register after-hook to detect container key registration dynamically. (via #274, @alassek)
37
+
38
+ ### Fixed
39
+
40
+ - Re-register components from manifest registrars in apps that reload the container (e.g. when
41
+ using dry-rails and Rails development mode) (via #286, @alassek)
42
+
43
+ ### Changed
44
+
45
+ - :finalize after-hook now executes before container freeze to allow mutation. (via #274, @alassek)
46
+
47
+ [Compare v1.2.2...v1.2.3](https://github.com/dry-rb/dry-system/compare/v1.2.2...v1.2.3)
48
+
49
+ ## [1.2.2] - 2025-01-31
50
+
51
+
52
+ ### Fixed
53
+
54
+ - Syntax errors on 3.3.0 (@flash-gordon, see #284)
55
+
56
+
57
+ [Compare v1.2.1...v1.2.2](https://github.com/dry-rb/dry-system/compare/v1.2.1...v1.2.2)
58
+
59
+ ## [1.2.1] - 2025-01-08
60
+
61
+
62
+ ### Fixed
63
+
64
+ - `eager_load` was removed from `finalize!`. It was introduced with `true` by default that
65
+ wasn't the intention #281 (via #282) (@flash-gordon)
66
+
67
+
68
+ [Compare v1.2.0...v1.2.1](https://github.com/dry-rb/dry-system/compare/v1.2.0...v1.2.1)
69
+
70
+ ## [1.2.0] - 2025-01-07
71
+
72
+
73
+ ### Added
74
+
75
+ - Option to skip eager loading during finalize with `eager_load: false` (via #276) (@cllns)
76
+
77
+ ### Changed
78
+
79
+ - Update required Ruby version to 3.1 (@flash-gordon)
80
+
81
+ [Compare v1.1.1...v1.2.0](https://github.com/dry-rb/dry-system/compare/v1.1.1...v1.2.0)
82
+
83
+ ## [1.1.1] - 2024-11-03
84
+
85
+
86
+ ### Fixed
87
+
88
+ - Restore `ProviderRegistrar#find_and_load_provider` as an alias of `#[]`
89
+
90
+
91
+ [Compare v1.1.0...v1.1.1](https://github.com/dry-rb/dry-system/compare/v1.1.0...v1.1.1)
92
+
93
+ ## [1.1.0] - 2024-10-31
94
+
95
+
96
+
97
+ [Compare v1.1.0.beta2...v1.1.0](https://github.com/dry-rb/dry-system/compare/v1.1.0.beta2...v1.1.0)
98
+
99
+ ## [1.1.0.beta2] - 2024-09-25
100
+
101
+
102
+ ### Changed
103
+
104
+ - Allow provider sources to use a custom superclass. This requires a custom provider registrar
105
+ to be configured, with its own implementations of `#provider_source_class` (the superclass to
106
+ use) and `#provider_source_options` (custom initialization args to pass to the provider
107
+ source). (via #275) (@alassek, @timriley)
108
+
109
+ [Compare v1.1.0.beta1...v1.1.0.beta2](https://github.com/dry-rb/dry-system/compare/v1.1.0.beta1...v1.1.0.beta2)
110
+
111
+ ## [1.1.0.beta1] - 2024-07-03
112
+
113
+
114
+ ### Added
115
+
116
+ - Add `Dry::System::ProviderRegistrar#target_container`, to be passed when initializing
117
+ providers. By default this is an alias of `#container`. This allows for custom provider
118
+ registrars to override `#target_container` to provide a custom `#target` within providers.
119
+ An overridden value **MUST** still wrap the original `#target_container` to ensure components
120
+ are registered in the right place. (via #270) (@timriley)
121
+
122
+ ### Changed
123
+
124
+ - Make `Dry::System::ProviderRegistrar` public API (via #270) (@timriley)
125
+ - When registering a provider source, you can now provide a `provider_options:` hash of default
126
+ options for providers to be registered using that source. The one provider option currently
127
+ supported is `namespace:`. (via #271) (@timriley)
128
+ - Load providers when accessing them via `Dry::System::ProviderRegistrar#[]`. The previous,
129
+ behavior of `#[]` returning `nil` if a provider had not been explicitly loaded was a
130
+ potential source of confusion. Now `#[]` can serve as the one and only interface for fetching
131
+ a provider. (via #273) (@timriley)
132
+
133
+ [Compare v1.0.1...v1.1.0.beta1](https://github.com/dry-rb/dry-system/compare/v1.0.1...v1.1.0.beta1)
134
+
135
+ ## [1.0.1] - 2022-11-18
136
+
137
+
138
+ ### Changed
139
+
140
+ - Bumped dry-auto_inject dependency to its 1.0.0 final release (@solnic)
141
+
142
+ [Compare v1.0.0...v1.0.1](https://github.com/dry-rb/dry-system/compare/v1.0.0...v1.0.1)
143
+
144
+ ## [1.0.0] - 2022-11-18
145
+
146
+
147
+ ### Fixed
148
+
149
+ - Only use DidYouMean-integrated Error for Component loading failure (via #261) (@cllns + @solnic)
150
+
151
+ ### Changed
152
+
153
+ - This version uses dry-core 1.0 and dry-configurable 1.0 (@solnic + @flash-gordon)
154
+ - Raise error on import after finalize (via #254) (@timriley + @tak1n)
155
+ - Validate settings even if loader does not set value (via #246) (@oeoeaio)
156
+ - Remove all deprecated functionality and deprecation messages (via #255) (@timriley)
157
+ - Use main dry/monitor entrypoint for autoloading (via #257) (@timriley)
158
+ - Use dry-configurable 1.0 (via 43c79095ccf54c6251e825ae20c97a9415e78209) (@flash-gordon)
159
+ - Use dry-core 1.0 (via 3d0cf95aef120601e67f3e8fbbf16d004017d376) (@flash-gordon)
160
+ - Remove dry-container dependency and update to use `Dry::Core::Container` (via 2b76554e5925fc92614627d5c1e0a9177cecf12f) (@solnic)
161
+
162
+ [Compare v0.27.2...v1.0.0](https://github.com/dry-rb/dry-system/compare/v0.27.2...v1.0.0)
163
+
164
+ ## [0.27.2] - 2022-10-17
165
+
166
+
167
+ ### Fixed
168
+
169
+ - Removed remaining manual require left-overs (@solnic)
170
+
171
+
172
+ [Compare v0.27.1...v0.27.2](https://github.com/dry-rb/dry-system/compare/v0.27.1...v0.27.2)
173
+
174
+ ## [0.27.1] - 2022-10-15
175
+
176
+
177
+ ### Fixed
178
+
179
+ - Tweak for zeitwerk loader (@flash-gordon)
180
+
181
+
182
+ [Compare v0.27.0...v0.27.1](https://github.com/dry-rb/dry-system/compare/v0.27.0...v0.27.1)
183
+
184
+ ## [0.27.0] - 2022-10-15
185
+
186
+
187
+ ### Changed
188
+
189
+ - [BREAKING] Use zeitwerk for auto-loading dry-system (@flash-gordon + @solnic)
190
+
191
+ From now on you need to do `require "dry/system"` as it sets up its Zeitwerk loader and from
192
+ there, everything else will be auto-loaded.
193
+
194
+ [Compare v0.26.0...v0.27.0](https://github.com/dry-rb/dry-system/compare/v0.26.0...v0.27.0)
195
+
196
+ ## [0.26.0] - 2022-10-08
197
+
198
+
199
+ ### Changed
200
+
201
+ - Update dry-configurable dependency to 0.16.0 and make internal adjustments to suit (@timriley in #249)
202
+ - Remove now-unused concurrent-ruby gem dependency (@timriley in #250)
203
+
204
+ [Compare v0.25.0...v0.26.0](https://github.com/dry-rb/dry-system/compare/v0.25.0...v0.26.0)
205
+
206
+ ## [0.25.0] - 2022-07-10
207
+
208
+
209
+ ### Fixed
210
+
211
+ - Fix incorrect type in `ManifestRegistrar#finalize!` (@alassek)
212
+
213
+ ### Changed
214
+
215
+ - Import root components via `nil` import namespace (via #236) (@timriley)
216
+ - Allow deeper `Provider::Source` hierarchies (via #240) (@timriley + @solnic)
217
+ - Prefer local components when importing (via #241) (@timriley + @solnic)
218
+
219
+ [Compare v0.24.0...v0.25.0](https://github.com/dry-rb/dry-system/compare/v0.24.0...v0.25.0)
220
+
221
+ ## [0.24.0] -
222
+
223
+
224
+ ### Changed
225
+
226
+ - dry-struct depedency was removed (@flash-gordon)
227
+
228
+ [Compare v0.23.0...master](https://github.com/dry-rb/dry-system/compare/v0.23.0...master)
229
+
230
+ ## [0.23.0] - 2022-02-08
231
+
232
+ This is a major overhaul of bootable components (now known as “Providers”), and brings major advancements to other areas, including container imports and exports.
233
+
234
+ Deprecations are in place for otherwise breaking changes to commonly used parts of dry-system, though some breaking changes remain.
235
+
236
+ This prepares the way for dry-system 1.0, which will be released in the coming months.
237
+
238
+
239
+ ### Added
240
+
241
+ - Containers can configure specific components for export using `config.exports` (@timriley in #209).
242
+
243
+ ```ruby
244
+ class MyContainer < Dry::System::Container
245
+ configure do |config|
246
+ config.exports = %w[component_a component_b]
247
+ end
248
+ end
249
+ ```
250
+
251
+ Containers importing another container with configured exports will import only those components.
252
+
253
+ When importing a specific set of components (see the note in the “Changed” section below), only those components whose keys intersect with the configured exports will be imported.
254
+ - A `:zeitwerk` plugin, to set up [Zeitwerk](https://github.com/fxn/zeitwerk) and integrate it with your container configuration (@ianks and @timriley in #197, #222, 13f8c87, #223)
255
+
256
+ This makes it possible to enable Zeitwerk with a one-liner:
257
+
258
+ ```ruby
259
+ class MyContainer < Dry::System::Container
260
+ use :zeitwerk
261
+
262
+ configure do |config|
263
+ config.component_dirs.add "lib"
264
+ # ...
265
+ end
266
+ end
267
+ ```
268
+
269
+ The plugin makes a `Zeitwerk::Loader` instance available at `config.autoloader`, and then in an after-`:configure` hook, the plugin will set up the loader to work with all of your configured component dirs and their namespaces. It will also enable the `Dry::System::Loader::Autoloading` loader for all component dirs, plus disable those dirs from being added to the `$LOAD_PATH`.
270
+
271
+ The plugin accepts the following options:
272
+
273
+ - `loader:` - (optional) to use a pre-initialized loader, if required.
274
+ - `run_setup:` - (optional) a bool to determine whether to run `Zeitwerk::Loader#setup` as part of the after-`:configure` hook. This may be useful to disable in advanced cases when integrating with an externally managed loader.
275
+ - `eager_load:` - (optional) a bool to determine whether to run `Zeitwerk::Loader#eager_load` as part of an after-`:finalize` hook. When not provided, it will default to true if the `:env` plugin is enabled and the env is set to `:production`.
276
+ - `debug:` - (optional) a bool to set whether Zeitwerk should log to `$stdout`.
277
+ - New `Identifier#end_with?` and `Identifier#include?` predicates (@timriley in #219)
278
+
279
+ These are key segment-aware predicates that can be useful when checking components as part of container configuration.
280
+
281
+ ```ruby
282
+ identifier.key # => "articles.operations.create"
283
+
284
+ identifier.end_with?("create") # => true
285
+ identifier.end_with?("operations.create") # => true
286
+ identifier.end_with?("ate") # => false, not a whole segment
287
+ identifier.end_with?("nope") # => false, not part of the key at all
288
+
289
+ identifier.include?("operations") # => true
290
+ identifier.include?("articles.operations") # => true
291
+ identifier.include?("operations.create") # => true
292
+ identifier.include?("article") # false, not a whole segment
293
+ identifier.include?("update") # => false, not part of the key at all
294
+ ```
295
+ - An `instance` setting for component dirs allows simpler per-dir control over component instantiation (@timriley in #215)
296
+
297
+ This optional setting should be provided a proc that receives a single `Dry::System::Component` instance as an argument, and should return the instance for the given component.
298
+
299
+ ```ruby
300
+ configure do |config|
301
+ config.component_dirs.add "lib" do |dir|
302
+ dir.instance = proc do |component|
303
+ if component.identifier.include?("workers")
304
+ # Register classes for jobs
305
+ component.loader.constant(component)
306
+ else
307
+ # Otherwise register regular instances per default loader
308
+ component.loader.call(component)
309
+ end
310
+ end
311
+ end
312
+ end
313
+ ```
314
+
315
+ For complete control of component loading, you should continue to configure the component dir’s `loader` instead.
316
+ - A new `ComponentNotLoadableError` error and helpful message is raised when resolving a component and an unexpected class is defined in the component’s source file (@cllns in #217).
317
+
318
+ The error shows expected and found class names, and inflector configuration that may be required in the case of class names containing acronyms.
319
+
320
+ ### Fixed
321
+
322
+ - Registrations made in providers (by calling `register` inside a provider step) have all their registration options preserved (such as a block-based registration, or the `memoize:` option) when having their registration merged into the target container after the provider lifecycle steps complete (@timriley in #212).
323
+ - Providers can no longer implicitly re-start themselves while in the process of starting and cause an infinite loop (@timriley #213).
324
+
325
+ This was possible before when a provider resolved a component from the target container that auto-injected dependencies with container keys sharing the same base key as the provider name.
326
+
327
+ ### Changed
328
+
329
+ - “Bootable components” (also referred to in some places simply as “components”) have been renamed to “Providers” (@timriley in #200).
330
+
331
+ Register a provider with `Dry::System::Container.register_provider` (`Dry::System::Container.boot` has been deprecated):
332
+
333
+ ```ruby
334
+ MyContainer.register_provider(:mailer) do
335
+ # ...
336
+ end
337
+ ```
338
+ - Provider `init` lifecycle step has been deprecated and renamed to `prepare` (@timriley in #200).
339
+
340
+ ```ruby
341
+ MyContainer.reigster_provider(:mailer) do
342
+ # Rename `init` to `prepare`
343
+ prepare do
344
+ require "some/third_party/mailer"
345
+ end
346
+ end
347
+ ```
348
+ - Provider behavior is now backed by a class per provider, known as the “Provider source” (@timriley in #202).
349
+
350
+ The provider source class is created for each provider as a subclass of `Dry::System::Provider::Source`.
351
+
352
+ You can still register simple providers using the block-based DSL, but the class backing means you can share state between provider steps using regular instance variables:
353
+
354
+ ```ruby
355
+ MyContainer.reigster_provider(:mailer) do
356
+ prepare do
357
+ require "some/third_party/mailer"
358
+ @some_config = ThirdParty::Mailer::Config.new
359
+ end
360
+
361
+ start do
362
+ # Since the `prepare` step will always run before start, we can access
363
+ # @some_config here
364
+ register "mailer", ThirdParty::Mailer.new(@some_config)
365
+ end
366
+ end
367
+ ```
368
+
369
+ Inside this `register_provider` block, `self` is the source subclass itself, and inside each of the step blocks (i.e. `prepare do`), `self` will be the _instance_ of that provider source.
370
+
371
+ For more complex providers, you can define your own source subclass and register it directly with the `source:` option for `register_provider`. This allows you to more readily use standard arrangements for factoring your logic within a class, such as extraction to another method:
372
+
373
+ ```ruby
374
+ MyContainer.register_provider(:mailer, source: Class.new(Dry::System::Provider::Source) {
375
+ # The provider lifecycle steps are ordinary methods
376
+ def prepare
377
+ end
378
+
379
+ def start
380
+ mailer = some_complex_logic_to_build_the_mailer(some: "config")
381
+ register(:mailer, mailer)
382
+ end
383
+
384
+ private
385
+
386
+ def some_complex_logic_to_build_the_mailer(**options)
387
+ # ...
388
+ end
389
+ })
390
+ ```
391
+ - The block argument to `Dry::System::Container.register_provider` (previously `.boot`) has been deprecated. (@timriley in #202).
392
+
393
+ This argument was used to give you access to the provider's target container (i.e. the container on which you were registering the provider).
394
+
395
+ To access the target container, you can use `#target_container` (or `#target` as a convenience alias) instead.
396
+
397
+ You can also access the provider's own container (which is where the provider's components are registered when you call `register` directly inside a provider step) as `#provider_container` (or `#container` as a convenience alias).
398
+ - `use(provider_name)` inside a provider step has been deprecated. Use `target_container.start(provider_name)` instead (@timriley in #211 and #224)
399
+
400
+ Now that you can access `target_container` consistently within all provider steps, you can use it to also start any other providers as you require without any special additional method. This also allows you to invoke other provider lifecycle steps, like `target_container.prepare(provider_name)`.
401
+ - `method_missing`-based delegation within providers to target container registrations has been removed (**BREAKING**) (@timriley in #202)
402
+
403
+ Delegation to registrations with the provider's own container has been kept, since it can be a convenient way to access registrations made in a prior lifecycle step:
404
+
405
+ ```ruby
406
+ MyContainer.register_provider(:mailer, namespace: true) do
407
+ prepare do
408
+ register :config, "mailer config here"
409
+ end
410
+
411
+ start do
412
+ config # => "mailer config here"
413
+ end
414
+ end
415
+ ```
416
+ - The previous "external component" and "provider" concepts have been renamed to "external provider sources", in keeping with the new provider terminology outlined above (@timriley in #200 and #202).
417
+
418
+ You can register a collection of external provider sources defined in their own source files via `Dry::System.register_provider_sources` (`Dry::System.register_provider` has been deprecated):
419
+
420
+ ```ruby
421
+ require "dry/system"
422
+
423
+ Dry::System.register_provider_sources(path)
424
+ ```
425
+
426
+ You can register an individual external provider source via `Dry::System.register_provider_source` (`Dry::System.register_component` has been deprecated):
427
+
428
+ ```ruby
429
+ Dry::System.register_provider_source(:something, group: :my_gem) do
430
+ start do
431
+ # ...
432
+ end
433
+ end
434
+ ```
435
+
436
+ Just like providers, you can also register a class as an external provider source:
437
+
438
+ ```ruby
439
+ module MyGem
440
+ class MySource < Dry::System::Provider::Source
441
+ def start
442
+ # ...
443
+ end
444
+ end
445
+ end
446
+
447
+ Dry::System.register_provider_source(:something, group: :my_gem, source: MyGem::MySource)
448
+ ```
449
+
450
+ The `group:` argument when registering an external provider sources is for preventing name clashes between provider sources. You should use an underscored version of your gem name or namespace when registering your own provider sources.
451
+ - Registering a provider using an explicitly named external provider source via `key:` argument is deprecated, use the `source:` argument instead (@timriley in #202).
452
+
453
+ You can register a provider using the same name as an external provider source by specifying the `from:` argument only, as before:
454
+
455
+ ```ruby
456
+ # Elsewhere
457
+ Dry::System.register_provider_source(:something, group: :my_gem) { ... }
458
+
459
+ # In your app:
460
+ MyContainer.register_provider(:something, from: :my_gem)
461
+ ```
462
+
463
+ When you wish the name your provider differently, this is when you need to use the `source:` argument:
464
+
465
+ ```ruby
466
+ MyContainer.register_provider(:differently_named, from: :my_gem, source: :something)
467
+ ```
468
+
469
+ When you're registering a provider using an external provider source, you cannot provie your own `Dry::System::Provider::Source` subclass as the `source:`, since that source class is being provided by the external provider source.
470
+ - Provider source settings are now defined using dry-configurable’s `setting` API at the top-level scope (@timriley in #202).
471
+
472
+ Use the top-level `setting` method to define your settings (the `settings` block and settings defined inside the block using `key` is deprecated). Inside the provider steps, the configured settings can be accessed as `config`:
473
+
474
+ ```ruby
475
+ # In the external provider source
476
+ Dry::System.register_provider_source(:something, group: :my_gem) do
477
+ setting :my_option
478
+
479
+ start do
480
+ # Do something with `config.my_option` here
481
+ end
482
+ end
483
+ ```
484
+
485
+ When using an external provider source, configure the source via the `#configure`:
486
+
487
+ ```ruby
488
+ # In your application's provider using the external source
489
+ MyContainer.register_provider(:something, from: :my_gem) do
490
+ configure do |config|
491
+ config.my_option = "some value"
492
+ end
493
+ end
494
+ ```
495
+
496
+ To provide default values and type checking or constraints for your settings, use the dry-configurable’s `default:` and `constructor:` arguments:
497
+
498
+ ```ruby
499
+ # Constructor can take any proc being passed the provided value
500
+ setting :my_option, default: "hello", constructor: -> (v) { v.to_s.upcase }
501
+
502
+ # Constructor will also work with dry-types objects
503
+ setting :my_option, default: "hello", constructor: Types::String.constrained(min_size: 3)
504
+ ```
505
+ - External provider sources can define their own methods for use by the providers alongside lifecycle steps (@timriley in #202).
506
+
507
+ Now that provider sources are class-backed, external provider sources can define their own methods to be made available when that provider source is used. This makes it possible to define your own extended API for interacting with the provider source:
508
+
509
+ ```ruby
510
+ # In the external provider source
511
+
512
+ module MyGem
513
+ class MySource < Dry::System::Provider::Source
514
+ # Standard lifecycle steps
515
+ def start
516
+ # Do something with @on_start here
517
+ end
518
+
519
+ # Custom behavior available when this provider source is used in a provider
520
+ def on_start(&block)
521
+ @on_start = block
522
+ end
523
+ end
524
+ end
525
+
526
+ Dry::System.register_provider_source(:something, group: :my_gem, source: MyGem::MySource)
527
+
528
+ # In your application's provider using the external source
529
+
530
+ MyContainer.register_provider(:something, from: :my_gem) do
531
+ # Use the custom method!
532
+ on_start do
533
+ # ...
534
+ end
535
+ end
536
+ ```
537
+ - Providers can be registered conditionally using the `if:` option (@timriley in #218).
538
+
539
+ You should provide a simple truthy or falsey value to `if:`, and in the case of falsey value, the provider will not be registered.
540
+
541
+ This is useful in cases where you have providers that are loaded explicitly for specific runtime configurations of your app (e.g. when they are needed for specific tasks or processes only), but you do not need them for your primaary app process, for which you may finalize your container.
542
+ - `bootable_dirs` container setting has been deprecated and replaced by `provider_dirs` (@timriley in #200).
543
+
544
+ The default value for `provider_dirs` is now `"system/providers`".
545
+ - Removed the unused `system_dir` container setting (**BREAKING**) (@timriley in #200)
546
+
547
+ If you’ve configured this inside your container, you can remove it.
548
+ - dry-system’s first-party external provider sources now available via `require "dry/system/provider_sources"`, with the previous `require "dry/system/components"` deprecated (@timriley in #202).
549
+ - When using registering a provider using a first-party dry-system provider source, `from: :dry_system` instead of `from: :system` (which is now deprecated) (@timriley in #202).
550
+
551
+ ```ruby
552
+ MyContainer.register_provider(:settings, from: :dry_system) do
553
+ # ...
554
+ end
555
+ - When registering a provider using the `:settings` provider source, settings are now defined using `setting` inside a `settings` block, rather than `key`, which is deprecated (@timriley in #202).
556
+
557
+ This `setting` method uses the dry-configurable setting API:
558
+
559
+ ```ruby
560
+ MyContainer.register_provider(:settings, from: :dry_system) do
561
+ settings do
562
+ # Previously:
563
+ # key :my_int_setting, MyTypes::Coercible::Integer
564
+
565
+ # Now:
566
+ setting :my_setting, default: 0, constructor: MyTypes::Coercible::Integer
567
+ end
568
+ end
569
+ ```
570
+ - The `:settings` provider source now requires the dotenv gem to load settings from `.env*` files (**BREAKING**) (@timriley in #204)
571
+
572
+ To ensure you can load your settings from these `.env*` files, add `gem "dotenv"` to your `Gemfile`.
573
+ - `Dry::System::Container` can be now be configured direclty using the setting writer methods on the class-level `.config` object, without going the `.configure(&block)` API (@timriley in #207).
574
+
575
+ If configuring via the class-level `.config` object, you should call `.configured!` after you're completed your configuration, which will finalize (freeze) the `config` object and then run any after-`:configure` hooks.
576
+ - `Dry::System::Container.configure(&block)` will now finalize (freeze) the `config` object by default, before returning (@timriley in #207).
577
+
578
+ You can opt out of this behavior by passing the `finalize_config: false` option:
579
+
580
+ ```ruby
581
+ class MyContainer < Dry::System::Container
582
+ configure(finalize_config: false) do |config|
583
+ # ...
584
+ end
585
+
586
+ # `config` is still non-finalized here
587
+ end
588
+ ```
589
+ - `Dry::System::Container.finalize!` will call `.configured!` (if it has not yet been called) before doing its work (@timriley in #207)
590
+
591
+ This ensures config finalization is an intrinsic part of the overall container finalization process.
592
+ - The `Dry::System::Container` `before(:configure)` hook has been removed (**BREAKING**) (@timriley in #207).
593
+
594
+ This was previously used for plugins to register their own settings, but this was not necessary given that plugins are modules, and can use their ordinary `.extended(container_class)` hook to register their settings. Essentially, any time after container subclass definition is "before configure" in nature.
595
+ - Container plugins should define their settings on the container using their module `.extended` hook, no longer in a `before(:configure)` hook (as above) (**BREAKING**) (@timriley in #207).
596
+
597
+ This ensures the plugin settings are available immediately after you’ve enabled the plugin via `Dry::System::Container.use`.
598
+ - The `Dry::System::Container` key `namespace_separator` setting is no longer expected to be user-configured. A key namespace separator of "." is hard-coded and expected to remain the separator string. (@timriley in #206)
599
+ - Containers can import a specific subset of another container’s components via changes to `.import`, which is now `.import(keys: nil, from:, as:)` (with prior API deprecated) (@timriley in #209)
600
+
601
+ To import specific components:
602
+
603
+ ```ruby
604
+ class MyContainer < Dry::System::Container
605
+ # config, etc.
606
+
607
+ # Will import components with keys "other.component_a", "other.component_b"
608
+ import(
609
+ keys: %w[component_a component_b],
610
+ from: OtherContainer,
611
+ as: :other
612
+ )
613
+ ```
614
+
615
+ Omitting `keys:` will import all the components available from the other container.
616
+ - Components imported into a container from another will be protected from subsequent export unless explicitly configured in `config.exports` (@timriley in #209)
617
+
618
+ Imported components are considered “private” by default because they did not originate in container that imported them.
619
+
620
+ This ensures there are no redundant imports in arrangements where multiple all containers import a common “base” container, and then some of those containers then import each other.
621
+ - Container imports are now made without finalizing the exporting container in most cases, ensuring more efficient imports (@timriley in #209)
622
+
623
+ Now, the only time the exporting container will be finalized is when a container is importing all components, and the exporting container has not declared any components in `config.exports`.
624
+ - [Internal] The `manual_registrar` container setting and associated `ManualRegistrar` class have been renamed to `manifest_registrar` and `ManifestRegistrar` respectively (**BREAKING**) (@timriley in #208).
625
+ - The default value for the container `registrations_dir` setting has been changed from `"container"` to `"system/registrations"` (**BREAKING**) (@timriley in #208)
626
+ - The `:dependency_graph` plugin now supports all dry-auto_inject injector strategies (@davydovanton and @timriley in #214)
627
+
628
+ [Compare v0.22.0...v0.23.0](https://github.com/dry-rb/dry-system/compare/v0.22.0...v0.23.0)
629
+
630
+ ## [0.22.0] - 2022-01-06
631
+
632
+
633
+ ### Added
634
+
635
+ - Expanded public interfaces for `Dry::System::Config::ComponentDirs` and `Dry::System::Config::Namespaces` to better support programmatic construction and inspection of these configs (@timriley in #195)
636
+
637
+ ### Changed
638
+
639
+ - Deprecated `Dry::System::Config::Namespaces#root` as the way to add and configure a root namespace. Use `#add_root` instead (@timriley in #195)
640
+ - Allow bootsnap plugin to use bootsnap on Ruby versions up to 3.0 (pusewicz in #196)
641
+
642
+ [Compare v0.21.0...v0.22.0](https://github.com/dry-rb/dry-system/compare/v0.21.0...v0.22.0)
643
+
644
+ ## [0.21.0] - 2021-11-01
645
+
646
+
647
+ ### Added
648
+
649
+ - Added **component dir namespaces** as a way to specify multiple, ordered, independent namespace rules within a given component dir. This replaces and expands upon the namespace support we previously provided via the singular `default_namespace` component dir setting (@timriley in #181)
650
+
651
+ ### Changed
652
+
653
+ - `default_namespace` setting on component dirs has been deprecated. Add a component dir namespace instead, e.g. instead of:
654
+
655
+ ```ruby
656
+ # Inside Dry::System::Container.configure
657
+ config.component_dirs.add "lib" do |dir|
658
+ dir.default_namespace = "admin"
659
+ end
660
+ ```
661
+
662
+ Add this:
663
+
664
+ ```ruby
665
+ config.component_dirs.add "lib" do |dir|
666
+ dir.namespaces.add "admin", key: nil
667
+ end
668
+ ```
669
+
670
+ (@timriley in #181)
671
+ - `Dry::System::Component#path` has been removed and replaced by `Component#require_path` and `Component#const_path` (@timriley in #181)
672
+ - Unused `Dry::System::FileNotFoundError` and `Dry::System::InvalidComponentIdentifierTypeError` errors have been removed (@timriley in #194)
673
+ - Allow bootsnap for Rubies up to 3.0.x (via #196) (@pusewicz)
674
+
675
+ [Compare v0.20.0...v0.21.0](https://github.com/dry-rb/dry-system/compare/v0.20.0...v0.21.0)
676
+
677
+ ## [0.20.0] - 2021-09-12
678
+
679
+
680
+ ### Fixed
681
+
682
+ - Fixed dependency graph plugin to work with internal changes introduced in 0.19.0 (@wuarmin in #173)
683
+ - Fixed behavior of `Dry::System::Identifier#start_with?` for components identified by a single segment, or if all matching segments are provided (@wuarmin in #177)
684
+ - Fixed compatibility of `finalize!` signature provided in `Container::Stubs` (@mpokrywka in #178)
685
+
686
+ ### Changed
687
+
688
+ - [internal] Upgraded to new `setting` API provided in dry-configurable 0.13.0 (@timriley in #179)
689
+
690
+ [Compare v0.19.2...v0.20.0](https://github.com/dry-rb/dry-system/compare/v0.19.2...v0.20.0)
691
+
692
+ ## [0.19.2] - 2021-08-30
693
+
694
+
695
+ ### Changed
696
+
697
+ - [internal] Improved compatibility with upcoming dry-configurable 0.13.0 release (@timriley in #186)
698
+
699
+ [Compare v0.18.2...v0.19.2](https://github.com/dry-rb/dry-system/compare/v0.18.2...v0.19.2)
700
+
701
+ ## [0.18.2] - 2021-08-30
702
+
703
+
704
+ ### Changed
705
+
706
+ - [internal] Improved compatibility with upcoming dry-configurable 0.13.0 release (@timriley in #187)
707
+
708
+ [Compare v0.19.1...v0.18.2](https://github.com/dry-rb/dry-system/compare/v0.19.1...v0.18.2)
709
+
710
+ ## [0.19.1] - 2021-07-11
711
+
712
+
713
+ ### Fixed
714
+
715
+ - Check for registered components (@timriley in #175)
716
+
717
+
718
+ [Compare v0.19.0...v0.19.1](https://github.com/dry-rb/dry-system/compare/v0.19.0...v0.19.1)
719
+
720
+ ## [0.19.0] - 2021-04-22
721
+
722
+ This release marks a huge step forward for dry-system, bringing support for Zeitwerk and other autoloaders, plus clearer configuration and improved consistency around component resolution for both finalized and lazy loading containers. [Read the announcement post](https://dry-rb.org/news/2021/04/22/dry-system-0-19-released-with-zeitwerk-support-and-more-leading-the-way-for-hanami-2-0/) for a high-level tour of the new features.
723
+
724
+ ### Added
725
+
726
+ - New `component_dirs` setting on `Dry::System::Container`, which must be used for specifying the directories which dry-system will search for component source files.
727
+
728
+ Each added component dir is relative to the container's `root`, and can have its own set of settings configured:
729
+
730
+ ```ruby
731
+ class MyApp::Container < Dry::System::Container
732
+ configure do |config|
733
+ config.root = __dir__
734
+
735
+ # Defaults for all component dirs can be configured separately
736
+ config.component_dirs.auto_register = true # default is already true
737
+
738
+ # Component dirs can be added and configured independently
739
+ config.component_dirs.add "lib" do |dir|
740
+ dir.add_to_load_path = true # defaults to true
741
+ dir.default_namespace = "my_app"
742
+ end
743
+
744
+ # All component dir settings are optional. Component dirs relying on default
745
+ # settings can be added like so:
746
+ config.component_dirs.add "custom_components"
747
+ end
748
+ end
749
+ ```
750
+
751
+ The following settings are available for configuring added `component_dirs`:
752
+
753
+ - `auto_register`, a boolean, or a proc accepting a `Dry::System::Component` instance and returning a truthy or falsey value. Providing a proc allows an auto-registration policy to apply on a per-component basis
754
+ - `add_to_load_path`, a boolean
755
+ - `default_namespace`, a string representing the leading namespace segments to be stripped from the component's identifier (given the identifier is derived from the component's fully qualified class name)
756
+ - `loader`, a custom replacement for the default `Dry::System::Loader` to be used for the component dir
757
+ - `memoize`, a boolean, to enable/disable memoizing all components in the directory, or a proc accepting a `Dry::System::Component` instance and returning a truthy or falsey value. Providing a proc allows a memoization policy to apply on a per-component basis
758
+
759
+ _All component dir settings are optional._
760
+
761
+ (@timriley in #155, #157, and #162)
762
+ - A new autoloading-friendly `Dry::System::Loader::Autoloading` is available, which is tested to work with [Zeitwerk](https://github.com/fxn/zeitwerk) 🎉
763
+
764
+ Configure this on the container (via a component dir `loader` setting), and the loader will no longer `require` any components, instead allowing missing constant resolution to trigger the loading of the required file.
765
+
766
+ This loader presumes an autoloading system like Zeitwerk has already been enabled and appropriately configured.
767
+
768
+ A recommended setup is as follows:
769
+
770
+ ```ruby
771
+ require "dry/system/container"
772
+ require "dry/system/loader/autoloading"
773
+ require "zeitwerk"
774
+
775
+ class MyApp::Container < Dry::System::Container
776
+ configure do |config|
777
+ config.root = __dir__
778
+
779
+ config.component_dirs.loader = Dry::System::Loader::Autoloading
780
+ config.component_dirs.add_to_load_path = false
781
+
782
+ config.component_dirs.add "lib" do |dir|
783
+ # ...
784
+ end
785
+ end
786
+ end
787
+
788
+ loader = Zeitwerk::Loader.new
789
+ loader.push_dir MyApp::Container.config.root.join("lib").realpath
790
+ loader.setup
791
+ ```
792
+
793
+ (@timriley in #153)
794
+ - [BREAKING] `Dry::System::Component` instances (which users of dry-system will interact with via custom loaders, as well as via the `auto_register` and `memoize` component dir settings described above) now return a `Dry::System::Identifier` from their `#identifier` method. The raw identifier string may be accessed via the identifier's own `#key` or `#to_s` methods. `Identifier` also provides a helpful namespace-aware `#start_with?` method for returning whether the identifier begins with the provided namespace(s) (@timriley in #158)
795
+
796
+ ### Changed
797
+
798
+ - Components with `# auto_register: false` magic comments in their source files are now properly ignored when lazy loading (@timriley in #155)
799
+ - `# memoize: true` and `# memoize: false` magic comments at top of component files are now respected (@timriley in #155)
800
+ - [BREAKING] `Dry::System::Container.load_paths!` has been renamed to `.add_to_load_path!`. This method now exists as a mere convenience only. Calling this method is no longer required for any configured `component_dirs`; these are now added to the load path automatically (@timriley in #153 and #155)
801
+ - [BREAKING] `auto_register` container setting has been removed. Configured directories to be auto-registered by adding `component_dirs` instead (@timriley in #155)
802
+ - [BREAKING] `default_namespace` container setting has been removed. Set it when adding `component_dirs` instead (@timriley in #155)
803
+ - [BREAKING] `loader` container setting has been nested under `component_dirs`, now available as `component_dirs.loader` to configure a default loader for all component dirs, as well as on individual component dirs when being added (@timriley in #162)
804
+ - [BREAKING] `Dry::System::ComponentLoadError` is no longer raised when a component could not be lazy loaded; this was only raised in a single specific failure condition. Instead, a `Dry::Container::Error` is raised in all cases of components failing to load (@timriley in #155)
805
+ - [BREAKING] `Dry::System::Container.auto_register!` has been removed. Configure `component_dirs` instead. (@timriley in #157)
806
+ - [BREAKING] The `Dry::System::Loader` interface has changed. It is now a static interface, no longer initialized with a component. The component is instead passed to each method as an argument: `.require!(component)`, `.call(component, *args)`, `.constant(component)` (@timriley in #157)
807
+ - [BREAKING] `Dry::System::Container.require_path` has been removed. Provide custom require behavior by configuring your own `loader` (@timriley in #153)
808
+
809
+ [Compare v0.18.1...v0.19.0](https://github.com/dry-rb/dry-system/compare/v0.18.1...v0.19.0)
810
+
811
+ ## [0.18.1] - 2020-08-26
812
+
813
+
814
+ ### Fixed
815
+
816
+ - Made `Booter#boot_files` a public method again, since it was required by dry-rails (@timriley)
817
+
818
+
819
+ [Compare v0.18.0...v0.18.1](https://github.com/dry-rb/dry-system/compare/v0.18.0...v0.18.1)
820
+
821
+ ## [0.18.0] - 2020-08-24
822
+
823
+
824
+ ### Added
825
+
826
+ - New `bootable_dirs` setting on `Dry::System::Container`, which accepts paths to multiple directories for looking up bootable component files. (@timriley in PR #151)
827
+
828
+ For each entry in the `bootable_dirs` array, relative directories will be appended to the container's `root`, and absolute directories will be left unchanged.
829
+
830
+ When searching for bootable files, the first match will win, and any subsequent same-named files will not be loaded. In this way, the `bootable_dirs` act similarly to the `$PATH` in a shell environment.
831
+
832
+
833
+ [Compare v0.17.0...v0.18.0](https://github.com/dry-rb/dry-system/compare/v0.17.0...v0.18.0)
834
+
835
+ ## [0.17.0] - 2020-02-19
836
+
837
+
838
+ ### Fixed
839
+
840
+ - Works with the latest dry-configurable version (issue #141) (@solnic)
841
+
842
+ ### Changed
843
+
844
+ - Depends on dry-configurable `=> 0.11.1` now (@solnic)
845
+
846
+ [Compare v0.16.0...v0.17.0](https://github.com/dry-rb/dry-system/compare/v0.16.0...v0.17.0)
847
+
848
+ ## [0.16.0] - 2020-02-15
849
+
850
+
851
+ ### Changed
852
+
853
+ - Plugins can now define their own settings which are available in the `before(:configure)` hook (@solnic)
854
+ - Dependency on dry-configurable was bumped to `~> 0.11` (@solnic)
855
+
856
+ [Compare v0.15.0...v0.16.0](https://github.com/dry-rb/dry-system/compare/v0.15.0...v0.16.0)
857
+
858
+ ## [0.15.0] - 2020-01-30
859
+
860
+
861
+ ### Added
862
+
863
+ - New hook - `before(:configure)` which a plugin should use if it needs to declare new settings (@solnic)
864
+
865
+ ```ruby
866
+ # in your plugin code
867
+ before(:configure) { setting :my_new_setting }
868
+
869
+ after(:configure) { config.my_new_setting = "awesome" }
870
+ ```
871
+
872
+
873
+ ### Changed
874
+
875
+ - Centralize error definitions in `lib/dry/system/errors.rb` (@cgeorgii)
876
+ - All built-in plugins use `before(:configure)` now to declare their settings (@solnic)
877
+
878
+ [Compare v0.14.1...v0.15.0](https://github.com/dry-rb/dry-system/compare/v0.14.1...v0.15.0)
879
+
880
+ ## [0.14.1] - 2020-01-22
881
+
882
+
883
+ ### Changed
884
+
885
+ - Use `Kernel.require` explicitly to avoid issues with monkey-patched `require` from ActiveSupport (@solnic)
886
+
887
+ [Compare v0.14.0...v0.14.1](https://github.com/dry-rb/dry-system/compare/v0.14.0...v0.14.1)
888
+
889
+ ## [0.14.0] - 2020-01-21
890
+
891
+
892
+ ### Fixed
893
+
894
+ - Misspelled plugin name raises meaningful error (issue #132) (@cgeorgii)
895
+ - Fail fast if auto_registrar config contains incorrect path (@cutalion)
896
+
897
+
898
+ [Compare v0.13.2...v0.14.0](https://github.com/dry-rb/dry-system/compare/v0.13.2...v0.14.0)
899
+
900
+ ## [0.13.2] - 2019-12-28
901
+
902
+
903
+ ### Fixed
904
+
905
+ - More keyword warnings (flash-gordon)
906
+
907
+
908
+ [Compare v0.13.1...v0.13.2](https://github.com/dry-rb/dry-system/compare/v0.13.1...v0.13.2)
909
+
910
+ ## [0.13.1] - 2019-11-07
911
+
912
+
913
+ ### Fixed
914
+
915
+ - Fixed keyword warnings reported by Ruby 2.7 (flash-gordon)
916
+ - Duplicates in `Dry::System::Plugins.loaded_dependencies` (AMHOL)
917
+
918
+
919
+ [Compare v0.13.0...v0.13.1](https://github.com/dry-rb/dry-system/compare/v0.13.0...v0.13.1)
920
+
921
+ ## [0.13.0] - 2019-10-13
922
+
923
+
924
+ ### Added
925
+
926
+ - `Container.resolve` accepts and optional block parameter which will be called if component cannot be found. This makes dry-system consistent with dry-container 0.7.2 (flash-gordon)
927
+ ```ruby
928
+ App.resolve('missing.dep') { :fallback } # => :fallback
929
+ ```
930
+
931
+ ### Changed
932
+
933
+ - [BREAKING] `Container.key?` triggers lazy-loading for not finalized containers. If component wasn't found it returns `false` without raising an error. This is a breaking change, if you seek the previous behavior, use `Container.registered?` (flash-gordon)
934
+
935
+ [Compare v0.12.0...v0.13.0](https://github.com/dry-rb/dry-system/compare/v0.12.0...v0.13.0)
936
+
937
+ ## [0.12.0] - 2019-04-24
938
+
939
+
940
+ ### Changed
941
+
942
+ - Compatibility with dry-struct 1.0 and dry-types 1.0 (flash-gordon)
943
+
944
+ [Compare v0.11.0...v0.12.0](https://github.com/dry-rb/dry-system/compare/v0.11.0...v0.12.0)
945
+
946
+ ## [0.11.0] - 2019-03-22
947
+
948
+
949
+ ### Changed
950
+
951
+ - [BREAKING] `:decorate` plugin was moved from dry-system to dry-container (available in 0.7.0+). To upgrade remove `use :decorate` and change `decorate` calls from `decorate(key, decorator: something)` to `decorate(key, with: something)` (flash-gordon)
952
+ - [internal] Compatibility with dry-struct 0.7.0 and dry-types 0.15.0
953
+
954
+ [Compare v0.10.1...v0.11.0](https://github.com/dry-rb/dry-system/compare/v0.10.1...v0.11.0)
955
+
956
+ ## [0.10.1] - 2018-07-05
957
+
958
+
959
+ ### Added
960
+
961
+ - Support for stopping bootable components with `Container.stop(component_name)` (GustavoCaso)
962
+
963
+ ### Fixed
964
+
965
+ - When using a non-finalized container, you can now resolve multiple different container objects registered using the same root key as a bootable component (timriley)
966
+
967
+
968
+ [Compare v0.10.0...v0.10.1](https://github.com/dry-rb/dry-system/compare/v0.10.0...v0.10.1)
969
+
970
+ ## [0.10.0] - 2018-06-07
971
+
972
+
973
+ ### Added
974
+
975
+ - You can now set a custom inflector on the container level. As a result, the `Loader`'s constructor accepts two arguments: `path` and `inflector`, update your custom loaders accordingly (flash-gordon)
976
+
977
+ ```ruby
978
+ class MyContainer < Dry::System::Container
979
+ configure do |config|
980
+ config.inflector = Dry::Inflector.new do |inflections|
981
+ inflections.acronym('API')
982
+ end
983
+ end
984
+ end
985
+ ```
986
+
987
+ ### Changed
988
+
989
+ - A helpful error will be raised if an invalid setting value is provided (GustavoCaso)
990
+ - When using setting plugin, will use default values from types (GustavoCaso)
991
+ - Minimal supported ruby version was bumped to `2.3` (flash-gordon)
992
+ - `dry-struct` was updated to `~> 0.5` (flash-gordon)
993
+
994
+ [Compare v0.9.2...v0.10.0](https://github.com/dry-rb/dry-system/compare/v0.9.2...v0.10.0)
995
+
996
+ ## [0.9.2] - 2018-02-08
997
+
998
+
999
+ ### Fixed
1000
+
1001
+ - Default namespace no longer breaks resolving dependencies with identifier that includes part of the namespace (ie `mail.mailer`) (GustavoCaso)
1002
+
1003
+
1004
+ [Compare v0.9.1...v0.9.2](https://github.com/dry-rb/dry-system/compare/v0.9.1...v0.9.2)
1005
+
1006
+ ## [0.9.1] - 2018-01-03
1007
+
1008
+
1009
+ ### Fixed
1010
+
1011
+ - Plugin dependencies are now auto-required and a meaningful error is raised when a dep failed to load (solnic)
1012
+
1013
+
1014
+ [Compare v0.9.0...v0.9.1](https://github.com/dry-rb/dry-system/compare/v0.9.0...v0.9.1)
1015
+
1016
+ ## [0.9.0] - 2018-01-02
1017
+
1018
+
1019
+ ### Added
1020
+
1021
+ - Plugin API (solnic)
1022
+ - `:env` plugin which adds support for setting `env` config value (solnic)
1023
+ - `:logging` plugin which adds a default logger (solnic)
1024
+ - `:decorate` plugin for decorating registered objects (solnic)
1025
+ - `:notifications` plugin adding pub/sub bus to containers (solnic)
1026
+ - `:monitoring` plugin which adds `monitor` method for monitoring object method calls (solnic)
1027
+ - `:bootsnap` plugin which adds support for bootsnap (solnic)
1028
+
1029
+ ### Changed
1030
+
1031
+ - [BREAKING] renamed `Container.{require=>require_from_root}` (GustavoCaso)
1032
+
1033
+ [Compare v0.8.1...v0.9.0](https://github.com/dry-rb/dry-system/compare/v0.8.1...v0.9.0)
1034
+
1035
+ ## [0.8.1] - 2017-10-17
1036
+
1037
+
1038
+ ### Fixed
1039
+
1040
+ - Aliasing an external component works correctly (solnic)
1041
+ - Manually calling `:init` will also finalize a component (solnic)
1042
+
1043
+
1044
+ [Compare v0.8.0...v0.8.1](https://github.com/dry-rb/dry-system/compare/v0.8.0...v0.8.1)
1045
+
1046
+ ## [0.8.0] - 2017-10-16
1047
+
1048
+
1049
+ ### Added
1050
+
1051
+ - Support for external bootable components (solnic)
1052
+ - Built-in `:system` components including `:settings` component (solnic)
1053
+
1054
+ ### Fixed
1055
+
1056
+ - Lazy-loading components work when a container has `default_namespace` configured (GustavoCaso)
1057
+
1058
+ ### Changed
1059
+
1060
+ - [BREAKING] Improved boot DSL with support for namespacing and lifecycle before/after callbacks (solnic)
1061
+
1062
+ [Compare v0.7.3...v0.8.0](https://github.com/dry-rb/dry-system/compare/v0.7.3...v0.8.0)
1063
+
1064
+ ## [0.7.3] - 2017-08-02
1065
+
1066
+
1067
+ ### Fixed
1068
+
1069
+ - `Container.enable_stubs!` calls super too, which actually adds `stub` API (solnic)
1070
+ - Issues with lazy-loading and import in stub mode are gone (solnic)
1071
+
1072
+
1073
+ [Compare v0.7.2...v0.7.3](https://github.com/dry-rb/dry-system/compare/v0.7.2...v0.7.3)
1074
+
1075
+ ## [0.7.2] - 2017-08-02
1076
+
1077
+
1078
+ ### Added
1079
+
1080
+ - `Container.enable_stubs!` for test environments which enables stubbing components (GustavoCaso)
1081
+
1082
+ ### Changed
1083
+
1084
+ - Component identifiers can now include same name more than once ie `foo.stuff.foo` (GustavoCaso)
1085
+ - `Container#boot!` was renamed to `Container#start` (davydovanton)
1086
+ - `Container#boot` was renamed to `Container#init` (davydovanton)
1087
+
1088
+ [Compare v0.7.1...v0.7.2](https://github.com/dry-rb/dry-system/compare/v0.7.1...v0.7.2)
1089
+
1090
+ ## [0.7.1] - 2017-06-16
1091
+
1092
+
1093
+ ### Changed
1094
+
1095
+ - Accept string values for Container's `root` config (timriley)
1096
+
1097
+ [Compare v0.7.0...v0.7.1](https://github.com/dry-rb/dry-system/compare/v0.7.0...v0.7.1)
1098
+
1099
+ ## [0.7.0] - 2017-06-15
1100
+
1101
+
1102
+ ### Added
1103
+
1104
+ - Added `manual_registrar` container setting (along with default `ManualRegistrar` implementation), and `registrations_dir` setting. These provide support for a well-established place for keeping files with manual container registrations (timriley)
1105
+ - AutoRegistrar parses initial lines of Ruby source files for "magic comments" when auto-registering components. An `# auto_register: false` magic comment will prevent a Ruby file from being auto-registered (timriley)
1106
+ - `Container.auto_register!`, when called with a block, yields a configuration object to control the auto-registration behavior for that path, with support for configuring 2 different aspects of auto-registration behavior (both optional):
1107
+
1108
+ ```ruby
1109
+ class MyContainer < Dry::System::Container
1110
+ auto_register!('lib') do |config|
1111
+ config.instance do |component|
1112
+ # custom logic for initializing a component
1113
+ end
1114
+
1115
+ config.exclude do |component|
1116
+ # return true to skip auto-registration of the component, e.g.
1117
+ # component.path =~ /entities/
1118
+ end
1119
+ end
1120
+ end
1121
+ ```
1122
+ - A helpful error will be raised if a bootable component's finalize block name doesn't match its boot file name (GustavoCaso)
1123
+
1124
+ ### Changed
1125
+
1126
+ - The `default_namespace` container setting now supports multi-level namespaces (GustavoCaso)
1127
+ - `Container.auto_register!` yields a configuration block instead of a block for returning a custom instance (see above) (GustavoCaso)
1128
+ - `Container.import` now requires an explicit local name for the imported container (e.g. `import(local_name: AnotherContainer)`) (timriley)
1129
+
1130
+ [Compare v0.6.0...v0.7.0](https://github.com/dry-rb/dry-system/compare/v0.6.0...v0.7.0)
1131
+
1132
+ ## [0.6.0] - 2016-02-02
1133
+
1134
+
1135
+ ### Changed
1136
+
1137
+ - Lazy load components as they are resolved, rather than on injection (timriley)
1138
+ - Perform registration even though component already required (blelump)
1139
+
1140
+ [Compare v0.5.1...v0.6.0](https://github.com/dry-rb/dry-system/compare/v0.5.1...v0.6.0)
1141
+
1142
+ ## [0.5.1] - 2016-08-23
1143
+
1144
+
1145
+ ### Fixed
1146
+
1147
+ - Undefined locals or method calls will raise proper exceptions in Lifecycle DSL (aradunovic)
1148
+
1149
+
1150
+ [Compare v0.5.0...v0.5.1](https://github.com/dry-rb/dry-system/compare/v0.5.0...v0.5.1)
1151
+
1152
+ ## [0.5.0] - 2016-08-15
1153
+
1154
+ for multi-container setups. As part of this release `dry-system` has been renamed to `dry-system`.
1155
+
1156
+ ### Added
1157
+
1158
+ - Boot DSL with:
1159
+ - Lifecycle triggers: `init`, `start` and `stop` (solnic)
1160
+ - `use` method which auto-boots a dependency and makes it available in the booting context (solnic)
1161
+ - When a component relies on a bootable component, and is being loaded in isolation, the component will be booted automatically (solnic)
1162
+
1163
+ ### Changed
1164
+
1165
+ - [BREAKING] `Dry::Component::Container` is now `Dry::System::Container` (solnic)
1166
+ - [BREAKING] Configurable `loader` is now a class that accepts container's config and responds to `#constant` and `#instance` (solnic)
1167
+ - [BREAKING] `core_dir` renameda to `system_dir` and defaults to `system` (solnic)
1168
+ - [BREAKING] `auto_register!` yields `Component` objects (solnic)
1169
+
1170
+ [Compare v0.4.3...v0.5.0](https://github.com/dry-rb/dry-system/compare/v0.4.3...v0.5.0)
1171
+
1172
+ ## [0.4.3] - 2016-08-01
1173
+
1174
+
1175
+ ### Fixed
1176
+
1177
+ - Return immediately from `Container.load_component` if the requested component key already exists in the container. This fixes a crash when requesting to load a manually registered component with a name that doesn't map to a filename (timriley in [#24](https://github.com/dry-rb/dry-system/pull/24))
1178
+
1179
+
1180
+ [Compare v0.4.2...v0.4.3](https://github.com/dry-rb/dry-system/compare/v0.4.2...v0.4.3)
1181
+
1182
+ ## [0.4.2] - 2016-07-26
1183
+
1184
+
1185
+ ### Fixed
1186
+
1187
+ - Ensure file components can be loaded when they're requested for the first time using their shorthand container identifier (i.e. with the container's default namespace removed) (timriley)
1188
+
1189
+
1190
+ [Compare v0.4.1...v0.4.2](https://github.com/dry-rb/dry-system/compare/v0.4.1...v0.4.2)
1191
+
1192
+ ## [0.4.1] - 2016-07-26
1193
+
1194
+
1195
+ ### Fixed
1196
+
1197
+ - Require the 0.4.0 release of dry-auto_inject for the features below (in 0.4.0) to work properly (timriley)
1198
+
1199
+
1200
+ [Compare v0.4.0...v0.4.1](https://github.com/dry-rb/dry-system/compare/v0.4.0...v0.4.1)
1201
+
1202
+ ## [0.4.0] - 2016-07-26
1203
+
1204
+
1205
+ ### Added
1206
+
1207
+ - Support for supplying a default namespace to a container, which is passed to the container's injector to allow for convenient shorthand access to registered objects in the same namespace (timriley in [#20](https://github.com/dry-rb/dry-system/pull/20))
1208
+
1209
+ ```ruby
1210
+ # Set up container with default namespace
1211
+ module Admin
1212
+ class Container < Dry::Component::Container
1213
+ configure do |config|
1214
+ config.root = Pathname.new(__dir__).join("../..")
1215
+ config.default_namespace = "admin"
1216
+ end
1217
+ end
1218
+
1219
+ Import = Container.injector
1220
+ end
1221
+
1222
+ module Admin
1223
+ class CreateUser
1224
+ # "users.repository" will resolve an Admin::Users::Repository instance,
1225
+ # where previously you had to identify it as "admin.users.repository"
1226
+ include Admin::Import["users.repository"]
1227
+ end
1228
+ end
1229
+ ```
1230
+ - Support for supplying to options directly to dry-auto_inject's `Builder` via `Dry::Component::Container#injector(options)`. This allows you to provide dry-auto_inject customizations like your own container of injection strategies (timriley in [#20](https://github.com/dry-rb/dry-system/pull/20))
1231
+ - Support for accessing all available injector strategies, not just the defaults (e.g. `MyContainer.injector.some_custom_strategy`) (timriley in [#19](https://github.com/dry-rb/dry-system/pull/19))
1232
+
1233
+ ### Changed
1234
+
1235
+ - Subclasses of `Dry::Component::Container` no longer have an `Injector` constant automatically defined within them. The recommended approach is to save your own injector object to a constant, which allows you to pass options to it at the same time, e.g. `MyApp::Import = MyApp::Container.injector(my_options)` (timriley in [#19](https://github.com/dry-rb/dry-system/pull/19))
1236
+
1237
+ [Compare v0.3.0...v0.4.0](https://github.com/dry-rb/dry-system/compare/v0.3.0...v0.4.0)
1238
+
1239
+ ## [0.3.0] - 2016-06-18
1240
+
1241
+ Removed two pieces that are moving to dry-web:
1242
+
1243
+ ### Changed
1244
+
1245
+ - Removed two pieces that are moving to dry-web:
1246
+ - Removed `env` setting from `Container` (timriley)
1247
+ - Removed `Dry::Component::Config` and `options` setting from `Container` (timriley)
1248
+ - Changed `Component#configure` behavior so it can be run multiple times for configuration to be applied in multiple passes (timriley)
1249
+
1250
+ [Compare v0.2.0...v0.3.0](https://github.com/dry-rb/dry-system/compare/v0.2.0...v0.3.0)
1251
+
1252
+ ## [0.2.0] - 2016-06-13
1253
+
1254
+
1255
+ ### Fixed
1256
+
1257
+ - Fixed bug where specified auto-inject strategies were not respected (timriley)
1258
+
1259
+ ### Changed
1260
+
1261
+ - Component core directory is now `component/` by default (timriley)
1262
+ - Injector default stragegy is now whatever dry-auto_inject's default is (rather than hard-coding a particular default strategy for dry-system) (timriley)
1263
+
1264
+ [Compare v0.1.0...v0.2.0](https://github.com/dry-rb/dry-system/compare/v0.1.0...v0.2.0)
1265
+
1266
+ ## [0.1.0] - 2016-06-07
1267
+
1268
+
1269
+ ### Added
1270
+
1271
+ - Provide a dependency injector as an `Inject` constant inside any subclass of `Dry::Component::Container`. This injector supports all of `dry-auto_inject`'s default injection strategies, and will lazily load any dependencies as they are injected. It also supports arbitrarily switching strategies, so they can be used in different classes as required (e.g. `include MyComponent::Inject.args["dep"]`) (timriley)
1272
+ - Support aliased dependency names when calling the injector object (e.g. `MyComponent::Inject[foo: "my_app.foo", bar: "another.thing"]`) (timriley)
1273
+ - Allow a custom dependency loader to be set on a container via its config (AMHOL)
1274
+
1275
+ ```ruby
1276
+ class MyContainer < Dry::Component::Container
1277
+ configure do |config|
1278
+ # other config
1279
+ config.loader = MyLoader
1280
+ end
1281
+ end
1282
+ ```
1283
+
1284
+ ### Changed
1285
+
1286
+ - `Container.boot` now only makes a simple `require` for the boot file (solnic)
1287
+ - Container object is passed to `Container.finalize` blocks (solnic)
1288
+ - Allow `Pathname` objects passed to `Container.require` (solnic)
1289
+ - Support lazily loading missing dependencies from imported containers (solnic)
1290
+ - `Container.import_module` renamed to `.injector` (timriley)
1291
+ - Default injection strategy is now `kwargs`, courtesy of the new dry-auto_inject default (timriley)
1292
+
1293
+ [Compare v0.0.2...v0.1.0](https://github.com/dry-rb/dry-system/compare/v0.0.2...v0.1.0)
1294
+
1295
+ ## [0.0.2] - 2015-12-24
1296
+
1297
+
1298
+ ### Added
1299
+
1300
+ - Containers have a `name` setting (solnic)
1301
+ - Containers can be imported into one another (solnic)
1302
+
1303
+ ### Changed
1304
+
1305
+ - Container name is used to determine the name of its config file (solnic)
1306
+
1307
+ [Compare v0.0.1...v0.0.2](https://github.com/dry-rb/dry-system/compare/v0.0.1...v0.0.2)
1308
+
1309
+ ## [0.0.1] - 2015-12-24
1310
+
1311
+ First public release, extracted from rodakase project