Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package rubygem-globalid for openSUSE:Factory checked in at 2021-08-25 20:58:07 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/rubygem-globalid (Old) and /work/SRC/openSUSE:Factory/.rubygem-globalid.new.1899 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "rubygem-globalid" Wed Aug 25 20:58:07 2021 rev:8 rq:914124 version:0.5.2 Changes: -------- --- /work/SRC/openSUSE:Factory/rubygem-globalid/rubygem-globalid.changes 2019-01-21 10:53:33.387786420 +0100 +++ /work/SRC/openSUSE:Factory/.rubygem-globalid.new.1899/rubygem-globalid.changes 2021-08-25 20:59:39.193047368 +0200 @@ -1,0 +2,8 @@ +Wed Aug 25 05:12:40 UTC 2021 - Manuel Schnitzer <mschnit...@suse.com> + +- updated to version 0.5.2 + + * Add back Ruby 2.5 support so gem install rails works out of the box, + thereby satisfying Rails' Ruby version requirement. See rails/rails#42931 + +------------------------------------------------------------------- Old: ---- globalid-0.4.2.gem New: ---- globalid-0.5.2.gem ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ rubygem-globalid.spec ++++++ --- /var/tmp/diff_new_pack.pcpkHl/_old 2021-08-25 20:59:39.669046743 +0200 +++ /var/tmp/diff_new_pack.pcpkHl/_new 2021-08-25 20:59:39.673046738 +0200 @@ -1,7 +1,7 @@ # # spec file for package rubygem-globalid # -# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2021 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -12,7 +12,7 @@ # license that conforms to the Open Source Definition (Version 1.9) # published by the Open Source Initiative. -# Please submit bugfixes or comments via http://bugs.opensuse.org/ +# Please submit bugfixes or comments via https://bugs.opensuse.org/ # @@ -24,7 +24,7 @@ # Name: rubygem-globalid -Version: 0.4.2 +Version: 0.5.2 Release: 0 %define mod_name globalid %define mod_full_name %{mod_name}-%{version} @@ -34,10 +34,10 @@ %endif # /MANUAL BuildRoot: %{_tmppath}/%{name}-%{version}-build -BuildRequires: %{ruby >= 1.9.3} +BuildRequires: %{ruby >= 2.5.0} BuildRequires: %{rubygem gem2rpm} BuildRequires: ruby-macros >= 5 -Url: http://www.rubyonrails.org +URL: http://www.rubyonrails.org Source: https://rubygems.org/gems/%{mod_full_name}.gem Source1: gem2rpm.yml Summary: Refer to any model with a URI: gid://app/class/id ++++++ globalid-0.4.2.gem -> globalid-0.5.2.gem ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/README.md new/README.md --- old/README.md 2019-01-11 14:58:27.000000000 +0100 +++ new/README.md 2021-08-02 15:07:32.000000000 +0200 @@ -133,6 +133,34 @@ # => #<Person:0x007fae94bf6298 @id="1"> ``` +### Locating many Global IDs + +When needing to locate many Global IDs use `GlobalID::Locator.locate_many` or `GlobalID::Locator.locate_many_signed` for Signed Global IDs to allow loading +Global IDs more efficiently. + +For instance, the default locator passes every `model_id` per `model_name` thus +using `model_name.where(id: model_ids)` versus `GlobalID::Locator.locate`'s `model_name.find(id)`. + +In the case of looking up Global IDs from a database, it's only necessary to query +once per `model_name` as shown here: + +```ruby +gids = users.concat(people).sort_by(&:id).map(&:to_global_id) +# => [#<GlobalID:0x00007ffd6a8411a0 @uri=#<URI::GID gid://app/User/1>>, +#<GlobalID:0x00007ffd675d32b8 @uri=#<URI::GID gid://app/Student/1>>, +#<GlobalID:0x00007ffd6a840b10 @uri=#<URI::GID gid://app/User/2>>, +#<GlobalID:0x00007ffd675d2c28 @uri=#<URI::GID gid://app/Student/2>>, +#<GlobalID:0x00007ffd6a840480 @uri=#<URI::GID gid://app/User/3>>, +#<GlobalID:0x00007ffd675d2598 @uri=#<URI::GID gid://app/Student/3>>] + +GlobalID::Locator.locate_many gids +# SELECT "users".* FROM "users" WHERE "users"."id" IN ($1, $2, $3) [["id", 1], ["id", 2], ["id", 3]] +# SELECT "students".* FROM "students" WHERE "students"."id" IN ($1, $2, $3) [["id", 1], ["id", 2], ["id", 3]] +# => [#<User id: 1>, #<Student id: 1>, #<User id: 2>, #<Student id: 2>, #<User id: 3>, #<Student id: 3>] +``` + +Note the order is maintained in the returned results. + ### Custom App Locator A custom locator can be set for an app by calling `GlobalID::Locator.use` and providing an app locator to use for that app. Binary files old/checksums.yaml.gz and new/checksums.yaml.gz differ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/global_id/identification.rb new/lib/global_id/identification.rb --- old/lib/global_id/identification.rb 2019-01-11 14:58:27.000000000 +0100 +++ new/lib/global_id/identification.rb 2021-08-02 15:07:32.000000000 +0200 @@ -1,9 +1,5 @@ -require 'active_support/concern' - class GlobalID module Identification - extend ActiveSupport::Concern - def to_global_id(options = {}) GlobalID.create(self, options) end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/global_id/railtie.rb new/lib/global_id/railtie.rb --- old/lib/global_id/railtie.rb 2019-01-11 14:58:27.000000000 +0100 +++ new/lib/global_id/railtie.rb 2021-08-02 15:07:32.000000000 +0200 @@ -5,6 +5,7 @@ require 'global_id' require 'active_support' require 'active_support/core_ext/string/inflections' +require 'active_support/core_ext/integer/time' class GlobalID # = GlobalID Railtie @@ -18,11 +19,11 @@ default_app_name = app.railtie_name.remove('_application').dasherize GlobalID.app = app.config.global_id.app ||= default_app_name - SignedGlobalID.expires_in = app.config.global_id.expires_in ||= default_expires_in + SignedGlobalID.expires_in = app.config.global_id.fetch(:expires_in, default_expires_in) config.after_initialize do GlobalID.app = app.config.global_id.app ||= default_app_name - SignedGlobalID.expires_in = app.config.global_id.expires_in ||= default_expires_in + SignedGlobalID.expires_in = app.config.global_id.fetch(:expires_in, default_expires_in) app.config.global_id.verifier ||= begin GlobalID::Verifier.new(app.key_generator.generate_key('signed_global_ids')) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/global_id/uri/gid.rb new/lib/global_id/uri/gid.rb --- old/lib/global_id/uri/gid.rb 2019-01-11 14:58:27.000000000 +0100 +++ new/lib/global_id/uri/gid.rb 2021-08-02 15:07:32.000000000 +0200 @@ -173,5 +173,9 @@ end end - @@schemes['GID'] = GID + if respond_to?(:register_scheme) + register_scheme('GID', GID) + else + @@schemes['GID'] = GID + end end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/metadata new/metadata --- old/metadata 2019-01-11 14:58:27.000000000 +0100 +++ new/metadata 2021-08-02 15:07:32.000000000 +0200 @@ -1,14 +1,14 @@ --- !ruby/object:Gem::Specification name: globalid version: !ruby/object:Gem::Version - version: 0.4.2 + version: 0.5.2 platform: ruby authors: - David Heinemeier Hansson autorequire: bindir: bin cert_chain: [] -date: 2019-01-11 00:00:00.000000000 Z +date: 2021-08-02 00:00:00.000000000 Z dependencies: - !ruby/object:Gem::Dependency name: activesupport @@ -16,14 +16,14 @@ requirements: - - ">=" - !ruby/object:Gem::Version - version: 4.2.0 + version: '5.0' type: :runtime prerelease: false version_requirements: !ruby/object:Gem::Requirement requirements: - - ">=" - !ruby/object:Gem::Version - version: 4.2.0 + version: '5.0' - !ruby/object:Gem::Dependency name: rake requirement: !ruby/object:Gem::Requirement @@ -67,14 +67,14 @@ requirements: - - ">=" - !ruby/object:Gem::Version - version: 1.9.3 + version: 2.5.0 required_rubygems_version: !ruby/object:Gem::Requirement requirements: - - ">=" - !ruby/object:Gem::Version version: '0' requirements: [] -rubygems_version: 3.0.2 +rubygems_version: 3.2.24 signing_key: specification_version: 4 summary: 'Refer to any model with a URI: gid://app/class/id'