Hello community,

here is the log from the commit of package rubygem-globalid for 
openSUSE:Factory checked in at 2019-01-21 10:53:17
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/rubygem-globalid (Old)
 and      /work/SRC/openSUSE:Factory/.rubygem-globalid.new.28833 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "rubygem-globalid"

Mon Jan 21 10:53:17 2019 rev:7 rq:665962 version:0.4.2

Changes:
--------
--- /work/SRC/openSUSE:Factory/rubygem-globalid/rubygem-globalid.changes        
2017-11-01 11:09:39.885715294 +0100
+++ 
/work/SRC/openSUSE:Factory/.rubygem-globalid.new.28833/rubygem-globalid.changes 
    2019-01-21 10:53:33.387786420 +0100
@@ -1,0 +2,9 @@
+Mon Jan 14 08:04:04 UTC 2019 - mschnit...@suse.com
+
+- updated to version 0.4.2
+
+  * Allow configuration in initialisers 3c8f909
+  * Clear to_global_id memoization on dup #109
+  * Adds hash equality #108
+
+-------------------------------------------------------------------

Old:
----
  globalid-0.4.1.gem

New:
----
  globalid-0.4.2.gem

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ rubygem-globalid.spec ++++++
--- /var/tmp/diff_new_pack.3Hh4Lw/_old  2019-01-21 10:53:33.975785710 +0100
+++ /var/tmp/diff_new_pack.3Hh4Lw/_new  2019-01-21 10:53:33.975785710 +0100
@@ -1,7 +1,7 @@
 #
 # spec file for package rubygem-globalid
 #
-# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany.
+# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany.
 #
 # All modifications and additions to the file contributed by third parties
 # remain the property of their copyright owners, unless otherwise agreed
@@ -24,7 +24,7 @@
 #
 
 Name:           rubygem-globalid
-Version:        0.4.1
+Version:        0.4.2
 Release:        0
 %define mod_name globalid
 %define mod_full_name %{mod_name}-%{version}

++++++ globalid-0.4.1.gem -> globalid-0.4.2.gem ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/README.md new/README.md
--- old/README.md       2017-10-24 18:00:45.000000000 +0200
+++ new/README.md       2019-01-11 14:58:27.000000000 +0100
@@ -24,17 +24,17 @@
 Support is automatically included in Active Record.
 
 ```ruby
->> person_gid = Person.find(1).to_global_id
-=> #<GlobalID ...
+person_gid = Person.find(1).to_global_id
+# => #<GlobalID ...
 
->> person_gid.uri
-=> #<URI ...
+person_gid.uri
+# => #<URI ...
 
->> person_gid.to_s
-=> "gid://app/Person/1"
+person_gid.to_s
+# => "gid://app/Person/1"
 
->> GlobalID::Locator.locate person_gid
-=> #<Person:0x007fae94bf6298 @id="1">
+GlobalID::Locator.locate person_gid
+# => #<Person:0x007fae94bf6298 @id="1">
 ```
 
 ### Signed Global IDs
@@ -42,77 +42,95 @@
 For added security GlobalIDs can also be signed to ensure that the data hasn't 
been tampered with.
 
 ```ruby
->> person_sgid = Person.find(1).to_signed_global_id
-=> #<SignedGlobalID:0x007fea1944b410>
+person_sgid = Person.find(1).to_signed_global_id
+# => #<SignedGlobalID:0x007fea1944b410>
 
->> person_sgid = Person.find(1).to_sgid
-=> #<SignedGlobalID:0x007fea1944b410>
+person_sgid = Person.find(1).to_sgid
+# => #<SignedGlobalID:0x007fea1944b410>
 
->> person_sgid.to_s
-=> 
"BAhJIh5naWQ6Ly9pZGluYWlkaS9Vc2VyLzM5NTk5BjoGRVQ=--81d7358dd5ee2ca33189bb404592df5e8d11420e"
-
->> GlobalID::Locator.locate_signed person_sgid
-=> #<Person:0x007fae94bf6298 @id="1">
+person_sgid.to_s
+# => 
"BAhJIh5naWQ6Ly9pZGluYWlkaS9Vc2VyLzM5NTk5BjoGRVQ=--81d7358dd5ee2ca33189bb404592df5e8d11420e"
 
+GlobalID::Locator.locate_signed person_sgid
+# => #<Person:0x007fae94bf6298 @id="1">
 ```
-You can even bump the security up some more by explaining what purpose a 
Signed Global ID is for.
-In this way evildoers can't reuse a sign-up form's SGID on the login page. For 
example.
 
-```ruby
->> signup_person_sgid = Person.find(1).to_sgid(for: 'signup_form')
-=> #<SignedGlobalID:0x007fea1984b520
-
->> GlobalID::Locator.locate_signed(signup_person_sgid.to_s, for: 'signup_form')
-=> #<Person:0x007fae94bf6298 @id="1">
-```
+**Expiration**
 
-You can also have SGIDs that expire some time in the future. Useful if there's 
a resource,
+Signed Global IDs can expire some time in the future. This is useful if 
there's a resource
 people shouldn't have indefinite access to, like a share link.
 
 ```ruby
->> expiring_sgid = Document.find(5).to_sgid(expires_in: 2.hours, for: 
'sharing')
-=> #<SignedGlobalID:0x008fde45df8937 ...>
+expiring_sgid = Document.find(5).to_sgid(expires_in: 2.hours, for: 'sharing')
+# => #<SignedGlobalID:0x008fde45df8937 ...>
 
 # Within 2 hours...
->> GlobalID::Locator.locate_signed(expiring_sgid.to_s, for: 'sharing')
-=> #<Document:0x007fae94bf6298 @id="5">
+GlobalID::Locator.locate_signed(expiring_sgid.to_s, for: 'sharing')
+# => #<Document:0x007fae94bf6298 @id="5">
 
 # More than 2 hours later...
->> GlobalID::Locator.locate_signed(expiring_sgid.to_s, for: 'sharing')
-=> nil
+GlobalID::Locator.locate_signed(expiring_sgid.to_s, for: 'sharing')
+# => nil
+```
 
->> explicit_expiring_sgid = SecretAgentMessage.find(5).to_sgid(expires_at: 
Time.now.advance(hours: 1))
-=> #<SignedGlobalID:0x008fde45df8937 ...>
+**In Rails, an auto-expiry of 1 month is set by default.** You can alter that 
deal
+in an initializer with:
 
-# 1 hour later...
->> GlobalID::Locator.locate_signed explicit_expiring_sgid.to_s
-=> nil
+```ruby
+# config/initializers/global_id.rb
+Rails.application.config.global_id.expires_in = 3.months
+```
+
+You can assign a default SGID lifetime like so:
+
+```ruby
+SignedGlobalID.expires_in = 1.month
+```
+
+This way any generated SGID will use that relative expiry.
 
+It's worth noting that _expiring SGIDs are not idempotent_ because they encode 
the current timestamp; repeated calls to `to_sgid` will produce different 
results. For example, in Rails
+
+```ruby
+Document.find(5).to_sgid.to_s == Document.find(5).to_sgid.to_s
+# => false
+```
+
+You need to explicitly pass `expires_in: nil` to generate a permanent SGID 
that will not expire,
+
+```ruby
 # Passing a false value to either expiry option turns off expiration entirely.
->> never_expiring_sgid = Document.find(5).to_sgid(expires_in: nil)
-=> #<SignedGlobalID:0x008fde45df8937 ...>
+never_expiring_sgid = Document.find(5).to_sgid(expires_in: nil)
+# => #<SignedGlobalID:0x008fde45df8937 ...>
 
 # Any time later...
->> GlobalID::Locator.locate_signed never_expiring_sgid
-=> #<Document:0x007fae94bf6298 @id="5">
+GlobalID::Locator.locate_signed never_expiring_sgid
+# => #<Document:0x007fae94bf6298 @id="5">
 ```
 
-Note that an explicit `:expires_at` takes precedence over a relative 
`:expires_in`.
-
-You can assign a default SGID lifetime like so:
+It's also possible to pass a specific expiry time
 
 ```ruby
-SignedGlobalID.expires_in = 1.month
+explicit_expiring_sgid = SecretAgentMessage.find(5).to_sgid(expires_at: 
Time.now.advance(hours: 1))
+# => #<SignedGlobalID:0x008fde45df8937 ...>
+
+# 1 hour later...
+GlobalID::Locator.locate_signed explicit_expiring_sgid.to_s
+# => nil
 ```
+Note that an explicit `:expires_at` takes precedence over a relative 
`:expires_in`.
 
-This way any generated SGID will use that relative expiry.
+**Purpose**
 
-In Rails, an auto-expiry of 1 month is set by default. You can alter that deal
-in an initializer with:
+You can even bump the security up some more by explaining what purpose a 
Signed Global ID is for.
+In this way evildoers can't reuse a sign-up form's SGID on the login page. For 
example.
 
 ```ruby
-# config/initializers/global_id.rb
-Rails.application.config.global_id.expires_in = 3.months
+signup_person_sgid = Person.find(1).to_sgid(for: 'signup_form')
+# => #<SignedGlobalID:0x007fea1984b520
+
+GlobalID::Locator.locate_signed(signup_person_sgid.to_s, for: 'signup_form')
+# => #<Person:0x007fae94bf6298 @id="1">
 ```
 
 ### Custom App Locator
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/global_id.rb 
new/lib/global_id/global_id.rb
--- old/lib/global_id/global_id.rb      2017-10-24 18:00:45.000000000 +0200
+++ new/lib/global_id/global_id.rb      2019-01-11 14:58:27.000000000 +0100
@@ -63,6 +63,11 @@
   def ==(other)
     other.is_a?(GlobalID) && @uri == other.uri
   end
+  alias_method :eql?, :==
+
+  def hash
+    self.class.hash | @uri.hash
+  end
 
   def to_param
     # remove the = padding character for a prettier param -- it'll be added 
back in parse_encoded_gid
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 2017-10-24 18:00:45.000000000 +0200
+++ new/lib/global_id/identification.rb 2019-01-11 14:58:27.000000000 +0100
@@ -5,7 +5,7 @@
     extend ActiveSupport::Concern
 
     def to_global_id(options = {})
-      @global_id ||= GlobalID.create(self, options)
+      GlobalID.create(self, options)
     end
     alias to_gid to_global_id
 
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        2017-10-24 18:00:45.000000000 +0200
+++ new/lib/global_id/railtie.rb        2019-01-11 14:58:27.000000000 +0100
@@ -14,14 +14,16 @@
     config.eager_load_namespaces << GlobalID
 
     initializer 'global_id' do |app|
+      default_expires_in = 1.month
+      default_app_name = app.railtie_name.remove('_application').dasherize
 
-      app.config.global_id.app ||= 
app.railtie_name.remove('_application').dasherize
-      GlobalID.app = app.config.global_id.app
-
-      app.config.global_id.expires_in ||= 1.month
-      SignedGlobalID.expires_in = app.config.global_id.expires_in
+      GlobalID.app = app.config.global_id.app ||= default_app_name
+      SignedGlobalID.expires_in = app.config.global_id.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
+
         app.config.global_id.verifier ||= begin
           
GlobalID::Verifier.new(app.key_generator.generate_key('signed_global_ids'))
         rescue ArgumentError
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/metadata new/metadata
--- old/metadata        2017-10-24 18:00:45.000000000 +0200
+++ new/metadata        2019-01-11 14:58:27.000000000 +0100
@@ -1,14 +1,14 @@
 --- !ruby/object:Gem::Specification
 name: globalid
 version: !ruby/object:Gem::Version
-  version: 0.4.1
+  version: 0.4.2
 platform: ruby
 authors:
 - David Heinemeier Hansson
 autorequire: 
 bindir: bin
 cert_chain: []
-date: 2017-10-24 00:00:00.000000000 Z
+date: 2019-01-11 00:00:00.000000000 Z
 dependencies:
 - !ruby/object:Gem::Dependency
   name: activesupport
@@ -74,8 +74,7 @@
     - !ruby/object:Gem::Version
       version: '0'
 requirements: []
-rubyforge_project: 
-rubygems_version: 2.6.12
+rubygems_version: 3.0.2
 signing_key: 
 specification_version: 4
 summary: 'Refer to any model with a URI: gid://app/class/id'


Reply via email to