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,4 +1,4 @@
|
|
1
|
-
require File.
|
1
|
+
require File.expand_path('../gemutilities', __FILE__)
|
2
2
|
require 'rubygems/commands/sources_command'
|
3
3
|
|
4
4
|
class TestGemCommandsSourcesCommand < RubyGemTestCase
|
@@ -115,48 +115,9 @@ beta-gems.example.com is not a URI
|
|
115
115
|
assert_equal '', @ui.error
|
116
116
|
end
|
117
117
|
|
118
|
-
def test_execute_add_legacy
|
119
|
-
util_setup_fake_fetcher
|
120
|
-
util_setup_source_info_cache
|
121
|
-
|
122
|
-
si = Gem::SourceIndex.new
|
123
|
-
si.add_spec @a1
|
124
|
-
|
125
|
-
@fetcher.data["#{@new_repo}/yaml"] = ''
|
126
|
-
|
127
|
-
@cmd.handle_options %W[--add #{@new_repo}]
|
128
|
-
|
129
|
-
use_ui @ui do
|
130
|
-
@cmd.execute
|
131
|
-
end
|
132
|
-
|
133
|
-
assert_equal [@gem_repo], Gem.sources
|
134
|
-
|
135
|
-
expected = <<-EOF
|
136
|
-
WARNING: RubyGems 1.2+ index not found for:
|
137
|
-
\t#{@new_repo}
|
138
|
-
|
139
|
-
Will cause RubyGems to revert to legacy indexes, degrading performance.
|
140
|
-
EOF
|
141
|
-
|
142
|
-
assert_equal "#{@new_repo} added to sources\n", @ui.output
|
143
|
-
assert_equal expected, @ui.error
|
144
|
-
end
|
145
|
-
|
146
118
|
def test_execute_clear_all
|
147
119
|
@cmd.handle_options %w[--clear-all]
|
148
120
|
|
149
|
-
util_setup_source_info_cache
|
150
|
-
|
151
|
-
cache = Gem::SourceInfoCache.cache
|
152
|
-
cache.update
|
153
|
-
cache.write_cache
|
154
|
-
|
155
|
-
assert File.exist?(cache.system_cache_file),
|
156
|
-
'system cache file'
|
157
|
-
assert File.exist?(cache.latest_system_cache_file),
|
158
|
-
'latest system cache file'
|
159
|
-
|
160
121
|
util_setup_spec_fetcher
|
161
122
|
|
162
123
|
fetcher = Gem::SpecFetcher.fetcher
|
@@ -179,11 +140,6 @@ Will cause RubyGems to revert to legacy indexes, degrading performance.
|
|
179
140
|
assert_equal expected, @ui.output
|
180
141
|
assert_equal '', @ui.error
|
181
142
|
|
182
|
-
refute File.exist?(cache.system_cache_file),
|
183
|
-
'system cache file'
|
184
|
-
refute File.exist?(cache.latest_system_cache_file),
|
185
|
-
'latest system cache file'
|
186
|
-
|
187
143
|
refute File.exist?(fetcher.dir), 'cache dir removed'
|
188
144
|
end
|
189
145
|
|
@@ -249,30 +205,5 @@ Will cause RubyGems to revert to legacy indexes, degrading performance.
|
|
249
205
|
assert_equal '', @ui.error
|
250
206
|
end
|
251
207
|
|
252
|
-
def test_execute_update_legacy
|
253
|
-
@cmd.handle_options %w[--update]
|
254
|
-
|
255
|
-
util_setup_fake_fetcher
|
256
|
-
util_setup_source_info_cache
|
257
|
-
Gem::SourceInfoCache.reset
|
258
|
-
|
259
|
-
si = Gem::SourceIndex.new
|
260
|
-
si.add_spec @a1
|
261
|
-
@fetcher.data["#{@gem_repo}yaml"] = YAML.dump si
|
262
|
-
@fetcher.data["#{@gem_repo}Marshal.#{@marshal_version}"] = si.dump
|
263
|
-
|
264
|
-
use_ui @ui do
|
265
|
-
@cmd.execute
|
266
|
-
end
|
267
|
-
|
268
|
-
expected = <<-EOF
|
269
|
-
Bulk updating Gem source index for: #{@gem_repo}
|
270
|
-
source cache successfully updated
|
271
|
-
EOF
|
272
|
-
|
273
|
-
assert_equal expected, @ui.output
|
274
|
-
assert_equal '', @ui.error
|
275
|
-
end
|
276
|
-
|
277
208
|
end
|
278
209
|
|
@@ -1,4 +1,4 @@
|
|
1
|
-
require File.
|
1
|
+
require File.expand_path('../gemutilities', __FILE__)
|
2
2
|
require 'rubygems/commands/specification_command'
|
3
3
|
|
4
4
|
class TestGemCommandsSpecificationCommand < RubyGemTestCase
|
@@ -80,7 +80,7 @@ class TestGemCommandsSpecificationCommand < RubyGemTestCase
|
|
80
80
|
@cmd.execute
|
81
81
|
end
|
82
82
|
|
83
|
-
assert_equal "
|
83
|
+
assert_equal "foo", YAML.load(@ui.output)
|
84
84
|
end
|
85
85
|
|
86
86
|
def test_execute_marshal
|
@@ -106,8 +106,7 @@ class TestGemCommandsSpecificationCommand < RubyGemTestCase
|
|
106
106
|
|
107
107
|
util_setup_spec_fetcher foo
|
108
108
|
|
109
|
-
FileUtils.rm File.join(@gemhome, 'specifications',
|
110
|
-
"#{foo.full_name}.gemspec")
|
109
|
+
FileUtils.rm File.join(@gemhome, 'specifications', foo.spec_name)
|
111
110
|
|
112
111
|
@cmd.options[:args] = %w[foo]
|
113
112
|
@cmd.options[:domain] = :remote
|
@@ -1,6 +1,5 @@
|
|
1
|
-
require File.
|
2
|
-
require File.
|
3
|
-
'gem_installer_test_case')
|
1
|
+
require File.expand_path('../gemutilities', __FILE__)
|
2
|
+
require File.expand_path('../gem_installer_test_case', __FILE__)
|
4
3
|
require 'rubygems/commands/uninstall_command'
|
5
4
|
|
6
5
|
class TestGemCommandsUninstallCommand < GemInstallerTestCase
|
@@ -60,7 +59,7 @@ class TestGemCommandsUninstallCommand < GemInstallerTestCase
|
|
60
59
|
|
61
60
|
def test_execute_prerelease
|
62
61
|
@spec = quick_gem "pre", "2.b"
|
63
|
-
@gem = File.join @tempdir,
|
62
|
+
@gem = File.join @tempdir, @spec.file_name
|
64
63
|
FileUtils.touch @gem
|
65
64
|
|
66
65
|
util_setup_gem
|
@@ -1,4 +1,4 @@
|
|
1
|
-
require File.
|
1
|
+
require File.expand_path('../gemutilities', __FILE__)
|
2
2
|
require 'rubygems/commands/update_command'
|
3
3
|
|
4
4
|
class TestGemCommandsUpdateCommand < RubyGemTestCase
|
@@ -13,14 +13,14 @@ class TestGemCommandsUpdateCommand < RubyGemTestCase
|
|
13
13
|
|
14
14
|
util_setup_fake_fetcher
|
15
15
|
|
16
|
-
@a1_path = File.join @gemhome, 'cache',
|
17
|
-
@a2_path = File.join @gemhome, 'cache',
|
16
|
+
@a1_path = File.join @gemhome, 'cache', @a1.file_name
|
17
|
+
@a2_path = File.join @gemhome, 'cache', @a2.file_name
|
18
18
|
|
19
19
|
util_setup_spec_fetcher @a1, @a2
|
20
20
|
|
21
|
-
@fetcher.data["#{@gem_repo}gems/#{@a1.
|
21
|
+
@fetcher.data["#{@gem_repo}gems/#{@a1.file_name}"] =
|
22
22
|
read_binary @a1_path
|
23
|
-
@fetcher.data["#{@gem_repo}gems/#{@a2.
|
23
|
+
@fetcher.data["#{@gem_repo}gems/#{@a2.file_name}"] =
|
24
24
|
read_binary @a2_path
|
25
25
|
end
|
26
26
|
|
@@ -65,9 +65,9 @@ class TestGemCommandsUpdateCommand < RubyGemTestCase
|
|
65
65
|
@a2.add_dependency 'c', '2'
|
66
66
|
@a2.add_dependency 'b', '2'
|
67
67
|
|
68
|
-
@b2_path = File.join @gemhome, 'cache',
|
69
|
-
@c1_2_path = File.join @gemhome, 'cache',
|
70
|
-
@c2_path = File.join @gemhome, 'cache',
|
68
|
+
@b2_path = File.join @gemhome, 'cache', @b2.file_name
|
69
|
+
@c1_2_path = File.join @gemhome, 'cache', @c1_2.file_name
|
70
|
+
@c2_path = File.join @gemhome, 'cache', @c2.file_name
|
71
71
|
|
72
72
|
@source_index = Gem::SourceIndex.new
|
73
73
|
@source_index.add_spec @a1
|
@@ -80,12 +80,12 @@ class TestGemCommandsUpdateCommand < RubyGemTestCase
|
|
80
80
|
util_build_gem @a2
|
81
81
|
util_build_gem @c2
|
82
82
|
|
83
|
-
@fetcher.data["#{@gem_repo}gems/#{@a1.
|
84
|
-
@fetcher.data["#{@gem_repo}gems/#{@a2.
|
85
|
-
@fetcher.data["#{@gem_repo}gems/#{@b2.
|
86
|
-
@fetcher.data["#{@gem_repo}gems/#{@c1_2.
|
83
|
+
@fetcher.data["#{@gem_repo}gems/#{@a1.file_name}"] = read_binary @a1_path
|
84
|
+
@fetcher.data["#{@gem_repo}gems/#{@a2.file_name}"] = read_binary @a2_path
|
85
|
+
@fetcher.data["#{@gem_repo}gems/#{@b2.file_name}"] = read_binary @b2_path
|
86
|
+
@fetcher.data["#{@gem_repo}gems/#{@c1_2.file_name}"] =
|
87
87
|
read_binary @c1_2_path
|
88
|
-
@fetcher.data["#{@gem_repo}gems/#{@c2.
|
88
|
+
@fetcher.data["#{@gem_repo}gems/#{@c2.file_name}"] = read_binary @c2_path
|
89
89
|
|
90
90
|
util_setup_spec_fetcher @a1, @a2, @b2, @c1_2, @c2
|
91
91
|
util_clear_gems
|
@@ -0,0 +1,66 @@
|
|
1
|
+
require File.expand_path('../gemutilities', __FILE__)
|
2
|
+
require 'rubygems/commands/which_command'
|
3
|
+
|
4
|
+
class TestGemCommandsWhichCommand < RubyGemTestCase
|
5
|
+
|
6
|
+
def setup
|
7
|
+
super
|
8
|
+
@cmd = Gem::Commands::WhichCommand.new
|
9
|
+
end
|
10
|
+
|
11
|
+
def test_execute
|
12
|
+
util_foo_bar
|
13
|
+
|
14
|
+
@cmd.handle_options %w[foo_bar]
|
15
|
+
|
16
|
+
use_ui @ui do
|
17
|
+
@cmd.execute
|
18
|
+
end
|
19
|
+
|
20
|
+
assert_equal "#{@foo_bar.full_gem_path}/lib/foo_bar.rb\n", @ui.output
|
21
|
+
assert_equal '', @ui.error
|
22
|
+
end
|
23
|
+
|
24
|
+
def test_execute_one_missing
|
25
|
+
util_foo_bar
|
26
|
+
|
27
|
+
@cmd.handle_options %w[foo_bar missing]
|
28
|
+
|
29
|
+
use_ui @ui do
|
30
|
+
@cmd.execute
|
31
|
+
end
|
32
|
+
|
33
|
+
assert_equal "#{@foo_bar.full_gem_path}/lib/foo_bar.rb\n", @ui.output
|
34
|
+
assert_match %r%Can't find ruby library file or shared library missing\n%,
|
35
|
+
@ui.error
|
36
|
+
end
|
37
|
+
|
38
|
+
def test_execute_missing
|
39
|
+
@cmd.handle_options %w[missing]
|
40
|
+
|
41
|
+
use_ui @ui do
|
42
|
+
assert_raises MockGemUi::TermError do
|
43
|
+
@cmd.execute
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
assert_equal '', @ui.output
|
48
|
+
assert_match %r%Can't find ruby library file or shared library missing\n%,
|
49
|
+
@ui.error
|
50
|
+
end
|
51
|
+
|
52
|
+
def util_foo_bar
|
53
|
+
files = %w[lib/foo_bar.rb Rakefile]
|
54
|
+
@foo_bar = quick_gem 'foo_bar' do |gem|
|
55
|
+
gem.files = files
|
56
|
+
end
|
57
|
+
|
58
|
+
files.each do |file|
|
59
|
+
filename = @foo_bar.full_gem_path + "/#{file}"
|
60
|
+
FileUtils.mkdir_p File.dirname(filename)
|
61
|
+
FileUtils.touch filename
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
end
|
66
|
+
|
@@ -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/config_file'
|
9
3
|
|
10
4
|
class TestGemConfigFile < RubyGemTestCase
|
@@ -271,6 +265,18 @@ class TestGemConfigFile < RubyGemTestCase
|
|
271
265
|
assert_equal %w[http://even-more-gems.example.com], Gem.sources
|
272
266
|
end
|
273
267
|
|
268
|
+
def test_load_rubygems_api_key_from_credentials
|
269
|
+
temp_cred = File.join Gem.user_home, '.gem', 'credentials'
|
270
|
+
FileUtils.mkdir File.dirname(temp_cred)
|
271
|
+
File.open temp_cred, 'w' do |fp|
|
272
|
+
fp.puts ":rubygems_api_key: 701229f217cdf23b1344c7b4b54ca97"
|
273
|
+
end
|
274
|
+
|
275
|
+
util_config_file
|
276
|
+
|
277
|
+
assert_equal "701229f217cdf23b1344c7b4b54ca97", @cfg.rubygems_api_key
|
278
|
+
end
|
279
|
+
|
274
280
|
def util_config_file(args = @cfg_args)
|
275
281
|
@cfg = Gem::ConfigFile.new args
|
276
282
|
end
|
data/test/test_gem_dependency.rb
CHANGED
@@ -1,189 +1,137 @@
|
|
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/dependency'
|
9
3
|
|
10
4
|
class TestGemDependency < RubyGemTestCase
|
11
5
|
|
12
|
-
def
|
13
|
-
|
14
|
-
|
15
|
-
@pkg1_0 = Gem::Dependency.new 'pkg', ['> 1.0']
|
16
|
-
@pkg1_1 = Gem::Dependency.new 'pkg', ['> 1.1']
|
17
|
-
|
18
|
-
@oth1_0 = Gem::Dependency.new 'other', ['> 1.0']
|
6
|
+
def test_subclass
|
7
|
+
sc = Class.new Gem::Dependency
|
8
|
+
def sc.requirement() bogus; end
|
19
9
|
|
20
|
-
|
21
|
-
|
10
|
+
out, err = capture_io do
|
11
|
+
assert_equal Gem::Requirement.default, sc.new('a').version_requirement
|
12
|
+
end
|
22
13
|
|
23
|
-
|
24
|
-
Gem::Dependency.new name, version
|
14
|
+
assert_match %r%deprecated%, err
|
25
15
|
end
|
26
16
|
|
27
17
|
def test_initialize
|
28
|
-
|
29
|
-
|
18
|
+
d = dep "pkg", "> 1.0"
|
19
|
+
|
20
|
+
assert_equal "pkg", d.name
|
21
|
+
assert_equal req("> 1.0"), d.requirement
|
30
22
|
end
|
31
23
|
|
32
24
|
def test_initialize_double
|
33
|
-
|
34
|
-
|
35
|
-
assert_equal Gem::Requirement.new(["> 1.0", "< 2.0"]),
|
36
|
-
dep.version_requirements
|
25
|
+
d = dep "pkg", "> 1.0", "< 2.0"
|
26
|
+
assert_equal req("> 1.0", "< 2.0"), d.requirement
|
37
27
|
end
|
38
28
|
|
39
29
|
def test_initialize_empty
|
40
|
-
|
41
|
-
req
|
42
|
-
|
43
|
-
req.instance_eval do
|
44
|
-
@version = ">= 1.0"
|
45
|
-
@op = ">="
|
46
|
-
@nums = [1,0]
|
47
|
-
@requirements = nil
|
48
|
-
end
|
49
|
-
|
50
|
-
dep.instance_eval do
|
51
|
-
@version_requirement = req
|
52
|
-
@version_requirements = nil
|
53
|
-
end
|
54
|
-
|
55
|
-
assert_equal Gem::Requirement.new([">= 1.0"]), dep.version_requirements
|
56
|
-
end
|
57
|
-
|
58
|
-
def test_initialize_version
|
59
|
-
dep = Gem::Dependency.new 'pkg', Gem::Version.new('2')
|
60
|
-
|
61
|
-
assert_equal 'pkg', dep.name
|
62
|
-
|
63
|
-
assert_equal Gem::Requirement.new('= 2'), dep.version_requirements
|
30
|
+
d = dep "pkg"
|
31
|
+
assert_equal req(">= 0"), d.requirement
|
64
32
|
end
|
65
33
|
|
66
|
-
def
|
67
|
-
|
68
|
-
assert_equal
|
69
|
-
end
|
34
|
+
def test_initialize_type
|
35
|
+
assert_equal :runtime, dep("pkg").type
|
36
|
+
assert_equal :development, dep("pkg", [], :development).type
|
70
37
|
|
71
|
-
def test_type_is_runtime_by_default
|
72
|
-
assert_equal(:runtime, Gem::Dependency.new("pkg", []).type)
|
73
|
-
end
|
74
|
-
|
75
|
-
def test_type_is_restricted
|
76
38
|
assert_raises ArgumentError do
|
77
|
-
|
39
|
+
dep "pkg", :sometimes
|
78
40
|
end
|
79
41
|
end
|
80
42
|
|
43
|
+
def test_initialize_version
|
44
|
+
d = dep "pkg", v("2")
|
45
|
+
assert_equal req("= 2"), d.requirement
|
46
|
+
end
|
47
|
+
|
81
48
|
def test_equals2
|
82
|
-
|
83
|
-
|
49
|
+
o = dep "other"
|
50
|
+
d = dep "pkg", "> 1.0"
|
51
|
+
d1 = dep "pkg", "> 1.1"
|
52
|
+
|
53
|
+
assert_equal d, d.dup
|
54
|
+
assert_equal d.dup, d
|
84
55
|
|
85
|
-
refute_equal
|
86
|
-
refute_equal
|
56
|
+
refute_equal d, d1
|
57
|
+
refute_equal d1, d
|
87
58
|
|
88
|
-
refute_equal
|
89
|
-
refute_equal
|
59
|
+
refute_equal d, o
|
60
|
+
refute_equal o, d
|
90
61
|
|
91
|
-
refute_equal
|
92
|
-
refute_equal Object.new,
|
62
|
+
refute_equal d, Object.new
|
63
|
+
refute_equal Object.new, d
|
93
64
|
end
|
94
65
|
|
95
66
|
def test_equals2_type
|
96
|
-
runtime
|
97
|
-
development = Gem::Dependency.new("pkg", [], :development)
|
98
|
-
|
99
|
-
refute_equal(runtime, development)
|
67
|
+
refute_equal dep("pkg", :runtime), dep("pkg", :development)
|
100
68
|
end
|
101
69
|
|
102
70
|
def test_equals_tilde
|
103
|
-
|
104
|
-
a1 = dep 'a', '1'
|
105
|
-
b0 = dep 'b', '0'
|
106
|
-
|
107
|
-
pa0 = dep 'a', '>= 0'
|
108
|
-
pa0r = dep(/a/, '>= 0')
|
109
|
-
pab0r = dep(/a|b/, '>= 0')
|
110
|
-
|
111
|
-
assert_match a0, a0, 'match self'
|
112
|
-
assert_match pa0, a0, 'match version exact'
|
113
|
-
assert_match pa0, a1, 'match version'
|
114
|
-
assert_match pa0r, a0, 'match regex simple'
|
115
|
-
assert_match pab0r, a0, 'match regex complex'
|
116
|
-
|
117
|
-
refute_match pa0r, b0, 'fail match regex'
|
118
|
-
refute_match pa0r, Object.new, 'fail match Object'
|
119
|
-
end
|
71
|
+
d = dep "a", "0"
|
120
72
|
|
121
|
-
|
122
|
-
|
73
|
+
assert_match d, d, "matche self"
|
74
|
+
assert_match dep("a", ">= 0"), d, "match version exact"
|
75
|
+
assert_match dep("a", ">= 0"), dep("a", "1"), "match version"
|
76
|
+
assert_match dep(/a/, ">= 0"), d, "match simple regexp"
|
77
|
+
assert_match dep(/a|b/, ">= 0"), d, "match scary regexp"
|
123
78
|
|
124
|
-
|
125
|
-
|
79
|
+
refute_match dep(/a/), dep("b")
|
80
|
+
refute_match dep("a"), Object.new
|
81
|
+
end
|
126
82
|
|
127
|
-
|
128
|
-
|
83
|
+
def test_equals_tilde_escape
|
84
|
+
refute_match dep("a|b"), dep("a", "1")
|
85
|
+
assert_match dep(/a|b/), dep("a", "1")
|
129
86
|
end
|
130
87
|
|
131
88
|
def test_equals_tilde_object
|
132
|
-
|
133
|
-
|
134
|
-
def
|
135
|
-
def a0.version() '0' end
|
136
|
-
|
137
|
-
pa0 = Gem::Dependency.new 'a', '>= 0'
|
89
|
+
o = Object.new
|
90
|
+
def o.name ; 'a' end
|
91
|
+
def o.version ; '0' end
|
138
92
|
|
139
|
-
assert_match
|
93
|
+
assert_match dep("a"), o
|
140
94
|
end
|
141
95
|
|
142
96
|
def test_equals_tilde_spec
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
97
|
+
assert_match dep("a", ">= 0"), spec("a", "0")
|
98
|
+
assert_match dep("a", "1"), spec("a", "1")
|
99
|
+
assert_match dep(/a/, ">= 0"), spec("a", "0")
|
100
|
+
assert_match dep(/a|b/, ">= 0"), spec("b", "0")
|
101
|
+
refute_match dep(/a/, ">= 0"), spec("b", "0")
|
102
|
+
end
|
149
103
|
|
150
|
-
|
151
|
-
|
152
|
-
b0 = spec 'b', '0'
|
104
|
+
def test_hash
|
105
|
+
d = dep "pkg", "1.0"
|
153
106
|
|
154
|
-
|
155
|
-
|
156
|
-
pab0r = dep(/a|b/, '>= 0')
|
107
|
+
assert_equal d.hash, d.dup.hash
|
108
|
+
assert_equal d.dup.hash, d.hash
|
157
109
|
|
158
|
-
|
159
|
-
|
110
|
+
refute_equal dep("pkg", "1.0").hash, dep("pkg", "2.0").hash, "requirement"
|
111
|
+
refute_equal dep("pkg", "1.0").hash, dep("abc", "1.0").hash, "name"
|
112
|
+
refute_equal dep("pkg", :development), dep("pkg", :runtime), "type"
|
113
|
+
end
|
160
114
|
|
161
|
-
|
162
|
-
|
115
|
+
def test_prerelease_eh
|
116
|
+
d = dep "pkg", "= 1"
|
163
117
|
|
164
|
-
|
165
|
-
assert_match pab0r, b0, 'match regex complex'
|
118
|
+
refute d.prerelease?
|
166
119
|
|
167
|
-
|
168
|
-
refute_match pa0r, Object.new, 'fail match Object'
|
169
|
-
end
|
120
|
+
d.prerelease = true
|
170
121
|
|
171
|
-
|
172
|
-
assert_equal @pkg1_0.hash, @pkg1_0.dup.hash
|
173
|
-
assert_equal @pkg1_0.dup.hash, @pkg1_0.hash
|
122
|
+
assert d.prerelease?
|
174
123
|
|
175
|
-
|
176
|
-
refute_equal @pkg1_1.hash, @pkg1_0.hash, "requirements different"
|
124
|
+
d = dep "pkg", "= 1.a"
|
177
125
|
|
178
|
-
|
179
|
-
|
180
|
-
|
126
|
+
assert d.prerelease?
|
127
|
+
|
128
|
+
d.prerelease = false
|
129
|
+
|
130
|
+
assert d.prerelease?
|
181
131
|
|
182
|
-
|
183
|
-
runtime = Gem::Dependency.new("pkg", [])
|
184
|
-
development = Gem::Dependency.new("pkg", [], :development)
|
132
|
+
d = dep "pkg", "> 1.a", "> 2"
|
185
133
|
|
186
|
-
|
134
|
+
assert d.prerelease?
|
187
135
|
end
|
188
136
|
|
189
137
|
end
|