Hello community,

here is the log from the commit of package rubygem-globalid for 
openSUSE:Factory checked in at 2015-08-05 19:14:37
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/rubygem-globalid (Old)
 and      /work/SRC/openSUSE:Factory/.rubygem-globalid.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "rubygem-globalid"

Changes:
--------
--- /work/SRC/openSUSE:Factory/rubygem-globalid/rubygem-globalid.changes        
2015-04-10 09:53:47.000000000 +0200
+++ /work/SRC/openSUSE:Factory/.rubygem-globalid.new/rubygem-globalid.changes   
2015-08-05 19:14:43.000000000 +0200
@@ -1,0 +2,6 @@
+Wed Aug  5 04:31:13 UTC 2015 - co...@suse.com
+
+- updated to version 0.3.6
+  no changelog found
+
+-------------------------------------------------------------------

Old:
----
  globalid-0.3.5.gem

New:
----
  globalid-0.3.6.gem

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

Other differences:
------------------
++++++ rubygem-globalid.spec ++++++
--- /var/tmp/diff_new_pack.9LT44G/_old  2015-08-05 19:14:44.000000000 +0200
+++ /var/tmp/diff_new_pack.9LT44G/_new  2015-08-05 19:14:44.000000000 +0200
@@ -24,7 +24,7 @@
 #
 
 Name:           rubygem-globalid
-Version:        0.3.5
+Version:        0.3.6
 Release:        0
 %define mod_name globalid
 %define mod_full_name %{mod_name}-%{version}

++++++ globalid-0.3.5.gem -> globalid-0.3.6.gem ++++++
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      1970-01-01 01:00:00.000000000 +0100
+++ new/lib/global_id/global_id.rb      2015-08-04 23:30:09.000000000 +0200
@@ -11,7 +11,8 @@
 
     def create(model, options = {})
       if app = options.fetch(:app) { GlobalID.app }
-        new URI::GID.create(app, model), options
+        params = options.except(:app, :verifier, :for)
+        new URI::GID.create(app, model, params), options
       else
         raise ArgumentError, 'An app is required to create a GlobalID. ' \
           'Pass the :app option or set the default GlobalID.app.'
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 1970-01-01 01:00:00.000000000 +0100
+++ new/lib/global_id/identification.rb 2015-08-04 23:30:09.000000000 +0200
@@ -4,13 +4,13 @@
   module Identification
     extend ActiveSupport::Concern
 
-    def to_global_id
-      @global_id ||= GlobalID.create(self)
+    def to_global_id(options = {})
+      @global_id ||= GlobalID.create(self, options)
     end
     alias to_gid to_global_id
 
-    def to_gid_param
-      to_global_id.to_param
+    def to_gid_param(options = {})
+      to_global_id(options).to_param
     end
 
     def to_signed_global_id(options = {})
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/global_id/locator.rb new/lib/global_id/locator.rb
--- old/lib/global_id/locator.rb        1970-01-01 01:00:00.000000000 +0100
+++ new/lib/global_id/locator.rb        2015-08-04 23:30:09.000000000 +0200
@@ -19,8 +19,11 @@
       end
 
       # Takes an array of GlobalIDs or strings that can be turned into a 
GlobalIDs.
-      # The GlobalIDs are located using Model.find(array_of_ids), so the 
models must respond to
-      # that finder signature.
+      # All GlobalIDs must belong to the same app, as they will be located 
using
+      # the same locator using its locate_many method.
+      #
+      # By default the GlobalIDs will be located using 
Model.find(array_of_ids), so the
+      # models must respond to that finder signature.
       #
       # This approach will efficiently call only one #find (or #where(id: id), 
when using ignore_missing)
       # per model class, but still interpolate the results to match the order 
in which the gids were passed.
@@ -37,13 +40,8 @@
       #   we will use #where(id: ids) instead, which does not raise on missing 
records.
       def locate_many(gids, options = {})
         if (allowed_gids = parse_allowed(gids, options[:only])).any?
-          models_and_ids  = allowed_gids.collect { |gid| [ 
gid.model_name.constantize, gid.model_id ] }
-          ids_by_model    = models_and_ids.group_by(&:first)
-          loaded_by_model = Hash[ids_by_model.map { |model, ids|
-            [ model, find_records(model, ids.map(&:last), ignore_missing: 
options[:ignore_missing]).index_by { |record| record.id.to_s } ]
-          }]
-
-          models_and_ids.collect { |(model, id)| loaded_by_model[model][id] 
}.compact
+          locator = locator_for(allowed_gids.first)
+          locator.locate_many(allowed_gids, options)
         else
           []
         end
@@ -108,7 +106,9 @@
 
       private
         def locator_for(gid)
-          @locators.fetch(normalize_app(gid.app)) { default_locator }
+          @locators.fetch(normalize_app(gid.app)) do
+            gid.model_class.respond_to?(:unscoped) ? UNSCOPED_LOCATOR : 
DEFAULT_LOCATOR
+          end
         end
 
         def find_allowed?(model_class, only = nil)
@@ -122,26 +122,48 @@
         def normalize_app(app)
           app.to_s.downcase
         end
-
-        def find_records(model_class, ids, options)
-          if options[:ignore_missing]
-            model_class.where(id: ids)
-          else
-            model_class.find(ids)
-          end
-        end
     end
 
     private
       @locators = {}
 
-      class ActiveRecordFinder
+      class DefaultLocator
         def locate(gid)
           gid.model_class.find gid.model_id
         end
+
+        def locate_many(gids, options = {})
+          models_and_ids  = gids.collect { |gid| [ gid.model_class, 
gid.model_id ] }
+          ids_by_model    = models_and_ids.group_by(&:first)
+          loaded_by_model = Hash[ids_by_model.map { |model, ids|
+            [ model, find_records(model, ids.map(&:last), ignore_missing: 
options[:ignore_missing]).index_by { |record| record.id.to_s } ]
+          }]
+
+          models_and_ids.collect { |(model, id)| loaded_by_model[model][id] 
}.compact
+        end
+
+        private
+          def find_records(model_class, ids, options)
+            if options[:ignore_missing]
+              model_class.where(id: ids)
+            else
+              model_class.find(ids)
+            end
+          end
       end
+      DEFAULT_LOCATOR = DefaultLocator.new
 
-      mattr_reader(:default_locator) { ActiveRecordFinder.new }
+      class UnscopedLocator < DefaultLocator
+        def locate(gid)
+          gid.model_class.unscoped { super }
+        end
+
+        private
+          def find_records(model_class, ids, options)
+            model_class.unscoped { super }
+          end
+      end
+      UNSCOPED_LOCATOR = UnscopedLocator.new
 
       class BlockLocator
         def initialize(block)
@@ -151,6 +173,10 @@
         def locate(gid)
           @locator.call(gid)
         end
+
+        def locate_many(gids, options = {})
+          gids.map { |gid| locate(gid) }
+        end
       end
   end
 end
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        1970-01-01 01:00:00.000000000 +0100
+++ new/lib/global_id/uri/gid.rb        2015-08-04 23:30:09.000000000 +0200
@@ -28,6 +28,9 @@
     alias :app :host
     attr_reader :model_name, :model_id, :params
 
+    # Raised when creating a Global ID for a model without an id
+    class MissingModelIdError < URI::InvalidComponentError; end
+
     class << self
       # Validates +app+'s as URI hostnames containing only alphanumeric 
characters
       # and hyphens. An ArgumentError is raised if +app+ is invalid.
@@ -80,8 +83,11 @@
       def build(args)
         parts = Util.make_components_hash(self, args)
         parts[:host] = parts[:app]
-        parts[:path] = "/#{parts[:model_name]}/#{parts[:model_id]}"
-        parts[:query] = URI.encode_www_form(parts[:params]) if parts[:params]
+        parts[:path] = 
"/#{parts[:model_name]}/#{CGI.escape(parts[:model_id].to_s)}"
+
+        if parts[:params] && !parts[:params].empty?
+          parts[:query] = URI.encode_www_form(parts[:params])
+        end
 
         super parts
       end
@@ -140,8 +146,9 @@
 
       def set_model_components(path, validate = false)
         _, model_name, model_id = path.match(PATH_REGEXP).to_a
+        model_id = CGI.unescape(model_id) if model_id
 
-        validate_component(model_name) && validate_component(model_id) if 
validate
+        validate_component(model_name) && validate_model_id(model_id, 
model_name) if validate
 
         @model_name = model_name
         @model_id = model_id
@@ -154,6 +161,13 @@
           "Expected a URI like gid://app/Person/1234: #{inspect}"
       end
 
+      def validate_model_id(model_id, model_name)
+        return model_id unless model_id.blank?
+
+        raise MissingModelIdError, "Unable to create a Global ID for " \
+          "#{model_name} without a model id."
+      end
+
       def parse_query_params(query)
         Hash[URI.decode_www_form(query)].with_indifferent_access if query
       end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/metadata new/metadata
--- old/metadata        1970-01-01 01:00:00.000000000 +0100
+++ new/metadata        2015-08-04 23:30:09.000000000 +0200
@@ -1,46 +1,41 @@
 --- !ruby/object:Gem::Specification
 name: globalid
 version: !ruby/object:Gem::Version
-  version: 0.3.5
-  prerelease: 
+  version: 0.3.6
 platform: ruby
 authors:
 - David Heinemeier Hansson
 autorequire: 
 bindir: bin
 cert_chain: []
-date: 2015-04-08 00:00:00.000000000 Z
+date: 2015-08-04 00:00:00.000000000 Z
 dependencies:
 - !ruby/object:Gem::Dependency
   name: activesupport
   requirement: !ruby/object:Gem::Requirement
-    none: false
     requirements:
-    - - ! '>='
+    - - ">="
       - !ruby/object:Gem::Version
         version: 4.1.0
   type: :runtime
   prerelease: false
   version_requirements: !ruby/object:Gem::Requirement
-    none: false
     requirements:
-    - - ! '>='
+    - - ">="
       - !ruby/object:Gem::Version
         version: 4.1.0
 - !ruby/object:Gem::Dependency
   name: rake
   requirement: !ruby/object:Gem::Requirement
-    none: false
     requirements:
-    - - ! '>='
+    - - ">="
       - !ruby/object:Gem::Version
         version: '0'
   type: :development
   prerelease: false
   version_requirements: !ruby/object:Gem::Requirement
-    none: false
     requirements:
-    - - ! '>='
+    - - ">="
       - !ruby/object:Gem::Version
         version: '0'
 description: URIs for your models makes it easy to pass references around.
@@ -50,37 +45,37 @@
 extra_rdoc_files: []
 files:
 - MIT-LICENSE
+- lib/global_id.rb
 - lib/global_id/global_id.rb
 - lib/global_id/identification.rb
 - lib/global_id/locator.rb
 - lib/global_id/railtie.rb
 - lib/global_id/signed_global_id.rb
 - lib/global_id/uri/gid.rb
-- lib/global_id.rb
 - lib/globalid.rb
 homepage: http://www.rubyonrails.org
 licenses:
 - MIT
+metadata: {}
 post_install_message: 
 rdoc_options: []
 require_paths:
 - lib
 required_ruby_version: !ruby/object:Gem::Requirement
-  none: false
   requirements:
-  - - ! '>='
+  - - ">="
     - !ruby/object:Gem::Version
       version: 1.9.3
 required_rubygems_version: !ruby/object:Gem::Requirement
-  none: false
   requirements:
-  - - ! '>='
+  - - ">="
     - !ruby/object:Gem::Version
       version: '0'
 requirements: []
 rubyforge_project: 
-rubygems_version: 1.8.23.2
+rubygems_version: 2.4.7
 signing_key: 
-specification_version: 3
-summary: ! 'Refer to any model with a URI: gid://app/class/id'
+specification_version: 4
+summary: 'Refer to any model with a URI: gid://app/class/id'
 test_files: []
+has_rdoc: 


Reply via email to