summaryrefslogtreecommitdiff
path: root/net/ruby-addressable
diff options
context:
space:
mode:
authorobache <obache@pkgsrc.org>2011-11-06 07:44:27 +0000
committerobache <obache@pkgsrc.org>2011-11-06 07:44:27 +0000
commit8780d85274f4d81bde5e2809ce617dfbcf05b08d (patch)
treedf1d113354a38caf4fdbd02c775768754e079db8 /net/ruby-addressable
parent4bd8b693d225b029611b5f80585496889d68edfd (diff)
downloadpkgsrc-8780d85274f4d81bde5e2809ce617dfbcf05b08d.tar.gz
Apply some changes taken from upstream for net/mikutter version 0.0.4.
Bump PKGREVISION.
Diffstat (limited to 'net/ruby-addressable')
-rw-r--r--net/ruby-addressable/Makefile3
-rw-r--r--net/ruby-addressable/distinfo4
-rw-r--r--net/ruby-addressable/patches/patch-lib_addressable_template.rb33
-rw-r--r--net/ruby-addressable/patches/patch-lib_addressable_uri.rb120
4 files changed, 158 insertions, 2 deletions
diff --git a/net/ruby-addressable/Makefile b/net/ruby-addressable/Makefile
index 3bef248007c..9c6af2c1c92 100644
--- a/net/ruby-addressable/Makefile
+++ b/net/ruby-addressable/Makefile
@@ -1,6 +1,7 @@
-# $NetBSD: Makefile,v 1.4 2011/06/19 02:50:20 taca Exp $
+# $NetBSD: Makefile,v 1.5 2011/11/06 07:44:27 obache Exp $
DISTNAME= addressable-2.2.6
+PKGREVISION= 1
CATEGORIES= net
MAINTAINER= pkgsrc-users@NetBSD.org
diff --git a/net/ruby-addressable/distinfo b/net/ruby-addressable/distinfo
index a19f19d6d96..ca349e5abd1 100644
--- a/net/ruby-addressable/distinfo
+++ b/net/ruby-addressable/distinfo
@@ -1,5 +1,7 @@
-$NetBSD: distinfo,v 1.4 2011/06/19 02:50:20 taca Exp $
+$NetBSD: distinfo,v 1.5 2011/11/06 07:44:27 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
diff --git a/net/ruby-addressable/patches/patch-lib_addressable_template.rb b/net/ruby-addressable/patches/patch-lib_addressable_template.rb
new file mode 100644
index 00000000000..f8f40ee8b8d
--- /dev/null
+++ b/net/ruby-addressable/patches/patch-lib_addressable_template.rb
@@ -0,0 +1,33 @@
+$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
new file mode 100644
index 00000000000..9d1a47d6157
--- /dev/null
+++ b/net/ruby-addressable/patches/patch-lib_addressable_uri.rb
@@ -0,0 +1,120 @@
+$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)