Script 'mail_helper' called by obssrc
Hello community,
here is the log from the commit of package rubygem-dry-configurable for
openSUSE:Factory checked in at 2022-02-07 23:37:36
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/rubygem-dry-configurable (Old)
and /work/SRC/openSUSE:Factory/.rubygem-dry-configurable.new.1898 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "rubygem-dry-configurable"
Mon Feb 7 23:37:36 2022 rev:4 rq:949068 version:0.14.0
Changes:
--------
---
/work/SRC/openSUSE:Factory/rubygem-dry-configurable/rubygem-dry-configurable.changes
2021-07-02 13:28:31.080271344 +0200
+++
/work/SRC/openSUSE:Factory/.rubygem-dry-configurable.new.1898/rubygem-dry-configurable.changes
2022-02-07 23:38:36.358232784 +0100
@@ -1,0 +2,50 @@
+Tue Jan 25 06:50:41 UTC 2022 - Stephan Kulow <[email protected]>
+
+updated to version 0.14.0
+ see installed CHANGELOG.md
+
+ ## 0.14.0 2022-01-14
+
+
+ ### Changed
+
+ - Settings defined after an access to `config` will still be made available
on that `config`. (#130 by @timriley)
+ - Cloneable settings are cloned immediately upon assignment. (#130 by
@timriley)
+ - Changes to config values in parent classes after subclasses have already
been created will not be propogated to those subclasses. Subclasses created
_after_ config values have been changed in the parent _will_ receive those
config values. (#130 by @timriley)
+
+ [Compare
v0.13.0...v0.14.0](https://github.com/dry-rb/dry-configurable/compare/v0.13.0...v0.14.0)
+
+ ## 0.13.0 2021-09-12
+
+
+ ### Added
+
+ - Added flags to determine whether to warn on the API usage deprecated in
this release (see "Changed" section below). Set these to `false` to suppress
the warnings. (#124 by @timriley)
+
+ ```ruby
+ Dry::Configurable.warn_on_setting_constructor_block false
+ Dry::Configurable.warn_on_setting_positional_default false
+ ```
+
+ ### Fixed
+
+ - Fixed `ArgumentError` for classes including `Dry::Configurable` whose
`initializer` has required kwargs. (#113 by @timriley)
+
+ ### Changed
+
+ - Deprecated the setting constructor provided as a block. Provide it via the
`constructor:` keyword argument instead. (#111 by @waiting-for-dev & @timriley)
+
+ ```ruby
+ setting :path, constructor: -> path { Pathname(path) }
+ ```
+ - Deprecated the setting default provided as the second positional argument.
Provide it via the `default:` keyword argument instead. (#112 and #121 by
@waiting-for-dev & @timriley)
+
+ ```ruby
+ setting :path, default: "some/default/path"
+ ```
+ - [BREAKING] Removed implicit `to_hash` conversion from `Config`. (#114 by
@timriley)
+
+ [Compare
v0.12.1...v0.13.0](https://github.com/dry-rb/dry-configurable/compare/v0.12.1...v0.13.0)
+
+
+-------------------------------------------------------------------
Old:
----
dry-configurable-0.12.1.gem
New:
----
dry-configurable-0.14.0.gem
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ rubygem-dry-configurable.spec ++++++
--- /var/tmp/diff_new_pack.kEaWA3/_old 2022-02-07 23:38:36.890229143 +0100
+++ /var/tmp/diff_new_pack.kEaWA3/_new 2022-02-07 23:38:36.894229116 +0100
@@ -1,7 +1,7 @@
#
# spec file for package rubygem-dry-configurable
#
-# Copyright (c) 2021 SUSE LLC
+# Copyright (c) 2022 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@@ -24,12 +24,12 @@
#
Name: rubygem-dry-configurable
-Version: 0.12.1
+Version: 0.14.0
Release: 0
%define mod_name dry-configurable
%define mod_full_name %{mod_name}-%{version}
BuildRoot: %{_tmppath}/%{name}-%{version}-build
-BuildRequires: %{ruby >= 2.5.0}
+BuildRequires: %{ruby >= 2.7.0}
BuildRequires: %{rubygem gem2rpm}
BuildRequires: ruby-macros >= 5
URL: https://dry-rb.org/gems/dry-configurable
++++++ dry-configurable-0.12.1.gem -> dry-configurable-0.14.0.gem ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/CHANGELOG.md new/CHANGELOG.md
--- old/CHANGELOG.md 2021-02-15 11:10:30.000000000 +0100
+++ new/CHANGELOG.md 2022-01-14 01:14:31.000000000 +0100
@@ -1,5 +1,48 @@
<!--- DO NOT EDIT THIS FILE - IT'S AUTOMATICALLY GENERATED VIA DEVTOOLS --->
+## 0.14.0 2022-01-14
+
+
+### Changed
+
+- Settings defined after an access to `config` will still be made available on
that `config`. (#130 by @timriley)
+- Cloneable settings are cloned immediately upon assignment. (#130 by
@timriley)
+- Changes to config values in parent classes after subclasses have already
been created will not be propogated to those subclasses. Subclasses created
_after_ config values have been changed in the parent _will_ receive those
config values. (#130 by @timriley)
+
+[Compare
v0.13.0...v0.14.0](https://github.com/dry-rb/dry-configurable/compare/v0.13.0...v0.14.0)
+
+## 0.13.0 2021-09-12
+
+
+### Added
+
+- Added flags to determine whether to warn on the API usage deprecated in this
release (see "Changed" section below). Set these to `false` to suppress the
warnings. (#124 by @timriley)
+
+ ```ruby
+ Dry::Configurable.warn_on_setting_constructor_block false
+ Dry::Configurable.warn_on_setting_positional_default false
+ ```
+
+### Fixed
+
+- Fixed `ArgumentError` for classes including `Dry::Configurable` whose
`initializer` has required kwargs. (#113 by @timriley)
+
+### Changed
+
+- Deprecated the setting constructor provided as a block. Provide it via the
`constructor:` keyword argument instead. (#111 by @waiting-for-dev & @timriley)
+
+ ```ruby
+ setting :path, constructor: -> path { Pathname(path) }
+ ```
+- Deprecated the setting default provided as the second positional argument.
Provide it via the `default:` keyword argument instead. (#112 and #121 by
@waiting-for-dev & @timriley)
+
+ ```ruby
+ setting :path, default: "some/default/path"
+ ```
+- [BREAKING] Removed implicit `to_hash` conversion from `Config`. (#114 by
@timriley)
+
+[Compare
v0.12.1...v0.13.0](https://github.com/dry-rb/dry-configurable/compare/v0.12.1...v0.13.0)
+
## 0.12.1 2021-02-15
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/README.md new/README.md
--- old/README.md 2021-02-15 11:10:30.000000000 +0100
+++ new/README.md 2022-01-14 01:14:31.000000000 +0100
@@ -1,3 +1,4 @@
+<!--- this file is synced from dry-rb/template-gem project -->
[gem]: https://rubygems.org/gems/dry-configurable
[actions]: https://github.com/dry-rb/dry-configurable/actions
[codacy]: https://www.codacy.com/gh/dry-rb/dry-configurable
@@ -14,15 +15,15 @@
## Links
-* [User documentation](http://dry-rb.org/gems/dry-configurable)
+* [User documentation](https://dry-rb.org/gems/dry-configurable)
* [API documentation](http://rubydoc.info/gems/dry-configurable)
## Supported Ruby versions
This library officially supports the following Ruby versions:
-* MRI >= `2.5`
-* jruby >= `9.2`
+* MRI `>= 2.7.0`
+* jruby `>= 9.3` (postponed until 2.7 is supported)
## License
Binary files old/checksums.yaml.gz and new/checksums.yaml.gz differ
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/dry-configurable.gemspec new/dry-configurable.gemspec
--- old/dry-configurable.gemspec 2021-02-15 11:10:30.000000000 +0100
+++ new/dry-configurable.gemspec 2022-01-14 01:14:31.000000000 +0100
@@ -1,35 +1,36 @@
# frozen_string_literal: true
-# this file is managed by dry-rb/devtools project
-lib = File.expand_path('lib', __dir__)
+# this file is synced from dry-rb/template-gem project
+
+lib = File.expand_path("lib", __dir__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
-require 'dry/configurable/version'
+require "dry/configurable/version"
Gem::Specification.new do |spec|
- spec.name = 'dry-configurable'
+ spec.name = "dry-configurable"
spec.authors = ["Andy Holland"]
spec.email = ["[email protected]"]
- spec.license = 'MIT'
+ spec.license = "MIT"
spec.version = Dry::Configurable::VERSION.dup
spec.summary = "A mixin to add configuration functionality to your
classes"
spec.description = spec.summary
- spec.homepage = 'https://dry-rb.org/gems/dry-configurable'
+ spec.homepage = "https://dry-rb.org/gems/dry-configurable"
spec.files = Dir["CHANGELOG.md", "LICENSE", "README.md",
"dry-configurable.gemspec", "lib/**/*"]
- spec.bindir = 'bin'
+ spec.bindir = "bin"
spec.executables = []
- spec.require_paths = ['lib']
+ spec.require_paths = ["lib"]
- spec.metadata['allowed_push_host'] = 'https://rubygems.org'
- spec.metadata['changelog_uri'] =
'https://github.com/dry-rb/dry-configurable/blob/master/CHANGELOG.md'
- spec.metadata['source_code_uri'] =
'https://github.com/dry-rb/dry-configurable'
- spec.metadata['bug_tracker_uri'] =
'https://github.com/dry-rb/dry-configurable/issues'
+ spec.metadata["allowed_push_host"] = "https://rubygems.org"
+ spec.metadata["changelog_uri"] =
"https://github.com/dry-rb/dry-configurable/blob/master/CHANGELOG.md"
+ spec.metadata["source_code_uri"] =
"https://github.com/dry-rb/dry-configurable"
+ spec.metadata["bug_tracker_uri"] =
"https://github.com/dry-rb/dry-configurable/issues"
- spec.required_ruby_version = ">= 2.5.0"
+ spec.required_ruby_version = ">= 2.7.0"
# to update dependencies edit project.yml
spec.add_runtime_dependency "concurrent-ruby", "~> 1.0"
- spec.add_runtime_dependency "dry-core", "~> 0.5", ">= 0.5.0"
+ spec.add_runtime_dependency "dry-core", "~> 0.6"
spec.add_development_dependency "bundler"
spec.add_development_dependency "rake"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/lib/dry/configurable/class_methods.rb
new/lib/dry/configurable/class_methods.rb
--- old/lib/dry/configurable/class_methods.rb 2021-02-15 11:10:30.000000000
+0100
+++ new/lib/dry/configurable/class_methods.rb 2022-01-14 01:14:31.000000000
+0100
@@ -1,11 +1,11 @@
# frozen_string_literal: true
-require 'set'
+require "set"
-require 'dry/configurable/constants'
-require 'dry/configurable/dsl'
-require 'dry/configurable/methods'
-require 'dry/configurable/settings'
+require "dry/configurable/constants"
+require "dry/configurable/dsl"
+require "dry/configurable/methods"
+require "dry/configurable/settings"
module Dry
module Configurable
@@ -13,30 +13,31 @@
include Methods
# @api private
- def inherited(klass)
+ def inherited(subclass)
super
- parent_settings = (respond_to?(:config) ? config._settings : _settings)
-
- klass.instance_variable_set('@_settings', parent_settings)
+ subclass.instance_variable_set("@_settings", _settings.dup)
+ subclass.instance_variable_set("@_config", config.dup) if
respond_to?(:config)
end
# Add a setting to the configuration
#
- # @param [Mixed] key
+ # @param [Mixed] name
# The accessor key for the configuration value
# @param [Mixed] default
- # The default config value
- #
+ # Default value for the setting
+ # @param [#call] constructor
+ # Transformation given value will go through
+ # @param [Boolean] reader
+ # Whether a reader accessor must be created
# @yield
- # If a block is given, it will be evaluated in the context of
- # a new configuration class, and bound as the default value
+ # A block can be given to add nested settings.
#
# @return [Dry::Configurable::Config]
#
# @api public
- def setting(*args, &block)
- setting = __config_dsl__.setting(*args, &block)
+ def setting(*args, **options, &block)
+ setting = __config_dsl__.setting(*args, **options, &block)
_settings << setting
@@ -69,12 +70,17 @@
#
# @api public
def config
+ # The _settings provided to the Config remain shared between the class
and the
+ # Config. This allows settings defined _after_ accessing the config to
become
+ # available in subsequent accesses to the config. The config is duped
when
+ # subclassing to ensure it remains distinct between subclasses and
parent classes
+ # (see `.inherited` above).
@config ||= Config.new(_settings)
end
# @api private
def __config_dsl__
- @dsl ||= DSL.new
+ @__config_dsl__ ||= DSL.new
end
# @api private
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/lib/dry/configurable/compiler.rb
new/lib/dry/configurable/compiler.rb
--- old/lib/dry/configurable/compiler.rb 2021-02-15 11:10:30.000000000
+0100
+++ new/lib/dry/configurable/compiler.rb 2022-01-14 01:14:31.000000000
+0100
@@ -1,7 +1,7 @@
# frozen_string_literal: true
-require 'dry/configurable/setting'
-require 'dry/configurable/settings'
+require "dry/configurable/setting"
+require "dry/configurable/settings"
module Dry
module Configurable
@@ -24,15 +24,9 @@
end
# @api private
- def visit_constructor(node)
- setting, constructor = node
- visit(setting).with(constructor: constructor)
- end
-
- # @api private
def visit_setting(node)
- name, default, opts = node
- Setting.new(name, **opts, default: default)
+ name, opts = node
+ Setting.new(name, **opts)
end
# @api private
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/lib/dry/configurable/config.rb
new/lib/dry/configurable/config.rb
--- old/lib/dry/configurable/config.rb 2021-02-15 11:10:30.000000000 +0100
+++ new/lib/dry/configurable/config.rb 2022-01-14 01:14:31.000000000 +0100
@@ -1,11 +1,11 @@
# frozen_string_literal: true
-require 'concurrent/map'
+require "concurrent/map"
-require 'dry/core/equalizer'
+require "dry/core/equalizer"
-require 'dry/configurable/constants'
-require 'dry/configurable/errors'
+require "dry/configurable/constants"
+require "dry/configurable/errors"
module Dry
module Configurable
@@ -23,7 +23,7 @@
# @api private
def initialize(settings)
- @_settings = settings.dup
+ @_settings = settings
@_resolved = Concurrent::Map.new
end
@@ -79,7 +79,6 @@
.to_h
end
alias_method :to_h, :values
- alias_method :to_hash, :values
# @api private
def finalize!
@@ -106,7 +105,7 @@
super unless setting
if setting.writer?(meth)
- raise FrozenConfig, 'Cannot modify frozen config' if frozen?
+ raise FrozenConfig, "Cannot modify frozen config" if frozen?
_settings << setting.with(input: args[0])
else
@@ -116,7 +115,7 @@
# @api private
def resolve(meth)
- _resolved.fetch(meth) { _resolved[meth] = meth.to_s.tr('=', '').to_sym
}
+ _resolved.fetch(meth) { _resolved[meth] = meth.to_s.tr("=", "").to_sym
}
end
# @api private
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/lib/dry/configurable/constants.rb
new/lib/dry/configurable/constants.rb
--- old/lib/dry/configurable/constants.rb 2021-02-15 11:10:30.000000000
+0100
+++ new/lib/dry/configurable/constants.rb 2022-01-14 01:14:31.000000000
+0100
@@ -1,6 +1,6 @@
# frozen_string_literal: true
-require 'dry/core/constants'
+require "dry/core/constants"
module Dry
# Shared constants
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/lib/dry/configurable/dsl/args.rb
new/lib/dry/configurable/dsl/args.rb
--- old/lib/dry/configurable/dsl/args.rb 2021-02-15 11:10:30.000000000
+0100
+++ new/lib/dry/configurable/dsl/args.rb 1970-01-01 01:00:00.000000000
+0100
@@ -1,58 +0,0 @@
-# frozen_string_literal: true
-
-require 'dry/configurable/constants'
-require 'dry/configurable/setting'
-
-module Dry
- module Configurable
- class DSL
- # @api private
- class Args
- # @api private
- attr_reader :args
-
- # @api private
- attr_reader :size
-
- # @api private
- attr_reader :opts
-
- # @api private
- def initialize(args)
- @args = args
- @size = args.size
- @opts = Setting::OPTIONS
- end
-
- # @api private
- def ensure_valid_options
- return unless options
-
- keys = options.keys - opts
- raise ArgumentError, "Invalid options: #{keys.inspect}" unless
keys.empty?
- end
-
- # @api private
- def to_ary
- [default, options || EMPTY_HASH]
- end
-
- # @api private
- def default
- if size.equal?(1) && options.nil?
- args[0]
- elsif size > 1 && options
- args[0]
- else
- Undefined
- end
- end
-
- # @api private
- def options
- args.detect { |arg| arg.is_a?(Hash) && (opts & arg.keys).any? }
- end
- end
- end
- end
-end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/lib/dry/configurable/dsl.rb
new/lib/dry/configurable/dsl.rb
--- old/lib/dry/configurable/dsl.rb 2021-02-15 11:10:30.000000000 +0100
+++ new/lib/dry/configurable/dsl.rb 2022-01-14 01:14:31.000000000 +0100
@@ -1,10 +1,11 @@
# frozen_string_literal: true
-require 'dry/configurable/constants'
-require 'dry/configurable/setting'
-require 'dry/configurable/settings'
-require 'dry/configurable/compiler'
-require 'dry/configurable/dsl/args'
+require "dry/configurable/constants"
+require "dry/configurable/flags"
+require "dry/configurable/setting"
+require "dry/configurable/settings"
+require "dry/configurable/compiler"
+require "dry/core/deprecations"
module Dry
module Configurable
@@ -27,36 +28,137 @@
instance_exec(&block) if block
end
- # Register a new setting node and compile it into a setting object
+ # Registers a new setting node and compile it into a setting object
#
# @see ClassMethods.setting
- # @api public
+ # @api private
# @return Setting
- def setting(name, *args, &block)
+ def setting(name, default = Undefined, **options, &block) #
rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity,
Metrics/PerceivedComplexity
unless VALID_NAME.match?(name.to_s)
raise ArgumentError, "#{name} is not a valid setting name"
end
- args = Args.new(args)
+ if default != Undefined
+ if Dry::Configurable.warn_on_setting_positional_default
+ Dry::Core::Deprecations.announce(
+ "default value as positional argument to settings",
+ "Provide a `default:` keyword argument instead",
+ tag: "dry-configurable",
+ uplevel: 2
+ )
+ end
- args.ensure_valid_options
+ options = options.merge(default: default)
+ end
- default, opts = args
+ if RUBY_VERSION < "3.0" &&
+ default == Undefined &&
+ (valid_opts, invalid_opts = valid_and_invalid_options(options)) &&
+ invalid_opts.any? &&
+ valid_opts.none?
+ # In Ruby 2.6 and 2.7, when a hash is given as the second positional
argument
+ # (i.e. the hash is intended to be the setting's default value), and
there are
+ # no other keyword arguments given, the hash is assigned to the
`options`
+ # variable instead of `default`.
+ #
+ # For example, for this setting:
+ #
+ # setting :hash_setting, {my_hash: true}
+ #
+ # We'll have a `default` of `Undefined` and an `options` of
`{my_hash: true}`
+ #
+ # If any additional keyword arguments are provided, e.g.:
+ #
+ # setting :hash_setting, {my_hash: true}, reader: true
+ #
+ # Then we'll have a `default` of `{my_hash: true}` and an `options`
of `{reader:
+ # true}`, which is what we want.
+ #
+ # To work around that first case and ensure our (deprecated)
backwards
+ # compatibility holds for Ruby 2.6 and 2.7, we extract all invalid
options from
+ # `options`, and if there are no remaining valid options (i.e. if
there were no
+ # keyword arguments given), then we can infer the invalid options to
be a
+ # default hash value for the setting.
+ #
+ # This approach also preserves the behavior of raising an
ArgumentError when a
+ # distinct hash is _not_ intentionally provided as the second
positional
+ # argument (i.e. it's not enclosed in braces), and instead invalid
keyword
+ # arguments are given alongside valid ones. So this setting:
+ #
+ # setting :some_setting, invalid_option: true, reader: true
+ #
+ # Would raise an ArgumentError as expected.
+ #
+ # However, the one case we can't catch here is when invalid options
are supplied
+ # without hash literal braces, but there are no other keyword
arguments
+ # supplied. In this case, a setting like:
+ #
+ # setting :hash_setting, my_hash: true
+ #
+ # Is parsed identically to the first case described above:
+ #
+ # setting :hash_setting, {my_hash: true}
+ #
+ # So in both of these cases, the default value will become
`{my_hash: true}`. We
+ # consider this unlikely to be a problem in practice, since users
are not likely
+ # to be providing invalid options to `setting` and expecting them to
be ignored.
+ # Additionally, the deprecation messages will make the new behavior
obvious, and
+ # encourage the users to upgrade their setting definitions.
+
+ if Dry::Configurable.warn_on_setting_positional_default
+ Dry::Core::Deprecations.announce(
+ "default value as positional argument to settings",
+ "Provide a `default:` keyword argument instead",
+ tag: "dry-configurable",
+ uplevel: 2
+ )
+ end
- node = [:setting, [name.to_sym, default, opts == default ? EMPTY_HASH
: opts]]
+ options = {default: invalid_opts}
+ end
- if block
- if block.arity.zero?
- ast << [:nested, [node, DSL.new(&block).ast]]
- else
- ast << [:constructor, [node, block]]
+ if block && !block.arity.zero?
+ if Dry::Configurable.warn_on_setting_constructor_block
+ Dry::Core::Deprecations.announce(
+ "passing a constructor as a block",
+ "Provide a `constructor:` keyword argument instead",
+ tag: "dry-configurable",
+ uplevel: 2
+ )
end
+
+ options = options.merge(constructor: block)
+ block = nil
+ end
+
+ ensure_valid_options(options)
+
+ node = [:setting, [name.to_sym, options]]
+
+ if block
+ ast << [:nested, [node, DSL.new(&block).ast]]
else
ast << node
end
compiler.visit(ast.last)
end
+
+ private
+
+ def ensure_valid_options(options)
+ return if options.none?
+
+ invalid_keys = options.keys - Setting::OPTIONS
+
+ raise ArgumentError, "Invalid options: #{invalid_keys.inspect}" unless
invalid_keys.empty?
+ end
+
+ # Returns a tuple of valid and invalid options hashes derived from the
options hash
+ # given to the setting
+ def valid_and_invalid_options(options)
+ options.partition { |k, _| Setting::OPTIONS.include?(k) }.map(&:to_h)
+ end
end
end
end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/lib/dry/configurable/flags.rb
new/lib/dry/configurable/flags.rb
--- old/lib/dry/configurable/flags.rb 1970-01-01 01:00:00.000000000 +0100
+++ new/lib/dry/configurable/flags.rb 2022-01-14 01:14:31.000000000 +0100
@@ -0,0 +1,19 @@
+# frozen_string_literal: true
+
+require "dry/core/class_attributes"
+
+module Dry
+ module Configurable
+ extend Core::ClassAttributes
+
+ # Set to false to suppress deprecation warning when a setting default is
provided as a
+ # positional argument
+ defines :warn_on_setting_positional_default
+ warn_on_setting_positional_default true
+
+ # Set to false to suppress deprecation warning when a setting constructor
is provided
+ # as a block
+ defines :warn_on_setting_constructor_block
+ warn_on_setting_constructor_block true
+ end
+end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/lib/dry/configurable/instance_methods.rb
new/lib/dry/configurable/instance_methods.rb
--- old/lib/dry/configurable/instance_methods.rb 2021-02-15
11:10:30.000000000 +0100
+++ new/lib/dry/configurable/instance_methods.rb 2022-01-14
01:14:31.000000000 +0100
@@ -1,7 +1,7 @@
# frozen_string_literal: true
-require 'dry/configurable/config'
-require 'dry/configurable/methods'
+require "dry/configurable/config"
+require "dry/configurable/methods"
module Dry
module Configurable
@@ -12,9 +12,14 @@
module Initializer
# @api private
def initialize(*)
+ # Dup settings at time of initializing to ensure setting values are
specific to
+ # this instance. This does mean that any settings defined on the class
_after_
+ # initialization will not be available on the instance.
@config = Config.new(self.class._settings.dup)
+
super
end
+ ruby2_keywords(:initialize) if respond_to?(:ruby2_keywords, true)
end
# Instance-level API when `Dry::Configurable` is included in a class
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/lib/dry/configurable/methods.rb
new/lib/dry/configurable/methods.rb
--- old/lib/dry/configurable/methods.rb 2021-02-15 11:10:30.000000000 +0100
+++ new/lib/dry/configurable/methods.rb 2022-01-14 01:14:31.000000000 +0100
@@ -1,6 +1,6 @@
# frozen_string_literal: true
-require 'dry/configurable/errors'
+require "dry/configurable/errors"
module Dry
module Configurable
@@ -10,7 +10,7 @@
module Methods
# @api public
def configure(&block)
- raise FrozenConfig, 'Cannot modify frozen config' if frozen?
+ raise FrozenConfig, "Cannot modify frozen config" if frozen?
yield(config) if block
self
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/lib/dry/configurable/setting.rb
new/lib/dry/configurable/setting.rb
--- old/lib/dry/configurable/setting.rb 2021-02-15 11:10:30.000000000 +0100
+++ new/lib/dry/configurable/setting.rb 2022-01-14 01:14:31.000000000 +0100
@@ -1,11 +1,11 @@
# frozen_string_literal: true
-require 'set'
+require "set"
-require 'dry/core/equalizer'
+require "dry/core/equalizer"
-require 'dry/configurable/constants'
-require 'dry/configurable/config'
+require "dry/configurable/constants"
+require "dry/configurable/config"
module Dry
module Configurable
@@ -62,9 +62,17 @@
def initialize(name, input: Undefined, default: Undefined, **options)
@name = name
@writer_name = :"#{name}="
+ @options = options
+
+ # Setting collections (see `Settings`) are shared between the
configurable class
+ # and its `config` object, so for cloneable individual settings, we
duplicate
+ # their _values_ as early as possible to ensure no impact from
unintended mutation
@input = input
@default = default
- @options = options
+ if cloneable?
+ @input = input.dup
+ @default = default.dup
+ end
evaluate if input_defined?
end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/lib/dry/configurable/settings.rb
new/lib/dry/configurable/settings.rb
--- old/lib/dry/configurable/settings.rb 2021-02-15 11:10:30.000000000
+0100
+++ new/lib/dry/configurable/settings.rb 2022-01-14 01:14:31.000000000
+0100
@@ -1,9 +1,9 @@
# frozen_string_literal: true
-require 'concurrent/map'
+require "concurrent/map"
-require 'dry/core/equalizer'
-require 'dry/configurable/constants'
+require "dry/core/equalizer"
+require "dry/configurable/constants"
module Dry
module Configurable
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/lib/dry/configurable/version.rb
new/lib/dry/configurable/version.rb
--- old/lib/dry/configurable/version.rb 2021-02-15 11:10:30.000000000 +0100
+++ new/lib/dry/configurable/version.rb 2022-01-14 01:14:31.000000000 +0100
@@ -3,6 +3,6 @@
module Dry
module Configurable
# @api public
- VERSION = '0.12.1'
+ VERSION = "0.14.0"
end
end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/lib/dry/configurable.rb new/lib/dry/configurable.rb
--- old/lib/dry/configurable.rb 2021-02-15 11:10:30.000000000 +0100
+++ new/lib/dry/configurable.rb 2022-01-14 01:14:31.000000000 +0100
@@ -1,13 +1,13 @@
# frozen_string_literal: true
-require 'concurrent/array'
+require "concurrent/array"
-require 'dry/configurable/constants'
-require 'dry/configurable/class_methods'
-require 'dry/configurable/instance_methods'
-require 'dry/configurable/config'
-require 'dry/configurable/setting'
-require 'dry/configurable/errors'
+require "dry/configurable/constants"
+require "dry/configurable/class_methods"
+require "dry/configurable/instance_methods"
+require "dry/configurable/config"
+require "dry/configurable/setting"
+require "dry/configurable/errors"
module Dry
# A simple configuration mixin
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/lib/dry-configurable.rb new/lib/dry-configurable.rb
--- old/lib/dry-configurable.rb 2021-02-15 11:10:30.000000000 +0100
+++ new/lib/dry-configurable.rb 2022-01-14 01:14:31.000000000 +0100
@@ -1,3 +1,3 @@
# frozen_string_literal: true
-require 'dry/configurable'
+require "dry/configurable"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/metadata new/metadata
--- old/metadata 2021-02-15 11:10:30.000000000 +0100
+++ new/metadata 2022-01-14 01:14:31.000000000 +0100
@@ -1,14 +1,14 @@
--- !ruby/object:Gem::Specification
name: dry-configurable
version: !ruby/object:Gem::Version
- version: 0.12.1
+ version: 0.14.0
platform: ruby
authors:
- Andy Holland
autorequire:
bindir: bin
cert_chain: []
-date: 2021-02-15 00:00:00.000000000 Z
+date: 2022-01-14 00:00:00.000000000 Z
dependencies:
- !ruby/object:Gem::Dependency
name: concurrent-ruby
@@ -30,20 +30,14 @@
requirements:
- - "~>"
- !ruby/object:Gem::Version
- version: '0.5'
- - - ">="
- - !ruby/object:Gem::Version
- version: 0.5.0
+ version: '0.6'
type: :runtime
prerelease: false
version_requirements: !ruby/object:Gem::Requirement
requirements:
- - "~>"
- !ruby/object:Gem::Version
- version: '0.5'
- - - ">="
- - !ruby/object:Gem::Version
- version: 0.5.0
+ version: '0.6'
- !ruby/object:Gem::Dependency
name: bundler
requirement: !ruby/object:Gem::Requirement
@@ -104,8 +98,8 @@
- lib/dry/configurable/config.rb
- lib/dry/configurable/constants.rb
- lib/dry/configurable/dsl.rb
-- lib/dry/configurable/dsl/args.rb
- lib/dry/configurable/errors.rb
+- lib/dry/configurable/flags.rb
- lib/dry/configurable/instance_methods.rb
- lib/dry/configurable/methods.rb
- lib/dry/configurable/setting.rb
@@ -128,14 +122,14 @@
requirements:
- - ">="
- !ruby/object:Gem::Version
- version: 2.5.0
+ version: 2.7.0
required_rubygems_version: !ruby/object:Gem::Requirement
requirements:
- - ">="
- !ruby/object:Gem::Version
version: '0'
requirements: []
-rubygems_version: 3.1.4
+rubygems_version: 3.1.6
signing_key:
specification_version: 4
summary: A mixin to add configuration functionality to your classes