rubygems-update 1.3.5 → 1.3.6
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of rubygems-update might be problematic. Click here for more details.
- data.tar.gz.sig +0 -0
- data/.autotest +8 -1
- data/ChangeLog +164 -0
- data/History.txt +52 -1
- data/Manifest.txt +8 -8
- data/README +3 -2
- data/Rakefile +49 -5
- data/bin/gem +2 -2
- data/bin/update_rubygems +9 -11
- data/cruise_config.rb +4 -3
- data/hide_lib_for_update/note.txt +5 -0
- data/lib/rbconfig/datadir.rb +10 -14
- data/lib/rubygems.rb +117 -140
- data/lib/rubygems/builder.rb +4 -2
- data/lib/rubygems/command.rb +51 -48
- data/lib/rubygems/command_manager.rb +2 -0
- data/lib/rubygems/commands/dependency_command.rb +10 -5
- data/lib/rubygems/commands/environment_command.rb +1 -1
- data/lib/rubygems/commands/fetch_command.rb +6 -5
- data/lib/rubygems/commands/install_command.rb +1 -0
- data/lib/rubygems/commands/mirror_command.rb +8 -8
- data/lib/rubygems/commands/owner_command.rb +75 -0
- data/lib/rubygems/commands/pristine_command.rb +1 -1
- data/lib/rubygems/commands/push_command.rb +45 -0
- data/lib/rubygems/commands/query_command.rb +4 -1
- data/lib/rubygems/commands/rdoc_command.rb +24 -9
- data/lib/rubygems/commands/server_command.rb +6 -0
- data/lib/rubygems/commands/setup_command.rb +14 -4
- data/lib/rubygems/commands/unpack_command.rb +2 -2
- data/lib/rubygems/commands/update_command.rb +2 -2
- data/lib/rubygems/commands/which_command.rb +7 -9
- data/lib/rubygems/config_file.rb +100 -26
- data/lib/rubygems/defaults.rb +1 -1
- data/lib/rubygems/dependency.rb +133 -75
- data/lib/rubygems/dependency_installer.rb +28 -10
- data/lib/rubygems/dependency_list.rb +41 -12
- data/lib/rubygems/doc_manager.rb +7 -0
- data/lib/rubygems/format.rb +16 -20
- data/lib/rubygems/gem_openssl.rb +1 -1
- data/lib/rubygems/gem_path_searcher.rb +10 -12
- data/lib/rubygems/gemcutter_utilities.rb +49 -0
- data/lib/rubygems/indexer.rb +2 -2
- data/lib/rubygems/install_update_options.rb +1 -9
- data/lib/rubygems/installer.rb +35 -76
- data/lib/rubygems/local_remote_options.rb +1 -2
- data/lib/rubygems/package.rb +0 -1
- data/lib/rubygems/package/tar_input.rb +3 -1
- data/lib/rubygems/package_task.rb +16 -11
- data/lib/rubygems/remote_fetcher.rb +22 -8
- data/lib/rubygems/requirement.rb +78 -100
- data/lib/rubygems/server.rb +41 -10
- data/lib/rubygems/source_index.rb +5 -5
- data/lib/rubygems/spec_fetcher.rb +2 -2
- data/lib/rubygems/specification.rb +66 -16
- data/lib/rubygems/test_utilities.rb +33 -4
- data/lib/rubygems/uninstaller.rb +3 -3
- data/lib/rubygems/user_interaction.rb +45 -0
- data/lib/rubygems/validator.rb +6 -7
- data/lib/rubygems/version.rb +206 -149
- data/lib/rubygems/version_option.rb +16 -0
- data/test/fake_certlib/openssl.rb +1 -1
- data/test/functional.rb +0 -7
- data/test/gem_installer_test_case.rb +4 -4
- data/test/gem_package_tar_test_case.rb +1 -1
- data/test/gemutilities.rb +35 -31
- data/test/insure_session.rb +0 -8
- data/test/mockgemui.rb +0 -8
- data/test/simple_gem.rb +2 -8
- data/test/test_config.rb +3 -10
- data/test/test_gem.rb +9 -14
- data/test/test_gem_builder.rb +1 -7
- data/test/test_gem_command.rb +1 -8
- data/test/test_gem_command_manager.rb +1 -7
- data/test/test_gem_commands_build_command.rb +4 -4
- data/test/test_gem_commands_cert_command.rb +1 -2
- data/test/test_gem_commands_check_command.rb +1 -7
- data/test/test_gem_commands_contents_command.rb +1 -1
- data/test/test_gem_commands_dependency_command.rb +17 -31
- data/test/test_gem_commands_environment_command.rb +1 -1
- data/test/test_gem_commands_fetch_command.rb +14 -12
- data/test/test_gem_commands_generate_index_command.rb +1 -1
- data/test/test_gem_commands_install_command.rb +22 -20
- data/test/test_gem_commands_list_command.rb +1 -1
- data/test/test_gem_commands_lock_command.rb +1 -1
- data/test/test_gem_commands_mirror_command.rb +5 -5
- data/test/test_gem_commands_outdated_command.rb +3 -5
- data/test/test_gem_commands_owner_command.rb +105 -0
- data/test/test_gem_commands_pristine_command.rb +2 -2
- data/test/test_gem_commands_push_command.rb +61 -0
- data/test/test_gem_commands_query_command.rb +23 -56
- data/test/test_gem_commands_server_command.rb +1 -1
- data/test/test_gem_commands_sources_command.rb +1 -70
- data/test/test_gem_commands_specification_command.rb +3 -4
- data/test/test_gem_commands_stale_command.rb +1 -1
- data/test/test_gem_commands_uninstall_command.rb +3 -4
- data/test/test_gem_commands_unpack_command.rb +1 -1
- data/test/test_gem_commands_update_command.rb +13 -13
- data/test/test_gem_commands_which_command.rb +66 -0
- data/test/test_gem_config_file.rb +13 -7
- data/test/test_gem_dependency.rb +82 -134
- data/test/test_gem_dependency_installer.rb +55 -30
- data/test/test_gem_dependency_list.rb +28 -7
- data/test/test_gem_doc_manager.rb +1 -7
- data/test/test_gem_ext_configure_builder.rb +2 -2
- data/test/test_gem_ext_ext_conf_builder.rb +1 -1
- data/test/test_gem_ext_rake_builder.rb +1 -1
- data/test/test_gem_format.rb +14 -11
- data/test/test_gem_gem_path_searcher.rb +12 -1
- data/test/test_gem_gem_runner.rb +1 -1
- data/test/test_gem_gemcutter_utilities.rb +103 -0
- data/test/test_gem_indexer.rb +44 -51
- data/test/test_gem_install_update_options.rb +1 -7
- data/test/test_gem_installer.rb +22 -82
- data/test/test_gem_local_remote_options.rb +1 -1
- data/test/test_gem_package_tar_header.rb +1 -8
- data/test/test_gem_package_tar_input.rb +1 -8
- data/test/test_gem_package_tar_output.rb +1 -8
- data/test/test_gem_package_tar_reader.rb +1 -8
- data/test/test_gem_package_tar_reader_entry.rb +1 -8
- data/test/test_gem_package_tar_writer.rb +1 -8
- data/test/test_gem_package_task.rb +1 -25
- data/test/test_gem_platform.rb +4 -4
- data/test/test_gem_remote_fetcher.rb +31 -21
- data/test/test_gem_requirement.rb +210 -140
- data/test/test_gem_server.rb +36 -1
- data/test/test_gem_source_index.rb +7 -13
- data/test/test_gem_spec_fetcher.rb +17 -47
- data/test/test_gem_specification.rb +7 -20
- data/test/test_gem_stream_ui.rb +21 -1
- data/test/test_gem_uninstaller.rb +1 -2
- data/test/test_gem_validator.rb +2 -8
- data/test/test_gem_version.rb +110 -254
- data/test/test_gem_version_option.rb +1 -1
- data/test/test_kernel.rb +1 -7
- data/util/CL2notes +1 -1
- data/util/gem_prelude.rb.template +64 -41
- metadata +33 -71
- metadata.gz.sig +0 -0
- data/lib/rubygems/digest/digest_adapter.rb +0 -49
- data/lib/rubygems/digest/md5.rb +0 -23
- data/lib/rubygems/digest/sha1.rb +0 -22
- data/lib/rubygems/digest/sha2.rb +0 -22
- data/lib/rubygems/timer.rb +0 -28
- data/test/test_gem_digest.rb +0 -46
- data/test/test_gem_source_info_cache.rb +0 -447
- data/test/test_gem_source_info_cache_entry.rb +0 -78
@@ -1,222 +1,292 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
# All rights reserved.
|
4
|
-
# See LICENSE.txt for permissions.
|
5
|
-
#++
|
6
|
-
|
7
|
-
require File.join(File.expand_path(File.dirname(__FILE__)), 'gemutilities')
|
8
|
-
require 'rubygems/version'
|
1
|
+
require File.expand_path('../gemutilities', __FILE__)
|
2
|
+
require "rubygems/requirement"
|
9
3
|
|
10
4
|
class TestGemRequirement < RubyGemTestCase
|
11
5
|
|
12
|
-
def setup
|
13
|
-
super
|
14
|
-
|
15
|
-
@r1_2 = Gem::Requirement.new '= 1.2'
|
16
|
-
@r1_3 = Gem::Requirement.new '= 1.3'
|
17
|
-
end
|
18
|
-
|
19
|
-
def test_initialize
|
20
|
-
r = Gem::Requirement.new '2'
|
21
|
-
assert_equal '= 2', r.to_s, 'String'
|
22
|
-
|
23
|
-
r = Gem::Requirement.new %w[2]
|
24
|
-
assert_equal '= 2', r.to_s, 'Array of Strings'
|
25
|
-
|
26
|
-
r = Gem::Requirement.new Gem::Version.new('2')
|
27
|
-
assert_equal '= 2', r.to_s, 'Gem::Version'
|
28
|
-
end
|
29
|
-
|
30
6
|
def test_equals2
|
31
|
-
|
32
|
-
assert_equal
|
7
|
+
r = req "= 1.2"
|
8
|
+
assert_equal r, r.dup
|
9
|
+
assert_equal r.dup, r
|
33
10
|
|
34
|
-
|
35
|
-
|
11
|
+
refute_requirement_equal "= 1.2", "= 1.3"
|
12
|
+
refute_requirement_equal "= 1.3", "= 1.2"
|
36
13
|
|
37
|
-
refute_equal Object.new,
|
38
|
-
refute_equal
|
14
|
+
refute_equal Object.new, req("= 1.2")
|
15
|
+
refute_equal req("= 1.2"), Object.new
|
39
16
|
end
|
40
17
|
|
41
|
-
def
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
refute_equal @r1_2.hash, @r1_3.hash
|
46
|
-
refute_equal @r1_3.hash, @r1_2.hash
|
18
|
+
def test_initialize
|
19
|
+
assert_requirement_equal "= 2", "2"
|
20
|
+
assert_requirement_equal "= 2", ["2"]
|
21
|
+
assert_requirement_equal "= 2", v(2)
|
47
22
|
end
|
48
23
|
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
def test_normalization
|
53
|
-
require 'yaml'
|
54
|
-
yamldep = %{--- !ruby/object:Gem::Requirement
|
55
|
-
nums:
|
56
|
-
- 1
|
57
|
-
- 0
|
58
|
-
- 4
|
59
|
-
op: ">="
|
60
|
-
version: ">= 1.0.4"}
|
61
|
-
dep = YAML.load(yamldep)
|
62
|
-
dep.normalize
|
63
|
-
assert_equal ">= 1.0.4", dep.to_s
|
24
|
+
def test_class_available_as_gem_version_requirement
|
25
|
+
assert_same Gem::Requirement, Gem::Version::Requirement,
|
26
|
+
"Gem::Version::Requirement is aliased for old YAML compatibility."
|
64
27
|
end
|
65
28
|
|
66
29
|
def test_parse
|
67
|
-
assert_equal ['=', Gem::Version.new(1)],
|
68
|
-
|
69
|
-
assert_equal ['
|
70
|
-
assert_equal ['
|
30
|
+
assert_equal ['=', Gem::Version.new(1)], Gem::Requirement.parse(' 1')
|
31
|
+
assert_equal ['=', Gem::Version.new(1)], Gem::Requirement.parse('= 1')
|
32
|
+
assert_equal ['>', Gem::Version.new(1)], Gem::Requirement.parse('> 1')
|
33
|
+
assert_equal ['=', Gem::Version.new(1)], Gem::Requirement.parse("=\n1")
|
71
34
|
|
72
|
-
assert_equal ['=', Gem::Version.new(
|
73
|
-
|
74
|
-
|
75
|
-
assert_equal ['=', Gem::Version.new(1)], @r1_2.parse("=\n1")
|
76
|
-
assert_equal ['=', Gem::Version.new(0)], @r1_2.parse("=\njunk")
|
77
|
-
|
78
|
-
assert_equal ['=', Gem::Version.new(2)], @r1_2.parse(Gem::Version.new('2'))
|
35
|
+
assert_equal ['=', Gem::Version.new(2)],
|
36
|
+
Gem::Requirement.parse(Gem::Version.new('2'))
|
79
37
|
end
|
80
38
|
|
81
|
-
def
|
39
|
+
def test_parse_bad
|
82
40
|
e = assert_raises ArgumentError do
|
83
|
-
|
41
|
+
Gem::Requirement.parse nil
|
84
42
|
end
|
85
43
|
|
86
44
|
assert_equal 'Illformed requirement [nil]', e.message
|
87
45
|
|
88
46
|
e = assert_raises ArgumentError do
|
89
|
-
|
47
|
+
Gem::Requirement.parse ""
|
90
48
|
end
|
91
49
|
|
92
50
|
assert_equal 'Illformed requirement [""]', e.message
|
93
51
|
end
|
94
52
|
|
53
|
+
def test_prerelease_eh
|
54
|
+
r = req '= 1'
|
55
|
+
|
56
|
+
refute r.prerelease?
|
57
|
+
|
58
|
+
r = req '= 1.a'
|
59
|
+
|
60
|
+
assert r.prerelease?
|
61
|
+
|
62
|
+
r = req '> 1.a', '< 2'
|
63
|
+
|
64
|
+
assert r.prerelease?
|
65
|
+
end
|
66
|
+
|
95
67
|
def test_satisfied_by_eh_bang_equal
|
96
|
-
|
97
|
-
v1_1 = Gem::Version.new '1.1'
|
98
|
-
v1_2 = Gem::Version.new '1.2'
|
99
|
-
v1_3 = Gem::Version.new '1.3'
|
68
|
+
r = req '!= 1.2'
|
100
69
|
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
70
|
+
assert_satisfied_by nil, r
|
71
|
+
assert_satisfied_by "1.1", r
|
72
|
+
refute_satisfied_by "1.2", r
|
73
|
+
assert_satisfied_by "1.3", r
|
105
74
|
end
|
106
75
|
|
107
76
|
def test_satisfied_by_eh_blank
|
108
|
-
|
109
|
-
v1_1 = Gem::Version.new '1.1'
|
110
|
-
v1_2 = Gem::Version.new '1.2'
|
111
|
-
v1_3 = Gem::Version.new '1.3'
|
77
|
+
r = req "1.2"
|
112
78
|
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
79
|
+
refute_satisfied_by nil, r
|
80
|
+
refute_satisfied_by "1.1", r
|
81
|
+
assert_satisfied_by "1.2", r
|
82
|
+
refute_satisfied_by "1.3", r
|
117
83
|
end
|
118
84
|
|
119
85
|
def test_satisfied_by_eh_equal
|
120
|
-
|
121
|
-
v1_1 = Gem::Version.new '1.1'
|
122
|
-
v1_2 = Gem::Version.new '1.2'
|
123
|
-
v1_3 = Gem::Version.new '1.3'
|
86
|
+
r = req "= 1.2"
|
124
87
|
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
88
|
+
refute_satisfied_by nil, r
|
89
|
+
refute_satisfied_by "1.1", r
|
90
|
+
assert_satisfied_by "1.2", r
|
91
|
+
refute_satisfied_by "1.3", r
|
129
92
|
end
|
130
93
|
|
131
94
|
def test_satisfied_by_eh_gt
|
132
|
-
|
133
|
-
v1_1 = Gem::Version.new '1.1'
|
134
|
-
v1_2 = Gem::Version.new '1.2'
|
135
|
-
v1_3 = Gem::Version.new '1.3'
|
95
|
+
r = req "> 1.2"
|
136
96
|
|
137
|
-
|
138
|
-
|
139
|
-
|
97
|
+
refute_satisfied_by "1.1", r
|
98
|
+
refute_satisfied_by "1.2", r
|
99
|
+
assert_satisfied_by "1.3", r
|
140
100
|
|
141
101
|
assert_raises NoMethodError do
|
142
|
-
|
102
|
+
r.satisfied_by? nil
|
143
103
|
end
|
144
104
|
end
|
145
105
|
|
146
106
|
def test_satisfied_by_eh_gte
|
147
|
-
|
148
|
-
v1_1 = Gem::Version.new '1.1'
|
149
|
-
v1_2 = Gem::Version.new '1.2'
|
150
|
-
v1_3 = Gem::Version.new '1.3'
|
107
|
+
r = req ">= 1.2"
|
151
108
|
|
152
|
-
|
153
|
-
|
154
|
-
|
109
|
+
refute_satisfied_by "1.1", r
|
110
|
+
assert_satisfied_by "1.2", r
|
111
|
+
assert_satisfied_by "1.3", r
|
155
112
|
|
156
113
|
assert_raises NoMethodError do
|
157
|
-
|
114
|
+
r.satisfied_by? nil
|
158
115
|
end
|
159
116
|
end
|
160
117
|
|
161
118
|
def test_satisfied_by_eh_list
|
162
|
-
r =
|
163
|
-
v1_1 = Gem::Version.new '1.1'
|
164
|
-
v1_2 = Gem::Version.new '1.2'
|
165
|
-
v1_3 = Gem::Version.new '1.3'
|
119
|
+
r = req "> 1.1", "< 1.3"
|
166
120
|
|
167
|
-
|
168
|
-
|
169
|
-
|
121
|
+
refute_satisfied_by "1.1", r
|
122
|
+
assert_satisfied_by "1.2", r
|
123
|
+
refute_satisfied_by "1.3", r
|
170
124
|
|
171
125
|
assert_raises NoMethodError do
|
172
|
-
|
126
|
+
r.satisfied_by? nil
|
173
127
|
end
|
174
128
|
end
|
175
129
|
|
176
130
|
def test_satisfied_by_eh_lt
|
177
|
-
|
178
|
-
v1_1 = Gem::Version.new '1.1'
|
179
|
-
v1_2 = Gem::Version.new '1.2'
|
180
|
-
v1_3 = Gem::Version.new '1.3'
|
131
|
+
r = req "< 1.2"
|
181
132
|
|
182
|
-
|
183
|
-
|
184
|
-
|
133
|
+
assert_satisfied_by "1.1", r
|
134
|
+
refute_satisfied_by "1.2", r
|
135
|
+
refute_satisfied_by "1.3", r
|
185
136
|
|
186
137
|
assert_raises NoMethodError do
|
187
|
-
|
138
|
+
r.satisfied_by? nil
|
188
139
|
end
|
189
140
|
end
|
190
141
|
|
191
142
|
def test_satisfied_by_eh_lte
|
192
|
-
|
193
|
-
v1_1 = Gem::Version.new '1.1'
|
194
|
-
v1_2 = Gem::Version.new '1.2'
|
195
|
-
v1_3 = Gem::Version.new '1.3'
|
143
|
+
r = req "<= 1.2"
|
196
144
|
|
197
|
-
|
198
|
-
|
199
|
-
|
145
|
+
assert_satisfied_by "1.1", r
|
146
|
+
assert_satisfied_by "1.2", r
|
147
|
+
refute_satisfied_by "1.3", r
|
200
148
|
|
201
149
|
assert_raises NoMethodError do
|
202
|
-
|
150
|
+
r.satisfied_by? nil
|
203
151
|
end
|
204
152
|
end
|
205
153
|
|
206
154
|
def test_satisfied_by_eh_tilde_gt
|
207
|
-
|
208
|
-
v1_1 = Gem::Version.new '1.1'
|
209
|
-
v1_2 = Gem::Version.new '1.2'
|
210
|
-
v1_3 = Gem::Version.new '1.3'
|
155
|
+
r = req "~> 1.2"
|
211
156
|
|
212
|
-
|
213
|
-
|
214
|
-
|
157
|
+
refute_satisfied_by "1.1", r
|
158
|
+
assert_satisfied_by "1.2", r
|
159
|
+
assert_satisfied_by "1.3", r
|
215
160
|
|
216
161
|
assert_raises NoMethodError do
|
217
|
-
|
162
|
+
r.satisfied_by? nil
|
218
163
|
end
|
219
164
|
end
|
220
165
|
|
221
|
-
|
166
|
+
def test_satisfied_by_eh_good
|
167
|
+
assert_satisfied_by "0.2.33", "= 0.2.33"
|
168
|
+
assert_satisfied_by "0.2.34", "> 0.2.33"
|
169
|
+
assert_satisfied_by "1.0", "= 1.0"
|
170
|
+
assert_satisfied_by "1.0", "1.0"
|
171
|
+
assert_satisfied_by "1.8.2", "> 1.8.0"
|
172
|
+
assert_satisfied_by "1.112", "> 1.111"
|
173
|
+
assert_satisfied_by "0.2", "> 0.0.0"
|
174
|
+
assert_satisfied_by "0.0.0.0.0.2", "> 0.0.0"
|
175
|
+
assert_satisfied_by "0.0.1.0", "> 0.0.0.1"
|
176
|
+
assert_satisfied_by "10.3.2", "> 9.3.2"
|
177
|
+
assert_satisfied_by "1.0.0.0", "= 1.0"
|
178
|
+
assert_satisfied_by "10.3.2", "!= 9.3.4"
|
179
|
+
assert_satisfied_by "10.3.2", "> 9.3.2"
|
180
|
+
assert_satisfied_by "10.3.2", "> 9.3.2"
|
181
|
+
assert_satisfied_by " 9.3.2", ">= 9.3.2"
|
182
|
+
assert_satisfied_by "9.3.2 ", ">= 9.3.2"
|
183
|
+
assert_satisfied_by "", "= 0"
|
184
|
+
assert_satisfied_by "", "< 0.1"
|
185
|
+
assert_satisfied_by " ", "< 0.1 "
|
186
|
+
assert_satisfied_by "", " < 0.1"
|
187
|
+
assert_satisfied_by " ", "> 0.a "
|
188
|
+
assert_satisfied_by "", " > 0.a"
|
189
|
+
assert_satisfied_by "3.1", "< 3.2.rc1"
|
190
|
+
assert_satisfied_by "3.2.0", "> 3.2.0.rc1"
|
191
|
+
assert_satisfied_by "3.2.0.rc2", "> 3.2.0.rc1"
|
192
|
+
assert_satisfied_by "3.0.rc2", "< 3.0"
|
193
|
+
assert_satisfied_by "3.0.rc2", "< 3.0.0"
|
194
|
+
assert_satisfied_by "3.0.rc2", "< 3.0.1"
|
195
|
+
end
|
222
196
|
|
197
|
+
def test_illformed_requirements
|
198
|
+
[ ">>> 1.3.5", "> blah" ].each do |rq|
|
199
|
+
assert_raises ArgumentError, "req [#{rq}] should fail" do
|
200
|
+
Gem::Requirement.new rq
|
201
|
+
end
|
202
|
+
end
|
203
|
+
end
|
204
|
+
|
205
|
+
def test_satisfied_by_eh_boxed
|
206
|
+
refute_satisfied_by "1.3", "~> 1.4"
|
207
|
+
assert_satisfied_by "1.4", "~> 1.4"
|
208
|
+
assert_satisfied_by "1.5", "~> 1.4"
|
209
|
+
refute_satisfied_by "2.0", "~> 1.4"
|
210
|
+
|
211
|
+
refute_satisfied_by "1.3", "~> 1.4.4"
|
212
|
+
refute_satisfied_by "1.4", "~> 1.4.4"
|
213
|
+
assert_satisfied_by "1.4.4", "~> 1.4.4"
|
214
|
+
assert_satisfied_by "1.4.5", "~> 1.4.4"
|
215
|
+
refute_satisfied_by "1.5", "~> 1.4.4"
|
216
|
+
refute_satisfied_by "2.0", "~> 1.4.4"
|
217
|
+
|
218
|
+
refute_satisfied_by "1.1.pre", "~> 1.0.0"
|
219
|
+
assert_satisfied_by "1.1.pre", "~> 1.1"
|
220
|
+
refute_satisfied_by "2.0.a", "~> 1.0"
|
221
|
+
assert_satisfied_by "2.0.a", "~> 2.0"
|
222
|
+
end
|
223
|
+
|
224
|
+
def test_satisfied_by_eh_multiple
|
225
|
+
req = [">= 1.4", "<= 1.6", "!= 1.5"]
|
226
|
+
|
227
|
+
refute_satisfied_by "1.3", req
|
228
|
+
assert_satisfied_by "1.4", req
|
229
|
+
refute_satisfied_by "1.5", req
|
230
|
+
assert_satisfied_by "1.6", req
|
231
|
+
refute_satisfied_by "1.7", req
|
232
|
+
refute_satisfied_by "2.0", req
|
233
|
+
end
|
234
|
+
|
235
|
+
def test_satisfied_by_boxed
|
236
|
+
refute_satisfied_by "1.3", "~> 1.4"
|
237
|
+
assert_satisfied_by "1.4", "~> 1.4"
|
238
|
+
assert_satisfied_by "1.5", "~> 1.4"
|
239
|
+
refute_satisfied_by "2.0", "~> 1.4"
|
240
|
+
|
241
|
+
refute_satisfied_by "1.3", "~> 1.4.4"
|
242
|
+
refute_satisfied_by "1.4", "~> 1.4.4"
|
243
|
+
assert_satisfied_by "1.4.4", "~> 1.4.4"
|
244
|
+
assert_satisfied_by "1.4.5", "~> 1.4.4"
|
245
|
+
refute_satisfied_by "1.5", "~> 1.4.4"
|
246
|
+
refute_satisfied_by "2.0", "~> 1.4.4"
|
247
|
+
end
|
248
|
+
|
249
|
+
def test_bad
|
250
|
+
refute_satisfied_by "", "> 0.1"
|
251
|
+
refute_satisfied_by "1.2.3", "!= 1.2.3"
|
252
|
+
refute_satisfied_by "1.2.003.0.0", "!= 1.02.3"
|
253
|
+
refute_satisfied_by "4.5.6", "< 1.2.3"
|
254
|
+
refute_satisfied_by "1.0", "> 1.1"
|
255
|
+
refute_satisfied_by "", "= 0.1"
|
256
|
+
refute_satisfied_by "1.1.1", "> 1.1.1"
|
257
|
+
refute_satisfied_by "1.2", "= 1.1"
|
258
|
+
refute_satisfied_by "1.40", "= 1.1"
|
259
|
+
refute_satisfied_by "1.3", "= 1.40"
|
260
|
+
refute_satisfied_by "9.3.3", "<= 9.3.2"
|
261
|
+
refute_satisfied_by "9.3.1", ">= 9.3.2"
|
262
|
+
refute_satisfied_by "9.3.03", "<= 9.3.2"
|
263
|
+
refute_satisfied_by "1.0.0.1", "= 1.0"
|
264
|
+
end
|
265
|
+
|
266
|
+
# Assert that two requirements are equal. Handles Gem::Requirements,
|
267
|
+
# strings, arrays, numbers, and versions.
|
268
|
+
|
269
|
+
def assert_requirement_equal expected, actual
|
270
|
+
assert_equal req(expected), req(actual)
|
271
|
+
end
|
272
|
+
|
273
|
+
# Assert that +version+ satisfies +requirement+.
|
274
|
+
|
275
|
+
def assert_satisfied_by version, requirement
|
276
|
+
assert req(requirement).satisfied_by?(v(version)),
|
277
|
+
"#{requirement} is satisfied by #{version}"
|
278
|
+
end
|
279
|
+
|
280
|
+
# Refute the assumption that two requirements are equal.
|
281
|
+
|
282
|
+
def refute_requirement_equal unexpected, actual
|
283
|
+
refute_equal req(unexpected), req(actual)
|
284
|
+
end
|
285
|
+
|
286
|
+
# Refute the assumption that +version+ satisfies +requirement+.
|
287
|
+
|
288
|
+
def refute_satisfied_by version, requirement
|
289
|
+
refute req(requirement).satisfied_by?(v(version)),
|
290
|
+
"#{requirement} is not satisfied by #{version}"
|
291
|
+
end
|
292
|
+
end
|
data/test/test_gem_server.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
require File.
|
1
|
+
require File.expand_path('../gemutilities', __FILE__)
|
2
2
|
require 'rubygems/server'
|
3
3
|
require 'stringio'
|
4
4
|
|
@@ -78,6 +78,26 @@ class TestGemServer < RubyGemTestCase
|
|
78
78
|
Marshal.load(Gem.gunzip(@res.body))
|
79
79
|
end
|
80
80
|
|
81
|
+
def test_listen
|
82
|
+
util_listen
|
83
|
+
|
84
|
+
out, err = capture_io do
|
85
|
+
@server.listen
|
86
|
+
end
|
87
|
+
|
88
|
+
assert_equal 1, @server.server.listeners.length
|
89
|
+
end
|
90
|
+
|
91
|
+
def test_listen_addresses
|
92
|
+
util_listen
|
93
|
+
|
94
|
+
out, err = capture_io do
|
95
|
+
@server.listen %w[a b]
|
96
|
+
end
|
97
|
+
|
98
|
+
assert_equal 2, @server.server.listeners.length
|
99
|
+
end
|
100
|
+
|
81
101
|
def test_quick_a_1_gemspec_rz
|
82
102
|
data = StringIO.new "GET /quick/a-1.gemspec.rz HTTP/1.0\r\n\r\n"
|
83
103
|
@req.parse data
|
@@ -306,5 +326,20 @@ class TestGemServer < RubyGemTestCase
|
|
306
326
|
assert_equal si, YAML.load(Gem.inflate(@res.body))
|
307
327
|
end
|
308
328
|
|
329
|
+
def util_listen
|
330
|
+
webrick = Object.new
|
331
|
+
webrick.instance_variable_set :@listeners, []
|
332
|
+
def webrick.listeners() @listeners end
|
333
|
+
def webrick.listen(host, port)
|
334
|
+
socket = Object.new
|
335
|
+
socket.instance_variable_set :@host, host
|
336
|
+
socket.instance_variable_set :@port, port
|
337
|
+
def socket.addr() [nil, @port, @host] end
|
338
|
+
@listeners << socket
|
339
|
+
end
|
340
|
+
|
341
|
+
@server.instance_variable_set :@server, webrick
|
342
|
+
end
|
343
|
+
|
309
344
|
end
|
310
345
|
|