Script 'mail_helper' called by obssrc
Hello community,
here is the log from the commit of package rubygem-dry-core for
openSUSE:Factory checked in at 2021-08-24 10:54:22
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/rubygem-dry-core (Old)
and /work/SRC/openSUSE:Factory/.rubygem-dry-core.new.1899 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "rubygem-dry-core"
Tue Aug 24 10:54:22 2021 rev:4 rq:912493 version:0.7.1
Changes:
--------
--- /work/SRC/openSUSE:Factory/rubygem-dry-core/rubygem-dry-core.changes
2021-07-02 13:28:32.316261754 +0200
+++
/work/SRC/openSUSE:Factory/.rubygem-dry-core.new.1899/rubygem-dry-core.changes
2021-08-24 10:55:13.212293344 +0200
@@ -1,0 +2,34 @@
+Mon Jul 26 05:53:37 UTC 2021 - Stephan Kulow <[email protected]>
+
+updated to version 0.7.1
+ see installed CHANGELOG.md
+
+ ## 0.7.1 2021-07-10
+
+
+ ### Fixed
+
+ - [memoizable] memoizable correctly handles cases where a method
+ has unnamed params (e.g. happens when the new `...` syntax is used)
(@flash-gordon)
+
+
+
+ [Compare
v0.7.0...v0.7.1](https://github.com/dry-rb/dry-core/compare/v0.7.0...v0.7.1)
+
+ ## 0.7.0 2021-07-08
+
+
+ ### Fixed
+
+ - [memoizable] warnings when using keyword arguments (@flash-gordon)
+ - [deprecations] warnings show more relevant information about caller by
default (@timriley)
+
+ ### Changed
+
+ - Minimal Ruby version is 2.6
+ - [memoizable] memoization of block-accepting methods is deprecated
(@flash-gordon)
+
+ [Compare
v0.6.0...v0.7.0](https://github.com/dry-rb/dry-core/compare/v0.6.0...v0.7.0)
+
+
+-------------------------------------------------------------------
Old:
----
dry-core-0.6.0.gem
New:
----
dry-core-0.7.1.gem
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ rubygem-dry-core.spec ++++++
--- /var/tmp/diff_new_pack.0ERl7s/_old 2021-08-24 10:55:13.708292687 +0200
+++ /var/tmp/diff_new_pack.0ERl7s/_new 2021-08-24 10:55:13.712292681 +0200
@@ -24,12 +24,12 @@
#
Name: rubygem-dry-core
-Version: 0.6.0
+Version: 0.7.1
Release: 0
%define mod_name dry-core
%define mod_full_name %{mod_name}-%{version}
BuildRoot: %{_tmppath}/%{name}-%{version}-build
-BuildRequires: %{ruby >= 2.5.0}
+BuildRequires: %{ruby >= 2.6.0}
BuildRequires: %{rubygem gem2rpm}
BuildRequires: ruby-macros >= 5
URL: https://dry-rb.org/gems/dry-core
++++++ dry-core-0.6.0.gem -> dry-core-0.7.1.gem ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/CHANGELOG.md new/CHANGELOG.md
--- old/CHANGELOG.md 2021-06-03 10:43:42.000000000 +0200
+++ new/CHANGELOG.md 2021-07-10 16:03:50.000000000 +0200
@@ -1,5 +1,32 @@
<!--- DO NOT EDIT THIS FILE - IT'S AUTOMATICALLY GENERATED VIA DEVTOOLS --->
+## 0.7.1 2021-07-10
+
+
+### Fixed
+
+- [memoizable] memoizable correctly handles cases where a method
+has unnamed params (e.g. happens when the new `...` syntax is used)
(@flash-gordon)
+
+
+
+[Compare
v0.7.0...v0.7.1](https://github.com/dry-rb/dry-core/compare/v0.7.0...v0.7.1)
+
+## 0.7.0 2021-07-08
+
+
+### Fixed
+
+- [memoizable] warnings when using keyword arguments (@flash-gordon)
+- [deprecations] warnings show more relevant information about caller by
default (@timriley)
+
+### Changed
+
+- Minimal Ruby version is 2.6
+- [memoizable] memoization of block-accepting methods is deprecated
(@flash-gordon)
+
+[Compare
v0.6.0...v0.7.0](https://github.com/dry-rb/dry-core/compare/v0.6.0...v0.7.0)
+
## 0.6.0 2021-06-03
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/README.md new/README.md
--- old/README.md 2021-06-03 10:43:42.000000000 +0200
+++ new/README.md 2021-07-10 16:03:50.000000000 +0200
@@ -1,3 +1,4 @@
+<!--- this file is synced from dry-rb/template-gem project -->
[gem]: https://rubygems.org/gems/dry-core
[actions]: https://github.com/dry-rb/dry-core/actions
[codacy]: https://www.codacy.com/gh/dry-rb/dry-core
@@ -14,15 +15,15 @@
## Links
-* [User documentation](http://dry-rb.org/gems/dry-core)
+* [User documentation](https://dry-rb.org/gems/dry-core)
* [API documentation](http://rubydoc.info/gems/dry-core)
## Supported Ruby versions
This library officially supports the following Ruby versions:
-* MRI >= `2.5`
-* jruby >= `9.2`
+* MRI `>= 2.6.0`
+* ~~jruby~~ `>= 9.3` (we are waiting for [2.6
support](https://github.com/jruby/jruby/issues/6161))
## 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-core.gemspec new/dry-core.gemspec
--- old/dry-core.gemspec 2021-06-03 10:43:42.000000000 +0200
+++ new/dry-core.gemspec 2021-07-10 16:03:50.000000000 +0200
@@ -26,7 +26,7 @@
spec.metadata["source_code_uri"] = "https://github.com/dry-rb/dry-core"
spec.metadata["bug_tracker_uri"] =
"https://github.com/dry-rb/dry-core/issues"
- spec.required_ruby_version = ">= 2.5.0"
+ spec.required_ruby_version = ">= 2.6.0"
# to update dependencies edit project.yml
spec.add_runtime_dependency "concurrent-ruby", "~> 1.0"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/lib/dry/core/cache.rb new/lib/dry/core/cache.rb
--- old/lib/dry/core/cache.rb 2021-06-03 10:43:42.000000000 +0200
+++ new/lib/dry/core/cache.rb 2021-07-10 16:03:50.000000000 +0200
@@ -46,7 +46,8 @@
# this means you shouldn't pass Procs in args unless you're sure
# they are always the same instances, otherwise you introduce a
memory leak
#
- # @return [Object] block's return value (cached for subsequent calls
with the same argument values)
+ # @return [Object] block's return value (cached for subsequent calls with
+ # the same argument values)
def fetch_or_store(*args, &block)
cache.fetch_or_store(args.hash, &block)
end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/lib/dry/core/class_attributes.rb
new/lib/dry/core/class_attributes.rb
--- old/lib/dry/core/class_attributes.rb 2021-06-03 10:43:42.000000000
+0200
+++ new/lib/dry/core/class_attributes.rb 2021-07-10 16:03:50.000000000
+0200
@@ -67,7 +67,7 @@
# defines :one, coerce: Dry::Types['coercible.string']
# end
#
- def defines(*args, type: ::Object, coerce: IDENTITY)
+ def defines(*args, type: ::Object, coerce: IDENTITY) # rubocop:disable
Metrics/PerceivedComplexity
unless coerce.respond_to?(:call)
raise ::ArgumentError, "Non-callable coerce option:
#{coerce.inspect}"
end
@@ -80,10 +80,10 @@
if Undefined.equal?(value)
if instance_variable_defined?(ivar)
instance_variable_get(ivar)
- else
+ else # rubocop:disable Style/EmptyElse
nil
end
- elsif type === value
+ elsif type === value # rubocop:disable Style/CaseEquality
instance_variable_set(ivar, coerce.call(value))
else
raise InvalidClassAttributeValue.new(name, value)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/lib/dry/core/class_builder.rb
new/lib/dry/core/class_builder.rb
--- old/lib/dry/core/class_builder.rb 2021-06-03 10:43:42.000000000 +0200
+++ new/lib/dry/core/class_builder.rb 2021-07-10 16:03:50.000000000 +0200
@@ -6,9 +6,7 @@
class ClassBuilder
ParentClassMismatch = Class.new(TypeError)
- attr_reader :name
- attr_reader :parent
- attr_reader :namespace
+ attr_reader :name, :parent, :namespace
def initialize(name:, parent: nil, namespace: nil)
@name = name
@@ -83,7 +81,7 @@
def create_base(namespace, name, parent)
begin
namespace.const_get(name)
- rescue NameError
+ rescue NameError # rubocop:disable Lint/SuppressedException
end
if namespace.const_defined?(name, false)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/lib/dry/core/constants.rb
new/lib/dry/core/constants.rb
--- old/lib/dry/core/constants.rb 2021-06-03 10:43:42.000000000 +0200
+++ new/lib/dry/core/constants.rb 2021-07-10 16:03:50.000000000 +0200
@@ -25,7 +25,7 @@
# An empty set
EMPTY_SET = ::Set.new.freeze
# An empty string
- EMPTY_STRING = "".freeze
+ EMPTY_STRING = ""
# Identity function
IDENTITY = (-> x { x }).freeze
@@ -42,7 +42,7 @@
# end
Undefined = Object.new.tap do |undefined|
# @api private
- Self = -> { Undefined }
+ Self = -> { Undefined } # rubocop:disable
Lint/ConstantDefinitionInBlock
# @api public
def undefined.to_s
@@ -62,7 +62,7 @@
# 1 + Undefined.default(val, 2)
# end
#
- def undefined.default(x, y = self)
+ def undefined.default(x, y = self) # rubocop:disable
Naming/MethodParameterName
if equal?(x)
if equal?(y)
yield
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/lib/dry/core/deprecations.rb
new/lib/dry/core/deprecations.rb
--- old/lib/dry/core/deprecations.rb 2021-06-03 10:43:42.000000000 +0200
+++ new/lib/dry/core/deprecations.rb 2021-07-10 16:03:50.000000000 +0200
@@ -37,12 +37,11 @@
# Defaults to "deprecated"
# @param [Integer] Caller frame to add to the message
def warn(msg, tag: nil, uplevel: nil)
- caller_info = uplevel.nil? ? nil : caller[uplevel]
- tag = "[#{tag || "deprecated"}]"
+ caller_info = uplevel.nil? ? nil : "#{caller_locations(uplevel + 2,
1)[0]} "
+ tag = "[#{tag || "deprecated"}] "
hint = msg.gsub(/^\s+/, "")
- logger.warn(
- [caller_info, tag, hint].compact.join(" ")
- )
+
+ logger.warn("#{caller_info}#{tag}#{hint}")
end
# Wraps arguments with a standard message format and prints a warning
@@ -50,6 +49,10 @@
# @param [Object] name what is deprecated
# @param [String] msg additional message usually containing upgrade
instructions
def announce(name, msg, tag: nil, uplevel: nil)
+ # Bump the uplevel (if provided) by one to account for the uplevel
calculation
+ # taking place one frame deeper in `.warn`
+ uplevel += 1 if uplevel
+
warn(deprecation_message(name, msg), tag: tag, uplevel: uplevel)
end
@@ -99,7 +102,7 @@
# @param [#warn] logger
#
# @api public
- def set_logger!(output = $stderr)
+ def set_logger!(output = $stderr) # rubocop:disable
Naming/AccessorMethodName
if output.respond_to?(:warn)
@logger = output
else
@@ -115,8 +118,9 @@
end
# @api private
- class Tagged < Module
+ class Tagged < ::Module
def initialize(tag)
+ super()
@tag = tag
end
@@ -152,8 +156,8 @@
# @option [String] message optional deprecation message
def deprecate(old_name, new_name = nil, message: nil)
full_msg = Deprecations.deprecated_name_message(
- "#{self.name}##{old_name}",
- new_name ? "#{self.name}##{new_name}" : nil,
+ "#{name}##{old_name}",
+ new_name ? "#{name}##{new_name}" : nil,
message
)
mod = self
@@ -185,8 +189,8 @@
# @option [String] message optional deprecation message
def deprecate_class_method(old_name, new_name = nil, message: nil)
full_msg = Deprecations.deprecated_name_message(
- "#{self.name}.#{old_name}",
- new_name ? "#{self.name}.#{new_name}" : nil,
+ "#{name}.#{old_name}",
+ new_name ? "#{name}.#{new_name}" : nil,
message
)
@@ -210,7 +214,7 @@
remove_const(constant_name)
full_msg = Deprecations.deprecated_name_message(
- "#{self.name}::#{constant_name}",
+ "#{name}::#{constant_name}",
message
)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/lib/dry/core/equalizer.rb
new/lib/dry/core/equalizer.rb
--- old/lib/dry/core/equalizer.rb 2021-06-03 10:43:42.000000000 +0200
+++ new/lib/dry/core/equalizer.rb 2021-07-10 16:03:50.000000000 +0200
@@ -14,7 +14,7 @@
module Core
# Define equality, equivalence and inspection methods
- class Equalizer < Module
+ class Equalizer < ::Module
# Initialize an Equalizer with the given keys
#
# Will use the keys with which it is initialized to define #cmp?,
@@ -29,6 +29,7 @@
#
# @api private
def initialize(*keys, **options)
+ super()
@keys = keys.uniq
define_methods(**options)
freeze
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/lib/dry/core/memoizable.rb
new/lib/dry/core/memoizable.rb
--- old/lib/dry/core/memoizable.rb 2021-06-03 10:43:42.000000000 +0200
+++ new/lib/dry/core/memoizable.rb 2021-07-10 16:03:50.000000000 +0200
@@ -1,9 +1,12 @@
# frozen_string_literal: true
+require "dry/core/deprecations"
+
module Dry
module Core
module Memoizable
MEMOIZED_HASH = {}.freeze
+ PARAM_PLACEHOLDERS = %i[* ** &].freeze
module ClassInterface
module Base
@@ -27,7 +30,7 @@
def new(*)
obj = super
- obj.instance_variable_set(:'@__memoized__', MEMOIZED_HASH.dup)
+ obj.instance_variable_set(:@__memoized__, MEMOIZED_HASH.dup)
obj
end
@@ -48,9 +51,10 @@
end
# @api private
- class Memoizer < Module
+ class Memoizer < ::Module
# @api private
def initialize(klass, names)
+ super()
names.each do |name|
define_memoizable(
method: klass.instance_method(name)
@@ -61,46 +65,137 @@
private
# @api private
- def define_memoizable(method:)
- module_eval <<~RUBY, __FILE__, __LINE__ + 1
- def #{method.name}(#{to_declaration(method.parameters)})
- key = [Kernel.__method__] + Kernel.local_variables.map { |var|
Kernel.eval(var.to_s) }
-
- if @__memoized__.key?(key)
- @__memoized__[key]
- else
- @__memoized__[key] = super
- end
+ def define_memoizable(method:) # rubocop:disable Metrics/AbcSize
+ parameters = method.parameters
+
+ if parameters.empty?
+ key = method.name.hash
+ module_eval(<<~RUBY, __FILE__, __LINE__ + 1)
+ def #{method.name} # def slow_fetch
+ if @__memoized__.key?(#{key}) # if
@__memoized__.key?(12345678)
+ @__memoized__[#{key}] #
@__memoized__[12345678]
+ else # else
+ @__memoized__[#{key}] = super #
@__memoized__[12345678] = super
+ end # end
+ end # end
+ RUBY
+ else
+ mapping = parameters.to_h { |k, v = nil| [k, v] }
+ params, binds = declaration(parameters, mapping)
+ last_param = parameters.last
+
+ if last_param[0].eql?(:block) && !last_param[1].eql?(:&)
+ Deprecations.warn(<<~WARN)
+ Memoization for block-accepting methods isn't safe.
+ Every call creates a new block instance bloating cached
results.
+ In the future, blocks will still be allowed but won't
participate in
+ cache key calculation.
+ WARN
end
- RUBY
- if respond_to?(:ruby2_keywords, true)
- ruby2_keywords(method.name)
+ m = module_eval(<<~RUBY, __FILE__, __LINE__ + 1)
+ def #{method.name}(#{params.join(", ")}) # def
slow_calc(arg1, arg2, arg3)
+ key = [:"#{method.name}", #{binds.join(", ")}].hash #
[:slow_calc, arg1, arg2, arg3].hash
+ #
+ if @__memoized__.key?(key) # if
@__memoized__.key?(key)
+ @__memoized__[key] #
@__memoized__[key]
+ else # else
+ @__memoized__[key] = super #
@__memoized__[key] = super
+ end # end
+ end # end
+ RUBY
+
+ if respond_to?(:ruby2_keywords, true) && mapping.key?(:reyrest)
+ ruby2_keywords(method.name)
+ end
+
+ m
+ end
+ end
+
+ # @api private
+ def declaration(definition, lookup)
+ params = []
+ binds = []
+ defined = {}
+
+ definition.each do |type, name|
+ mapped_type = map_bind_type(type, name, lookup, defined) do
+ raise ::NotImplementedError, "type: #{type}, name: #{name}"
+ end
+
+ if mapped_type
+ defined[mapped_type] = true
+ bind = name_from_param(name) || make_bind_name(binds.size)
+
+ binds << bind
+ params << param(bind, mapped_type)
+ end
end
+
+ [params, binds]
end
# @api private
- def to_declaration(params, lookup = params.to_h)
- params.map do |type, name|
- case type
- when :req
- name
- when :rest
- "*#{name}"
- when :keyreq
- "#{name}:"
- when :keyrest
- "**#{name}"
- when :block
- "&#{name}"
- when :opt
- lookup.key?(:rest) ? nil : "*args"
- when :key
- lookup.key?(:keyrest) ? nil : "**kwargs"
+ def name_from_param(name)
+ if PARAM_PLACEHOLDERS.include?(name)
+ nil
+ else
+ name
+ end
+ end
+
+ # @api private
+ def make_bind_name(idx)
+ :"__lv_#{idx}__"
+ end
+
+ # @api private
+ def map_bind_type(type, name, original_params, defined_types) #
rubocop:disable Metrics/PerceivedComplexity
+ case type
+ when :req
+ :reqular
+ when :rest, :keyreq, :keyrest
+ type
+ when :block
+ if name.eql?(:&)
+ # most likely this is a case of delegation
+ # rather than actual block
+ nil
+ else
+ type
+ end
+ when :opt
+ if original_params.key?(:rest) || defined_types[:rest]
+ nil
else
- raise NotImplementedError, "type: #{type}, name: #{name}"
+ :rest
end
- end.compact.join(", ")
+ when :key
+ if original_params.key?(:keyrest) || defined_types[:keyrest]
+ nil
+ else
+ :keyrest
+ end
+ else
+ yield
+ end
+ end
+
+ # @api private
+ def param(name, type)
+ case type
+ when :reqular
+ name
+ when :rest
+ "*#{name}"
+ when :keyreq
+ "#{name}:"
+ when :keyrest
+ "**#{name}"
+ when :block
+ "&#{name}"
+ end
end
end
end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/lib/dry/core/version.rb new/lib/dry/core/version.rb
--- old/lib/dry/core/version.rb 2021-06-03 10:43:42.000000000 +0200
+++ new/lib/dry/core/version.rb 2021-07-10 16:03:50.000000000 +0200
@@ -2,6 +2,6 @@
module Dry
module Core
- VERSION = "0.6.0".freeze
+ VERSION = "0.7.1"
end
end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/metadata new/metadata
--- old/metadata 2021-06-03 10:43:42.000000000 +0200
+++ new/metadata 2021-07-10 16:03:50.000000000 +0200
@@ -1,14 +1,14 @@
--- !ruby/object:Gem::Specification
name: dry-core
version: !ruby/object:Gem::Version
- version: 0.6.0
+ version: 0.7.1
platform: ruby
authors:
- Nikita Shilnikov
autorequire:
bindir: bin
cert_chain: []
-date: 2021-06-03 00:00:00.000000000 Z
+date: 2021-07-10 00:00:00.000000000 Z
dependencies:
- !ruby/object:Gem::Dependency
name: concurrent-ruby
@@ -107,7 +107,7 @@
requirements:
- - ">="
- !ruby/object:Gem::Version
- version: 2.5.0
+ version: 2.6.0
required_rubygems_version: !ruby/object:Gem::Requirement
requirements:
- - ">="