diff options
author | obache <obache> | 2012-02-29 07:47:04 +0000 |
---|---|---|
committer | obache <obache> | 2012-02-29 07:47:04 +0000 |
commit | a5d5bf2ba8cca9807284775254cf04169b9d2454 (patch) | |
tree | 3b4d3e6acfd210efdd9133d293329df9356034fd /net/ruby-addressable | |
parent | 9b21ac98fb4dbfa9e6f48caa431ef122b694dc30 (diff) | |
download | pkgsrc-a5d5bf2ba8cca9807284775254cf04169b9d2454.tar.gz |
Update ruby-addressable to 2.2.7.
# Addressable 2.2.7
- fixed issues related to Addressable::URI#query_values=
- the Addressable::URI.parse method is now polymorphic
Diffstat (limited to 'net/ruby-addressable')
-rw-r--r-- | net/ruby-addressable/Makefile | 5 | ||||
-rw-r--r-- | net/ruby-addressable/PLIST | 3 | ||||
-rw-r--r-- | net/ruby-addressable/distinfo | 10 | ||||
-rw-r--r-- | net/ruby-addressable/patches/patch-lib_addressable_template.rb | 33 | ||||
-rw-r--r-- | net/ruby-addressable/patches/patch-lib_addressable_uri.rb | 120 |
5 files changed, 8 insertions, 163 deletions
diff --git a/net/ruby-addressable/Makefile b/net/ruby-addressable/Makefile index 9c6af2c1c92..6b45efd9cb0 100644 --- a/net/ruby-addressable/Makefile +++ b/net/ruby-addressable/Makefile @@ -1,7 +1,6 @@ -# $NetBSD: Makefile,v 1.5 2011/11/06 07:44:27 obache Exp $ +# $NetBSD: Makefile,v 1.6 2012/02/29 07:47:04 obache Exp $ -DISTNAME= addressable-2.2.6 -PKGREVISION= 1 +DISTNAME= addressable-2.2.7 CATEGORIES= net MAINTAINER= pkgsrc-users@NetBSD.org diff --git a/net/ruby-addressable/PLIST b/net/ruby-addressable/PLIST index 790692be141..d4b9bc764f5 100644 --- a/net/ruby-addressable/PLIST +++ b/net/ruby-addressable/PLIST @@ -1,4 +1,4 @@ -@comment $NetBSD: PLIST,v 1.3 2011/06/19 02:50:20 taca Exp $ +@comment $NetBSD: PLIST,v 1.4 2012/02/29 07:47:04 obache Exp $ ${GEM_HOME}/cache/${GEM_NAME}.gem ${GEM_LIBDIR}/CHANGELOG ${GEM_LIBDIR}/LICENSE @@ -11,6 +11,7 @@ ${GEM_LIBDIR}/lib/addressable/template.rb ${GEM_LIBDIR}/lib/addressable/uri.rb ${GEM_LIBDIR}/lib/addressable/version.rb ${GEM_LIBDIR}/spec/addressable/idna_spec.rb +${GEM_LIBDIR}/spec/addressable/net_http_compat_spec.rb ${GEM_LIBDIR}/spec/addressable/template_spec.rb ${GEM_LIBDIR}/spec/addressable/uri_spec.rb ${GEM_LIBDIR}/tasks/clobber.rake diff --git a/net/ruby-addressable/distinfo b/net/ruby-addressable/distinfo index ca349e5abd1..eceb368c177 100644 --- a/net/ruby-addressable/distinfo +++ b/net/ruby-addressable/distinfo @@ -1,7 +1,5 @@ -$NetBSD: distinfo,v 1.5 2011/11/06 07:44:27 obache Exp $ +$NetBSD: distinfo,v 1.6 2012/02/29 07:47:04 obache Exp $ -SHA1 (addressable-2.2.6.gem) = 0b46d26336521fdc1843a5efc515b8102ef8a60c -RMD160 (addressable-2.2.6.gem) = 52df9776570df16e4014f3add8799269ed506c0c -Size (addressable-2.2.6.gem) = 97792 bytes -SHA1 (patch-lib_addressable_template.rb) = e6f9b63e4fca8007246924d98efbc72c34a8267a -SHA1 (patch-lib_addressable_uri.rb) = 41f7bc99d7bf18a62bf4b181a0ee094de57a1c5c +SHA1 (addressable-2.2.7.gem) = ffd2c2908477dfa3089e37462e9b2f7582e86ae7 +RMD160 (addressable-2.2.7.gem) = c4228c6c241f324fde8551fe8825377552b98adc +Size (addressable-2.2.7.gem) = 98816 bytes diff --git a/net/ruby-addressable/patches/patch-lib_addressable_template.rb b/net/ruby-addressable/patches/patch-lib_addressable_template.rb deleted file mode 100644 index f8f40ee8b8d..00000000000 --- a/net/ruby-addressable/patches/patch-lib_addressable_template.rb +++ /dev/null @@ -1,33 +0,0 @@ -$NetBSD: patch-lib_addressable_template.rb,v 1.1 2011/11/06 07:44:28 obache Exp $ - -* Fixed variable shadowing (from upstream repo). - ---- lib/addressable/template.rb.orig 2011-11-06 07:18:52.000000000 +0000 -+++ lib/addressable/template.rb -@@ -931,7 +931,7 @@ module Addressable - values.pop if values[-1] == "" - - if processor && processor.respond_to?(:restore) -- values.map! { |value| processor.restore(variables.first, value) } -+ values.map! { |val| processor.restore(variables.first, val) } - end - values = values.first if values.size == 1 - if mapping[variables.first] == nil || mapping[variables.first] == values -@@ -965,7 +965,7 @@ module Addressable - values = value.split(argument, -1) - values.pop if values[-1] == "" - if processor && processor.respond_to?(:restore) -- values.map! { |value| processor.restore(variables.first, value) } -+ values.map! { |val| processor.restore(variables.first, val) } - end - values = values.first if values.size == 1 - if mapping[variables.first] == nil || mapping[variables.first] == values -@@ -1034,7 +1034,7 @@ module Addressable - values = value.split(argument, -1) - values.pop if values[-1] == "" - if processor && processor.respond_to?(:restore) -- values.map! { |value| processor.restore(variables.first, value) } -+ values.map! { |val| processor.restore(variables.first, val) } - end - if mapping[variables.first] == nil || mapping[variables.first] == values - mapping[variables.first] = values diff --git a/net/ruby-addressable/patches/patch-lib_addressable_uri.rb b/net/ruby-addressable/patches/patch-lib_addressable_uri.rb deleted file mode 100644 index 9d1a47d6157..00000000000 --- a/net/ruby-addressable/patches/patch-lib_addressable_uri.rb +++ /dev/null @@ -1,120 +0,0 @@ -$NetBSD: patch-lib_addressable_uri.rb,v 1.1 2011/11/06 07:44:28 obache Exp $ - -* some fixes and improvements (from upstream repo). - ---- lib/addressable/uri.rb.orig 2011-11-06 07:18:52.000000000 +0000 -+++ lib/addressable/uri.rb -@@ -325,7 +325,11 @@ module Addressable - return nil if component.nil? - - begin -- component = component.to_str -+ if component.kind_of?(Symbol) || component.kind_of?(Numeric) -+ component = component.to_s -+ else -+ component = component.to_str -+ end - rescue TypeError, NoMethodError - raise TypeError, "Can't convert #{component.class} into String." - end if !component.is_a? String -@@ -715,6 +719,7 @@ module Addressable - self.authority = options[:authority] if options[:authority] - self.path = options[:path] if options[:path] - self.query = options[:query] if options[:query] -+ self.query_values = options[:query_values] if options[:query_values] - self.fragment = options[:fragment] if options[:fragment] - end - end -@@ -1497,39 +1502,55 @@ module Addressable - # Only to be used for non-Array inputs. Arrays should preserve order. - new_query_values.sort! - end -- # new_query_values have form [['key1', 'value1'], ['key2', 'value2']] - -- # Algorithm shamelessly stolen from Julien Genestoux, slightly modified -- buffer = "" -- stack = [] -- e = lambda do |component| -- component = component.to_s if component.kind_of?(Symbol) -- URI.encode_component(component, CharacterClasses::UNRESERVED) -- end -- new_query_values.each do |key, value| -- if value.kind_of?(Hash) -- stack << [key, value] -- elsif value.kind_of?(Array) -- stack << [ -- key, -- value.inject({}) { |accu, x| accu[accu.size.to_s] = x; accu } -- ] -+ ## -+ # Joins and converts parent and value into a properly encoded and -+ # ordered URL query. -+ # -+ # @private -+ # @param [String] parent an URI encoded component. -+ # @param [Array, Hash, Symbol, #to_str] value -+ # -+ # @return [String] a properly escaped and ordered URL query. -+ to_query = lambda do |parent, value| -+ if value.is_a?(Hash) -+ value = value.map do |key, val| -+ [ -+ URI.encode_component(key, CharacterClasses::UNRESERVED), -+ val -+ ] -+ end -+ value.sort! -+ buffer = "" -+ value.each do |key, val| -+ new_parent = "#{parent}[#{key}]" -+ buffer << "#{to_query.call(new_parent, val)}&" -+ end -+ return buffer.chop -+ elsif value.is_a?(Array) -+ buffer = "" -+ value.each_with_index do |val, i| -+ new_parent = "#{parent}[#{i}]" -+ buffer << "#{to_query.call(new_parent, val)}&" -+ end -+ return buffer.chop - elsif value == true -- buffer << "#{e.call(key)}&" -+ return parent - else -- buffer << "#{e.call(key)}=#{e.call(value)}&" -+ encoded_value = URI.encode_component( -+ value, CharacterClasses::UNRESERVED -+ ) -+ return "#{parent}=#{encoded_value}" - end - end -- stack.each do |(parent, hash)| -- (hash.sort_by { |key| key.to_s }).each do |(key, value)| -- if value.kind_of?(Hash) -- stack << ["#{parent}[#{key}]", value] -- elsif value == true -- buffer << "#{parent}[#{e.call(key)}]&" -- else -- buffer << "#{parent}[#{e.call(key)}]=#{e.call(value)}&" -- end -- end -+ -+ # new_query_values have form [['key1', 'value1'], ['key2', 'value2']] -+ buffer = "" -+ new_query_values.each do |parent, value| -+ encoded_parent = URI.encode_component( -+ parent, CharacterClasses::UNRESERVED -+ ) -+ buffer << "#{to_query.call(encoded_parent, value)}&" - end - self.query = buffer.chop - end -@@ -2182,7 +2203,7 @@ module Addressable - parent = normalized_path.match(NPATH2) - if parent && ((parent[1] != PARENT1 && parent[1] != PARENT2) \ - || (parent[2] != PARENT1 && parent[2] != PARENT2)) -- mod ||= normalized_path.gsub!(/\/#{parent[1]}\/\.\.\/|(\/#{parent[2]}\/\.\.$)/, SLASH) -+ mod ||= normalized_path.gsub!(/\/#{Regexp.escape(parent[1].to_s)}\/\.\.\/|(\/#{Regexp.escape(parent[2].to_s)}\/\.\.$)/, SLASH) - end - - mod ||= normalized_path.gsub!(NPATH3, EMPTYSTR) |