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,10 +1,4 @@
|
|
1
|
-
|
2
|
-
# Copyright 2006 by Chad Fowler, Rich Kilmer, Jim Weirich and others.
|
3
|
-
# All rights reserved.
|
4
|
-
# See LICENSE.txt for permissions.
|
5
|
-
#++
|
6
|
-
|
7
|
-
require File.join(File.expand_path(File.dirname(__FILE__)), 'gemutilities')
|
1
|
+
require File.expand_path('../gemutilities', __FILE__)
|
8
2
|
require 'rubygems/source_index'
|
9
3
|
require 'rubygems/config_file'
|
10
4
|
|
@@ -31,7 +25,7 @@ class TestGemSourceIndex < RubyGemTestCase
|
|
31
25
|
|
32
26
|
a1 = quick_gem 'a', '1' do |spec| spec.author = 'author 1' end
|
33
27
|
|
34
|
-
spec_file = File.join spec_dir,
|
28
|
+
spec_file = File.join spec_dir, a1.spec_name
|
35
29
|
|
36
30
|
File.open spec_file, 'w' do |fp|
|
37
31
|
fp.write a1.to_ruby
|
@@ -52,7 +46,7 @@ class TestGemSourceIndex < RubyGemTestCase
|
|
52
46
|
|
53
47
|
a1 = quick_gem 'a', '1' do |spec| spec.author = 'author 1' end
|
54
48
|
|
55
|
-
spec_file = File.join spec_dir,
|
49
|
+
spec_file = File.join spec_dir, a1.spec_name
|
56
50
|
|
57
51
|
File.open spec_file, 'w' do |fp|
|
58
52
|
fp.write a1.to_ruby
|
@@ -298,11 +292,11 @@ WARNING: Invalid .gemspec format in '#{spec_file}'
|
|
298
292
|
a1 = quick_gem 'a', '1' do |spec| spec.author = 'author 1' end
|
299
293
|
a2 = quick_gem 'a', '1' do |spec| spec.author = 'author 2' end
|
300
294
|
|
301
|
-
File.open File.join(spec_dir1,
|
295
|
+
File.open File.join(spec_dir1, a1.spec_name), 'w' do |fp|
|
302
296
|
fp.write a1.to_ruby
|
303
297
|
end
|
304
298
|
|
305
|
-
File.open File.join(spec_dir2,
|
299
|
+
File.open File.join(spec_dir2, a2.spec_name), 'w' do |fp|
|
306
300
|
fp.write a2.to_ruby
|
307
301
|
end
|
308
302
|
|
@@ -340,7 +334,7 @@ WARNING: Invalid .gemspec format in '#{spec_file}'
|
|
340
334
|
end
|
341
335
|
|
342
336
|
def test_refresh_bang
|
343
|
-
a1_spec = File.join @gemhome, "specifications",
|
337
|
+
a1_spec = File.join @gemhome, "specifications", @a1.spec_name
|
344
338
|
|
345
339
|
FileUtils.mv a1_spec, @tempdir
|
346
340
|
|
@@ -348,7 +342,7 @@ WARNING: Invalid .gemspec format in '#{spec_file}'
|
|
348
342
|
|
349
343
|
refute source_index.gems.include?(@a1.full_name)
|
350
344
|
|
351
|
-
FileUtils.mv File.join(@tempdir,
|
345
|
+
FileUtils.mv File.join(@tempdir, @a1.spec_name), a1_spec
|
352
346
|
|
353
347
|
source_index.refresh!
|
354
348
|
|
@@ -1,4 +1,4 @@
|
|
1
|
-
require File.
|
1
|
+
require File.expand_path('../gemutilities', __FILE__)
|
2
2
|
require 'rubygems/spec_fetcher'
|
3
3
|
|
4
4
|
class TestGemSpecFetcher < RubyGemTestCase
|
@@ -39,16 +39,17 @@ class TestGemSpecFetcher < RubyGemTestCase
|
|
39
39
|
end
|
40
40
|
|
41
41
|
def test_fetch_all
|
42
|
-
@fetcher.data["#{@gem_repo}#{Gem::MARSHAL_SPEC_DIR}#{@a1.
|
42
|
+
@fetcher.data["#{@gem_repo}#{Gem::MARSHAL_SPEC_DIR}#{@a1.spec_name}.rz"] =
|
43
43
|
util_zip(Marshal.dump(@a1))
|
44
|
-
@fetcher.data["#{@gem_repo}#{Gem::MARSHAL_SPEC_DIR}#{@a2.
|
44
|
+
@fetcher.data["#{@gem_repo}#{Gem::MARSHAL_SPEC_DIR}#{@a2.spec_name}.rz"] =
|
45
45
|
util_zip(Marshal.dump(@a2))
|
46
|
-
@fetcher.data["#{@gem_repo}#{Gem::MARSHAL_SPEC_DIR}#{@a_pre.
|
46
|
+
@fetcher.data["#{@gem_repo}#{Gem::MARSHAL_SPEC_DIR}#{@a_pre.spec_name}.rz"] =
|
47
47
|
util_zip(Marshal.dump(@a_pre))
|
48
|
-
@fetcher.data["#{@gem_repo}#{Gem::MARSHAL_SPEC_DIR}#{@a3a.
|
48
|
+
@fetcher.data["#{@gem_repo}#{Gem::MARSHAL_SPEC_DIR}#{@a3a.spec_name}.rz"] =
|
49
49
|
util_zip(Marshal.dump(@a3a))
|
50
50
|
|
51
51
|
dep = Gem::Dependency.new 'a', 1
|
52
|
+
|
52
53
|
specs_and_sources = @sf.fetch dep, true
|
53
54
|
|
54
55
|
spec_names = specs_and_sources.map do |spec, source_uri|
|
@@ -63,11 +64,11 @@ class TestGemSpecFetcher < RubyGemTestCase
|
|
63
64
|
end
|
64
65
|
|
65
66
|
def test_fetch_latest
|
66
|
-
@fetcher.data["#{@gem_repo}#{Gem::MARSHAL_SPEC_DIR}#{@a1.
|
67
|
+
@fetcher.data["#{@gem_repo}#{Gem::MARSHAL_SPEC_DIR}#{@a1.spec_name}.rz"] =
|
67
68
|
util_zip(Marshal.dump(@a1))
|
68
|
-
@fetcher.data["#{@gem_repo}#{Gem::MARSHAL_SPEC_DIR}#{@a2.
|
69
|
+
@fetcher.data["#{@gem_repo}#{Gem::MARSHAL_SPEC_DIR}#{@a2.spec_name}.rz"] =
|
69
70
|
util_zip(Marshal.dump(@a2))
|
70
|
-
@fetcher.data["#{@gem_repo}#{Gem::MARSHAL_SPEC_DIR}#{@a_pre.
|
71
|
+
@fetcher.data["#{@gem_repo}#{Gem::MARSHAL_SPEC_DIR}#{@a_pre.spec_name}.rz"] =
|
71
72
|
util_zip(Marshal.dump(@a_pre))
|
72
73
|
|
73
74
|
dep = Gem::Dependency.new 'a', 1
|
@@ -81,11 +82,11 @@ class TestGemSpecFetcher < RubyGemTestCase
|
|
81
82
|
end
|
82
83
|
|
83
84
|
def test_fetch_prerelease
|
84
|
-
@fetcher.data["#{@gem_repo}#{Gem::MARSHAL_SPEC_DIR}#{@a1.
|
85
|
+
@fetcher.data["#{@gem_repo}#{Gem::MARSHAL_SPEC_DIR}#{@a1.spec_name}.rz"] =
|
85
86
|
util_zip(Marshal.dump(@a1))
|
86
|
-
@fetcher.data["#{@gem_repo}#{Gem::MARSHAL_SPEC_DIR}#{@a2.
|
87
|
+
@fetcher.data["#{@gem_repo}#{Gem::MARSHAL_SPEC_DIR}#{@a2.spec_name}.rz"] =
|
87
88
|
util_zip(Marshal.dump(@a2))
|
88
|
-
@fetcher.data["#{@gem_repo}#{Gem::MARSHAL_SPEC_DIR}#{@a_pre.
|
89
|
+
@fetcher.data["#{@gem_repo}#{Gem::MARSHAL_SPEC_DIR}#{@a_pre.spec_name}.rz"] =
|
89
90
|
util_zip(Marshal.dump(@a_pre))
|
90
91
|
|
91
92
|
dep = Gem::Dependency.new 'a', '1.a'
|
@@ -98,37 +99,6 @@ class TestGemSpecFetcher < RubyGemTestCase
|
|
98
99
|
assert_equal [[@a_pre.full_name, @gem_repo]], spec_names
|
99
100
|
end
|
100
101
|
|
101
|
-
def test_fetch_legacy_repo
|
102
|
-
@fetcher.data.delete "#{@gem_repo}specs.#{Gem.marshal_version}.gz"
|
103
|
-
@fetcher.data["#{@gem_repo}yaml"] = ''
|
104
|
-
util_setup_source_info_cache @a1, @a2
|
105
|
-
|
106
|
-
dep = Gem::Dependency.new 'a', 1
|
107
|
-
specs = nil
|
108
|
-
|
109
|
-
use_ui @ui do
|
110
|
-
specs = @sf.fetch dep, true
|
111
|
-
end
|
112
|
-
|
113
|
-
expected = <<-EOF
|
114
|
-
WARNING: RubyGems 1.2+ index not found for:
|
115
|
-
\thttp://gems.example.com/
|
116
|
-
|
117
|
-
RubyGems will revert to legacy indexes degrading performance.
|
118
|
-
EOF
|
119
|
-
|
120
|
-
assert_equal expected, @ui.error
|
121
|
-
|
122
|
-
specs = specs.map { |spec, source_uri| [spec.full_name, source_uri] }
|
123
|
-
|
124
|
-
expected = [
|
125
|
-
[@a1.full_name, @gem_repo],
|
126
|
-
[@a2.full_name, @gem_repo],
|
127
|
-
]
|
128
|
-
|
129
|
-
assert_equal expected, specs
|
130
|
-
end
|
131
|
-
|
132
102
|
def test_fetch_platform
|
133
103
|
util_set_arch 'i386-linux'
|
134
104
|
|
@@ -146,7 +116,7 @@ RubyGems will revert to legacy indexes degrading performance.
|
|
146
116
|
end
|
147
117
|
|
148
118
|
def test_fetch_spec
|
149
|
-
spec_uri = "#{@gem_repo}#{Gem::MARSHAL_SPEC_DIR}#{@a1.
|
119
|
+
spec_uri = "#{@gem_repo}#{Gem::MARSHAL_SPEC_DIR}#{@a1.spec_name}"
|
150
120
|
@fetcher.data["#{spec_uri}.rz"] = util_zip(Marshal.dump(@a1))
|
151
121
|
|
152
122
|
spec = @sf.fetch_spec ['a', Gem::Version.new(1), 'ruby'], @uri
|
@@ -154,19 +124,19 @@ RubyGems will revert to legacy indexes degrading performance.
|
|
154
124
|
|
155
125
|
cache_dir = @sf.cache_dir URI.parse(spec_uri)
|
156
126
|
|
157
|
-
cache_file = File.join cache_dir,
|
127
|
+
cache_file = File.join cache_dir, @a1.spec_name
|
158
128
|
|
159
129
|
assert File.exist?(cache_file)
|
160
130
|
end
|
161
131
|
|
162
132
|
def test_fetch_spec_cached
|
163
|
-
spec_uri = "#{@gem_repo}/#{Gem::MARSHAL_SPEC_DIR}#{@a1.
|
133
|
+
spec_uri = "#{@gem_repo}/#{Gem::MARSHAL_SPEC_DIR}#{@a1.spec_name}"
|
164
134
|
@fetcher.data["#{spec_uri}.rz"] = nil
|
165
135
|
|
166
136
|
cache_dir = @sf.cache_dir URI.parse(spec_uri)
|
167
137
|
FileUtils.mkdir_p cache_dir
|
168
138
|
|
169
|
-
cache_file = File.join cache_dir,
|
139
|
+
cache_file = File.join cache_dir, @a1.spec_name
|
170
140
|
|
171
141
|
open cache_file, 'wb' do |io|
|
172
142
|
Marshal.dump @a1, io
|
@@ -186,7 +156,7 @@ RubyGems will revert to legacy indexes degrading performance.
|
|
186
156
|
end
|
187
157
|
|
188
158
|
def test_fetch_spec_platform_ruby
|
189
|
-
@fetcher.data["#{@gem_repo}#{Gem::MARSHAL_SPEC_DIR}#{@a1.
|
159
|
+
@fetcher.data["#{@gem_repo}#{Gem::MARSHAL_SPEC_DIR}#{@a1.spec_name}.rz"] =
|
190
160
|
util_zip(Marshal.dump(@a1))
|
191
161
|
|
192
162
|
spec = @sf.fetch_spec ['a', Gem::Version.new(1), nil], @uri
|
@@ -1,11 +1,5 @@
|
|
1
|
-
|
2
|
-
# Copyright 2006 by Chad Fowler, Rich Kilmer, Jim Weirich and others.
|
3
|
-
# All rights reserved.
|
4
|
-
# See LICENSE.txt for permissions.
|
5
|
-
#++
|
6
|
-
|
1
|
+
require File.expand_path('../gemutilities', __FILE__)
|
7
2
|
require 'stringio'
|
8
|
-
require File.join(File.expand_path(File.dirname(__FILE__)), 'gemutilities')
|
9
3
|
require 'rubygems/specification'
|
10
4
|
|
11
5
|
class TestGemSpecification < RubyGemTestCase
|
@@ -129,7 +123,7 @@ end
|
|
129
123
|
end
|
130
124
|
|
131
125
|
def test_self_load
|
132
|
-
spec = File.join @gemhome, 'specifications',
|
126
|
+
spec = File.join @gemhome, 'specifications', @a2.spec_name
|
133
127
|
gs = Gem::Specification.load spec
|
134
128
|
|
135
129
|
assert_equal @a2, gs
|
@@ -145,16 +139,6 @@ end
|
|
145
139
|
assert_equal false, spec.has_unit_tests?
|
146
140
|
end
|
147
141
|
|
148
|
-
def test_self_load_legacy_yaml
|
149
|
-
s = YAML.load StringIO.new(LEGACY_YAML_SPEC)
|
150
|
-
assert_equal 'keyedlist', s.name
|
151
|
-
assert_equal '0.4.0', s.version.to_s
|
152
|
-
assert_equal true, s.has_rdoc?
|
153
|
-
#assert_equal Date.today, s.date
|
154
|
-
#assert s.required_ruby_version.satisfied_by?(Gem::Version.new('1'))
|
155
|
-
assert_equal false, s.has_unit_tests?
|
156
|
-
end
|
157
|
-
|
158
142
|
def test_self_normalize_yaml_input_with_183_yaml
|
159
143
|
input = "!ruby/object:Gem::Specification "
|
160
144
|
assert_equal "--- #{input}", Gem::Specification.normalize_yaml_input(input)
|
@@ -538,8 +522,7 @@ end
|
|
538
522
|
|
539
523
|
def test_full_gem_path_double_slash
|
540
524
|
gemhome = @gemhome.sub(/\w\//, '\&/')
|
541
|
-
@a1.loaded_from = File.join gemhome, 'specifications',
|
542
|
-
"#{@a1.full_name}.gemspec"
|
525
|
+
@a1.loaded_from = File.join gemhome, 'specifications', @a1.spec_name
|
543
526
|
|
544
527
|
assert_equal File.join(@gemhome, 'gems', @a1.full_name),
|
545
528
|
@a1.full_gem_path
|
@@ -730,6 +713,10 @@ end
|
|
730
713
|
assert_equal( 1, (s2 <=> s1))
|
731
714
|
end
|
732
715
|
|
716
|
+
def test_spec_name
|
717
|
+
assert_equal 'a-1.gemspec', @a1.spec_name
|
718
|
+
end
|
719
|
+
|
733
720
|
def test_summary
|
734
721
|
assert_equal 'this is a summary', @a1.summary
|
735
722
|
end
|
data/test/test_gem_stream_ui.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
require File.
|
1
|
+
require File.expand_path('../gemutilities', __FILE__)
|
2
2
|
require 'rubygems/user_interaction'
|
3
3
|
|
4
4
|
class TestGemStreamUI < RubyGemTestCase
|
@@ -46,6 +46,26 @@ class TestGemStreamUI < RubyGemTestCase
|
|
46
46
|
end
|
47
47
|
end
|
48
48
|
|
49
|
+
def test_ask_for_password
|
50
|
+
skip 'Always uses $stdin on windows' if Gem.win_platform?
|
51
|
+
|
52
|
+
timeout(1) do
|
53
|
+
expected_answer = "Arthur, King of the Britons"
|
54
|
+
@in.string = "#{expected_answer}\n"
|
55
|
+
actual_answer = @sui.ask_for_password("What is your name?")
|
56
|
+
assert_equal expected_answer, actual_answer
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
def test_ask_for_password_no_tty
|
61
|
+
@in.tty = false
|
62
|
+
|
63
|
+
timeout(0.1) do
|
64
|
+
answer = @sui.ask_for_password("what is the airspeed velocity of an unladen swallow?")
|
65
|
+
assert_equal nil, answer
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
49
69
|
def test_ask_yes_no_no_tty_with_default
|
50
70
|
@in.tty = false
|
51
71
|
|
data/test/test_gem_validator.rb
CHANGED
@@ -1,11 +1,5 @@
|
|
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 File.join(File.expand_path(File.dirname(__FILE__)), 'simple_gem')
|
1
|
+
require File.expand_path('../gemutilities', __FILE__)
|
2
|
+
require File.expand_path('../simple_gem', __FILE__)
|
9
3
|
require 'rubygems/validator'
|
10
4
|
|
11
5
|
class TestGemValidator < RubyGemTestCase
|
data/test/test_gem_version.rb
CHANGED
@@ -1,316 +1,172 @@
|
|
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/version"
|
9
3
|
|
10
4
|
class TestGemVersion < RubyGemTestCase
|
11
5
|
|
12
|
-
def
|
13
|
-
|
14
|
-
|
15
|
-
version = Object.new
|
16
|
-
def version.to_s() '1.4.0' end
|
17
|
-
|
18
|
-
@v1_0 = Gem::Version.new '1.0'
|
19
|
-
@v1_2 = Gem::Version.new '1.2'
|
20
|
-
@v1_3 = Gem::Version.new '1.3'
|
21
|
-
@v1_4_0 = Gem::Version.new version
|
22
|
-
end
|
23
|
-
|
24
|
-
def test_class_create
|
25
|
-
assert_version Gem::Version.create('1.0')
|
26
|
-
assert_version Gem::Version.create("1.0 ")
|
27
|
-
assert_version Gem::Version.create(" 1.0 ")
|
28
|
-
assert_version Gem::Version.create("1.0\n")
|
29
|
-
assert_version Gem::Version.create("\n1.0\n")
|
30
|
-
|
31
|
-
assert_equal Gem::Version.create('1'), Gem::Version.create(1)
|
32
|
-
end
|
33
|
-
|
34
|
-
def test_class_create_malformed
|
35
|
-
e = assert_raises ArgumentError do Gem::Version.create("junk") end
|
36
|
-
assert_equal "Malformed version number string junk", e.message
|
37
|
-
|
38
|
-
e = assert_raises ArgumentError do Gem::Version.create("1.0\n2.0") end
|
39
|
-
assert_equal "Malformed version number string 1.0\n2.0", e.message
|
6
|
+
def test_bump
|
7
|
+
assert_bumped_version_equal "5.3", "5.2.4"
|
40
8
|
end
|
41
9
|
|
42
|
-
def
|
43
|
-
|
44
|
-
assert_inadequate( "1.2.3", "!= 1.2.3")
|
45
|
-
assert_inadequate( "1.2.003.0.0", "!= 1.02.3")
|
46
|
-
assert_inadequate( "4.5.6", "< 1.2.3")
|
47
|
-
assert_inadequate( "1.0", "> 1.1")
|
48
|
-
assert_inadequate( "0", ">")
|
49
|
-
assert_inadequate( "0", "<")
|
50
|
-
assert_inadequate( "", "= 0.1")
|
51
|
-
assert_inadequate( "1.1.1", "> 1.1.1")
|
52
|
-
assert_inadequate( "1.2", "= 1.1")
|
53
|
-
assert_inadequate( "1.40", "= 1.1")
|
54
|
-
assert_inadequate( "1.3", "= 1.40")
|
55
|
-
assert_inadequate( "9.3.3", "<= 9.3.2")
|
56
|
-
assert_inadequate( "9.3.1", ">= 9.3.2")
|
57
|
-
assert_inadequate( "9.3.03", "<= 9.3.2")
|
58
|
-
assert_inadequate( "1.0.0.1", "= 1.0")
|
10
|
+
def test_bump_alpha
|
11
|
+
assert_bumped_version_equal "5.3", "5.2.4.a"
|
59
12
|
end
|
60
13
|
|
61
14
|
def test_bump_trailing_zeros
|
62
|
-
|
63
|
-
assert_equal "5.1", v.bump.to_s
|
64
|
-
end
|
65
|
-
|
66
|
-
def test_bump
|
67
|
-
v = Gem::Version.new("5.2.4")
|
68
|
-
assert_equal "5.3", v.bump.to_s
|
69
|
-
end
|
70
|
-
|
71
|
-
def test_bump_alpha
|
72
|
-
v = Gem::Version.new("5.2.4.a")
|
73
|
-
assert_equal "5.3", v.bump.to_s
|
15
|
+
assert_bumped_version_equal "5.1", "5.0.0"
|
74
16
|
end
|
75
17
|
|
76
18
|
def test_bump_one_level
|
77
|
-
|
78
|
-
assert_equal "6", v.bump.to_s
|
19
|
+
assert_bumped_version_equal "6", "5"
|
79
20
|
end
|
80
21
|
|
81
|
-
|
82
|
-
|
83
|
-
v1_2_0 = Gem::Version.new '1.2.0'
|
22
|
+
# FIX: For "legacy reasons," any object that responds to +version+
|
23
|
+
# is returned unchanged. I'm not certain why.
|
84
24
|
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
assert_equal false, v1_2_0.eql?(@v1_2)
|
89
|
-
assert_equal false, @v1_2.eql?(v1_2_0)
|
25
|
+
def test_class_create
|
26
|
+
fake = Object.new
|
27
|
+
def fake.version; "1.0" end
|
90
28
|
|
91
|
-
|
92
|
-
|
29
|
+
assert_same fake, Gem::Version.create(fake)
|
30
|
+
assert_nil Gem::Version.create(nil)
|
31
|
+
assert_equal v("5.1"), Gem::Version.create("5.1")
|
93
32
|
end
|
94
33
|
|
95
|
-
def
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
assert_equal true, v1_4_0.eql?(@v1_4_0)
|
100
|
-
assert_equal true, @v1_4_0.eql?(v1_4_0)
|
101
|
-
|
102
|
-
assert_equal false, v1_4.eql?(@v1_4_0)
|
103
|
-
assert_equal false, @v1_4_0.eql?(v1_4)
|
104
|
-
|
105
|
-
assert_equal false, @v1_4_0.eql?(@v1_3)
|
106
|
-
assert_equal false, @v1_3.eql?(@v1_4_0)
|
34
|
+
def test_eql_eh
|
35
|
+
assert_version_eql "1.2", "1.2"
|
36
|
+
refute_version_eql "1.2", "1.2.0"
|
37
|
+
refute_version_eql "1.2", "1.3"
|
107
38
|
end
|
108
39
|
|
109
|
-
def
|
110
|
-
|
111
|
-
|
112
|
-
assert_equal v, @v1_2
|
113
|
-
assert_equal @v1_2, v
|
114
|
-
|
115
|
-
refute_equal @v1_2, @v1_3
|
116
|
-
refute_equal @v1_3, @v1_2
|
40
|
+
def test_equals
|
41
|
+
assert_version_equal "1.2", "1.2"
|
42
|
+
refute_version_equal "1.2", "1.3"
|
117
43
|
end
|
118
44
|
|
45
|
+
# REVISIT: consider removing as too impl-bound
|
119
46
|
def test_hash
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
assert_equal v1_2.hash, @v1_2.hash
|
125
|
-
|
126
|
-
refute_equal v1_2_0.hash, @v1_2.hash
|
127
|
-
|
128
|
-
assert_equal v1_4_0.hash, @v1_4_0.hash
|
129
|
-
|
130
|
-
refute_equal @v1_2.hash, @v1_3.hash
|
131
|
-
|
132
|
-
refute_equal @v1_2.hash, @v1_4_0.hash
|
47
|
+
assert_equal v("1.2").hash, v("1.2").hash
|
48
|
+
refute_equal v("1.2").hash, v("1.3").hash
|
49
|
+
refute_equal v("1.2").hash, v("1.2.0").hash
|
133
50
|
end
|
134
51
|
|
135
|
-
def
|
136
|
-
[ "
|
137
|
-
|
138
|
-
Gem::Version::Requirement.new rq
|
139
|
-
end
|
52
|
+
def test_initialize
|
53
|
+
["1.0", "1.0 ", " 1.0 ", "1.0\n", "\n1.0\n"].each do |good|
|
54
|
+
assert_version_equal "1.0", good
|
140
55
|
end
|
141
|
-
end
|
142
56
|
|
143
|
-
|
144
|
-
assert_equal [0], Gem::Version.new("").normalize.map { |part| part.value }
|
145
|
-
assert_equal [0], Gem::Version.new("0").normalize.map { |part| part.value }
|
146
|
-
assert_equal [1], Gem::Version.new("1").normalize.map { |part| part.value }
|
147
|
-
assert_equal [1], Gem::Version.new("1.0").normalize.map { |part| part.value }
|
148
|
-
assert_equal [1, 1], Gem::Version.new("1.1").normalize.map { |part| part.value }
|
149
|
-
assert_equal [1, 1, "a"], Gem::Version.new("1.1.a").normalize.map { |part| part.value }
|
57
|
+
assert_version_equal "1", 1
|
150
58
|
end
|
151
59
|
|
152
|
-
def
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
assert_adequate( "1.8.2", "> 1.8.0")
|
158
|
-
assert_adequate( "1.112", "> 1.111")
|
159
|
-
assert_adequate( "0.2", "> 0.0.0")
|
160
|
-
assert_adequate( "0.0.0.0.0.2", "> 0.0.0")
|
161
|
-
assert_adequate( "0.0.1.0", "> 0.0.0.1")
|
162
|
-
assert_adequate( "10.3.2", "> 9.3.2")
|
163
|
-
assert_adequate( "1.0.0.0", "= 1.0")
|
164
|
-
assert_adequate( "10.3.2", "!= 9.3.4")
|
165
|
-
assert_adequate( "10.3.2", "> 9.3.2")
|
166
|
-
assert_adequate( "10.3.2", "> 9.3.2")
|
167
|
-
assert_adequate( " 9.3.2", ">= 9.3.2")
|
168
|
-
assert_adequate( "9.3.2 ", ">= 9.3.2")
|
169
|
-
assert_adequate( "", "= 0")
|
170
|
-
assert_adequate( "", "< 0.1")
|
171
|
-
assert_adequate( " ", "< 0.1 ")
|
172
|
-
assert_adequate( "", " < 0.1")
|
173
|
-
assert_adequate( " ", "> 0.a ")
|
174
|
-
assert_adequate( "", " > 0.a")
|
175
|
-
assert_adequate( "0", "=")
|
176
|
-
assert_adequate( "0", ">=")
|
177
|
-
assert_adequate( "0", "<=")
|
178
|
-
assert_adequate( "3.1", "< 3.2.rc1")
|
179
|
-
assert_adequate( "3.2.0", "> 3.2.0.rc1")
|
180
|
-
assert_adequate( "3.2.0.rc2", "> 3.2.0.rc1")
|
181
|
-
assert_adequate( "3.0.rc2", "< 3.0")
|
182
|
-
assert_adequate( "3.0.rc2", "< 3.0.0")
|
183
|
-
assert_adequate( "3.0.rc2", "< 3.0.1")
|
184
|
-
end
|
60
|
+
def test_initialize_bad
|
61
|
+
["junk", "1.0\n2.0"].each do |bad|
|
62
|
+
e = assert_raises ArgumentError do
|
63
|
+
Gem::Version.new bad
|
64
|
+
end
|
185
65
|
|
186
|
-
|
187
|
-
|
188
|
-
assert_equal [1], part_values(Gem::Version.new("1").parse_parts_from_version_string)
|
189
|
-
assert_equal [1, 0], part_values(Gem::Version.new("1.0").parse_parts_from_version_string)
|
190
|
-
assert_equal [1, 0, "a"], part_values(Gem::Version.new("1.0.a").parse_parts_from_version_string)
|
66
|
+
assert_equal "Malformed version number string #{bad}", e.message
|
67
|
+
end
|
191
68
|
end
|
192
69
|
|
193
70
|
def test_prerelease
|
194
|
-
|
195
|
-
|
196
|
-
|
71
|
+
assert_prerelease "1.2.0.a"
|
72
|
+
assert_prerelease "2.9.b"
|
73
|
+
assert_prerelease "22.1.50.0.d"
|
74
|
+
assert_prerelease "1.2.d.42"
|
197
75
|
|
198
|
-
|
199
|
-
refute Gem::Version.new('2.9').prerelease?
|
200
|
-
refute Gem::Version.new('22.1.50.0').prerelease?
|
201
|
-
end
|
202
|
-
|
203
|
-
def test_release
|
204
|
-
assert_equal Gem::Version.new('1.2.0'), Gem::Version.new('1.2.0.a').release
|
205
|
-
assert_equal Gem::Version.new('1.1'), Gem::Version.new('1.1.rc10').release
|
206
|
-
assert_equal Gem::Version.new('1.9.3'), Gem::Version.new('1.9.3.alpha.5').release
|
207
|
-
assert_equal Gem::Version.new('1.9.3'), Gem::Version.new('1.9.3').release
|
208
|
-
end
|
76
|
+
assert_prerelease '1.A'
|
209
77
|
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
assert_adequate( "1.5", "~> 1.4")
|
214
|
-
assert_inadequate("2.0", "~> 1.4")
|
215
|
-
|
216
|
-
assert_inadequate("1.3", "~> 1.4.4")
|
217
|
-
assert_inadequate("1.4", "~> 1.4.4")
|
218
|
-
assert_adequate( "1.4.4", "~> 1.4.4")
|
219
|
-
assert_adequate( "1.4.5", "~> 1.4.4")
|
220
|
-
assert_inadequate("1.5", "~> 1.4.4")
|
221
|
-
assert_inadequate("2.0", "~> 1.4.4")
|
222
|
-
|
223
|
-
assert_inadequate("1.1.pre", "~> 1.0.0")
|
224
|
-
assert_adequate( "1.1.pre", "~> 1.1")
|
225
|
-
assert_inadequate("2.0.a", "~> 1.0")
|
226
|
-
assert_adequate( "2.0.a", "~> 2.0")
|
78
|
+
refute_prerelease "1.2.0"
|
79
|
+
refute_prerelease "2.9"
|
80
|
+
refute_prerelease "22.1.50.0"
|
227
81
|
end
|
228
82
|
|
229
|
-
def
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
assert_adequate( "1.6", req)
|
235
|
-
assert_inadequate("1.7", req)
|
236
|
-
assert_inadequate("2.0", req)
|
83
|
+
def test_release
|
84
|
+
assert_release_equal "1.2.0", "1.2.0.a"
|
85
|
+
assert_release_equal "1.1", "1.1.rc10"
|
86
|
+
assert_release_equal "1.9.3", "1.9.3.alpha.5"
|
87
|
+
assert_release_equal "1.9.3", "1.9.3"
|
237
88
|
end
|
238
89
|
|
239
90
|
def test_spaceship
|
240
|
-
assert_equal 0,
|
241
|
-
assert_equal 1,
|
242
|
-
assert_equal 1,
|
243
|
-
assert_equal 1,
|
244
|
-
assert_equal 1,
|
245
|
-
assert_equal
|
91
|
+
assert_equal( 0, v("1.0") <=> v("1.0.0"))
|
92
|
+
assert_equal( 1, v("1.0") <=> v("1.0.a"))
|
93
|
+
assert_equal( 1, v("1.8.2") <=> v("0.0.0"))
|
94
|
+
assert_equal( 1, v("1.8.2") <=> v("1.8.2.a"))
|
95
|
+
assert_equal( 1, v("1.8.2.b") <=> v("1.8.2.a"))
|
96
|
+
assert_equal(-1, v("1.8.2.a") <=> v("1.8.2"))
|
97
|
+
assert_equal( 0, v("") <=> v("0"))
|
246
98
|
end
|
247
99
|
|
248
|
-
def
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
assert_inadequate("1.4", "~> 1.4.4")
|
256
|
-
assert_adequate( "1.4.4", "~> 1.4.4")
|
257
|
-
assert_adequate( "1.4.5", "~> 1.4.4")
|
258
|
-
assert_inadequate("1.5", "~> 1.4.4")
|
259
|
-
assert_inadequate("2.0", "~> 1.4.4")
|
100
|
+
def test_spermy_recommendation
|
101
|
+
assert_spermy_equal "~> 1.0", "1"
|
102
|
+
assert_spermy_equal "~> 1.0", "1.0"
|
103
|
+
assert_spermy_equal "~> 1.2", "1.2"
|
104
|
+
assert_spermy_equal "~> 1.2", "1.2.0"
|
105
|
+
assert_spermy_equal "~> 1.2", "1.2.3"
|
106
|
+
assert_spermy_equal "~> 1.2", "1.2.3.a.4"
|
260
107
|
end
|
261
108
|
|
262
109
|
def test_to_s
|
263
|
-
|
264
|
-
|
110
|
+
assert_equal "5.2.4", v("5.2.4").to_s
|
111
|
+
end
|
112
|
+
|
113
|
+
# Asserts that +version+ is a prerelease.
|
114
|
+
|
115
|
+
def assert_prerelease version
|
116
|
+
assert v(version).prerelease?, "#{version} is a prerelease"
|
265
117
|
end
|
266
118
|
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
"Version #{version} should be adequate for Requirement #{requirement}"
|
119
|
+
# Assert that +expected+ is the "spermy" recommendation for +version".
|
120
|
+
|
121
|
+
def assert_spermy_equal expected, version
|
122
|
+
assert_equal expected, v(version).spermy_recommendation
|
272
123
|
end
|
273
124
|
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
"Version #{version} should not be adequate for Requirement #{requirement}"
|
125
|
+
# Assert that bumping the +unbumped+ version yields the +expected+.
|
126
|
+
|
127
|
+
def assert_bumped_version_equal expected, unbumped
|
128
|
+
assert_version_equal expected, v(unbumped).bump
|
279
129
|
end
|
280
130
|
|
281
|
-
|
282
|
-
|
283
|
-
|
131
|
+
# Assert that +release+ is the correct non-prerelease +version+.
|
132
|
+
|
133
|
+
def assert_release_equal release, version
|
134
|
+
assert_version_equal release, v(version).release
|
284
135
|
end
|
285
136
|
|
286
|
-
|
287
|
-
|
137
|
+
# Assert that two versions are equal. Handles strings or
|
138
|
+
# Gem::Version instances.
|
139
|
+
|
140
|
+
def assert_version_equal expected, actual
|
141
|
+
assert_equal v(expected), v(actual)
|
288
142
|
end
|
289
|
-
end
|
290
143
|
|
291
|
-
|
292
|
-
|
293
|
-
|
294
|
-
|
295
|
-
|
144
|
+
# Assert that two versions are eql?. Checks both directions.
|
145
|
+
|
146
|
+
def assert_version_eql first, second
|
147
|
+
first, second = v(first), v(second)
|
148
|
+
assert first.eql?(second), "#{first} is eql? #{second}"
|
149
|
+
assert second.eql?(first), "#{second} is eql? #{first}"
|
296
150
|
end
|
297
151
|
|
298
|
-
|
299
|
-
assert_equal(-1, Gem::Version::Part.new(1) <=> Gem::Version::Part.new(2))
|
300
|
-
assert_equal( 0, Gem::Version::Part.new(2) <=> Gem::Version::Part.new(2))
|
301
|
-
assert_equal( 1, Gem::Version::Part.new(2) <=> Gem::Version::Part.new(1))
|
152
|
+
# Refute the assumption that +version+ is a prerelease.
|
302
153
|
|
303
|
-
|
304
|
-
|
305
|
-
|
154
|
+
def refute_prerelease version
|
155
|
+
refute v(version).prerelease?, "#{version} is NOT a prerelease"
|
156
|
+
end
|
306
157
|
|
307
|
-
|
308
|
-
|
158
|
+
# Refute the assumption that two versions are eql?. Checks both
|
159
|
+
# directions.
|
160
|
+
|
161
|
+
def refute_version_eql first, second
|
162
|
+
first, second = v(first), v(second)
|
163
|
+
refute first.eql?(second), "#{first} is NOT eql? #{second}"
|
164
|
+
refute second.eql?(first), "#{second} is NOT eql? #{first}"
|
309
165
|
end
|
310
166
|
|
311
|
-
|
312
|
-
|
313
|
-
|
167
|
+
# Refute the assumption that the two versions are equal?.
|
168
|
+
|
169
|
+
def refute_version_equal unexpected, actual
|
170
|
+
refute_equal v(unexpected), v(actual)
|
314
171
|
end
|
315
172
|
end
|
316
|
-
|