addressable 2.2.6 → 2.2.7
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +25 -21
- data/lib/addressable/template.rb +3 -3
- data/lib/addressable/uri.rb +61 -32
- data/lib/addressable/version.rb +1 -1
- data/spec/addressable/net_http_compat_spec.rb +26 -0
- data/spec/addressable/uri_spec.rb +123 -13
- data/tasks/gem.rake +2 -0
- data/tasks/git.rake +6 -1
- data/tasks/spec.rake +7 -0
- metadata +6 -18
data/CHANGELOG
CHANGED
@@ -1,33 +1,37 @@
|
|
1
|
-
|
1
|
+
# Addressable 2.2.7
|
2
|
+
- fixed issues related to Addressable::URI#query_values=
|
3
|
+
- the Addressable::URI.parse method is now polymorphic
|
4
|
+
|
5
|
+
# Addressable 2.2.6
|
2
6
|
- changed the way ambiguous paths are handled
|
3
7
|
- fixed bug with frozen URIs
|
4
8
|
- https supported in heuristic parsing
|
5
9
|
|
6
|
-
|
10
|
+
# Addressable 2.2.5
|
7
11
|
- 'parsing' a pre-parsed URI object is now a dup operation
|
8
12
|
- introduced conditional support for libidn
|
9
13
|
- fixed normalization issue on ampersands in query strings
|
10
14
|
- added additional tests around handling of query strings
|
11
15
|
|
12
|
-
|
16
|
+
# Addressable 2.2.4
|
13
17
|
- added origin support from draft-ietf-websec-origin-00
|
14
18
|
- resolved issue with attempting to navigate below root
|
15
19
|
- fixed bug with string splitting in query strings
|
16
20
|
|
17
|
-
|
21
|
+
# Addressable 2.2.3
|
18
22
|
- added :flat_array notation for query strings
|
19
23
|
|
20
|
-
|
24
|
+
# Addressable 2.2.2
|
21
25
|
- fixed issue with percent escaping of '+' character in query strings
|
22
26
|
|
23
|
-
|
27
|
+
# Addressable 2.2.1
|
24
28
|
- added support for application/x-www-form-urlencoded.
|
25
29
|
|
26
|
-
|
30
|
+
# Addressable 2.2.0
|
27
31
|
- added site methods
|
28
32
|
- improved documentation
|
29
33
|
|
30
|
-
|
34
|
+
# Addressable 2.1.2
|
31
35
|
- added HTTP request URI methods
|
32
36
|
- better handling of Windows file paths
|
33
37
|
- validation_deferred boolean replaced with defer_validation block
|
@@ -35,14 +39,14 @@
|
|
35
39
|
- fixed issue with constructing URIs with relative paths
|
36
40
|
- fixed warnings
|
37
41
|
|
38
|
-
|
42
|
+
# Addressable 2.1.1
|
39
43
|
- more type checking changes
|
40
44
|
- fixed issue with unicode normalization
|
41
45
|
- added method to find template defaults
|
42
46
|
- symbolic keys are now allowed in template mappings
|
43
47
|
- numeric values and symbolic values are now allowed in template mappings
|
44
48
|
|
45
|
-
|
49
|
+
# Addressable 2.1.0
|
46
50
|
- refactored URI template support out into its own class
|
47
51
|
- removed extract method due to being useless and unreliable
|
48
52
|
- removed Addressable::URI.expand_template
|
@@ -56,15 +60,15 @@
|
|
56
60
|
- worked around issue with freezing URIs
|
57
61
|
- improved specs
|
58
62
|
|
59
|
-
|
63
|
+
# Addressable 2.0.2
|
60
64
|
- fixed issue with URI template expansion
|
61
65
|
- fixed issue with percent escaping characters 0-15
|
62
66
|
|
63
|
-
|
67
|
+
# Addressable 2.0.1
|
64
68
|
- fixed issue with query string assignment
|
65
69
|
- fixed issue with improperly encoded components
|
66
70
|
|
67
|
-
|
71
|
+
# Addressable 2.0.0
|
68
72
|
- the initialize method now takes an options hash as its only parameter
|
69
73
|
- added query_values method to URI class
|
70
74
|
- completely replaced IDNA implementation with pure Ruby
|
@@ -79,20 +83,20 @@
|
|
79
83
|
- updated URI Template code to match v 03 of the draft spec
|
80
84
|
- added a bunch of new specifications
|
81
85
|
|
82
|
-
|
86
|
+
# Addressable 1.0.4
|
83
87
|
- switched to using RSpec's pending system for specs that rely on IDN
|
84
88
|
- fixed issue with creating URIs with paths that are not prefixed with '/'
|
85
89
|
|
86
|
-
|
90
|
+
# Addressable 1.0.3
|
87
91
|
- implemented a hash method
|
88
92
|
|
89
|
-
|
93
|
+
# Addressable 1.0.2
|
90
94
|
- fixed minor bug with the extract_mapping method
|
91
95
|
|
92
|
-
|
96
|
+
# Addressable 1.0.1
|
93
97
|
- fixed minor bug with the extract_mapping method
|
94
98
|
|
95
|
-
|
99
|
+
# Addressable 1.0.0
|
96
100
|
- heuristic parse method added
|
97
101
|
- parsing is slightly more strict
|
98
102
|
- replaced to_h with to_hash
|
@@ -101,16 +105,16 @@
|
|
101
105
|
- improved heckle rake task
|
102
106
|
- no surviving heckle mutations
|
103
107
|
|
104
|
-
|
108
|
+
# Addressable 0.1.2
|
105
109
|
- improved normalization
|
106
110
|
- fixed bug in joining algorithm
|
107
111
|
- updated specifications
|
108
112
|
|
109
|
-
|
113
|
+
# Addressable 0.1.1
|
110
114
|
- updated documentation
|
111
115
|
- added URI Template variable extraction
|
112
116
|
|
113
|
-
|
117
|
+
# Addressable 0.1.0
|
114
118
|
- initial release
|
115
119
|
- implementation based on RFC 3986, 3987
|
116
120
|
- support for IRIs via libidn
|
data/lib/addressable/template.rb
CHANGED
@@ -931,7 +931,7 @@ module Addressable
|
|
931
931
|
values.pop if values[-1] == ""
|
932
932
|
|
933
933
|
if processor && processor.respond_to?(:restore)
|
934
|
-
values.map! { |
|
934
|
+
values.map! { |val| processor.restore(variables.first, val) }
|
935
935
|
end
|
936
936
|
values = values.first if values.size == 1
|
937
937
|
if mapping[variables.first] == nil || mapping[variables.first] == values
|
@@ -965,7 +965,7 @@ module Addressable
|
|
965
965
|
values = value.split(argument, -1)
|
966
966
|
values.pop if values[-1] == ""
|
967
967
|
if processor && processor.respond_to?(:restore)
|
968
|
-
values.map! { |
|
968
|
+
values.map! { |val| processor.restore(variables.first, val) }
|
969
969
|
end
|
970
970
|
values = values.first if values.size == 1
|
971
971
|
if mapping[variables.first] == nil || mapping[variables.first] == values
|
@@ -1034,7 +1034,7 @@ module Addressable
|
|
1034
1034
|
values = value.split(argument, -1)
|
1035
1035
|
values.pop if values[-1] == ""
|
1036
1036
|
if processor && processor.respond_to?(:restore)
|
1037
|
-
values.map! { |
|
1037
|
+
values.map! { |val| processor.restore(variables.first, val) }
|
1038
1038
|
end
|
1039
1039
|
if mapping[variables.first] == nil || mapping[variables.first] == values
|
1040
1040
|
mapping[variables.first] = values
|
data/lib/addressable/uri.rb
CHANGED
@@ -127,7 +127,7 @@ module Addressable
|
|
127
127
|
port = nil
|
128
128
|
end
|
129
129
|
|
130
|
-
return
|
130
|
+
return new(
|
131
131
|
:scheme => scheme,
|
132
132
|
:user => user,
|
133
133
|
:password => password,
|
@@ -325,7 +325,11 @@ module Addressable
|
|
325
325
|
return nil if component.nil?
|
326
326
|
|
327
327
|
begin
|
328
|
-
component
|
328
|
+
if component.kind_of?(Symbol) || component.kind_of?(Numeric)
|
329
|
+
component = component.to_s
|
330
|
+
else
|
331
|
+
component = component.to_str
|
332
|
+
end
|
329
333
|
rescue TypeError, NoMethodError
|
330
334
|
raise TypeError, "Can't convert #{component.class} into String."
|
331
335
|
end if !component.is_a? String
|
@@ -715,6 +719,7 @@ module Addressable
|
|
715
719
|
self.authority = options[:authority] if options[:authority]
|
716
720
|
self.path = options[:path] if options[:path]
|
717
721
|
self.query = options[:query] if options[:query]
|
722
|
+
self.query_values = options[:query_values] if options[:query_values]
|
718
723
|
self.fragment = options[:fragment] if options[:fragment]
|
719
724
|
end
|
720
725
|
end
|
@@ -1015,6 +1020,14 @@ module Addressable
|
|
1015
1020
|
validate()
|
1016
1021
|
end
|
1017
1022
|
|
1023
|
+
##
|
1024
|
+
# @see Addressable::URI#host
|
1025
|
+
alias_method :hostname, :host
|
1026
|
+
|
1027
|
+
##
|
1028
|
+
# @see Addressable::URI#host=
|
1029
|
+
alias_method :hostname=, :host=
|
1030
|
+
|
1018
1031
|
##
|
1019
1032
|
# The authority component for this URI.
|
1020
1033
|
# Combines the user, password, host, and port components.
|
@@ -1415,7 +1428,7 @@ module Addressable
|
|
1415
1428
|
end
|
1416
1429
|
end
|
1417
1430
|
if hash != {} && hash.keys.all? { |key| key =~ /^\d+$/ }
|
1418
|
-
hash.sort.inject([]) do |accu, (
|
1431
|
+
hash.sort.inject([]) do |accu, (_, value)|
|
1419
1432
|
accu << value; accu
|
1420
1433
|
end
|
1421
1434
|
else
|
@@ -1497,39 +1510,55 @@ module Addressable
|
|
1497
1510
|
# Only to be used for non-Array inputs. Arrays should preserve order.
|
1498
1511
|
new_query_values.sort!
|
1499
1512
|
end
|
1500
|
-
# new_query_values have form [['key1', 'value1'], ['key2', 'value2']]
|
1501
1513
|
|
1502
|
-
|
1503
|
-
|
1504
|
-
|
1505
|
-
|
1506
|
-
|
1507
|
-
|
1508
|
-
|
1509
|
-
|
1510
|
-
|
1511
|
-
|
1512
|
-
|
1513
|
-
|
1514
|
-
|
1515
|
-
|
1516
|
-
|
1514
|
+
##
|
1515
|
+
# Joins and converts parent and value into a properly encoded and
|
1516
|
+
# ordered URL query.
|
1517
|
+
#
|
1518
|
+
# @private
|
1519
|
+
# @param [String] parent an URI encoded component.
|
1520
|
+
# @param [Array, Hash, Symbol, #to_str] value
|
1521
|
+
#
|
1522
|
+
# @return [String] a properly escaped and ordered URL query.
|
1523
|
+
to_query = lambda do |parent, value|
|
1524
|
+
if value.is_a?(Hash)
|
1525
|
+
value = value.map do |key, val|
|
1526
|
+
[
|
1527
|
+
URI.encode_component(key, CharacterClasses::UNRESERVED),
|
1528
|
+
val
|
1529
|
+
]
|
1530
|
+
end
|
1531
|
+
value.sort!
|
1532
|
+
buffer = ""
|
1533
|
+
value.each do |key, val|
|
1534
|
+
new_parent = "#{parent}[#{key}]"
|
1535
|
+
buffer << "#{to_query.call(new_parent, val)}&"
|
1536
|
+
end
|
1537
|
+
return buffer.chop
|
1538
|
+
elsif value.is_a?(Array)
|
1539
|
+
buffer = ""
|
1540
|
+
value.each_with_index do |val, i|
|
1541
|
+
new_parent = "#{parent}[#{i}]"
|
1542
|
+
buffer << "#{to_query.call(new_parent, val)}&"
|
1543
|
+
end
|
1544
|
+
return buffer.chop
|
1517
1545
|
elsif value == true
|
1518
|
-
|
1546
|
+
return parent
|
1519
1547
|
else
|
1520
|
-
|
1548
|
+
encoded_value = URI.encode_component(
|
1549
|
+
value, CharacterClasses::UNRESERVED
|
1550
|
+
)
|
1551
|
+
return "#{parent}=#{encoded_value}"
|
1521
1552
|
end
|
1522
1553
|
end
|
1523
|
-
|
1524
|
-
|
1525
|
-
|
1526
|
-
|
1527
|
-
|
1528
|
-
|
1529
|
-
|
1530
|
-
|
1531
|
-
end
|
1532
|
-
end
|
1554
|
+
|
1555
|
+
# new_query_values have form [['key1', 'value1'], ['key2', 'value2']]
|
1556
|
+
buffer = ""
|
1557
|
+
new_query_values.each do |parent, value|
|
1558
|
+
encoded_parent = URI.encode_component(
|
1559
|
+
parent, CharacterClasses::UNRESERVED
|
1560
|
+
)
|
1561
|
+
buffer << "#{to_query.call(encoded_parent, value)}&"
|
1533
1562
|
end
|
1534
1563
|
self.query = buffer.chop
|
1535
1564
|
end
|
@@ -2182,7 +2211,7 @@ module Addressable
|
|
2182
2211
|
parent = normalized_path.match(NPATH2)
|
2183
2212
|
if parent && ((parent[1] != PARENT1 && parent[1] != PARENT2) \
|
2184
2213
|
|| (parent[2] != PARENT1 && parent[2] != PARENT2))
|
2185
|
-
mod ||= normalized_path.gsub!(/\/#{parent[1]}\/\.\.\/|(\/#{parent[2]}\/\.\.$)/, SLASH)
|
2214
|
+
mod ||= normalized_path.gsub!(/\/#{Regexp.escape(parent[1].to_s)}\/\.\.\/|(\/#{Regexp.escape(parent[2].to_s)}\/\.\.$)/, SLASH)
|
2186
2215
|
end
|
2187
2216
|
|
2188
2217
|
mod ||= normalized_path.gsub!(NPATH3, EMPTYSTR)
|
data/lib/addressable/version.rb
CHANGED
@@ -0,0 +1,26 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
# Copyright (C) 2006-2011 Bob Aman
|
3
|
+
#
|
4
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
+
# you may not use this file except in compliance with the License.
|
6
|
+
# You may obtain a copy of the License at
|
7
|
+
#
|
8
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
#
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
+
# See the License for the specific language governing permissions and
|
14
|
+
# limitations under the License.
|
15
|
+
|
16
|
+
|
17
|
+
require "addressable/uri"
|
18
|
+
require "net/http"
|
19
|
+
|
20
|
+
describe Net::HTTP do
|
21
|
+
it "should be compatible with Addressable" do
|
22
|
+
response_body =
|
23
|
+
Net::HTTP.get(Addressable::URI.parse('http://www.google.com/'))
|
24
|
+
response_body.should_not be_nil
|
25
|
+
end
|
26
|
+
end
|
@@ -1013,11 +1013,11 @@ describe Addressable::URI, "when parsed from " +
|
|
1013
1013
|
end
|
1014
1014
|
|
1015
1015
|
it "should have the correct password after assignment" do
|
1016
|
-
@uri.password = "secret@123!"
|
1017
|
-
@uri.password.should == "secret@123!"
|
1018
|
-
@uri.normalized_password.should == "
|
1016
|
+
@uri.password = "#secret@123!"
|
1017
|
+
@uri.password.should == "#secret@123!"
|
1018
|
+
@uri.normalized_password.should == "%23secret%40123%21"
|
1019
1019
|
@uri.user.should == ""
|
1020
|
-
@uri.normalize.to_s.should == "http
|
1020
|
+
@uri.normalize.to_s.should == "http://:%23secret%40123%21@example.com/"
|
1021
1021
|
@uri.omit(:password).to_s.should == "http://example.com"
|
1022
1022
|
end
|
1023
1023
|
|
@@ -1844,6 +1844,82 @@ describe Addressable::URI, "when parsed from " +
|
|
1844
1844
|
end
|
1845
1845
|
end
|
1846
1846
|
|
1847
|
+
describe Addressable::URI, "when parsed from " +
|
1848
|
+
"'http://example.com/path(/..'" do
|
1849
|
+
before do
|
1850
|
+
@uri = Addressable::URI.parse("http://example.com/path(/..")
|
1851
|
+
end
|
1852
|
+
|
1853
|
+
it "should have the correct port" do
|
1854
|
+
@uri.inferred_port.should == 80
|
1855
|
+
end
|
1856
|
+
|
1857
|
+
it "should not be considered to be in normal form" do
|
1858
|
+
@uri.normalize.should_not be_eql(@uri)
|
1859
|
+
end
|
1860
|
+
|
1861
|
+
it "should normalize to 'http://example.com/'" do
|
1862
|
+
@uri.normalize.should === "http://example.com/"
|
1863
|
+
end
|
1864
|
+
end
|
1865
|
+
|
1866
|
+
describe Addressable::URI, "when parsed from " +
|
1867
|
+
"'http://example.com/(path)/..'" do
|
1868
|
+
before do
|
1869
|
+
@uri = Addressable::URI.parse("http://example.com/(path)/..")
|
1870
|
+
end
|
1871
|
+
|
1872
|
+
it "should have the correct port" do
|
1873
|
+
@uri.inferred_port.should == 80
|
1874
|
+
end
|
1875
|
+
|
1876
|
+
it "should not be considered to be in normal form" do
|
1877
|
+
@uri.normalize.should_not be_eql(@uri)
|
1878
|
+
end
|
1879
|
+
|
1880
|
+
it "should normalize to 'http://example.com/'" do
|
1881
|
+
@uri.normalize.should === "http://example.com/"
|
1882
|
+
end
|
1883
|
+
end
|
1884
|
+
|
1885
|
+
describe Addressable::URI, "when parsed from " +
|
1886
|
+
"'http://example.com/path(/../'" do
|
1887
|
+
before do
|
1888
|
+
@uri = Addressable::URI.parse("http://example.com/path(/../")
|
1889
|
+
end
|
1890
|
+
|
1891
|
+
it "should have the correct port" do
|
1892
|
+
@uri.inferred_port.should == 80
|
1893
|
+
end
|
1894
|
+
|
1895
|
+
it "should not be considered to be in normal form" do
|
1896
|
+
@uri.normalize.should_not be_eql(@uri)
|
1897
|
+
end
|
1898
|
+
|
1899
|
+
it "should normalize to 'http://example.com/'" do
|
1900
|
+
@uri.normalize.should === "http://example.com/"
|
1901
|
+
end
|
1902
|
+
end
|
1903
|
+
|
1904
|
+
describe Addressable::URI, "when parsed from " +
|
1905
|
+
"'http://example.com/(path)/../'" do
|
1906
|
+
before do
|
1907
|
+
@uri = Addressable::URI.parse("http://example.com/(path)/../")
|
1908
|
+
end
|
1909
|
+
|
1910
|
+
it "should have the correct port" do
|
1911
|
+
@uri.inferred_port.should == 80
|
1912
|
+
end
|
1913
|
+
|
1914
|
+
it "should not be considered to be in normal form" do
|
1915
|
+
@uri.normalize.should_not be_eql(@uri)
|
1916
|
+
end
|
1917
|
+
|
1918
|
+
it "should normalize to 'http://example.com/'" do
|
1919
|
+
@uri.normalize.should === "http://example.com/"
|
1920
|
+
end
|
1921
|
+
end
|
1922
|
+
|
1847
1923
|
describe Addressable::URI, "when parsed from " +
|
1848
1924
|
"'http://example.com/path/to/resource/'" do
|
1849
1925
|
before do
|
@@ -2777,7 +2853,8 @@ describe Addressable::URI, "when parsed from " +
|
|
2777
2853
|
@uri.query_values.should == { 'q' => 'Q&A' }
|
2778
2854
|
end
|
2779
2855
|
|
2780
|
-
it "should normalize to the original uri
|
2856
|
+
it "should normalize to the original uri " +
|
2857
|
+
"(with the ampersand properly percent-encoded)" do
|
2781
2858
|
@uri.normalize.to_s.should == "http://example.com/search?q=Q%26A"
|
2782
2859
|
end
|
2783
2860
|
end
|
@@ -4422,25 +4499,25 @@ end
|
|
4422
4499
|
describe Addressable::URI, "when encoding a bogus object" do
|
4423
4500
|
it "should raise a TypeError" do
|
4424
4501
|
(lambda do
|
4425
|
-
Addressable::URI.encode(
|
4502
|
+
Addressable::URI.encode(Object.new)
|
4426
4503
|
end).should raise_error(TypeError)
|
4427
4504
|
end
|
4428
4505
|
|
4429
4506
|
it "should raise a TypeError" do
|
4430
4507
|
(lambda do
|
4431
|
-
Addressable::URI.normalized_encode(
|
4508
|
+
Addressable::URI.normalized_encode(Object.new)
|
4432
4509
|
end).should raise_error(TypeError)
|
4433
4510
|
end
|
4434
4511
|
|
4435
4512
|
it "should raise a TypeError" do
|
4436
4513
|
(lambda do
|
4437
|
-
Addressable::URI.encode_component("günther",
|
4514
|
+
Addressable::URI.encode_component("günther", Object.new)
|
4438
4515
|
end).should raise_error(TypeError)
|
4439
4516
|
end
|
4440
4517
|
|
4441
4518
|
it "should raise a TypeError" do
|
4442
4519
|
(lambda do
|
4443
|
-
Addressable::URI.encode_component(
|
4520
|
+
Addressable::URI.encode_component(Object.new)
|
4444
4521
|
end).should raise_error(TypeError)
|
4445
4522
|
end
|
4446
4523
|
end
|
@@ -4457,7 +4534,9 @@ describe Addressable::URI, "when given the input " +
|
|
4457
4534
|
end
|
4458
4535
|
|
4459
4536
|
it "should not raise error when frozen" do
|
4460
|
-
lambda
|
4537
|
+
(lambda do
|
4538
|
+
Addressable::URI.heuristic_parse(@input).freeze.to_s
|
4539
|
+
end).should_not raise_error
|
4461
4540
|
end
|
4462
4541
|
end
|
4463
4542
|
|
@@ -4653,8 +4732,19 @@ describe Addressable::URI, "when assigning query values" do
|
|
4653
4732
|
@uri.query.should == "a=a&b[0]=c&b[1]=d&b[2]=e"
|
4654
4733
|
end
|
4655
4734
|
|
4735
|
+
it "should correctly assign {'a' => {'b' => [ 'c']}}" do
|
4736
|
+
@uri.query_values = { 'a' => {'b' => [ 'c'] } }
|
4737
|
+
@uri.query.should == "a[b][0]=c"
|
4738
|
+
end
|
4739
|
+
|
4740
|
+
it "should correctly assign {:b => '2', :a => {:c => '1'}}" do
|
4741
|
+
@uri.query_values = {:b => '2', :a => { :c => '1' }}
|
4742
|
+
@uri.query.should == "a[c]=1&b=2"
|
4743
|
+
end
|
4744
|
+
|
4656
4745
|
it "should correctly assign " +
|
4657
|
-
"{:a => 'a', :b => [{:c => 'c', :d => 'd'},
|
4746
|
+
"{:a => 'a', :b => [{:c => 'c', :d => 'd'}, " +
|
4747
|
+
"{:e => 'e', :f => 'f'}]}" do
|
4658
4748
|
@uri.query_values = {
|
4659
4749
|
:a => "a", :b => [{:c => "c", :d => "d"}, {:e => "e", :f => "f"}]
|
4660
4750
|
}
|
@@ -4662,7 +4752,8 @@ describe Addressable::URI, "when assigning query values" do
|
|
4662
4752
|
end
|
4663
4753
|
|
4664
4754
|
it "should correctly assign " +
|
4665
|
-
"{:a => 'a', :b => [{:c => true, :d => 'd'},
|
4755
|
+
"{:a => 'a', :b => [{:c => true, :d => 'd'}, " +
|
4756
|
+
"{:e => 'e', :f => 'f'}]}" do
|
4666
4757
|
@uri.query_values = {
|
4667
4758
|
:a => 'a', :b => [{:c => true, :d => 'd'}, {:e => 'e', :f => 'f'}]
|
4668
4759
|
}
|
@@ -4678,13 +4769,32 @@ describe Addressable::URI, "when assigning query values" do
|
|
4678
4769
|
end
|
4679
4770
|
|
4680
4771
|
it "should correctly assign " +
|
4681
|
-
"{:a => 'a', :b => {:c => true, :d => 'd'}
|
4772
|
+
"{:a => 'a', :b => {:c => true, :d => 'd'}}" do
|
4682
4773
|
@uri.query_values = {
|
4683
4774
|
:a => 'a', :b => {:c => true, :d => 'd'}
|
4684
4775
|
}
|
4685
4776
|
@uri.query.should == "a=a&b[c]&b[d]=d"
|
4686
4777
|
end
|
4687
4778
|
|
4779
|
+
it "should correctly assign {:a => 1, :b => 1.5}" do
|
4780
|
+
@uri.query_values = { :a => 1, :b => 1.5 }
|
4781
|
+
@uri.query.should == "a=1&b=1.5"
|
4782
|
+
end
|
4783
|
+
|
4784
|
+
it "should correctly assign " +
|
4785
|
+
"{:z => 1, :f => [2, {999.1 => [3,'4']}, ['h', 'i']], " +
|
4786
|
+
":a => {:b => ['c', 'd'], :e => true, :y => 0.5}}" do
|
4787
|
+
@uri.query_values = {
|
4788
|
+
:z => 1,
|
4789
|
+
:f => [ 2, {999.1 => [3,'4']}, ['h', 'i'] ],
|
4790
|
+
:a => { :b => ['c', 'd'], :e => true, :y => 0.5 }
|
4791
|
+
}
|
4792
|
+
@uri.query.should == (
|
4793
|
+
"a[b][0]=c&a[b][1]=d&a[e]&a[y]=0.5&f[0]=2&" +
|
4794
|
+
"f[1][999.1][0]=3&f[1][999.1][1]=4&f[2][0]=h&f[2][1]=i&z=1"
|
4795
|
+
)
|
4796
|
+
end
|
4797
|
+
|
4688
4798
|
it "should correctly assign {}" do
|
4689
4799
|
@uri.query_values = {}
|
4690
4800
|
@uri.query.should == ''
|
data/tasks/gem.rake
CHANGED
data/tasks/git.rake
CHANGED
@@ -19,10 +19,15 @@ namespace :git do
|
|
19
19
|
v = ENV["VERSION"] or abort "Must supply VERSION=x.y.z"
|
20
20
|
abort "Versions don't match #{v} vs #{PKG_VERSION}" if v != PKG_VERSION
|
21
21
|
|
22
|
+
git_status = `git status`
|
23
|
+
if git_status !~ /nothing to commit \(working directory clean\)/
|
24
|
+
abort "Working directory isn't clean."
|
25
|
+
end
|
26
|
+
|
22
27
|
tag = "#{PKG_NAME}-#{PKG_VERSION}"
|
23
28
|
msg = "Release #{PKG_NAME}-#{PKG_VERSION}"
|
24
29
|
|
25
|
-
existing_tags = `git tag -l
|
30
|
+
existing_tags = `git tag -l #{PKG_NAME}-*`.split('\n')
|
26
31
|
if existing_tags.include?(tag)
|
27
32
|
warn("Tag already exists, deleting...")
|
28
33
|
unless system "git tag -d #{tag}"
|
data/tasks/spec.rake
CHANGED
@@ -18,6 +18,13 @@ namespace :spec do
|
|
18
18
|
end
|
19
19
|
|
20
20
|
Spec::Rake::SpecTask.new(:normal) do |t|
|
21
|
+
t.libs = %w[lib spec]
|
22
|
+
t.spec_files = FileList['spec/**/*_spec.rb'].exclude(/compat/)
|
23
|
+
t.spec_opts = ['--color', '--format', 'specdoc']
|
24
|
+
t.rcov = false
|
25
|
+
end
|
26
|
+
|
27
|
+
Spec::Rake::SpecTask.new(:all) do |t|
|
21
28
|
t.libs = %w[lib spec]
|
22
29
|
t.spec_files = FileList['spec/**/*_spec.rb']
|
23
30
|
t.spec_opts = ['--color', '--format', 'specdoc']
|
metadata
CHANGED
@@ -1,13 +1,12 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: addressable
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
prerelease:
|
4
|
+
prerelease: false
|
6
5
|
segments:
|
7
6
|
- 2
|
8
7
|
- 2
|
9
|
-
-
|
10
|
-
version: 2.2.
|
8
|
+
- 7
|
9
|
+
version: 2.2.7
|
11
10
|
platform: ruby
|
12
11
|
authors:
|
13
12
|
- Bob Aman
|
@@ -15,18 +14,16 @@ autorequire:
|
|
15
14
|
bindir: bin
|
16
15
|
cert_chain: []
|
17
16
|
|
18
|
-
date:
|
17
|
+
date: 2012-02-16 00:00:00 +03:00
|
19
18
|
default_executable:
|
20
19
|
dependencies:
|
21
20
|
- !ruby/object:Gem::Dependency
|
22
21
|
name: rake
|
23
22
|
prerelease: false
|
24
23
|
requirement: &id001 !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
24
|
requirements:
|
27
25
|
- - ">="
|
28
26
|
- !ruby/object:Gem::Version
|
29
|
-
hash: 5
|
30
27
|
segments:
|
31
28
|
- 0
|
32
29
|
- 7
|
@@ -38,11 +35,9 @@ dependencies:
|
|
38
35
|
name: rspec
|
39
36
|
prerelease: false
|
40
37
|
requirement: &id002 !ruby/object:Gem::Requirement
|
41
|
-
none: false
|
42
38
|
requirements:
|
43
39
|
- - ">="
|
44
40
|
- !ruby/object:Gem::Version
|
45
|
-
hash: 7
|
46
41
|
segments:
|
47
42
|
- 1
|
48
43
|
- 0
|
@@ -54,11 +49,9 @@ dependencies:
|
|
54
49
|
name: launchy
|
55
50
|
prerelease: false
|
56
51
|
requirement: &id003 !ruby/object:Gem::Requirement
|
57
|
-
none: false
|
58
52
|
requirements:
|
59
53
|
- - ">="
|
60
54
|
- !ruby/object:Gem::Version
|
61
|
-
hash: 23
|
62
55
|
segments:
|
63
56
|
- 0
|
64
57
|
- 3
|
@@ -70,11 +63,9 @@ dependencies:
|
|
70
63
|
name: diff-lcs
|
71
64
|
prerelease: false
|
72
65
|
requirement: &id004 !ruby/object:Gem::Requirement
|
73
|
-
none: false
|
74
66
|
requirements:
|
75
67
|
- - ">="
|
76
68
|
- !ruby/object:Gem::Version
|
77
|
-
hash: 23
|
78
69
|
segments:
|
79
70
|
- 1
|
80
71
|
- 1
|
@@ -102,6 +93,7 @@ files:
|
|
102
93
|
- lib/addressable/uri.rb
|
103
94
|
- lib/addressable/version.rb
|
104
95
|
- spec/addressable/idna_spec.rb
|
96
|
+
- spec/addressable/net_http_compat_spec.rb
|
105
97
|
- spec/addressable/template_spec.rb
|
106
98
|
- spec/addressable/uri_spec.rb
|
107
99
|
- tasks/clobber.rake
|
@@ -128,27 +120,23 @@ rdoc_options:
|
|
128
120
|
require_paths:
|
129
121
|
- lib
|
130
122
|
required_ruby_version: !ruby/object:Gem::Requirement
|
131
|
-
none: false
|
132
123
|
requirements:
|
133
124
|
- - ">="
|
134
125
|
- !ruby/object:Gem::Version
|
135
|
-
hash: 3
|
136
126
|
segments:
|
137
127
|
- 0
|
138
128
|
version: "0"
|
139
129
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
140
|
-
none: false
|
141
130
|
requirements:
|
142
131
|
- - ">="
|
143
132
|
- !ruby/object:Gem::Version
|
144
|
-
hash: 3
|
145
133
|
segments:
|
146
134
|
- 0
|
147
135
|
version: "0"
|
148
136
|
requirements: []
|
149
137
|
|
150
138
|
rubyforge_project: addressable
|
151
|
-
rubygems_version: 1.
|
139
|
+
rubygems_version: 1.3.6
|
152
140
|
signing_key:
|
153
141
|
specification_version: 3
|
154
142
|
summary: URI Implementation
|